* [PATCH 05/06] i2c: Runtime PM for i2c-sh_mobile.c
@ 2009-07-09 15:20 Magnus Damm
0 siblings, 0 replies; 2+ messages in thread
From: Magnus Damm @ 2009-07-09 15:20 UTC (permalink / raw)
To: linux-sh
From: Magnus Damm <damm@igel.co.jp>
This patch modifies the SuperH Mobile i2c driver to support
Runtime PM. These changes should be all that is needed for
proper Runtime PM support in this driver. Driver callbacks
for Runtime PM are not needed becuase the registers are
always re-initialized.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
---
drivers/i2c/busses/i2c-sh_mobile.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
--- 0001/drivers/i2c/busses/i2c-sh_mobile.c
+++ work/drivers/i2c/busses/i2c-sh_mobile.c 2009-07-07 18:50:53.000000000 +0900
@@ -28,6 +28,7 @@
#include <linux/interrupt.h>
#include <linux/i2c.h>
#include <linux/err.h>
+#include <linux/pm_runtime.h>
#include <linux/clk.h>
#include <linux/io.h>
@@ -165,6 +166,9 @@ static void activate_ch(struct sh_mobile
u_int32_t denom;
u_int32_t tmp;
+ /* Runtime PM must wake up device */
+ pm_runtime_resume(pd->dev);
+
/* Make sure the clock is enabled */
clk_enable(pd->clk);
@@ -215,6 +219,9 @@ static void deactivate_ch(struct sh_mobi
/* Disable clock */
clk_disable(pd->clk);
+
+ /* Runtime PM code may suspend now */
+ pm_runtime_suspend(pd->dev);
}
static unsigned char i2c_op(struct sh_mobile_i2c_data *pd,
@@ -572,6 +579,20 @@ static int sh_mobile_i2c_probe(struct pl
goto err_irq;
}
+ /* Enable Runtime PM for this device.
+ *
+ * Also tell the Runtime PM core to ignore children
+ * for this device since it is valid for us to suspend
+ * this I2C master driver even though the slave devices
+ * on the I2C bus may not be suspended.
+ *
+ * The state of the I2C hardware bus is unaffected by
+ * the Runtime PM state.
+ */
+ pm_suspend_ignore_children(&dev->dev, true);
+ pm_runtime_set_suspended(&dev->dev);
+ pm_runtime_enable(&dev->dev);
+
/* setup the private data */
adap = &pd->adap;
i2c_set_adapdata(adap, pd);
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 05/06] i2c: Runtime PM for i2c-sh_mobile.c
2009-07-09 15:19 [PATCH 00/06][RFC] sh: Runtime PM Prototype for SuperH Mobile Magnus Damm
@ 2009-07-09 15:20 ` Magnus Damm
0 siblings, 0 replies; 2+ messages in thread
From: Magnus Damm @ 2009-07-09 15:20 UTC (permalink / raw)
To: linux-pm; +Cc: linux-sh, gregkh
From: Magnus Damm <damm@igel.co.jp>
This patch modifies the SuperH Mobile i2c driver to support
Runtime PM. These changes should be all that is needed for
proper Runtime PM support in this driver. Driver callbacks
for Runtime PM are not needed becuase the registers are
always re-initialized.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
---
drivers/i2c/busses/i2c-sh_mobile.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
--- 0001/drivers/i2c/busses/i2c-sh_mobile.c
+++ work/drivers/i2c/busses/i2c-sh_mobile.c 2009-07-07 18:50:53.000000000 +0900
@@ -28,6 +28,7 @@
#include <linux/interrupt.h>
#include <linux/i2c.h>
#include <linux/err.h>
+#include <linux/pm_runtime.h>
#include <linux/clk.h>
#include <linux/io.h>
@@ -165,6 +166,9 @@ static void activate_ch(struct sh_mobile
u_int32_t denom;
u_int32_t tmp;
+ /* Runtime PM must wake up device */
+ pm_runtime_resume(pd->dev);
+
/* Make sure the clock is enabled */
clk_enable(pd->clk);
@@ -215,6 +219,9 @@ static void deactivate_ch(struct sh_mobi
/* Disable clock */
clk_disable(pd->clk);
+
+ /* Runtime PM code may suspend now */
+ pm_runtime_suspend(pd->dev);
}
static unsigned char i2c_op(struct sh_mobile_i2c_data *pd,
@@ -572,6 +579,20 @@ static int sh_mobile_i2c_probe(struct pl
goto err_irq;
}
+ /* Enable Runtime PM for this device.
+ *
+ * Also tell the Runtime PM core to ignore children
+ * for this device since it is valid for us to suspend
+ * this I2C master driver even though the slave devices
+ * on the I2C bus may not be suspended.
+ *
+ * The state of the I2C hardware bus is unaffected by
+ * the Runtime PM state.
+ */
+ pm_suspend_ignore_children(&dev->dev, true);
+ pm_runtime_set_suspended(&dev->dev);
+ pm_runtime_enable(&dev->dev);
+
/* setup the private data */
adap = &pd->adap;
i2c_set_adapdata(adap, pd);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-07-09 15:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-09 15:20 [PATCH 05/06] i2c: Runtime PM for i2c-sh_mobile.c Magnus Damm
-- strict thread matches above, loose matches on Subject: below --
2009-07-09 15:19 [PATCH 00/06][RFC] sh: Runtime PM Prototype for SuperH Mobile Magnus Damm
2009-07-09 15:20 ` [PATCH 05/06] i2c: Runtime PM for i2c-sh_mobile.c Magnus Damm
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.