All of lore.kernel.org
 help / color / mirror / Atom feed
* [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 00/06][RFC] sh: Runtime PM Prototype for SuperH Mobile
@ 2009-07-09 15:19 Magnus Damm
  2009-07-09 15:20 ` [PATCH 05/06] i2c: Runtime PM for i2c-sh_mobile.c Magnus Damm
  0 siblings, 1 reply; 2+ messages in thread
From: Magnus Damm @ 2009-07-09 15:19 UTC (permalink / raw)
  To: linux-sh

sh: Runtime PM Prototype for SuperH Mobile

[PATCH 01/06] Driver Core: Runtime PM callbacks for the Platform Bus
[PATCH 02/06] sh: Add support for multiple hwblk counters
[PATCH 03/06] sh: Runtime PM for SuperH Mobile
[PATCH 04/06] sh: Runtime PM for sh7722 and Migo-R
[PATCH 05/06] i2c: Runtime PM for i2c-sh_mobile.c
[PATCH 06/06] video: Runtime PM for sh_mobile_lcdcfb.c

This is the first complete Runtime PM prototype for SuperH Mobile.
The patches above should be applied on top of the sh-2.6 git tree
and the following ones:
"PM: Introduce core framework for run-time PM of I/O devices (rev. 9)"
"Driver Core: Add platform device arch data V3"

Looking forward to hear what you think. Before, during or after the
PM Summit!

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 arch/sh/boards/mach-migor/setup.c        |    9 +
 arch/sh/include/asm/device.h             |   16 ++
 arch/sh/include/asm/hwblk.h              |   17 ++
 arch/sh/kernel/cpu/hwblk.c               |   69 ++++++----
 arch/sh/kernel/cpu/sh4a/hwblk-sh7722.c   |   14 +-
 arch/sh/kernel/cpu/sh4a/setup-sh7722.c   |   31 ++++
 arch/sh/kernel/cpu/shmobile/Makefile     |    1 
 arch/sh/kernel/cpu/shmobile/pm_runtime.c |  206 ++++++++++++++++++++++++++++++
 drivers/base/platform.c                  |   31 ++++
 drivers/i2c/busses/i2c-sh_mobile.c       |   21 +++
 drivers/video/sh_mobile_lcdcfb.c         |   31 +---
 11 files changed, 398 insertions(+), 48 deletions(-)

^ 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.