All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 04/06] sh: Runtime PM for sh7722 and Migo-R
@ 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 contains sh7722 processor specific Runtime PM code
along with some Migo-R board code that deals with sh7722.

For each platform device within the SoC a hwblk id is added
to the architecture specific platform device data area. The
hwblk code for sh7722 which is invoked by cpuidle is extended
in a hackish way to tell the system to start driver suspending.

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

 arch/sh/boards/mach-migor/setup.c      |    9 +++++++++
 arch/sh/kernel/cpu/sh4a/hwblk-sh7722.c |   10 +++++++++-
 arch/sh/kernel/cpu/sh4a/setup-sh7722.c |   31 +++++++++++++++++++++++++++++++
 3 files changed, 49 insertions(+), 1 deletion(-)

--- 0001/arch/sh/boards/mach-migor/setup.c
+++ work/arch/sh/boards/mach-migor/setup.c	2009-07-09 18:43:42.000000000 +0900
@@ -98,6 +98,9 @@ static struct platform_device sh_keysc_d
 	.dev	= {
 		.platform_data	= &sh_keysc_info,
 	},
+	.archdata = {
+		.hw_blk_id = HWBLK_KEYSC,
+	},
 };
 
 static struct mtd_partition migor_nor_flash_partitions[] @@ -292,6 +295,9 @@ static struct platform_device migor_lcdc
 	.dev	= {
 		.platform_data	= &sh_mobile_lcdc_info,
 	},
+	.archdata = {
+		.hw_blk_id = HWBLK_LCDC,
+	},
 };
 
 static struct clk *camera_clk;
@@ -379,6 +385,9 @@ static struct platform_device migor_ceu_
 	.dev	= {
 		.platform_data	= &sh_mobile_ceu_info,
 	},
+	.archdata = {
+		.hw_blk_id = HWBLK_CEU,
+	},
 };
 
 struct spi_gpio_platform_data sdcard_cn9_platform_data = {
--- 0005/arch/sh/kernel/cpu/sh4a/hwblk-sh7722.c
+++ work/arch/sh/kernel/cpu/sh4a/hwblk-sh7722.c	2009-07-09 18:44:44.000000000 +0900
@@ -89,10 +89,18 @@ static struct hwblk_info sh7722_hwblk_in
 	.nr_hwblks = ARRAY_SIZE(sh7722_hwblk),
 };
 
+void platform_pm_runtime_suspend_idle(void); /* FIXME */
+
 int arch_hwblk_sleep_mode(void)
 {
-	if (!sh7722_hwblk_area[CORE_AREA].cnt[HWBLK_CNT_USAGE])
+	if (!sh7722_hwblk_area[CORE_AREA].cnt[HWBLK_CNT_USAGE]) {
+		if (sh7722_hwblk_area[CORE_AREA].cnt[HWBLK_CNT_IDLE])
+			platform_pm_runtime_suspend_idle();
+		else
+			return SUSP_SH_USTANDBY | SUSP_SH_SF;
+
 		return SUSP_SH_STANDBY | SUSP_SH_SF;
+	}
 
 	if (!sh7722_hwblk_area[CORE_AREA_BM].cnt[HWBLK_CNT_USAGE])
 		return SUSP_SH_SLEEP | SUSP_SH_SF;
--- 0001/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
+++ work/arch/sh/kernel/cpu/sh4a/setup-sh7722.c	2009-07-09 18:43:36.000000000 +0900
@@ -16,6 +16,7 @@
 #include <linux/sh_timer.h>
 #include <asm/clock.h>
 #include <asm/mmzone.h>
+#include <cpu/sh7722.h>
 
 static struct resource rtc_resources[] = {
 	[0] = {
@@ -45,6 +46,9 @@ static struct platform_device rtc_device
 	.id		= -1,
 	.num_resources	= ARRAY_SIZE(rtc_resources),
 	.resource	= rtc_resources,
+	.archdata = {
+		.hw_blk_id = HWBLK_RTC,
+	},
 };
 
 static struct resource usbf_resources[] = {
@@ -70,6 +74,9 @@ static struct platform_device usbf_devic
 	},
 	.num_resources	= ARRAY_SIZE(usbf_resources),
 	.resource	= usbf_resources,
+	.archdata = {
+		.hw_blk_id = HWBLK_USBF,
+	},
 };
 
 static struct resource iic_resources[] = {
@@ -91,6 +98,9 @@ static struct platform_device iic_device
 	.id             = 0, /* "i2c0" clock */
 	.num_resources  = ARRAY_SIZE(iic_resources),
 	.resource       = iic_resources,
+	.archdata = {
+		.hw_blk_id = HWBLK_IIC,
+	},
 };
 
 static struct uio_info vpu_platform_data = {
@@ -119,6 +129,9 @@ static struct platform_device vpu_device
 	},
 	.resource	= vpu_resources,
 	.num_resources	= ARRAY_SIZE(vpu_resources),
+	.archdata = {
+		.hw_blk_id = HWBLK_VPU,
+	},
 };
 
 static struct uio_info veu_platform_data = {
@@ -147,6 +160,9 @@ static struct platform_device veu_device
 	},
 	.resource	= veu_resources,
 	.num_resources	= ARRAY_SIZE(veu_resources),
+	.archdata = {
+		.hw_blk_id = HWBLK_VEU,
+	},
 };
 
 static struct uio_info jpu_platform_data = {
@@ -175,6 +191,9 @@ static struct platform_device jpu_device
 	},
 	.resource	= jpu_resources,
 	.num_resources	= ARRAY_SIZE(jpu_resources),
+	.archdata = {
+		.hw_blk_id = HWBLK_JPU,
+	},
 };
 
 static struct sh_timer_config cmt_platform_data = {
@@ -207,6 +226,9 @@ static struct platform_device cmt_device
 	},
 	.resource	= cmt_resources,
 	.num_resources	= ARRAY_SIZE(cmt_resources),
+	.archdata = {
+		.hw_blk_id = HWBLK_CMT,
+	},
 };
 
 static struct sh_timer_config tmu0_platform_data = {
@@ -238,6 +260,9 @@ static struct platform_device tmu0_devic
 	},
 	.resource	= tmu0_resources,
 	.num_resources	= ARRAY_SIZE(tmu0_resources),
+	.archdata = {
+		.hw_blk_id = HWBLK_TMU,
+	},
 };
 
 static struct sh_timer_config tmu1_platform_data = {
@@ -269,6 +294,9 @@ static struct platform_device tmu1_devic
 	},
 	.resource	= tmu1_resources,
 	.num_resources	= ARRAY_SIZE(tmu1_resources),
+	.archdata = {
+		.hw_blk_id = HWBLK_TMU,
+	},
 };
 
 static struct sh_timer_config tmu2_platform_data = {
@@ -299,6 +327,9 @@ static struct platform_device tmu2_devic
 	},
 	.resource	= tmu2_resources,
 	.num_resources	= ARRAY_SIZE(tmu2_resources),
+	.archdata = {
+		.hw_blk_id = HWBLK_TMU,
+	},
 };
 
 static struct plat_sci_port sci_platform_data[] = {

^ 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 04/06] sh: Runtime PM for sh7722 and Migo-R 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 04/06] sh: Runtime PM for sh7722 and Migo-R 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 04/06] sh: Runtime PM for sh7722 and Migo-R 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.