Hi,
 Please find in attach the replacement of the previous patch 
0001-intel_mid_i2s-Fix-handling-interrupt-for-shared-irq-.patch send on 19 Nov.

 This patch removes unauthorized access to PCI device registers in case of 
interrupt call during suspend (as IRQ of SSP is shared, software interrupt 
should be ignored if driver is in suspend).
 It also provides additional modifications to fix syntax problems and 
compilation problems that occurs during compilation without CONFIG_PM.
 It replaces the patch send on 19Nov.

 (this patch should be applied after the patches delivered on 10
 November by Selma Bensaid : 0001-Call-the-DMA-Terminate-All-interface-
 when-closing-in.patch )

Best regards
Louis

>From 7334046ccaccc47faf5f5bb1949eac3166489f80 Mon Sep 17 00:00:00 2001
From: Louis LE GALL <[email protected]>
Date: Fri, 19 Nov 2010 17:19:18 +0100
Subject: [PATCH] intel_mid_i2s:Fix handling interrupt for shared irq when 
suspended and
 remove warning during compilation without CONFIG_PM active and other minor 
warnings.

The irq for ssp is shared, so when device is suspended driver
should not read register and ignore the interrupt

This patch ignores interrupts when device is suspended.
This also allows the device to be explictly suspended after probe

Signed-off-by: Louis LE GALL <[email protected]>
---
 sound/pci/intel_mid_i2s/intel_mid_i2s.c |   28 +++++++++++++++++++++++-----
 sound/pci/intel_mid_i2s/intel_mid_i2s.h |    2 ++
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/sound/pci/intel_mid_i2s/intel_mid_i2s.c 
b/sound/pci/intel_mid_i2s/intel_mid_i2s.c
index 65b2193..3fcd060 100644
--- a/sound/pci/intel_mid_i2s/intel_mid_i2s.c
+++ b/sound/pci/intel_mid_i2s/intel_mid_i2s.c
@@ -39,19 +39,23 @@ MODULE_VERSION("1.0.0");
 /*
  * structures for pci probing
  */
+#ifdef CONFIG_PM
 static const struct dev_pm_ops intel_mid_i2s_pm_ops = {
        .runtime_suspend = intel_mid_i2s_runtime_suspend,
        .runtime_resume = intel_mid_i2s_runtime_resume,
 };
+#endif
 static DEFINE_PCI_DEVICE_TABLE(pci_ids) = {
        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, MFLD_SSP1_DEVICE_ID) },
        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, MFLD_SSP0_DEVICE_ID) },
        { 0, }, /* terminate list */
 };
 static struct pci_driver intel_mid_i2s_driver = {
+#ifdef CONFIG_PM
        .driver = {
                .pm = &intel_mid_i2s_pm_ops,
        },
+#endif
        .name = DRIVER_NAME,
        .id_table = pci_ids,
        .probe = intel_mid_i2s_probe,
@@ -148,7 +152,6 @@ static int intel_mid_i2s_runtime_suspend(struct device 
*device_ptr)
        dev_dbg(&drv_data->pdev->dev, "Suspend of SSP requested !!\n");
        return intel_mid_i2s_driver_suspend(to_pci_dev(device_ptr), 
PMSG_SUSPEND);
 }
-#endif
 
 /**
  * intel_mid_i2s_runtime_resume - runtime power management resume activity
@@ -173,6 +176,7 @@ static int intel_mid_i2s_runtime_resume(struct device 
*device_ptr)
        return intel_mid_i2s_driver_resume(to_pci_dev(device_ptr));
 }
 
+#endif
 /*
  * INTERFACE FUNCTIONS
  */
@@ -488,7 +492,7 @@ int intel_mid_i2s_wr_req(struct intel_mid_i2s_hdl 
*drv_data, u32 *source, size_t
        if (!txdesc) {
                dev_WARN(&(drv_data->pdev->dev),
                        "wr_req dma memcpy FAILED(src=%08x,len=%d,txchan=%p)\n",
-                       src, len, txchan);
+                       (unsigned int)src, len, txchan);
                return -1;
        }
        dev_dbg(&(drv_data->pdev->dev), "WR dma tx summit\n");
@@ -627,11 +631,13 @@ void intel_mid_i2s_close(struct intel_mid_i2s_hdl 
*drv_data)
        put_device(&drv_data->pdev->dev);
        write_SSCR0(0, reg);
 
-       /* pm runtime */
-       pm_runtime_put(&drv_data->pdev->dev);
        dev_dbg(&(drv_data->pdev->dev), "SSP Stopped.\n");
        clear_bit(I2S_PORT_CLOSING, &drv_data->flags);
        clear_bit(I2S_PORT_OPENED, &drv_data->flags);
+
+       /* pm runtime */
+       pm_runtime_put(&drv_data->pdev->dev);
+
        mutex_unlock(&drv_data->mutex);
 }
 EXPORT_SYMBOL_GPL(intel_mid_i2s_close);
@@ -1027,6 +1033,14 @@ static irqreturn_t i2s_int(int irq, void *dev_id)
        reg = drv_data->ioaddr;
        irq_status = read_SSSR(reg);
 
+
+       if (ddbg->power.status!=DPM_ON)
+               return IRQ_NONE;
+#ifdef CONFIG_PM_RUNTIME
+       if (ddbg->power.runtime_status!=RPM_ACTIVE)
+               return IRQ_NONE;
+#endif
+
        if (!(irq_status & (drv_data->mask_sr))) {
                return IRQ_NONE;
        } else {
@@ -1390,7 +1404,7 @@ static int intel_mid_i2s_probe(struct pci_dev *pdev,
                status = -ENODEV;
                goto err_i2s_probe1;
        }
-       dev_dbg(&(pdev->dev), "paddr = : %x\n", drv_data->paddr);
+       dev_dbg(&(pdev->dev), "paddr = : %x\n", (unsigned int) drv_data->paddr);
        dev_dbg(&(pdev->dev), "iolen = : %d\n", drv_data->iolen);
        if (status) {
                dev_err((&pdev->dev), "Can't request region. err=%d\n", status);
@@ -1442,6 +1456,10 @@ static int intel_mid_i2s_probe(struct pci_dev *pdev,
                goto err_i2s_probe3;
        }
        pm_runtime_enable(&(drv_data->pdev->dev));
+       pm_runtime_allow(&(drv_data->pdev->dev));
+       pm_runtime_set_active(&(drv_data->pdev->dev));
+       pm_request_idle(&(drv_data->pdev->dev));
+
        goto leave;
 err_i2s_probe3:
        iounmap(drv_data->ioaddr);
diff --git a/sound/pci/intel_mid_i2s/intel_mid_i2s.h 
b/sound/pci/intel_mid_i2s/intel_mid_i2s.h
index ef29ce7..819164d 100644
--- a/sound/pci/intel_mid_i2s/intel_mid_i2s.h
+++ b/sound/pci/intel_mid_i2s/intel_mid_i2s.h
@@ -364,8 +364,10 @@ static irqreturn_t i2s_int(int irq, void *dev_id);
 static void set_ssp_i2s_hw(struct intel_mid_i2s_hdl *drv_data,
                const struct intel_mid_i2s_settings *ps_settings);
 static int check_device(struct device *device_ptr, void *data);
+#ifdef CONFIG_PM
 static int intel_mid_i2s_runtime_resume(struct device *device_ptr);
 static int intel_mid_i2s_runtime_suspend(struct device *device_ptr);
+#endif
 static int intel_mid_i2s_probe(struct pci_dev *pdev,
                const struct pci_device_id *ent);
 static void intel_mid_i2s_remove(struct pci_dev *pdev);
-- 
1.7.2.3


---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

Attachment: 0001-intel_mid_i2s-Fix-handling-interrupt-for-shared-irq-.patch
Description: 0001-intel_mid_i2s-Fix-handling-interrupt-for-shared-irq-.patch

_______________________________________________
MeeGo-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel

Reply via email to