[PATCH V2] I2C: Fix for suspend/resume issue in i2c-core

2010-09-04 Thread Vishwanath BS
In current i2c core driver, call to pm_runtime_set_active from 
i2c_device_pm_resume
will unconditionally enable i2c module and increment child count of the parent.
Because of this, in CPU Idle path, i2c does not idle, preventing Core to
enter retention. Also i2c module will not be suspended upon system suspend as
pm_runtime_set_suspended is not called from i2c_device_pm_suspend.
This issue is fixed by  removing  pm_runtime_set_active call from resume path 
which
is not necessary.
This fix has been tested on OMAP4430.

Signed-off-by: Partha Basak 
Signed-off-by: Vishwanath BS 

Cc: Rafael J. Wysocki 
Cc: Kevin Hilman 
Cc: Ben Dooks 
Cc: Jean Delvare 
---
 drivers/i2c/i2c-core.c |6 --
 1 files changed, 0 insertions(+), 6 deletions(-)
 mode change 100644 => 100755 drivers/i2c/i2c-core.c

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
old mode 100644
new mode 100755
index 6649176..13927d5
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -216,12 +216,6 @@ static int i2c_device_pm_resume(struct device *dev)
else
ret = i2c_legacy_resume(dev);
 
-   if (!ret) {
-   pm_runtime_disable(dev);
-   pm_runtime_set_active(dev);
-   pm_runtime_enable(dev);
-   }
-
return ret;
 }
 
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] I2C: Fix for suspend/resume issue in i2c-core

2010-08-30 Thread Vishwanath BS
In current i2c core driver, pm_runtime_set_active call from i2c_device_pm_resume
is not balanced by pm_runtime_set_suspended call from i2c_device_pm_suspend.
pm_runtime_set_active called from resume path will increase the child_count of
the device's parent. However, matching pm_runtime_set_suspended is not called
in suspend routine because of which child_count of the device's parent
is not balanced, preventing the parent device to idle.
Issue has been fixed by adding pm_runtime_set_suspended call inside suspend
reoutine which will make sure that child_counts are balanced.
This fix has been tested on OMAP4430.

Signed-off-by: Partha Basak 
Signed-off-by: Vishwanath BS 

Cc: Rafael J. Wysocki 
Cc: Kevin Hilman 
Cc: Ben Dooks 
---
 drivers/i2c/i2c-core.c |   12 ++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 6649176..3146bff
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -196,14 +196,22 @@ static int i2c_legacy_resume(struct device *dev)
 static int i2c_device_pm_suspend(struct device *dev)
 {
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+   int ret;
 
if (pm_runtime_suspended(dev))
return 0;
 
if (pm)
-   return pm->suspend ? pm->suspend(dev) : 0;
+   ret = pm->suspend ? pm->suspend(dev) : 0;
+   else
+   ret = i2c_legacy_suspend(dev, PMSG_SUSPEND);
 
-   return i2c_legacy_suspend(dev, PMSG_SUSPEND);
+   if (!ret) {
+   pm_runtime_disable(dev);
+   pm_runtime_set_suspended(dev);
+   pm_runtime_enable(dev);
+   }
+   return ret;
 }
 
 static int i2c_device_pm_resume(struct device *dev)
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] I2C: Fix for suspend/resume issue in i2c-core

2010-08-30 Thread Vishwanath BS
In current i2c core driver, pm_runtime_set_active call from i2c_device_pm_resume
is not balanced by pm_runtime_set_suspended call from i2c_device_pm_suspend.
pm_runtime_set_active called from resume path will increase the child_count of
the device's parent. However, matching pm_runtime_set_suspended is not called
in suspend routine because of which child_count of the device's parent
is not balanced, preventing the parent device to idle.
Issue has been fixed by adding pm_runtime_set_suspended call inside suspend
reoutine which will make sure that child_counts are balanced.
This fix has been tested on OMAP4430.

Signed-off-by: Partha Basak 
Signed-off-by: Vishwanath BS 

Cc: Rafael J. Wysocki 
Cc: Kevin Hilman 
Cc: Ben Dooks 
---
 drivers/i2c/i2c-core.c |   12 ++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 6649176..3146bff
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -196,14 +196,22 @@ static int i2c_legacy_resume(struct device *dev)
 static int i2c_device_pm_suspend(struct device *dev)
 {
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+   int ret;
 
if (pm_runtime_suspended(dev))
return 0;
 
if (pm)
-   return pm->suspend ? pm->suspend(dev) : 0;
+   ret = pm->suspend ? pm->suspend(dev) : 0;
+   else
+   ret = i2c_legacy_suspend(dev, PMSG_SUSPEND);
 
-   return i2c_legacy_suspend(dev, PMSG_SUSPEND);
+   if (!ret) {
+   pm_runtime_disable(dev);
+   pm_runtime_set_suspended(dev);
+   pm_runtime_enable(dev);
+   }
+   return ret;
 }
 
 static int i2c_device_pm_resume(struct device *dev)
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html