]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
i2c-designware: switch to use runtime PM autosuspend
authorMika Westerberg <mika.westerberg@linux.intel.com>
Wed, 10 Apr 2013 00:36:42 +0000 (00:36 +0000)
committerWolfram Sang <wsa@the-dreams.de>
Mon, 15 Apr 2013 16:18:45 +0000 (18:18 +0200)
Using autosuspend helps to reduce the resume latency in situations where
another I2C message is going to be started soon. For example with HID over
I2C touch panels we get several messages in a short period of time while
the touch panel is in use.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-designware-core.c
drivers/i2c/busses/i2c-designware-pcidrv.c
drivers/i2c/busses/i2c-designware-platdrv.c

index 7c10c5bd36dcd52cfc15291a2d9bbb5fd2f1e0db..21fbb340ad6603a249d052d8f7accb6aed0f7753 100644 (file)
@@ -600,7 +600,8 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
        ret = -EIO;
 
 done:
-       pm_runtime_put(dev->dev);
+       pm_runtime_mark_last_busy(dev->dev);
+       pm_runtime_put_autosuspend(dev->dev);
        mutex_unlock(&dev->lock);
 
        return ret;
index aacb64e916a590d68da99deae29fbac03ff69f56..c8797e22459c4e2e1de8eda8a8e12f02ce38d855 100644 (file)
@@ -291,7 +291,8 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
        /* Increase reference counter */
        get_device(&pdev->dev);
 
-       pm_runtime_put_noidle(&pdev->dev);
+       pm_runtime_set_autosuspend_delay(&pdev->dev, 1000);
+       pm_runtime_use_autosuspend(&pdev->dev);
        pm_runtime_allow(&pdev->dev);
 
        return 0;
index 2a596dd1ec6682792f83e6843809f6bc17610eb5..dec939aca588eb3cba74c19185c0509a86cea2f5 100644 (file)
@@ -173,9 +173,10 @@ static int dw_i2c_probe(struct platform_device *pdev)
        /* Increase reference counter */
        get_device(&pdev->dev);
 
+       pm_runtime_set_autosuspend_delay(&pdev->dev, 1000);
+       pm_runtime_use_autosuspend(&pdev->dev);
        pm_runtime_set_active(&pdev->dev);
        pm_runtime_enable(&pdev->dev);
-       pm_runtime_put(&pdev->dev);
 
        return 0;
 }