All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
@ 2011-04-07  0:02 ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel

This series aims to consolidate OMAP and SH-mobile runtime PM
implementations around the new device power domains.

In 2.6.39, device power domains were added (commit
7538e3db6e015e890825fbd9f8659952896ddd5b, PM: add support for device
power domains).  In converting both OMAP and SH-mobile to use device
power domains, the overlap between implementations was almost 100%.  

To share the runtime PM implementation based on simple clock gating,
move it to arch/arm/common and initialize it from OMAP and SH-mobile.

Also, OMAP was the only user of platform_bus_set_pm_ops().  Now that
it has been converted to device power domains, remove
platform_bus_set_pm_ops().

Kevin Hilman (6):
  ARM: sh-mobile: runtime PM: convert to device powerdomains
  OMAP2+: PM: move runtime PM implementation to use device power
    domains
  OMAP1: runtime PM: drop platform bus implementation
  ARM: move SH-mobile runtime PM to arm/common for sharing with other
    platforms
  ARM: use common clock-based runtime PM implementation on SH-mobile &
    OMAP1
  Revert "driver core: platform_bus: allow runtime override of
    dev_pm_ops"

 arch/arm/common/Makefile            |    1 +
 arch/arm/common/pm_runtime_clock.c  |  176 +++++++++++++++++++++++++++++++++++
 arch/arm/include/asm/pm_runtime.h   |   17 ++++
 arch/arm/mach-omap1/Makefile        |    2 +-
 arch/arm/mach-omap1/pm_bus.c        |  100 --------------------
 arch/arm/mach-omap1/pm_runtime.c    |   18 ++++
 arch/arm/mach-omap2/Makefile        |    6 +-
 arch/arm/mach-omap2/pm_bus.c        |   85 -----------------
 arch/arm/mach-shmobile/pm_runtime.c |  152 +-----------------------------
 arch/arm/plat-omap/omap_device.c    |   22 +++++
 drivers/base/platform.c             |   35 -------
 include/linux/platform_device.h     |    3 -
 12 files changed, 241 insertions(+), 376 deletions(-)
 create mode 100644 arch/arm/common/pm_runtime_clock.c
 create mode 100644 arch/arm/include/asm/pm_runtime.h
 delete mode 100644 arch/arm/mach-omap1/pm_bus.c
 create mode 100644 arch/arm/mach-omap1/pm_runtime.c
 delete mode 100644 arch/arm/mach-omap2/pm_bus.c

-- 
1.7.4


^ permalink raw reply	[flat|nested] 66+ messages in thread

* [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
@ 2011-04-07  0:02 ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel, linux-omap, linux-sh
  Cc: linux-kernel, Magnus Damm, Rafael J. Wysocki, Grant Likely,
	Greg Kroah-Hartman

This series aims to consolidate OMAP and SH-mobile runtime PM
implementations around the new device power domains.

In 2.6.39, device power domains were added (commit
7538e3db6e015e890825fbd9f8659952896ddd5b, PM: add support for device
power domains).  In converting both OMAP and SH-mobile to use device
power domains, the overlap between implementations was almost 100%.  

To share the runtime PM implementation based on simple clock gating,
move it to arch/arm/common and initialize it from OMAP and SH-mobile.

Also, OMAP was the only user of platform_bus_set_pm_ops().  Now that
it has been converted to device power domains, remove
platform_bus_set_pm_ops().

Kevin Hilman (6):
  ARM: sh-mobile: runtime PM: convert to device powerdomains
  OMAP2+: PM: move runtime PM implementation to use device power
    domains
  OMAP1: runtime PM: drop platform bus implementation
  ARM: move SH-mobile runtime PM to arm/common for sharing with other
    platforms
  ARM: use common clock-based runtime PM implementation on SH-mobile &
    OMAP1
  Revert "driver core: platform_bus: allow runtime override of
    dev_pm_ops"

 arch/arm/common/Makefile            |    1 +
 arch/arm/common/pm_runtime_clock.c  |  176 +++++++++++++++++++++++++++++++++++
 arch/arm/include/asm/pm_runtime.h   |   17 ++++
 arch/arm/mach-omap1/Makefile        |    2 +-
 arch/arm/mach-omap1/pm_bus.c        |  100 --------------------
 arch/arm/mach-omap1/pm_runtime.c    |   18 ++++
 arch/arm/mach-omap2/Makefile        |    6 +-
 arch/arm/mach-omap2/pm_bus.c        |   85 -----------------
 arch/arm/mach-shmobile/pm_runtime.c |  152 +-----------------------------
 arch/arm/plat-omap/omap_device.c    |   22 +++++
 drivers/base/platform.c             |   35 -------
 include/linux/platform_device.h     |    3 -
 12 files changed, 241 insertions(+), 376 deletions(-)
 create mode 100644 arch/arm/common/pm_runtime_clock.c
 create mode 100644 arch/arm/include/asm/pm_runtime.h
 delete mode 100644 arch/arm/mach-omap1/pm_bus.c
 create mode 100644 arch/arm/mach-omap1/pm_runtime.c
 delete mode 100644 arch/arm/mach-omap2/pm_bus.c

-- 
1.7.4


^ permalink raw reply	[flat|nested] 66+ messages in thread

* [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
@ 2011-04-07  0:02 ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel

This series aims to consolidate OMAP and SH-mobile runtime PM
implementations around the new device power domains.

In 2.6.39, device power domains were added (commit
7538e3db6e015e890825fbd9f8659952896ddd5b, PM: add support for device
power domains).  In converting both OMAP and SH-mobile to use device
power domains, the overlap between implementations was almost 100%.  

To share the runtime PM implementation based on simple clock gating,
move it to arch/arm/common and initialize it from OMAP and SH-mobile.

Also, OMAP was the only user of platform_bus_set_pm_ops().  Now that
it has been converted to device power domains, remove
platform_bus_set_pm_ops().

Kevin Hilman (6):
  ARM: sh-mobile: runtime PM: convert to device powerdomains
  OMAP2+: PM: move runtime PM implementation to use device power
    domains
  OMAP1: runtime PM: drop platform bus implementation
  ARM: move SH-mobile runtime PM to arm/common for sharing with other
    platforms
  ARM: use common clock-based runtime PM implementation on SH-mobile &
    OMAP1
  Revert "driver core: platform_bus: allow runtime override of
    dev_pm_ops"

 arch/arm/common/Makefile            |    1 +
 arch/arm/common/pm_runtime_clock.c  |  176 +++++++++++++++++++++++++++++++++++
 arch/arm/include/asm/pm_runtime.h   |   17 ++++
 arch/arm/mach-omap1/Makefile        |    2 +-
 arch/arm/mach-omap1/pm_bus.c        |  100 --------------------
 arch/arm/mach-omap1/pm_runtime.c    |   18 ++++
 arch/arm/mach-omap2/Makefile        |    6 +-
 arch/arm/mach-omap2/pm_bus.c        |   85 -----------------
 arch/arm/mach-shmobile/pm_runtime.c |  152 +-----------------------------
 arch/arm/plat-omap/omap_device.c    |   22 +++++
 drivers/base/platform.c             |   35 -------
 include/linux/platform_device.h     |    3 -
 12 files changed, 241 insertions(+), 376 deletions(-)
 create mode 100644 arch/arm/common/pm_runtime_clock.c
 create mode 100644 arch/arm/include/asm/pm_runtime.h
 delete mode 100644 arch/arm/mach-omap1/pm_bus.c
 create mode 100644 arch/arm/mach-omap1/pm_runtime.c
 delete mode 100644 arch/arm/mach-omap2/pm_bus.c

-- 
1.7.4

^ permalink raw reply	[flat|nested] 66+ messages in thread

* [PATCH/RFC 1/6] ARM: sh-mobile: runtime PM: convert to device powerdomains
  2011-04-07  0:02 ` Kevin Hilman
  (?)
@ 2011-04-07  0:02   ` Kevin Hilman
  -1 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel

Remove the deprecated use of weak platform_bus symbols in favor of using
the new device power domains.

Cc: Magnus Damm <damm@opensource.se>
Cc: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-shmobile/pm_runtime.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-shmobile/pm_runtime.c b/arch/arm/mach-shmobile/pm_runtime.c
index 94912d3..6c75c3f 100644
--- a/arch/arm/mach-shmobile/pm_runtime.c
+++ b/arch/arm/mach-shmobile/pm_runtime.c
@@ -66,7 +66,7 @@ static void platform_pm_runtime_bug(struct device *dev,
 		dev_err(dev, "runtime pm suspend before resume\n");
 }
 
-int platform_pm_runtime_suspend(struct device *dev)
+static int platform_pm_runtime_suspend(struct device *dev)
 {
 	struct pm_runtime_data *prd = __to_prd(dev);
 
@@ -82,7 +82,7 @@ int platform_pm_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-int platform_pm_runtime_resume(struct device *dev)
+static int platform_pm_runtime_resume(struct device *dev)
 {
 	struct pm_runtime_data *prd = __to_prd(dev);
 
@@ -98,12 +98,20 @@ int platform_pm_runtime_resume(struct device *dev)
 	return 0;
 }
 
-int platform_pm_runtime_idle(struct device *dev)
+static int platform_pm_runtime_idle(struct device *dev)
 {
 	/* suspend synchronously to disable clocks immediately */
 	return pm_runtime_suspend(dev);
 }
 
+static struct dev_power_domain platform_pm_power_domain = {
+	.ops = {
+		.runtime_suspend = platform_pm_runtime_suspend,
+		.runtime_resume = platform_pm_runtime_resume,
+		.runtime_idle = platform_pm_runtime_idle,
+	},
+};
+
 static int platform_bus_notify(struct notifier_block *nb,
 			       unsigned long action, void *data)
 {
@@ -114,10 +122,12 @@ static int platform_bus_notify(struct notifier_block *nb,
 
 	if (action = BUS_NOTIFY_BIND_DRIVER) {
 		prd = devres_alloc(__devres_release, sizeof(*prd), GFP_KERNEL);
-		if (prd)
+		if (prd) {
 			devres_add(dev, prd);
-		else
+			dev->pwr_domain = &platform_pm_power_domain;
+		} else {
 			dev_err(dev, "unable to alloc memory for runtime pm\n");
+		}
 	}
 
 	return 0;
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 66+ messages in thread

* [PATCH/RFC 1/6] ARM: sh-mobile: runtime PM: convert to device powerdomains
@ 2011-04-07  0:02   ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel, linux-omap, linux-sh
  Cc: linux-kernel, Magnus Damm, Rafael J. Wysocki, Grant Likely,
	Greg Kroah-Hartman, Magnus Damm, Paul Mundt

Remove the deprecated use of weak platform_bus symbols in favor of using
the new device power domains.

Cc: Magnus Damm <damm@opensource.se>
Cc: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-shmobile/pm_runtime.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-shmobile/pm_runtime.c b/arch/arm/mach-shmobile/pm_runtime.c
index 94912d3..6c75c3f 100644
--- a/arch/arm/mach-shmobile/pm_runtime.c
+++ b/arch/arm/mach-shmobile/pm_runtime.c
@@ -66,7 +66,7 @@ static void platform_pm_runtime_bug(struct device *dev,
 		dev_err(dev, "runtime pm suspend before resume\n");
 }
 
-int platform_pm_runtime_suspend(struct device *dev)
+static int platform_pm_runtime_suspend(struct device *dev)
 {
 	struct pm_runtime_data *prd = __to_prd(dev);
 
@@ -82,7 +82,7 @@ int platform_pm_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-int platform_pm_runtime_resume(struct device *dev)
+static int platform_pm_runtime_resume(struct device *dev)
 {
 	struct pm_runtime_data *prd = __to_prd(dev);
 
@@ -98,12 +98,20 @@ int platform_pm_runtime_resume(struct device *dev)
 	return 0;
 }
 
-int platform_pm_runtime_idle(struct device *dev)
+static int platform_pm_runtime_idle(struct device *dev)
 {
 	/* suspend synchronously to disable clocks immediately */
 	return pm_runtime_suspend(dev);
 }
 
+static struct dev_power_domain platform_pm_power_domain = {
+	.ops = {
+		.runtime_suspend = platform_pm_runtime_suspend,
+		.runtime_resume = platform_pm_runtime_resume,
+		.runtime_idle = platform_pm_runtime_idle,
+	},
+};
+
 static int platform_bus_notify(struct notifier_block *nb,
 			       unsigned long action, void *data)
 {
@@ -114,10 +122,12 @@ static int platform_bus_notify(struct notifier_block *nb,
 
 	if (action == BUS_NOTIFY_BIND_DRIVER) {
 		prd = devres_alloc(__devres_release, sizeof(*prd), GFP_KERNEL);
-		if (prd)
+		if (prd) {
 			devres_add(dev, prd);
-		else
+			dev->pwr_domain = &platform_pm_power_domain;
+		} else {
 			dev_err(dev, "unable to alloc memory for runtime pm\n");
+		}
 	}
 
 	return 0;
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 66+ messages in thread

* [PATCH/RFC 1/6] ARM: sh-mobile: runtime PM: convert to device powerdomains
@ 2011-04-07  0:02   ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel

Remove the deprecated use of weak platform_bus symbols in favor of using
the new device power domains.

Cc: Magnus Damm <damm@opensource.se>
Cc: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-shmobile/pm_runtime.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-shmobile/pm_runtime.c b/arch/arm/mach-shmobile/pm_runtime.c
index 94912d3..6c75c3f 100644
--- a/arch/arm/mach-shmobile/pm_runtime.c
+++ b/arch/arm/mach-shmobile/pm_runtime.c
@@ -66,7 +66,7 @@ static void platform_pm_runtime_bug(struct device *dev,
 		dev_err(dev, "runtime pm suspend before resume\n");
 }
 
-int platform_pm_runtime_suspend(struct device *dev)
+static int platform_pm_runtime_suspend(struct device *dev)
 {
 	struct pm_runtime_data *prd = __to_prd(dev);
 
@@ -82,7 +82,7 @@ int platform_pm_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-int platform_pm_runtime_resume(struct device *dev)
+static int platform_pm_runtime_resume(struct device *dev)
 {
 	struct pm_runtime_data *prd = __to_prd(dev);
 
@@ -98,12 +98,20 @@ int platform_pm_runtime_resume(struct device *dev)
 	return 0;
 }
 
-int platform_pm_runtime_idle(struct device *dev)
+static int platform_pm_runtime_idle(struct device *dev)
 {
 	/* suspend synchronously to disable clocks immediately */
 	return pm_runtime_suspend(dev);
 }
 
+static struct dev_power_domain platform_pm_power_domain = {
+	.ops = {
+		.runtime_suspend = platform_pm_runtime_suspend,
+		.runtime_resume = platform_pm_runtime_resume,
+		.runtime_idle = platform_pm_runtime_idle,
+	},
+};
+
 static int platform_bus_notify(struct notifier_block *nb,
 			       unsigned long action, void *data)
 {
@@ -114,10 +122,12 @@ static int platform_bus_notify(struct notifier_block *nb,
 
 	if (action == BUS_NOTIFY_BIND_DRIVER) {
 		prd = devres_alloc(__devres_release, sizeof(*prd), GFP_KERNEL);
-		if (prd)
+		if (prd) {
 			devres_add(dev, prd);
-		else
+			dev->pwr_domain = &platform_pm_power_domain;
+		} else {
 			dev_err(dev, "unable to alloc memory for runtime pm\n");
+		}
 	}
 
 	return 0;
-- 
1.7.4

^ permalink raw reply related	[flat|nested] 66+ messages in thread

* [PATCH/RFC 2/6] OMAP2+: PM: move runtime PM implementation to use device power domains
  2011-04-07  0:02 ` Kevin Hilman
  (?)
  (?)
@ 2011-04-07  0:02   ` Kevin Hilman
  -1 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel

In commit 7538e3db6e015e890825fbd9f8659952896ddd5b (PM: add support
for device power domains) a better way for handling platform-specific
power hooks was introduced.

Rather than using the platform_bus dev_pm_ops overrides
(platform_bus_set_pm_ops()), this patch moves the OMAP runtime PM
implementation over to using device power domains.

Since OMAP is the only user of platform_bus_set_pm_ops(), that
interface can be removed (and will be in a forthcoming patch.)

Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap2/Makefile     |    6 +-
 arch/arm/mach-omap2/pm_bus.c     |   85 --------------------------------------
 arch/arm/plat-omap/omap_device.c |   22 ++++++++++
 3 files changed, 25 insertions(+), 88 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/pm_bus.c

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index a45cd64..b353584 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -59,10 +59,10 @@ endif
 # Power Management
 ifeq ($(CONFIG_PM),y)
 obj-$(CONFIG_ARCH_OMAP2)		+= pm24xx.o
-obj-$(CONFIG_ARCH_OMAP2)		+= sleep24xx.o pm_bus.o
+obj-$(CONFIG_ARCH_OMAP2)		+= sleep24xx.o
 obj-$(CONFIG_ARCH_OMAP3)		+= pm34xx.o sleep34xx.o \
-					   cpuidle34xx.o pm_bus.o
-obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o pm_bus.o
+					   cpuidle34xx.o
+obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o
 obj-$(CONFIG_PM_DEBUG)			+= pm-debug.o
 obj-$(CONFIG_OMAP_SMARTREFLEX)          += sr_device.o smartreflex.o
 obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3)	+= smartreflex-class3.o
diff --git a/arch/arm/mach-omap2/pm_bus.c b/arch/arm/mach-omap2/pm_bus.c
deleted file mode 100644
index 5acd2ab..0000000
--- a/arch/arm/mach-omap2/pm_bus.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Runtime PM support code for OMAP
- *
- * Author: Kevin Hilman, Deep Root Systems, LLC
- *
- * Copyright (C) 2010 Texas Instruments, Inc.
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/io.h>
-#include <linux/pm_runtime.h>
-#include <linux/platform_device.h>
-#include <linux/mutex.h>
-
-#include <plat/omap_device.h>
-#include <plat/omap-pm.h>
-
-#ifdef CONFIG_PM_RUNTIME
-static int omap_pm_runtime_suspend(struct device *dev)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-	int r, ret = 0;
-
-	dev_dbg(dev, "%s\n", __func__);
-
-	ret = pm_generic_runtime_suspend(dev);
-
-	if (!ret && dev->parent = &omap_device_parent) {
-		r = omap_device_idle(pdev);
-		WARN_ON(r);
-	}
-
-	return ret;
-};
-
-static int omap_pm_runtime_resume(struct device *dev)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-	int r;
-
-	dev_dbg(dev, "%s\n", __func__);
-
-	if (dev->parent = &omap_device_parent) {
-		r = omap_device_enable(pdev);
-		WARN_ON(r);
-	}
-
-	return pm_generic_runtime_resume(dev);
-};
-#else
-#define omap_pm_runtime_suspend NULL
-#define omap_pm_runtime_resume NULL
-#endif /* CONFIG_PM_RUNTIME */
-
-static int __init omap_pm_runtime_init(void)
-{
-	const struct dev_pm_ops *pm;
-	struct dev_pm_ops *omap_pm;
-
-	pm = platform_bus_get_pm_ops();
-	if (!pm) {
-		pr_err("%s: unable to get dev_pm_ops from platform_bus\n",
-			__func__);
-		return -ENODEV;
-	}
-
-	omap_pm = kmemdup(pm, sizeof(struct dev_pm_ops), GFP_KERNEL);
-	if (!omap_pm) {
-		pr_err("%s: unable to alloc memory for new dev_pm_ops\n",
-			__func__);
-		return -ENOMEM;
-	}
-
-	omap_pm->runtime_suspend = omap_pm_runtime_suspend;
-	omap_pm->runtime_resume = omap_pm_runtime_resume;
-
-	platform_bus_set_pm_ops(omap_pm);
-
-	return 0;
-}
-core_initcall(omap_pm_runtime_init);
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index 9bbda9a..93cd2fb 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -536,6 +536,27 @@ int omap_early_device_register(struct omap_device *od)
 	return 0;
 }
 
+static int _od_runtime_suspend(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+
+	return omap_device_idle(pdev);
+}
+
+static int _od_runtime_resume(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+
+	return omap_device_enable(pdev);
+}
+
+static struct dev_power_domain omap_device_power_domain = {
+	.ops = {
+		.runtime_suspend = _od_runtime_suspend,
+		.runtime_resume = _od_runtime_resume,
+	}
+};
+
 /**
  * omap_device_register - register an omap_device with one omap_hwmod
  * @od: struct omap_device * to register
@@ -549,6 +570,7 @@ int omap_device_register(struct omap_device *od)
 	pr_debug("omap_device: %s: registering\n", od->pdev.name);
 
 	od->pdev.dev.parent = &omap_device_parent;
+	od->pdev.dev.pwr_domain = &omap_device_power_domain;
 	return platform_device_register(&od->pdev);
 }
 
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 66+ messages in thread

* [PATCH/RFC 2/6] OMAP2+: PM: move runtime PM implementation to use device power domains
@ 2011-04-07  0:02   ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel, linux-omap, linux-sh
  Cc: linux-kernel, Magnus Damm, Rafael J. Wysocki, Grant Likely,
	Greg Kroah-Hartman, Rafael J. Wysocki

In commit 7538e3db6e015e890825fbd9f8659952896ddd5b (PM: add support
for device power domains) a better way for handling platform-specific
power hooks was introduced.

Rather than using the platform_bus dev_pm_ops overrides
(platform_bus_set_pm_ops()), this patch moves the OMAP runtime PM
implementation over to using device power domains.

Since OMAP is the only user of platform_bus_set_pm_ops(), that
interface can be removed (and will be in a forthcoming patch.)

Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap2/Makefile     |    6 +-
 arch/arm/mach-omap2/pm_bus.c     |   85 --------------------------------------
 arch/arm/plat-omap/omap_device.c |   22 ++++++++++
 3 files changed, 25 insertions(+), 88 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/pm_bus.c

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index a45cd64..b353584 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -59,10 +59,10 @@ endif
 # Power Management
 ifeq ($(CONFIG_PM),y)
 obj-$(CONFIG_ARCH_OMAP2)		+= pm24xx.o
-obj-$(CONFIG_ARCH_OMAP2)		+= sleep24xx.o pm_bus.o
+obj-$(CONFIG_ARCH_OMAP2)		+= sleep24xx.o
 obj-$(CONFIG_ARCH_OMAP3)		+= pm34xx.o sleep34xx.o \
-					   cpuidle34xx.o pm_bus.o
-obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o pm_bus.o
+					   cpuidle34xx.o
+obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o
 obj-$(CONFIG_PM_DEBUG)			+= pm-debug.o
 obj-$(CONFIG_OMAP_SMARTREFLEX)          += sr_device.o smartreflex.o
 obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3)	+= smartreflex-class3.o
diff --git a/arch/arm/mach-omap2/pm_bus.c b/arch/arm/mach-omap2/pm_bus.c
deleted file mode 100644
index 5acd2ab..0000000
--- a/arch/arm/mach-omap2/pm_bus.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Runtime PM support code for OMAP
- *
- * Author: Kevin Hilman, Deep Root Systems, LLC
- *
- * Copyright (C) 2010 Texas Instruments, Inc.
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/io.h>
-#include <linux/pm_runtime.h>
-#include <linux/platform_device.h>
-#include <linux/mutex.h>
-
-#include <plat/omap_device.h>
-#include <plat/omap-pm.h>
-
-#ifdef CONFIG_PM_RUNTIME
-static int omap_pm_runtime_suspend(struct device *dev)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-	int r, ret = 0;
-
-	dev_dbg(dev, "%s\n", __func__);
-
-	ret = pm_generic_runtime_suspend(dev);
-
-	if (!ret && dev->parent == &omap_device_parent) {
-		r = omap_device_idle(pdev);
-		WARN_ON(r);
-	}
-
-	return ret;
-};
-
-static int omap_pm_runtime_resume(struct device *dev)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-	int r;
-
-	dev_dbg(dev, "%s\n", __func__);
-
-	if (dev->parent == &omap_device_parent) {
-		r = omap_device_enable(pdev);
-		WARN_ON(r);
-	}
-
-	return pm_generic_runtime_resume(dev);
-};
-#else
-#define omap_pm_runtime_suspend NULL
-#define omap_pm_runtime_resume NULL
-#endif /* CONFIG_PM_RUNTIME */
-
-static int __init omap_pm_runtime_init(void)
-{
-	const struct dev_pm_ops *pm;
-	struct dev_pm_ops *omap_pm;
-
-	pm = platform_bus_get_pm_ops();
-	if (!pm) {
-		pr_err("%s: unable to get dev_pm_ops from platform_bus\n",
-			__func__);
-		return -ENODEV;
-	}
-
-	omap_pm = kmemdup(pm, sizeof(struct dev_pm_ops), GFP_KERNEL);
-	if (!omap_pm) {
-		pr_err("%s: unable to alloc memory for new dev_pm_ops\n",
-			__func__);
-		return -ENOMEM;
-	}
-
-	omap_pm->runtime_suspend = omap_pm_runtime_suspend;
-	omap_pm->runtime_resume = omap_pm_runtime_resume;
-
-	platform_bus_set_pm_ops(omap_pm);
-
-	return 0;
-}
-core_initcall(omap_pm_runtime_init);
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index 9bbda9a..93cd2fb 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -536,6 +536,27 @@ int omap_early_device_register(struct omap_device *od)
 	return 0;
 }
 
+static int _od_runtime_suspend(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+
+	return omap_device_idle(pdev);
+}
+
+static int _od_runtime_resume(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+
+	return omap_device_enable(pdev);
+}
+
+static struct dev_power_domain omap_device_power_domain = {
+	.ops = {
+		.runtime_suspend = _od_runtime_suspend,
+		.runtime_resume = _od_runtime_resume,
+	}
+};
+
 /**
  * omap_device_register - register an omap_device with one omap_hwmod
  * @od: struct omap_device * to register
@@ -549,6 +570,7 @@ int omap_device_register(struct omap_device *od)
 	pr_debug("omap_device: %s: registering\n", od->pdev.name);
 
 	od->pdev.dev.parent = &omap_device_parent;
+	od->pdev.dev.pwr_domain = &omap_device_power_domain;
 	return platform_device_register(&od->pdev);
 }
 
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 66+ messages in thread

* [PATCH/RFC 2/6] OMAP2+: PM: move runtime PM implementation to use device power domains
@ 2011-04-07  0:02   ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel, linux-omap, linux-sh
  Cc: Rafael J. Wysocki, Rafael J. Wysocki, Greg Kroah-Hartman,
	Magnus Damm, linux-kernel, Grant Likely

In commit 7538e3db6e015e890825fbd9f8659952896ddd5b (PM: add support
for device power domains) a better way for handling platform-specific
power hooks was introduced.

Rather than using the platform_bus dev_pm_ops overrides
(platform_bus_set_pm_ops()), this patch moves the OMAP runtime PM
implementation over to using device power domains.

Since OMAP is the only user of platform_bus_set_pm_ops(), that
interface can be removed (and will be in a forthcoming patch.)

Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap2/Makefile     |    6 +-
 arch/arm/mach-omap2/pm_bus.c     |   85 --------------------------------------
 arch/arm/plat-omap/omap_device.c |   22 ++++++++++
 3 files changed, 25 insertions(+), 88 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/pm_bus.c

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index a45cd64..b353584 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -59,10 +59,10 @@ endif
 # Power Management
 ifeq ($(CONFIG_PM),y)
 obj-$(CONFIG_ARCH_OMAP2)		+= pm24xx.o
-obj-$(CONFIG_ARCH_OMAP2)		+= sleep24xx.o pm_bus.o
+obj-$(CONFIG_ARCH_OMAP2)		+= sleep24xx.o
 obj-$(CONFIG_ARCH_OMAP3)		+= pm34xx.o sleep34xx.o \
-					   cpuidle34xx.o pm_bus.o
-obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o pm_bus.o
+					   cpuidle34xx.o
+obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o
 obj-$(CONFIG_PM_DEBUG)			+= pm-debug.o
 obj-$(CONFIG_OMAP_SMARTREFLEX)          += sr_device.o smartreflex.o
 obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3)	+= smartreflex-class3.o
diff --git a/arch/arm/mach-omap2/pm_bus.c b/arch/arm/mach-omap2/pm_bus.c
deleted file mode 100644
index 5acd2ab..0000000
--- a/arch/arm/mach-omap2/pm_bus.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Runtime PM support code for OMAP
- *
- * Author: Kevin Hilman, Deep Root Systems, LLC
- *
- * Copyright (C) 2010 Texas Instruments, Inc.
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/io.h>
-#include <linux/pm_runtime.h>
-#include <linux/platform_device.h>
-#include <linux/mutex.h>
-
-#include <plat/omap_device.h>
-#include <plat/omap-pm.h>
-
-#ifdef CONFIG_PM_RUNTIME
-static int omap_pm_runtime_suspend(struct device *dev)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-	int r, ret = 0;
-
-	dev_dbg(dev, "%s\n", __func__);
-
-	ret = pm_generic_runtime_suspend(dev);
-
-	if (!ret && dev->parent == &omap_device_parent) {
-		r = omap_device_idle(pdev);
-		WARN_ON(r);
-	}
-
-	return ret;
-};
-
-static int omap_pm_runtime_resume(struct device *dev)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-	int r;
-
-	dev_dbg(dev, "%s\n", __func__);
-
-	if (dev->parent == &omap_device_parent) {
-		r = omap_device_enable(pdev);
-		WARN_ON(r);
-	}
-
-	return pm_generic_runtime_resume(dev);
-};
-#else
-#define omap_pm_runtime_suspend NULL
-#define omap_pm_runtime_resume NULL
-#endif /* CONFIG_PM_RUNTIME */
-
-static int __init omap_pm_runtime_init(void)
-{
-	const struct dev_pm_ops *pm;
-	struct dev_pm_ops *omap_pm;
-
-	pm = platform_bus_get_pm_ops();
-	if (!pm) {
-		pr_err("%s: unable to get dev_pm_ops from platform_bus\n",
-			__func__);
-		return -ENODEV;
-	}
-
-	omap_pm = kmemdup(pm, sizeof(struct dev_pm_ops), GFP_KERNEL);
-	if (!omap_pm) {
-		pr_err("%s: unable to alloc memory for new dev_pm_ops\n",
-			__func__);
-		return -ENOMEM;
-	}
-
-	omap_pm->runtime_suspend = omap_pm_runtime_suspend;
-	omap_pm->runtime_resume = omap_pm_runtime_resume;
-
-	platform_bus_set_pm_ops(omap_pm);
-
-	return 0;
-}
-core_initcall(omap_pm_runtime_init);
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index 9bbda9a..93cd2fb 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -536,6 +536,27 @@ int omap_early_device_register(struct omap_device *od)
 	return 0;
 }
 
+static int _od_runtime_suspend(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+
+	return omap_device_idle(pdev);
+}
+
+static int _od_runtime_resume(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+
+	return omap_device_enable(pdev);
+}
+
+static struct dev_power_domain omap_device_power_domain = {
+	.ops = {
+		.runtime_suspend = _od_runtime_suspend,
+		.runtime_resume = _od_runtime_resume,
+	}
+};
+
 /**
  * omap_device_register - register an omap_device with one omap_hwmod
  * @od: struct omap_device * to register
@@ -549,6 +570,7 @@ int omap_device_register(struct omap_device *od)
 	pr_debug("omap_device: %s: registering\n", od->pdev.name);
 
 	od->pdev.dev.parent = &omap_device_parent;
+	od->pdev.dev.pwr_domain = &omap_device_power_domain;
 	return platform_device_register(&od->pdev);
 }
 
-- 
1.7.4

^ permalink raw reply related	[flat|nested] 66+ messages in thread

* [PATCH/RFC 2/6] OMAP2+: PM: move runtime PM implementation to use device power domains
@ 2011-04-07  0:02   ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel

In commit 7538e3db6e015e890825fbd9f8659952896ddd5b (PM: add support
for device power domains) a better way for handling platform-specific
power hooks was introduced.

Rather than using the platform_bus dev_pm_ops overrides
(platform_bus_set_pm_ops()), this patch moves the OMAP runtime PM
implementation over to using device power domains.

Since OMAP is the only user of platform_bus_set_pm_ops(), that
interface can be removed (and will be in a forthcoming patch.)

Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap2/Makefile     |    6 +-
 arch/arm/mach-omap2/pm_bus.c     |   85 --------------------------------------
 arch/arm/plat-omap/omap_device.c |   22 ++++++++++
 3 files changed, 25 insertions(+), 88 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/pm_bus.c

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index a45cd64..b353584 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -59,10 +59,10 @@ endif
 # Power Management
 ifeq ($(CONFIG_PM),y)
 obj-$(CONFIG_ARCH_OMAP2)		+= pm24xx.o
-obj-$(CONFIG_ARCH_OMAP2)		+= sleep24xx.o pm_bus.o
+obj-$(CONFIG_ARCH_OMAP2)		+= sleep24xx.o
 obj-$(CONFIG_ARCH_OMAP3)		+= pm34xx.o sleep34xx.o \
-					   cpuidle34xx.o pm_bus.o
-obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o pm_bus.o
+					   cpuidle34xx.o
+obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o
 obj-$(CONFIG_PM_DEBUG)			+= pm-debug.o
 obj-$(CONFIG_OMAP_SMARTREFLEX)          += sr_device.o smartreflex.o
 obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3)	+= smartreflex-class3.o
diff --git a/arch/arm/mach-omap2/pm_bus.c b/arch/arm/mach-omap2/pm_bus.c
deleted file mode 100644
index 5acd2ab..0000000
--- a/arch/arm/mach-omap2/pm_bus.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Runtime PM support code for OMAP
- *
- * Author: Kevin Hilman, Deep Root Systems, LLC
- *
- * Copyright (C) 2010 Texas Instruments, Inc.
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/io.h>
-#include <linux/pm_runtime.h>
-#include <linux/platform_device.h>
-#include <linux/mutex.h>
-
-#include <plat/omap_device.h>
-#include <plat/omap-pm.h>
-
-#ifdef CONFIG_PM_RUNTIME
-static int omap_pm_runtime_suspend(struct device *dev)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-	int r, ret = 0;
-
-	dev_dbg(dev, "%s\n", __func__);
-
-	ret = pm_generic_runtime_suspend(dev);
-
-	if (!ret && dev->parent == &omap_device_parent) {
-		r = omap_device_idle(pdev);
-		WARN_ON(r);
-	}
-
-	return ret;
-};
-
-static int omap_pm_runtime_resume(struct device *dev)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-	int r;
-
-	dev_dbg(dev, "%s\n", __func__);
-
-	if (dev->parent == &omap_device_parent) {
-		r = omap_device_enable(pdev);
-		WARN_ON(r);
-	}
-
-	return pm_generic_runtime_resume(dev);
-};
-#else
-#define omap_pm_runtime_suspend NULL
-#define omap_pm_runtime_resume NULL
-#endif /* CONFIG_PM_RUNTIME */
-
-static int __init omap_pm_runtime_init(void)
-{
-	const struct dev_pm_ops *pm;
-	struct dev_pm_ops *omap_pm;
-
-	pm = platform_bus_get_pm_ops();
-	if (!pm) {
-		pr_err("%s: unable to get dev_pm_ops from platform_bus\n",
-			__func__);
-		return -ENODEV;
-	}
-
-	omap_pm = kmemdup(pm, sizeof(struct dev_pm_ops), GFP_KERNEL);
-	if (!omap_pm) {
-		pr_err("%s: unable to alloc memory for new dev_pm_ops\n",
-			__func__);
-		return -ENOMEM;
-	}
-
-	omap_pm->runtime_suspend = omap_pm_runtime_suspend;
-	omap_pm->runtime_resume = omap_pm_runtime_resume;
-
-	platform_bus_set_pm_ops(omap_pm);
-
-	return 0;
-}
-core_initcall(omap_pm_runtime_init);
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index 9bbda9a..93cd2fb 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -536,6 +536,27 @@ int omap_early_device_register(struct omap_device *od)
 	return 0;
 }
 
+static int _od_runtime_suspend(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+
+	return omap_device_idle(pdev);
+}
+
+static int _od_runtime_resume(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+
+	return omap_device_enable(pdev);
+}
+
+static struct dev_power_domain omap_device_power_domain = {
+	.ops = {
+		.runtime_suspend = _od_runtime_suspend,
+		.runtime_resume = _od_runtime_resume,
+	}
+};
+
 /**
  * omap_device_register - register an omap_device with one omap_hwmod
  * @od: struct omap_device * to register
@@ -549,6 +570,7 @@ int omap_device_register(struct omap_device *od)
 	pr_debug("omap_device: %s: registering\n", od->pdev.name);
 
 	od->pdev.dev.parent = &omap_device_parent;
+	od->pdev.dev.pwr_domain = &omap_device_power_domain;
 	return platform_device_register(&od->pdev);
 }
 
-- 
1.7.4

^ permalink raw reply related	[flat|nested] 66+ messages in thread

* [PATCH/RFC 3/6] OMAP1: runtime PM: drop platform bus implementation
  2011-04-07  0:02 ` Kevin Hilman
  (?)
  (?)
@ 2011-04-07  0:02   ` Kevin Hilman
  -1 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel

Current runtime PM implementation on OMAP1 is is based on a deprecated
interface: platform_bus_set_pm_ops().  Subsequent patch will convert
OMAP1 runtime PM to an implementation shared with SH-mobile, and based
on the new device power domain infrastructure in the common PM core.

Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap1/Makefile |    2 +-
 arch/arm/mach-omap1/pm_bus.c |  100 ------------------------------------------
 2 files changed, 1 insertions(+), 101 deletions(-)
 delete mode 100644 arch/arm/mach-omap1/pm_bus.c

diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index af98117..1913c2d 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -11,7 +11,7 @@ obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
 obj-$(CONFIG_OMAP_32K_TIMER)	+= timer32k.o
 
 # Power Management
-obj-$(CONFIG_PM) += pm.o sleep.o pm_bus.o
+obj-$(CONFIG_PM) += pm.o sleep.o
 
 # DSP
 obj-$(CONFIG_OMAP_MBOX_FWK)	+= mailbox_mach.o
diff --git a/arch/arm/mach-omap1/pm_bus.c b/arch/arm/mach-omap1/pm_bus.c
deleted file mode 100644
index 6588c22..0000000
--- a/arch/arm/mach-omap1/pm_bus.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Runtime PM support code for OMAP1
- *
- * Author: Kevin Hilman, Deep Root Systems, LLC
- *
- * Copyright (C) 2010 Texas Instruments, Inc.
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/io.h>
-#include <linux/pm_runtime.h>
-#include <linux/platform_device.h>
-#include <linux/mutex.h>
-#include <linux/clk.h>
-#include <linux/err.h>
-
-#include <plat/omap_device.h>
-#include <plat/omap-pm.h>
-
-#ifdef CONFIG_PM_RUNTIME
-static int omap1_pm_runtime_suspend(struct device *dev)
-{
-	struct clk *iclk, *fclk;
-	int ret = 0;
-
-	dev_dbg(dev, "%s\n", __func__);
-
-	ret = pm_generic_runtime_suspend(dev);
-
-	fclk = clk_get(dev, "fck");
-	if (!IS_ERR(fclk)) {
-		clk_disable(fclk);
-		clk_put(fclk);
-	}
-
-	iclk = clk_get(dev, "ick");
-	if (!IS_ERR(iclk)) {
-		clk_disable(iclk);
-		clk_put(iclk);
-	}
-
-	return 0;
-};
-
-static int omap1_pm_runtime_resume(struct device *dev)
-{
-	struct clk *iclk, *fclk;
-
-	dev_dbg(dev, "%s\n", __func__);
-
-	iclk = clk_get(dev, "ick");
-	if (!IS_ERR(iclk)) {
-		clk_enable(iclk);
-		clk_put(iclk);
-	}
-
-	fclk = clk_get(dev, "fck");
-	if (!IS_ERR(fclk)) {
-		clk_enable(fclk);
-		clk_put(fclk);
-	}
-
-	return pm_generic_runtime_resume(dev);
-};
-
-static int __init omap1_pm_runtime_init(void)
-{
-	const struct dev_pm_ops *pm;
-	struct dev_pm_ops *omap_pm;
-
-	if (!cpu_class_is_omap1())
-		return -ENODEV;
-
-	pm = platform_bus_get_pm_ops();
-	if (!pm) {
-		pr_err("%s: unable to get dev_pm_ops from platform_bus\n",
-			__func__);
-		return -ENODEV;
-	}
-
-	omap_pm = kmemdup(pm, sizeof(struct dev_pm_ops), GFP_KERNEL);
-	if (!omap_pm) {
-		pr_err("%s: unable to alloc memory for new dev_pm_ops\n",
-			__func__);
-		return -ENOMEM;
-	}
-
-	omap_pm->runtime_suspend = omap1_pm_runtime_suspend;
-	omap_pm->runtime_resume = omap1_pm_runtime_resume;
-
-	platform_bus_set_pm_ops(omap_pm);
-
-	return 0;
-}
-core_initcall(omap1_pm_runtime_init);
-#endif /* CONFIG_PM_RUNTIME */
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 66+ messages in thread

* [PATCH/RFC 3/6] OMAP1: runtime PM: drop platform bus implementation
@ 2011-04-07  0:02   ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel, linux-omap, linux-sh
  Cc: linux-kernel, Magnus Damm, Rafael J. Wysocki, Grant Likely,
	Greg Kroah-Hartman

Current runtime PM implementation on OMAP1 is is based on a deprecated
interface: platform_bus_set_pm_ops().  Subsequent patch will convert
OMAP1 runtime PM to an implementation shared with SH-mobile, and based
on the new device power domain infrastructure in the common PM core.

Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap1/Makefile |    2 +-
 arch/arm/mach-omap1/pm_bus.c |  100 ------------------------------------------
 2 files changed, 1 insertions(+), 101 deletions(-)
 delete mode 100644 arch/arm/mach-omap1/pm_bus.c

diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index af98117..1913c2d 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -11,7 +11,7 @@ obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
 obj-$(CONFIG_OMAP_32K_TIMER)	+= timer32k.o
 
 # Power Management
-obj-$(CONFIG_PM) += pm.o sleep.o pm_bus.o
+obj-$(CONFIG_PM) += pm.o sleep.o
 
 # DSP
 obj-$(CONFIG_OMAP_MBOX_FWK)	+= mailbox_mach.o
diff --git a/arch/arm/mach-omap1/pm_bus.c b/arch/arm/mach-omap1/pm_bus.c
deleted file mode 100644
index 6588c22..0000000
--- a/arch/arm/mach-omap1/pm_bus.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Runtime PM support code for OMAP1
- *
- * Author: Kevin Hilman, Deep Root Systems, LLC
- *
- * Copyright (C) 2010 Texas Instruments, Inc.
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/io.h>
-#include <linux/pm_runtime.h>
-#include <linux/platform_device.h>
-#include <linux/mutex.h>
-#include <linux/clk.h>
-#include <linux/err.h>
-
-#include <plat/omap_device.h>
-#include <plat/omap-pm.h>
-
-#ifdef CONFIG_PM_RUNTIME
-static int omap1_pm_runtime_suspend(struct device *dev)
-{
-	struct clk *iclk, *fclk;
-	int ret = 0;
-
-	dev_dbg(dev, "%s\n", __func__);
-
-	ret = pm_generic_runtime_suspend(dev);
-
-	fclk = clk_get(dev, "fck");
-	if (!IS_ERR(fclk)) {
-		clk_disable(fclk);
-		clk_put(fclk);
-	}
-
-	iclk = clk_get(dev, "ick");
-	if (!IS_ERR(iclk)) {
-		clk_disable(iclk);
-		clk_put(iclk);
-	}
-
-	return 0;
-};
-
-static int omap1_pm_runtime_resume(struct device *dev)
-{
-	struct clk *iclk, *fclk;
-
-	dev_dbg(dev, "%s\n", __func__);
-
-	iclk = clk_get(dev, "ick");
-	if (!IS_ERR(iclk)) {
-		clk_enable(iclk);
-		clk_put(iclk);
-	}
-
-	fclk = clk_get(dev, "fck");
-	if (!IS_ERR(fclk)) {
-		clk_enable(fclk);
-		clk_put(fclk);
-	}
-
-	return pm_generic_runtime_resume(dev);
-};
-
-static int __init omap1_pm_runtime_init(void)
-{
-	const struct dev_pm_ops *pm;
-	struct dev_pm_ops *omap_pm;
-
-	if (!cpu_class_is_omap1())
-		return -ENODEV;
-
-	pm = platform_bus_get_pm_ops();
-	if (!pm) {
-		pr_err("%s: unable to get dev_pm_ops from platform_bus\n",
-			__func__);
-		return -ENODEV;
-	}
-
-	omap_pm = kmemdup(pm, sizeof(struct dev_pm_ops), GFP_KERNEL);
-	if (!omap_pm) {
-		pr_err("%s: unable to alloc memory for new dev_pm_ops\n",
-			__func__);
-		return -ENOMEM;
-	}
-
-	omap_pm->runtime_suspend = omap1_pm_runtime_suspend;
-	omap_pm->runtime_resume = omap1_pm_runtime_resume;
-
-	platform_bus_set_pm_ops(omap_pm);
-
-	return 0;
-}
-core_initcall(omap1_pm_runtime_init);
-#endif /* CONFIG_PM_RUNTIME */
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 66+ messages in thread

* [PATCH/RFC 3/6] OMAP1: runtime PM: drop platform bus implementation
@ 2011-04-07  0:02   ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel, linux-omap, linux-sh
  Cc: Rafael J. Wysocki, Grant Likely, Greg Kroah-Hartman, Magnus Damm,
	linux-kernel

Current runtime PM implementation on OMAP1 is is based on a deprecated
interface: platform_bus_set_pm_ops().  Subsequent patch will convert
OMAP1 runtime PM to an implementation shared with SH-mobile, and based
on the new device power domain infrastructure in the common PM core.

Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap1/Makefile |    2 +-
 arch/arm/mach-omap1/pm_bus.c |  100 ------------------------------------------
 2 files changed, 1 insertions(+), 101 deletions(-)
 delete mode 100644 arch/arm/mach-omap1/pm_bus.c

diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index af98117..1913c2d 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -11,7 +11,7 @@ obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
 obj-$(CONFIG_OMAP_32K_TIMER)	+= timer32k.o
 
 # Power Management
-obj-$(CONFIG_PM) += pm.o sleep.o pm_bus.o
+obj-$(CONFIG_PM) += pm.o sleep.o
 
 # DSP
 obj-$(CONFIG_OMAP_MBOX_FWK)	+= mailbox_mach.o
diff --git a/arch/arm/mach-omap1/pm_bus.c b/arch/arm/mach-omap1/pm_bus.c
deleted file mode 100644
index 6588c22..0000000
--- a/arch/arm/mach-omap1/pm_bus.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Runtime PM support code for OMAP1
- *
- * Author: Kevin Hilman, Deep Root Systems, LLC
- *
- * Copyright (C) 2010 Texas Instruments, Inc.
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/io.h>
-#include <linux/pm_runtime.h>
-#include <linux/platform_device.h>
-#include <linux/mutex.h>
-#include <linux/clk.h>
-#include <linux/err.h>
-
-#include <plat/omap_device.h>
-#include <plat/omap-pm.h>
-
-#ifdef CONFIG_PM_RUNTIME
-static int omap1_pm_runtime_suspend(struct device *dev)
-{
-	struct clk *iclk, *fclk;
-	int ret = 0;
-
-	dev_dbg(dev, "%s\n", __func__);
-
-	ret = pm_generic_runtime_suspend(dev);
-
-	fclk = clk_get(dev, "fck");
-	if (!IS_ERR(fclk)) {
-		clk_disable(fclk);
-		clk_put(fclk);
-	}
-
-	iclk = clk_get(dev, "ick");
-	if (!IS_ERR(iclk)) {
-		clk_disable(iclk);
-		clk_put(iclk);
-	}
-
-	return 0;
-};
-
-static int omap1_pm_runtime_resume(struct device *dev)
-{
-	struct clk *iclk, *fclk;
-
-	dev_dbg(dev, "%s\n", __func__);
-
-	iclk = clk_get(dev, "ick");
-	if (!IS_ERR(iclk)) {
-		clk_enable(iclk);
-		clk_put(iclk);
-	}
-
-	fclk = clk_get(dev, "fck");
-	if (!IS_ERR(fclk)) {
-		clk_enable(fclk);
-		clk_put(fclk);
-	}
-
-	return pm_generic_runtime_resume(dev);
-};
-
-static int __init omap1_pm_runtime_init(void)
-{
-	const struct dev_pm_ops *pm;
-	struct dev_pm_ops *omap_pm;
-
-	if (!cpu_class_is_omap1())
-		return -ENODEV;
-
-	pm = platform_bus_get_pm_ops();
-	if (!pm) {
-		pr_err("%s: unable to get dev_pm_ops from platform_bus\n",
-			__func__);
-		return -ENODEV;
-	}
-
-	omap_pm = kmemdup(pm, sizeof(struct dev_pm_ops), GFP_KERNEL);
-	if (!omap_pm) {
-		pr_err("%s: unable to alloc memory for new dev_pm_ops\n",
-			__func__);
-		return -ENOMEM;
-	}
-
-	omap_pm->runtime_suspend = omap1_pm_runtime_suspend;
-	omap_pm->runtime_resume = omap1_pm_runtime_resume;
-
-	platform_bus_set_pm_ops(omap_pm);
-
-	return 0;
-}
-core_initcall(omap1_pm_runtime_init);
-#endif /* CONFIG_PM_RUNTIME */
-- 
1.7.4

^ permalink raw reply related	[flat|nested] 66+ messages in thread

* [PATCH/RFC 3/6] OMAP1: runtime PM: drop platform bus implementation
@ 2011-04-07  0:02   ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel

Current runtime PM implementation on OMAP1 is is based on a deprecated
interface: platform_bus_set_pm_ops().  Subsequent patch will convert
OMAP1 runtime PM to an implementation shared with SH-mobile, and based
on the new device power domain infrastructure in the common PM core.

Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap1/Makefile |    2 +-
 arch/arm/mach-omap1/pm_bus.c |  100 ------------------------------------------
 2 files changed, 1 insertions(+), 101 deletions(-)
 delete mode 100644 arch/arm/mach-omap1/pm_bus.c

diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index af98117..1913c2d 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -11,7 +11,7 @@ obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
 obj-$(CONFIG_OMAP_32K_TIMER)	+= timer32k.o
 
 # Power Management
-obj-$(CONFIG_PM) += pm.o sleep.o pm_bus.o
+obj-$(CONFIG_PM) += pm.o sleep.o
 
 # DSP
 obj-$(CONFIG_OMAP_MBOX_FWK)	+= mailbox_mach.o
diff --git a/arch/arm/mach-omap1/pm_bus.c b/arch/arm/mach-omap1/pm_bus.c
deleted file mode 100644
index 6588c22..0000000
--- a/arch/arm/mach-omap1/pm_bus.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Runtime PM support code for OMAP1
- *
- * Author: Kevin Hilman, Deep Root Systems, LLC
- *
- * Copyright (C) 2010 Texas Instruments, Inc.
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/io.h>
-#include <linux/pm_runtime.h>
-#include <linux/platform_device.h>
-#include <linux/mutex.h>
-#include <linux/clk.h>
-#include <linux/err.h>
-
-#include <plat/omap_device.h>
-#include <plat/omap-pm.h>
-
-#ifdef CONFIG_PM_RUNTIME
-static int omap1_pm_runtime_suspend(struct device *dev)
-{
-	struct clk *iclk, *fclk;
-	int ret = 0;
-
-	dev_dbg(dev, "%s\n", __func__);
-
-	ret = pm_generic_runtime_suspend(dev);
-
-	fclk = clk_get(dev, "fck");
-	if (!IS_ERR(fclk)) {
-		clk_disable(fclk);
-		clk_put(fclk);
-	}
-
-	iclk = clk_get(dev, "ick");
-	if (!IS_ERR(iclk)) {
-		clk_disable(iclk);
-		clk_put(iclk);
-	}
-
-	return 0;
-};
-
-static int omap1_pm_runtime_resume(struct device *dev)
-{
-	struct clk *iclk, *fclk;
-
-	dev_dbg(dev, "%s\n", __func__);
-
-	iclk = clk_get(dev, "ick");
-	if (!IS_ERR(iclk)) {
-		clk_enable(iclk);
-		clk_put(iclk);
-	}
-
-	fclk = clk_get(dev, "fck");
-	if (!IS_ERR(fclk)) {
-		clk_enable(fclk);
-		clk_put(fclk);
-	}
-
-	return pm_generic_runtime_resume(dev);
-};
-
-static int __init omap1_pm_runtime_init(void)
-{
-	const struct dev_pm_ops *pm;
-	struct dev_pm_ops *omap_pm;
-
-	if (!cpu_class_is_omap1())
-		return -ENODEV;
-
-	pm = platform_bus_get_pm_ops();
-	if (!pm) {
-		pr_err("%s: unable to get dev_pm_ops from platform_bus\n",
-			__func__);
-		return -ENODEV;
-	}
-
-	omap_pm = kmemdup(pm, sizeof(struct dev_pm_ops), GFP_KERNEL);
-	if (!omap_pm) {
-		pr_err("%s: unable to alloc memory for new dev_pm_ops\n",
-			__func__);
-		return -ENOMEM;
-	}
-
-	omap_pm->runtime_suspend = omap1_pm_runtime_suspend;
-	omap_pm->runtime_resume = omap1_pm_runtime_resume;
-
-	platform_bus_set_pm_ops(omap_pm);
-
-	return 0;
-}
-core_initcall(omap1_pm_runtime_init);
-#endif /* CONFIG_PM_RUNTIME */
-- 
1.7.4

^ permalink raw reply related	[flat|nested] 66+ messages in thread

* [PATCH/RFC 4/6] ARM: move SH-mobile runtime PM to arm/common for sharing with other platforms
  2011-04-07  0:02 ` Kevin Hilman
  (?)
@ 2011-04-07  0:02   ` Kevin Hilman
  -1 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel

There is really nothing SH-mobile specific about this runtime PM
implementation.  Any platform wanting to implement runtime PM based on
simple clock gating can use this implementation.

Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/common/Makefile            |    1 +
 arch/arm/common/pm_runtime_clock.c  |  176 ++++++++++++++++++++++++++++++++++
 arch/arm/include/asm/pm_runtime.h   |   17 ++++
 arch/arm/mach-shmobile/pm_runtime.c |  179 -----------------------------------
 4 files changed, 194 insertions(+), 179 deletions(-)
 create mode 100644 arch/arm/common/pm_runtime_clock.c
 create mode 100644 arch/arm/include/asm/pm_runtime.h
 delete mode 100644 arch/arm/mach-shmobile/pm_runtime.c

diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index e7521bca..efa79c7 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -18,3 +18,4 @@ obj-$(CONFIG_ARCH_IXP23XX)	+= uengine.o
 obj-$(CONFIG_PCI_HOST_ITE8152)  += it8152.o
 obj-$(CONFIG_COMMON_CLKDEV)	+= clkdev.o
 obj-$(CONFIG_ARM_TIMER_SP804)	+= timer-sp.o
+obj-$(CONFIG_PM_RUNTIME)	+= pm_runtime_clock.o
diff --git a/arch/arm/common/pm_runtime_clock.c b/arch/arm/common/pm_runtime_clock.c
new file mode 100644
index 0000000..453fc95
--- /dev/null
+++ b/arch/arm/common/pm_runtime_clock.c
@@ -0,0 +1,176 @@
+/*
+ * Generic Runtime PM support code for managing device clocks
+ *
+ *  Copyright (C) 2009-2010 Magnus Damm
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/io.h>
+#include <linux/pm_runtime.h>
+#include <linux/platform_device.h>
+#include <linux/clk.h>
+#include <linux/bitmap.h>
+#include <linux/err.h>
+
+#ifdef CONFIG_PM_RUNTIME
+#define BIT_ONCE 0
+#define BIT_ACTIVE 1
+#define BIT_CLK_ENABLED 2
+
+struct pm_runtime_data {
+	unsigned long flags;
+	struct clk *clk;
+};
+
+static void __devres_release(struct device *dev, void *res)
+{
+	struct pm_runtime_data *prd = res;
+
+	dev_dbg(dev, "__devres_release()\n");
+
+	if (test_bit(BIT_CLK_ENABLED, &prd->flags))
+		clk_disable(prd->clk);
+
+	if (test_bit(BIT_ACTIVE, &prd->flags))
+		clk_put(prd->clk);
+}
+
+static struct pm_runtime_data *__to_prd(struct device *dev)
+{
+	return devres_find(dev, __devres_release, NULL, NULL);
+}
+
+static void platform_pm_runtime_init(struct device *dev,
+				     struct pm_runtime_data *prd)
+{
+	if (prd && !test_and_set_bit(BIT_ONCE, &prd->flags)) {
+		prd->clk = clk_get(dev, NULL);
+		if (!IS_ERR(prd->clk)) {
+			set_bit(BIT_ACTIVE, &prd->flags);
+			dev_info(dev, "clocks managed by runtime pm\n");
+		}
+	}
+}
+
+static void platform_pm_runtime_bug(struct device *dev,
+				    struct pm_runtime_data *prd)
+{
+	if (prd && !test_and_set_bit(BIT_ONCE, &prd->flags))
+		dev_err(dev, "runtime pm suspend before resume\n");
+}
+
+static int platform_pm_runtime_suspend(struct device *dev)
+{
+	struct pm_runtime_data *prd = __to_prd(dev);
+
+	dev_dbg(dev, "platform_pm_runtime_suspend()\n");
+
+	platform_pm_runtime_bug(dev, prd);
+
+	if (prd && test_bit(BIT_ACTIVE, &prd->flags)) {
+		clk_disable(prd->clk);
+		clear_bit(BIT_CLK_ENABLED, &prd->flags);
+	}
+
+	return 0;
+}
+
+static int platform_pm_runtime_resume(struct device *dev)
+{
+	struct pm_runtime_data *prd = __to_prd(dev);
+
+	dev_dbg(dev, "platform_pm_runtime_resume()\n");
+
+	platform_pm_runtime_init(dev, prd);
+
+	if (prd && test_bit(BIT_ACTIVE, &prd->flags)) {
+		clk_enable(prd->clk);
+		set_bit(BIT_CLK_ENABLED, &prd->flags);
+	}
+
+	return 0;
+}
+
+static int platform_pm_runtime_idle(struct device *dev)
+{
+	/* suspend synchronously to disable clocks immediately */
+	return pm_runtime_suspend(dev);
+}
+
+static struct dev_power_domain platform_pm_power_domain = {
+	.ops = {
+		.runtime_suspend = platform_pm_runtime_suspend,
+		.runtime_resume = platform_pm_runtime_resume,
+		.runtime_idle = platform_pm_runtime_idle,
+	},
+};
+
+static int platform_bus_notify(struct notifier_block *nb,
+			       unsigned long action, void *data)
+{
+	struct device *dev = data;
+	struct pm_runtime_data *prd;
+
+	dev_dbg(dev, "platform_bus_notify() %ld !\n", action);
+
+	if (action = BUS_NOTIFY_BIND_DRIVER) {
+		prd = devres_alloc(__devres_release, sizeof(*prd), GFP_KERNEL);
+		if (prd) {
+			devres_add(dev, prd);
+			dev->pwr_domain = &platform_pm_power_domain;
+		} else {
+			dev_err(dev, "unable to alloc memory for runtime pm\n");
+		}
+	}
+
+	return 0;
+}
+
+#else /* CONFIG_PM_RUNTIME */
+
+static int platform_bus_notify(struct notifier_block *nb,
+			       unsigned long action, void *data)
+{
+	struct device *dev = data;
+	struct clk *clk;
+
+	dev_dbg(dev, "platform_bus_notify() %ld !\n", action);
+
+	switch (action) {
+	case BUS_NOTIFY_BIND_DRIVER:
+		clk = clk_get(dev, NULL);
+		if (!IS_ERR(clk)) {
+			clk_enable(clk);
+			clk_put(clk);
+			dev_info(dev, "runtime pm disabled, clock forced on\n");
+		}
+		break;
+	case BUS_NOTIFY_UNBOUND_DRIVER:
+		clk = clk_get(dev, NULL);
+		if (!IS_ERR(clk)) {
+			clk_disable(clk);
+			clk_put(clk);
+			dev_info(dev, "runtime pm disabled, clock forced off\n");
+		}
+		break;
+	}
+
+	return 0;
+}
+
+#endif /* CONFIG_PM_RUNTIME */
+
+static struct notifier_block platform_bus_notifier = {
+	.notifier_call = platform_bus_notify
+};
+
+int __init pm_runtime_clock_init(void)
+{
+	bus_register_notifier(&platform_bus_type, &platform_bus_notifier);
+	return 0;
+}
diff --git a/arch/arm/include/asm/pm_runtime.h b/arch/arm/include/asm/pm_runtime.h
new file mode 100644
index 0000000..0c54b07
--- /dev/null
+++ b/arch/arm/include/asm/pm_runtime.h
@@ -0,0 +1,17 @@
+/*
+ * ARM common runtime PM definitions/prototypes
+ *
+ * Author: Kevin Hilman
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+#ifndef __ASM_PM_RUNTIME_H__
+#define __ASM_PM_RUNTIME_H__
+
+int __init pm_runtime_clock_init(void);
+
+#endif /* __ASM_PM_RUNTIME_H__ */
diff --git a/arch/arm/mach-shmobile/pm_runtime.c b/arch/arm/mach-shmobile/pm_runtime.c
deleted file mode 100644
index 6c75c3f..0000000
--- a/arch/arm/mach-shmobile/pm_runtime.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * arch/arm/mach-shmobile/pm_runtime.c
- *
- * Runtime PM support code for SuperH Mobile ARM
- *
- *  Copyright (C) 2009-2010 Magnus Damm
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/io.h>
-#include <linux/pm_runtime.h>
-#include <linux/platform_device.h>
-#include <linux/clk.h>
-#include <linux/sh_clk.h>
-#include <linux/bitmap.h>
-
-#ifdef CONFIG_PM_RUNTIME
-#define BIT_ONCE 0
-#define BIT_ACTIVE 1
-#define BIT_CLK_ENABLED 2
-
-struct pm_runtime_data {
-	unsigned long flags;
-	struct clk *clk;
-};
-
-static void __devres_release(struct device *dev, void *res)
-{
-	struct pm_runtime_data *prd = res;
-
-	dev_dbg(dev, "__devres_release()\n");
-
-	if (test_bit(BIT_CLK_ENABLED, &prd->flags))
-		clk_disable(prd->clk);
-
-	if (test_bit(BIT_ACTIVE, &prd->flags))
-		clk_put(prd->clk);
-}
-
-static struct pm_runtime_data *__to_prd(struct device *dev)
-{
-	return devres_find(dev, __devres_release, NULL, NULL);
-}
-
-static void platform_pm_runtime_init(struct device *dev,
-				     struct pm_runtime_data *prd)
-{
-	if (prd && !test_and_set_bit(BIT_ONCE, &prd->flags)) {
-		prd->clk = clk_get(dev, NULL);
-		if (!IS_ERR(prd->clk)) {
-			set_bit(BIT_ACTIVE, &prd->flags);
-			dev_info(dev, "clocks managed by runtime pm\n");
-		}
-	}
-}
-
-static void platform_pm_runtime_bug(struct device *dev,
-				    struct pm_runtime_data *prd)
-{
-	if (prd && !test_and_set_bit(BIT_ONCE, &prd->flags))
-		dev_err(dev, "runtime pm suspend before resume\n");
-}
-
-static int platform_pm_runtime_suspend(struct device *dev)
-{
-	struct pm_runtime_data *prd = __to_prd(dev);
-
-	dev_dbg(dev, "platform_pm_runtime_suspend()\n");
-
-	platform_pm_runtime_bug(dev, prd);
-
-	if (prd && test_bit(BIT_ACTIVE, &prd->flags)) {
-		clk_disable(prd->clk);
-		clear_bit(BIT_CLK_ENABLED, &prd->flags);
-	}
-
-	return 0;
-}
-
-static int platform_pm_runtime_resume(struct device *dev)
-{
-	struct pm_runtime_data *prd = __to_prd(dev);
-
-	dev_dbg(dev, "platform_pm_runtime_resume()\n");
-
-	platform_pm_runtime_init(dev, prd);
-
-	if (prd && test_bit(BIT_ACTIVE, &prd->flags)) {
-		clk_enable(prd->clk);
-		set_bit(BIT_CLK_ENABLED, &prd->flags);
-	}
-
-	return 0;
-}
-
-static int platform_pm_runtime_idle(struct device *dev)
-{
-	/* suspend synchronously to disable clocks immediately */
-	return pm_runtime_suspend(dev);
-}
-
-static struct dev_power_domain platform_pm_power_domain = {
-	.ops = {
-		.runtime_suspend = platform_pm_runtime_suspend,
-		.runtime_resume = platform_pm_runtime_resume,
-		.runtime_idle = platform_pm_runtime_idle,
-	},
-};
-
-static int platform_bus_notify(struct notifier_block *nb,
-			       unsigned long action, void *data)
-{
-	struct device *dev = data;
-	struct pm_runtime_data *prd;
-
-	dev_dbg(dev, "platform_bus_notify() %ld !\n", action);
-
-	if (action = BUS_NOTIFY_BIND_DRIVER) {
-		prd = devres_alloc(__devres_release, sizeof(*prd), GFP_KERNEL);
-		if (prd) {
-			devres_add(dev, prd);
-			dev->pwr_domain = &platform_pm_power_domain;
-		} else {
-			dev_err(dev, "unable to alloc memory for runtime pm\n");
-		}
-	}
-
-	return 0;
-}
-
-#else /* CONFIG_PM_RUNTIME */
-
-static int platform_bus_notify(struct notifier_block *nb,
-			       unsigned long action, void *data)
-{
-	struct device *dev = data;
-	struct clk *clk;
-
-	dev_dbg(dev, "platform_bus_notify() %ld !\n", action);
-
-	switch (action) {
-	case BUS_NOTIFY_BIND_DRIVER:
-		clk = clk_get(dev, NULL);
-		if (!IS_ERR(clk)) {
-			clk_enable(clk);
-			clk_put(clk);
-			dev_info(dev, "runtime pm disabled, clock forced on\n");
-		}
-		break;
-	case BUS_NOTIFY_UNBOUND_DRIVER:
-		clk = clk_get(dev, NULL);
-		if (!IS_ERR(clk)) {
-			clk_disable(clk);
-			clk_put(clk);
-			dev_info(dev, "runtime pm disabled, clock forced off\n");
-		}
-		break;
-	}
-
-	return 0;
-}
-
-#endif /* CONFIG_PM_RUNTIME */
-
-static struct notifier_block platform_bus_notifier = {
-	.notifier_call = platform_bus_notify
-};
-
-static int __init sh_pm_runtime_init(void)
-{
-	bus_register_notifier(&platform_bus_type, &platform_bus_notifier);
-	return 0;
-}
-core_initcall(sh_pm_runtime_init);
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 66+ messages in thread

* [PATCH/RFC 4/6] ARM: move SH-mobile runtime PM to arm/common for sharing with other platforms
@ 2011-04-07  0:02   ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel, linux-omap, linux-sh
  Cc: linux-kernel, Magnus Damm, Rafael J. Wysocki, Grant Likely,
	Greg Kroah-Hartman

There is really nothing SH-mobile specific about this runtime PM
implementation.  Any platform wanting to implement runtime PM based on
simple clock gating can use this implementation.

Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/common/Makefile            |    1 +
 arch/arm/common/pm_runtime_clock.c  |  176 ++++++++++++++++++++++++++++++++++
 arch/arm/include/asm/pm_runtime.h   |   17 ++++
 arch/arm/mach-shmobile/pm_runtime.c |  179 -----------------------------------
 4 files changed, 194 insertions(+), 179 deletions(-)
 create mode 100644 arch/arm/common/pm_runtime_clock.c
 create mode 100644 arch/arm/include/asm/pm_runtime.h
 delete mode 100644 arch/arm/mach-shmobile/pm_runtime.c

diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index e7521bca..efa79c7 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -18,3 +18,4 @@ obj-$(CONFIG_ARCH_IXP23XX)	+= uengine.o
 obj-$(CONFIG_PCI_HOST_ITE8152)  += it8152.o
 obj-$(CONFIG_COMMON_CLKDEV)	+= clkdev.o
 obj-$(CONFIG_ARM_TIMER_SP804)	+= timer-sp.o
+obj-$(CONFIG_PM_RUNTIME)	+= pm_runtime_clock.o
diff --git a/arch/arm/common/pm_runtime_clock.c b/arch/arm/common/pm_runtime_clock.c
new file mode 100644
index 0000000..453fc95
--- /dev/null
+++ b/arch/arm/common/pm_runtime_clock.c
@@ -0,0 +1,176 @@
+/*
+ * Generic Runtime PM support code for managing device clocks
+ *
+ *  Copyright (C) 2009-2010 Magnus Damm
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/io.h>
+#include <linux/pm_runtime.h>
+#include <linux/platform_device.h>
+#include <linux/clk.h>
+#include <linux/bitmap.h>
+#include <linux/err.h>
+
+#ifdef CONFIG_PM_RUNTIME
+#define BIT_ONCE 0
+#define BIT_ACTIVE 1
+#define BIT_CLK_ENABLED 2
+
+struct pm_runtime_data {
+	unsigned long flags;
+	struct clk *clk;
+};
+
+static void __devres_release(struct device *dev, void *res)
+{
+	struct pm_runtime_data *prd = res;
+
+	dev_dbg(dev, "__devres_release()\n");
+
+	if (test_bit(BIT_CLK_ENABLED, &prd->flags))
+		clk_disable(prd->clk);
+
+	if (test_bit(BIT_ACTIVE, &prd->flags))
+		clk_put(prd->clk);
+}
+
+static struct pm_runtime_data *__to_prd(struct device *dev)
+{
+	return devres_find(dev, __devres_release, NULL, NULL);
+}
+
+static void platform_pm_runtime_init(struct device *dev,
+				     struct pm_runtime_data *prd)
+{
+	if (prd && !test_and_set_bit(BIT_ONCE, &prd->flags)) {
+		prd->clk = clk_get(dev, NULL);
+		if (!IS_ERR(prd->clk)) {
+			set_bit(BIT_ACTIVE, &prd->flags);
+			dev_info(dev, "clocks managed by runtime pm\n");
+		}
+	}
+}
+
+static void platform_pm_runtime_bug(struct device *dev,
+				    struct pm_runtime_data *prd)
+{
+	if (prd && !test_and_set_bit(BIT_ONCE, &prd->flags))
+		dev_err(dev, "runtime pm suspend before resume\n");
+}
+
+static int platform_pm_runtime_suspend(struct device *dev)
+{
+	struct pm_runtime_data *prd = __to_prd(dev);
+
+	dev_dbg(dev, "platform_pm_runtime_suspend()\n");
+
+	platform_pm_runtime_bug(dev, prd);
+
+	if (prd && test_bit(BIT_ACTIVE, &prd->flags)) {
+		clk_disable(prd->clk);
+		clear_bit(BIT_CLK_ENABLED, &prd->flags);
+	}
+
+	return 0;
+}
+
+static int platform_pm_runtime_resume(struct device *dev)
+{
+	struct pm_runtime_data *prd = __to_prd(dev);
+
+	dev_dbg(dev, "platform_pm_runtime_resume()\n");
+
+	platform_pm_runtime_init(dev, prd);
+
+	if (prd && test_bit(BIT_ACTIVE, &prd->flags)) {
+		clk_enable(prd->clk);
+		set_bit(BIT_CLK_ENABLED, &prd->flags);
+	}
+
+	return 0;
+}
+
+static int platform_pm_runtime_idle(struct device *dev)
+{
+	/* suspend synchronously to disable clocks immediately */
+	return pm_runtime_suspend(dev);
+}
+
+static struct dev_power_domain platform_pm_power_domain = {
+	.ops = {
+		.runtime_suspend = platform_pm_runtime_suspend,
+		.runtime_resume = platform_pm_runtime_resume,
+		.runtime_idle = platform_pm_runtime_idle,
+	},
+};
+
+static int platform_bus_notify(struct notifier_block *nb,
+			       unsigned long action, void *data)
+{
+	struct device *dev = data;
+	struct pm_runtime_data *prd;
+
+	dev_dbg(dev, "platform_bus_notify() %ld !\n", action);
+
+	if (action == BUS_NOTIFY_BIND_DRIVER) {
+		prd = devres_alloc(__devres_release, sizeof(*prd), GFP_KERNEL);
+		if (prd) {
+			devres_add(dev, prd);
+			dev->pwr_domain = &platform_pm_power_domain;
+		} else {
+			dev_err(dev, "unable to alloc memory for runtime pm\n");
+		}
+	}
+
+	return 0;
+}
+
+#else /* CONFIG_PM_RUNTIME */
+
+static int platform_bus_notify(struct notifier_block *nb,
+			       unsigned long action, void *data)
+{
+	struct device *dev = data;
+	struct clk *clk;
+
+	dev_dbg(dev, "platform_bus_notify() %ld !\n", action);
+
+	switch (action) {
+	case BUS_NOTIFY_BIND_DRIVER:
+		clk = clk_get(dev, NULL);
+		if (!IS_ERR(clk)) {
+			clk_enable(clk);
+			clk_put(clk);
+			dev_info(dev, "runtime pm disabled, clock forced on\n");
+		}
+		break;
+	case BUS_NOTIFY_UNBOUND_DRIVER:
+		clk = clk_get(dev, NULL);
+		if (!IS_ERR(clk)) {
+			clk_disable(clk);
+			clk_put(clk);
+			dev_info(dev, "runtime pm disabled, clock forced off\n");
+		}
+		break;
+	}
+
+	return 0;
+}
+
+#endif /* CONFIG_PM_RUNTIME */
+
+static struct notifier_block platform_bus_notifier = {
+	.notifier_call = platform_bus_notify
+};
+
+int __init pm_runtime_clock_init(void)
+{
+	bus_register_notifier(&platform_bus_type, &platform_bus_notifier);
+	return 0;
+}
diff --git a/arch/arm/include/asm/pm_runtime.h b/arch/arm/include/asm/pm_runtime.h
new file mode 100644
index 0000000..0c54b07
--- /dev/null
+++ b/arch/arm/include/asm/pm_runtime.h
@@ -0,0 +1,17 @@
+/*
+ * ARM common runtime PM definitions/prototypes
+ *
+ * Author: Kevin Hilman
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+#ifndef __ASM_PM_RUNTIME_H__
+#define __ASM_PM_RUNTIME_H__
+
+int __init pm_runtime_clock_init(void);
+
+#endif /* __ASM_PM_RUNTIME_H__ */
diff --git a/arch/arm/mach-shmobile/pm_runtime.c b/arch/arm/mach-shmobile/pm_runtime.c
deleted file mode 100644
index 6c75c3f..0000000
--- a/arch/arm/mach-shmobile/pm_runtime.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * arch/arm/mach-shmobile/pm_runtime.c
- *
- * Runtime PM support code for SuperH Mobile ARM
- *
- *  Copyright (C) 2009-2010 Magnus Damm
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/io.h>
-#include <linux/pm_runtime.h>
-#include <linux/platform_device.h>
-#include <linux/clk.h>
-#include <linux/sh_clk.h>
-#include <linux/bitmap.h>
-
-#ifdef CONFIG_PM_RUNTIME
-#define BIT_ONCE 0
-#define BIT_ACTIVE 1
-#define BIT_CLK_ENABLED 2
-
-struct pm_runtime_data {
-	unsigned long flags;
-	struct clk *clk;
-};
-
-static void __devres_release(struct device *dev, void *res)
-{
-	struct pm_runtime_data *prd = res;
-
-	dev_dbg(dev, "__devres_release()\n");
-
-	if (test_bit(BIT_CLK_ENABLED, &prd->flags))
-		clk_disable(prd->clk);
-
-	if (test_bit(BIT_ACTIVE, &prd->flags))
-		clk_put(prd->clk);
-}
-
-static struct pm_runtime_data *__to_prd(struct device *dev)
-{
-	return devres_find(dev, __devres_release, NULL, NULL);
-}
-
-static void platform_pm_runtime_init(struct device *dev,
-				     struct pm_runtime_data *prd)
-{
-	if (prd && !test_and_set_bit(BIT_ONCE, &prd->flags)) {
-		prd->clk = clk_get(dev, NULL);
-		if (!IS_ERR(prd->clk)) {
-			set_bit(BIT_ACTIVE, &prd->flags);
-			dev_info(dev, "clocks managed by runtime pm\n");
-		}
-	}
-}
-
-static void platform_pm_runtime_bug(struct device *dev,
-				    struct pm_runtime_data *prd)
-{
-	if (prd && !test_and_set_bit(BIT_ONCE, &prd->flags))
-		dev_err(dev, "runtime pm suspend before resume\n");
-}
-
-static int platform_pm_runtime_suspend(struct device *dev)
-{
-	struct pm_runtime_data *prd = __to_prd(dev);
-
-	dev_dbg(dev, "platform_pm_runtime_suspend()\n");
-
-	platform_pm_runtime_bug(dev, prd);
-
-	if (prd && test_bit(BIT_ACTIVE, &prd->flags)) {
-		clk_disable(prd->clk);
-		clear_bit(BIT_CLK_ENABLED, &prd->flags);
-	}
-
-	return 0;
-}
-
-static int platform_pm_runtime_resume(struct device *dev)
-{
-	struct pm_runtime_data *prd = __to_prd(dev);
-
-	dev_dbg(dev, "platform_pm_runtime_resume()\n");
-
-	platform_pm_runtime_init(dev, prd);
-
-	if (prd && test_bit(BIT_ACTIVE, &prd->flags)) {
-		clk_enable(prd->clk);
-		set_bit(BIT_CLK_ENABLED, &prd->flags);
-	}
-
-	return 0;
-}
-
-static int platform_pm_runtime_idle(struct device *dev)
-{
-	/* suspend synchronously to disable clocks immediately */
-	return pm_runtime_suspend(dev);
-}
-
-static struct dev_power_domain platform_pm_power_domain = {
-	.ops = {
-		.runtime_suspend = platform_pm_runtime_suspend,
-		.runtime_resume = platform_pm_runtime_resume,
-		.runtime_idle = platform_pm_runtime_idle,
-	},
-};
-
-static int platform_bus_notify(struct notifier_block *nb,
-			       unsigned long action, void *data)
-{
-	struct device *dev = data;
-	struct pm_runtime_data *prd;
-
-	dev_dbg(dev, "platform_bus_notify() %ld !\n", action);
-
-	if (action == BUS_NOTIFY_BIND_DRIVER) {
-		prd = devres_alloc(__devres_release, sizeof(*prd), GFP_KERNEL);
-		if (prd) {
-			devres_add(dev, prd);
-			dev->pwr_domain = &platform_pm_power_domain;
-		} else {
-			dev_err(dev, "unable to alloc memory for runtime pm\n");
-		}
-	}
-
-	return 0;
-}
-
-#else /* CONFIG_PM_RUNTIME */
-
-static int platform_bus_notify(struct notifier_block *nb,
-			       unsigned long action, void *data)
-{
-	struct device *dev = data;
-	struct clk *clk;
-
-	dev_dbg(dev, "platform_bus_notify() %ld !\n", action);
-
-	switch (action) {
-	case BUS_NOTIFY_BIND_DRIVER:
-		clk = clk_get(dev, NULL);
-		if (!IS_ERR(clk)) {
-			clk_enable(clk);
-			clk_put(clk);
-			dev_info(dev, "runtime pm disabled, clock forced on\n");
-		}
-		break;
-	case BUS_NOTIFY_UNBOUND_DRIVER:
-		clk = clk_get(dev, NULL);
-		if (!IS_ERR(clk)) {
-			clk_disable(clk);
-			clk_put(clk);
-			dev_info(dev, "runtime pm disabled, clock forced off\n");
-		}
-		break;
-	}
-
-	return 0;
-}
-
-#endif /* CONFIG_PM_RUNTIME */
-
-static struct notifier_block platform_bus_notifier = {
-	.notifier_call = platform_bus_notify
-};
-
-static int __init sh_pm_runtime_init(void)
-{
-	bus_register_notifier(&platform_bus_type, &platform_bus_notifier);
-	return 0;
-}
-core_initcall(sh_pm_runtime_init);
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 66+ messages in thread

* [PATCH/RFC 4/6] ARM: move SH-mobile runtime PM to arm/common for sharing with other platforms
@ 2011-04-07  0:02   ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel

There is really nothing SH-mobile specific about this runtime PM
implementation.  Any platform wanting to implement runtime PM based on
simple clock gating can use this implementation.

Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/common/Makefile            |    1 +
 arch/arm/common/pm_runtime_clock.c  |  176 ++++++++++++++++++++++++++++++++++
 arch/arm/include/asm/pm_runtime.h   |   17 ++++
 arch/arm/mach-shmobile/pm_runtime.c |  179 -----------------------------------
 4 files changed, 194 insertions(+), 179 deletions(-)
 create mode 100644 arch/arm/common/pm_runtime_clock.c
 create mode 100644 arch/arm/include/asm/pm_runtime.h
 delete mode 100644 arch/arm/mach-shmobile/pm_runtime.c

diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index e7521bca..efa79c7 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -18,3 +18,4 @@ obj-$(CONFIG_ARCH_IXP23XX)	+= uengine.o
 obj-$(CONFIG_PCI_HOST_ITE8152)  += it8152.o
 obj-$(CONFIG_COMMON_CLKDEV)	+= clkdev.o
 obj-$(CONFIG_ARM_TIMER_SP804)	+= timer-sp.o
+obj-$(CONFIG_PM_RUNTIME)	+= pm_runtime_clock.o
diff --git a/arch/arm/common/pm_runtime_clock.c b/arch/arm/common/pm_runtime_clock.c
new file mode 100644
index 0000000..453fc95
--- /dev/null
+++ b/arch/arm/common/pm_runtime_clock.c
@@ -0,0 +1,176 @@
+/*
+ * Generic Runtime PM support code for managing device clocks
+ *
+ *  Copyright (C) 2009-2010 Magnus Damm
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/io.h>
+#include <linux/pm_runtime.h>
+#include <linux/platform_device.h>
+#include <linux/clk.h>
+#include <linux/bitmap.h>
+#include <linux/err.h>
+
+#ifdef CONFIG_PM_RUNTIME
+#define BIT_ONCE 0
+#define BIT_ACTIVE 1
+#define BIT_CLK_ENABLED 2
+
+struct pm_runtime_data {
+	unsigned long flags;
+	struct clk *clk;
+};
+
+static void __devres_release(struct device *dev, void *res)
+{
+	struct pm_runtime_data *prd = res;
+
+	dev_dbg(dev, "__devres_release()\n");
+
+	if (test_bit(BIT_CLK_ENABLED, &prd->flags))
+		clk_disable(prd->clk);
+
+	if (test_bit(BIT_ACTIVE, &prd->flags))
+		clk_put(prd->clk);
+}
+
+static struct pm_runtime_data *__to_prd(struct device *dev)
+{
+	return devres_find(dev, __devres_release, NULL, NULL);
+}
+
+static void platform_pm_runtime_init(struct device *dev,
+				     struct pm_runtime_data *prd)
+{
+	if (prd && !test_and_set_bit(BIT_ONCE, &prd->flags)) {
+		prd->clk = clk_get(dev, NULL);
+		if (!IS_ERR(prd->clk)) {
+			set_bit(BIT_ACTIVE, &prd->flags);
+			dev_info(dev, "clocks managed by runtime pm\n");
+		}
+	}
+}
+
+static void platform_pm_runtime_bug(struct device *dev,
+				    struct pm_runtime_data *prd)
+{
+	if (prd && !test_and_set_bit(BIT_ONCE, &prd->flags))
+		dev_err(dev, "runtime pm suspend before resume\n");
+}
+
+static int platform_pm_runtime_suspend(struct device *dev)
+{
+	struct pm_runtime_data *prd = __to_prd(dev);
+
+	dev_dbg(dev, "platform_pm_runtime_suspend()\n");
+
+	platform_pm_runtime_bug(dev, prd);
+
+	if (prd && test_bit(BIT_ACTIVE, &prd->flags)) {
+		clk_disable(prd->clk);
+		clear_bit(BIT_CLK_ENABLED, &prd->flags);
+	}
+
+	return 0;
+}
+
+static int platform_pm_runtime_resume(struct device *dev)
+{
+	struct pm_runtime_data *prd = __to_prd(dev);
+
+	dev_dbg(dev, "platform_pm_runtime_resume()\n");
+
+	platform_pm_runtime_init(dev, prd);
+
+	if (prd && test_bit(BIT_ACTIVE, &prd->flags)) {
+		clk_enable(prd->clk);
+		set_bit(BIT_CLK_ENABLED, &prd->flags);
+	}
+
+	return 0;
+}
+
+static int platform_pm_runtime_idle(struct device *dev)
+{
+	/* suspend synchronously to disable clocks immediately */
+	return pm_runtime_suspend(dev);
+}
+
+static struct dev_power_domain platform_pm_power_domain = {
+	.ops = {
+		.runtime_suspend = platform_pm_runtime_suspend,
+		.runtime_resume = platform_pm_runtime_resume,
+		.runtime_idle = platform_pm_runtime_idle,
+	},
+};
+
+static int platform_bus_notify(struct notifier_block *nb,
+			       unsigned long action, void *data)
+{
+	struct device *dev = data;
+	struct pm_runtime_data *prd;
+
+	dev_dbg(dev, "platform_bus_notify() %ld !\n", action);
+
+	if (action == BUS_NOTIFY_BIND_DRIVER) {
+		prd = devres_alloc(__devres_release, sizeof(*prd), GFP_KERNEL);
+		if (prd) {
+			devres_add(dev, prd);
+			dev->pwr_domain = &platform_pm_power_domain;
+		} else {
+			dev_err(dev, "unable to alloc memory for runtime pm\n");
+		}
+	}
+
+	return 0;
+}
+
+#else /* CONFIG_PM_RUNTIME */
+
+static int platform_bus_notify(struct notifier_block *nb,
+			       unsigned long action, void *data)
+{
+	struct device *dev = data;
+	struct clk *clk;
+
+	dev_dbg(dev, "platform_bus_notify() %ld !\n", action);
+
+	switch (action) {
+	case BUS_NOTIFY_BIND_DRIVER:
+		clk = clk_get(dev, NULL);
+		if (!IS_ERR(clk)) {
+			clk_enable(clk);
+			clk_put(clk);
+			dev_info(dev, "runtime pm disabled, clock forced on\n");
+		}
+		break;
+	case BUS_NOTIFY_UNBOUND_DRIVER:
+		clk = clk_get(dev, NULL);
+		if (!IS_ERR(clk)) {
+			clk_disable(clk);
+			clk_put(clk);
+			dev_info(dev, "runtime pm disabled, clock forced off\n");
+		}
+		break;
+	}
+
+	return 0;
+}
+
+#endif /* CONFIG_PM_RUNTIME */
+
+static struct notifier_block platform_bus_notifier = {
+	.notifier_call = platform_bus_notify
+};
+
+int __init pm_runtime_clock_init(void)
+{
+	bus_register_notifier(&platform_bus_type, &platform_bus_notifier);
+	return 0;
+}
diff --git a/arch/arm/include/asm/pm_runtime.h b/arch/arm/include/asm/pm_runtime.h
new file mode 100644
index 0000000..0c54b07
--- /dev/null
+++ b/arch/arm/include/asm/pm_runtime.h
@@ -0,0 +1,17 @@
+/*
+ * ARM common runtime PM definitions/prototypes
+ *
+ * Author: Kevin Hilman
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+#ifndef __ASM_PM_RUNTIME_H__
+#define __ASM_PM_RUNTIME_H__
+
+int __init pm_runtime_clock_init(void);
+
+#endif /* __ASM_PM_RUNTIME_H__ */
diff --git a/arch/arm/mach-shmobile/pm_runtime.c b/arch/arm/mach-shmobile/pm_runtime.c
deleted file mode 100644
index 6c75c3f..0000000
--- a/arch/arm/mach-shmobile/pm_runtime.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * arch/arm/mach-shmobile/pm_runtime.c
- *
- * Runtime PM support code for SuperH Mobile ARM
- *
- *  Copyright (C) 2009-2010 Magnus Damm
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/io.h>
-#include <linux/pm_runtime.h>
-#include <linux/platform_device.h>
-#include <linux/clk.h>
-#include <linux/sh_clk.h>
-#include <linux/bitmap.h>
-
-#ifdef CONFIG_PM_RUNTIME
-#define BIT_ONCE 0
-#define BIT_ACTIVE 1
-#define BIT_CLK_ENABLED 2
-
-struct pm_runtime_data {
-	unsigned long flags;
-	struct clk *clk;
-};
-
-static void __devres_release(struct device *dev, void *res)
-{
-	struct pm_runtime_data *prd = res;
-
-	dev_dbg(dev, "__devres_release()\n");
-
-	if (test_bit(BIT_CLK_ENABLED, &prd->flags))
-		clk_disable(prd->clk);
-
-	if (test_bit(BIT_ACTIVE, &prd->flags))
-		clk_put(prd->clk);
-}
-
-static struct pm_runtime_data *__to_prd(struct device *dev)
-{
-	return devres_find(dev, __devres_release, NULL, NULL);
-}
-
-static void platform_pm_runtime_init(struct device *dev,
-				     struct pm_runtime_data *prd)
-{
-	if (prd && !test_and_set_bit(BIT_ONCE, &prd->flags)) {
-		prd->clk = clk_get(dev, NULL);
-		if (!IS_ERR(prd->clk)) {
-			set_bit(BIT_ACTIVE, &prd->flags);
-			dev_info(dev, "clocks managed by runtime pm\n");
-		}
-	}
-}
-
-static void platform_pm_runtime_bug(struct device *dev,
-				    struct pm_runtime_data *prd)
-{
-	if (prd && !test_and_set_bit(BIT_ONCE, &prd->flags))
-		dev_err(dev, "runtime pm suspend before resume\n");
-}
-
-static int platform_pm_runtime_suspend(struct device *dev)
-{
-	struct pm_runtime_data *prd = __to_prd(dev);
-
-	dev_dbg(dev, "platform_pm_runtime_suspend()\n");
-
-	platform_pm_runtime_bug(dev, prd);
-
-	if (prd && test_bit(BIT_ACTIVE, &prd->flags)) {
-		clk_disable(prd->clk);
-		clear_bit(BIT_CLK_ENABLED, &prd->flags);
-	}
-
-	return 0;
-}
-
-static int platform_pm_runtime_resume(struct device *dev)
-{
-	struct pm_runtime_data *prd = __to_prd(dev);
-
-	dev_dbg(dev, "platform_pm_runtime_resume()\n");
-
-	platform_pm_runtime_init(dev, prd);
-
-	if (prd && test_bit(BIT_ACTIVE, &prd->flags)) {
-		clk_enable(prd->clk);
-		set_bit(BIT_CLK_ENABLED, &prd->flags);
-	}
-
-	return 0;
-}
-
-static int platform_pm_runtime_idle(struct device *dev)
-{
-	/* suspend synchronously to disable clocks immediately */
-	return pm_runtime_suspend(dev);
-}
-
-static struct dev_power_domain platform_pm_power_domain = {
-	.ops = {
-		.runtime_suspend = platform_pm_runtime_suspend,
-		.runtime_resume = platform_pm_runtime_resume,
-		.runtime_idle = platform_pm_runtime_idle,
-	},
-};
-
-static int platform_bus_notify(struct notifier_block *nb,
-			       unsigned long action, void *data)
-{
-	struct device *dev = data;
-	struct pm_runtime_data *prd;
-
-	dev_dbg(dev, "platform_bus_notify() %ld !\n", action);
-
-	if (action == BUS_NOTIFY_BIND_DRIVER) {
-		prd = devres_alloc(__devres_release, sizeof(*prd), GFP_KERNEL);
-		if (prd) {
-			devres_add(dev, prd);
-			dev->pwr_domain = &platform_pm_power_domain;
-		} else {
-			dev_err(dev, "unable to alloc memory for runtime pm\n");
-		}
-	}
-
-	return 0;
-}
-
-#else /* CONFIG_PM_RUNTIME */
-
-static int platform_bus_notify(struct notifier_block *nb,
-			       unsigned long action, void *data)
-{
-	struct device *dev = data;
-	struct clk *clk;
-
-	dev_dbg(dev, "platform_bus_notify() %ld !\n", action);
-
-	switch (action) {
-	case BUS_NOTIFY_BIND_DRIVER:
-		clk = clk_get(dev, NULL);
-		if (!IS_ERR(clk)) {
-			clk_enable(clk);
-			clk_put(clk);
-			dev_info(dev, "runtime pm disabled, clock forced on\n");
-		}
-		break;
-	case BUS_NOTIFY_UNBOUND_DRIVER:
-		clk = clk_get(dev, NULL);
-		if (!IS_ERR(clk)) {
-			clk_disable(clk);
-			clk_put(clk);
-			dev_info(dev, "runtime pm disabled, clock forced off\n");
-		}
-		break;
-	}
-
-	return 0;
-}
-
-#endif /* CONFIG_PM_RUNTIME */
-
-static struct notifier_block platform_bus_notifier = {
-	.notifier_call = platform_bus_notify
-};
-
-static int __init sh_pm_runtime_init(void)
-{
-	bus_register_notifier(&platform_bus_type, &platform_bus_notifier);
-	return 0;
-}
-core_initcall(sh_pm_runtime_init);
-- 
1.7.4

^ permalink raw reply related	[flat|nested] 66+ messages in thread

* [PATCH/RFC 5/6] ARM: use common clock-based runtime PM implementation on SH-mobile & OMAP1
  2011-04-07  0:02 ` Kevin Hilman
  (?)
@ 2011-04-07  0:02   ` Kevin Hilman
  -1 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap1/Makefile        |    2 +-
 arch/arm/mach-omap1/pm_runtime.c    |   18 ++++++++++++++++++
 arch/arm/mach-shmobile/pm_runtime.c |   23 +++++++++++++++++++++++
 3 files changed, 42 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-omap1/pm_runtime.c
 create mode 100644 arch/arm/mach-shmobile/pm_runtime.c

diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index 1913c2d..04c60f9 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -11,7 +11,7 @@ obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
 obj-$(CONFIG_OMAP_32K_TIMER)	+= timer32k.o
 
 # Power Management
-obj-$(CONFIG_PM) += pm.o sleep.o
+obj-$(CONFIG_PM) += pm.o sleep.o pm_runtime.o
 
 # DSP
 obj-$(CONFIG_OMAP_MBOX_FWK)	+= mailbox_mach.o
diff --git a/arch/arm/mach-omap1/pm_runtime.c b/arch/arm/mach-omap1/pm_runtime.c
new file mode 100644
index 0000000..bbceb64
--- /dev/null
+++ b/arch/arm/mach-omap1/pm_runtime.c
@@ -0,0 +1,18 @@
+/*
+ * Runtime PM support code for TI OMAP1
+ *
+ *  Copyright (C) 2011 Texas Instruments, Inc.
+ *  Author: Kevin Hilman <khilman@ti.com>
+ *
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+#include <asm/pm_runtime.h>
+
+static int __init omap1_pm_runtime_init(void)
+{
+	pm_runtime_clock_init();
+	return 0;
+}
+core_initcall(omap1_pm_runtime_init);
diff --git a/arch/arm/mach-shmobile/pm_runtime.c b/arch/arm/mach-shmobile/pm_runtime.c
new file mode 100644
index 0000000..edc0fa5
--- /dev/null
+++ b/arch/arm/mach-shmobile/pm_runtime.c
@@ -0,0 +1,23 @@
+/*
+ * arch/arm/mach-shmobile/pm_runtime.c
+ *
+ * Runtime PM support code for SuperH Mobile ARM
+ *
+ *  Copyright (C) 2009-2010 Magnus Damm
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+#include <asm/pm_runtime.h>
+
+static int __init sh_pm_runtime_init(void)
+{
+	pm_runtime_clock_init();
+	return 0;
+}
+core_initcall(sh_pm_runtime_init);
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 66+ messages in thread

* [PATCH/RFC 5/6] ARM: use common clock-based runtime PM implementation on SH-mobile & OMAP1
@ 2011-04-07  0:02   ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel, linux-omap, linux-sh
  Cc: linux-kernel, Magnus Damm, Rafael J. Wysocki, Grant Likely,
	Greg Kroah-Hartman

Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap1/Makefile        |    2 +-
 arch/arm/mach-omap1/pm_runtime.c    |   18 ++++++++++++++++++
 arch/arm/mach-shmobile/pm_runtime.c |   23 +++++++++++++++++++++++
 3 files changed, 42 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-omap1/pm_runtime.c
 create mode 100644 arch/arm/mach-shmobile/pm_runtime.c

diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index 1913c2d..04c60f9 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -11,7 +11,7 @@ obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
 obj-$(CONFIG_OMAP_32K_TIMER)	+= timer32k.o
 
 # Power Management
-obj-$(CONFIG_PM) += pm.o sleep.o
+obj-$(CONFIG_PM) += pm.o sleep.o pm_runtime.o
 
 # DSP
 obj-$(CONFIG_OMAP_MBOX_FWK)	+= mailbox_mach.o
diff --git a/arch/arm/mach-omap1/pm_runtime.c b/arch/arm/mach-omap1/pm_runtime.c
new file mode 100644
index 0000000..bbceb64
--- /dev/null
+++ b/arch/arm/mach-omap1/pm_runtime.c
@@ -0,0 +1,18 @@
+/*
+ * Runtime PM support code for TI OMAP1
+ *
+ *  Copyright (C) 2011 Texas Instruments, Inc.
+ *  Author: Kevin Hilman <khilman@ti.com>
+ *
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+#include <asm/pm_runtime.h>
+
+static int __init omap1_pm_runtime_init(void)
+{
+	pm_runtime_clock_init();
+	return 0;
+}
+core_initcall(omap1_pm_runtime_init);
diff --git a/arch/arm/mach-shmobile/pm_runtime.c b/arch/arm/mach-shmobile/pm_runtime.c
new file mode 100644
index 0000000..edc0fa5
--- /dev/null
+++ b/arch/arm/mach-shmobile/pm_runtime.c
@@ -0,0 +1,23 @@
+/*
+ * arch/arm/mach-shmobile/pm_runtime.c
+ *
+ * Runtime PM support code for SuperH Mobile ARM
+ *
+ *  Copyright (C) 2009-2010 Magnus Damm
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+#include <asm/pm_runtime.h>
+
+static int __init sh_pm_runtime_init(void)
+{
+	pm_runtime_clock_init();
+	return 0;
+}
+core_initcall(sh_pm_runtime_init);
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 66+ messages in thread

* [PATCH/RFC 5/6] ARM: use common clock-based runtime PM implementation on SH-mobile & OMAP1
@ 2011-04-07  0:02   ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap1/Makefile        |    2 +-
 arch/arm/mach-omap1/pm_runtime.c    |   18 ++++++++++++++++++
 arch/arm/mach-shmobile/pm_runtime.c |   23 +++++++++++++++++++++++
 3 files changed, 42 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-omap1/pm_runtime.c
 create mode 100644 arch/arm/mach-shmobile/pm_runtime.c

diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index 1913c2d..04c60f9 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -11,7 +11,7 @@ obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
 obj-$(CONFIG_OMAP_32K_TIMER)	+= timer32k.o
 
 # Power Management
-obj-$(CONFIG_PM) += pm.o sleep.o
+obj-$(CONFIG_PM) += pm.o sleep.o pm_runtime.o
 
 # DSP
 obj-$(CONFIG_OMAP_MBOX_FWK)	+= mailbox_mach.o
diff --git a/arch/arm/mach-omap1/pm_runtime.c b/arch/arm/mach-omap1/pm_runtime.c
new file mode 100644
index 0000000..bbceb64
--- /dev/null
+++ b/arch/arm/mach-omap1/pm_runtime.c
@@ -0,0 +1,18 @@
+/*
+ * Runtime PM support code for TI OMAP1
+ *
+ *  Copyright (C) 2011 Texas Instruments, Inc.
+ *  Author: Kevin Hilman <khilman@ti.com>
+ *
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+#include <asm/pm_runtime.h>
+
+static int __init omap1_pm_runtime_init(void)
+{
+	pm_runtime_clock_init();
+	return 0;
+}
+core_initcall(omap1_pm_runtime_init);
diff --git a/arch/arm/mach-shmobile/pm_runtime.c b/arch/arm/mach-shmobile/pm_runtime.c
new file mode 100644
index 0000000..edc0fa5
--- /dev/null
+++ b/arch/arm/mach-shmobile/pm_runtime.c
@@ -0,0 +1,23 @@
+/*
+ * arch/arm/mach-shmobile/pm_runtime.c
+ *
+ * Runtime PM support code for SuperH Mobile ARM
+ *
+ *  Copyright (C) 2009-2010 Magnus Damm
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+#include <asm/pm_runtime.h>
+
+static int __init sh_pm_runtime_init(void)
+{
+	pm_runtime_clock_init();
+	return 0;
+}
+core_initcall(sh_pm_runtime_init);
-- 
1.7.4

^ permalink raw reply related	[flat|nested] 66+ messages in thread

* [PATCH/RFC 6/6] Revert "driver core: platform_bus: allow runtime override of dev_pm_ops"
  2011-04-07  0:02 ` Kevin Hilman
  (?)
@ 2011-04-07  0:02   ` Kevin Hilman
  -1 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel

This reverts commit c64a0926710153b9d44c979d2942f4a8648fd74e.

The platform_bus_set_pm_ops() is deprecated in favor of the new device
power domain infrastructre implemented in commit
7538e3db6e015e890825fbd9f8659952896ddd5b (PM: add support for device
power domains)

Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 drivers/base/platform.c         |   35 -----------------------------------
 include/linux/platform_device.h |    3 ---
 2 files changed, 0 insertions(+), 38 deletions(-)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index f051cff..46335ca 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -976,41 +976,6 @@ struct bus_type platform_bus_type = {
 };
 EXPORT_SYMBOL_GPL(platform_bus_type);
 
-/**
- * platform_bus_get_pm_ops() - return pointer to busses dev_pm_ops
- *
- * This function can be used by platform code to get the current
- * set of dev_pm_ops functions used by the platform_bus_type.
- */
-const struct dev_pm_ops * __init platform_bus_get_pm_ops(void)
-{
-	return platform_bus_type.pm;
-}
-
-/**
- * platform_bus_set_pm_ops() - update dev_pm_ops for the platform_bus_type
- *
- * @pm: pointer to new dev_pm_ops struct to be used for platform_bus_type
- *
- * Platform code can override the dev_pm_ops methods of
- * platform_bus_type by using this function.  It is expected that
- * platform code will first do a platform_bus_get_pm_ops(), then
- * kmemdup it, then customize selected methods and pass a pointer to
- * the new struct dev_pm_ops to this function.
- *
- * Since platform-specific code is customizing methods for *all*
- * devices (not just platform-specific devices) it is expected that
- * any custom overrides of these functions will keep existing behavior
- * and simply extend it.  For example, any customization of the
- * runtime PM methods should continue to call the pm_generic_*
- * functions as the default ones do in addition to the
- * platform-specific behavior.
- */
-void __init platform_bus_set_pm_ops(const struct dev_pm_ops *pm)
-{
-	platform_bus_type.pm = pm;
-}
-
 int __init platform_bus_init(void)
 {
 	int error;
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index d96db98..53745dc 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -145,9 +145,6 @@ extern struct platform_device *platform_create_bundle(struct platform_driver *dr
 					struct resource *res, unsigned int n_res,
 					const void *data, size_t size);
 
-extern const struct dev_pm_ops * platform_bus_get_pm_ops(void);
-extern void platform_bus_set_pm_ops(const struct dev_pm_ops *pm);
-
 /* early platform driver interface */
 struct early_platform_driver {
 	const char *class_str;
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 66+ messages in thread

* [PATCH/RFC 6/6] Revert "driver core: platform_bus: allow runtime override of dev_pm_ops"
@ 2011-04-07  0:02   ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel, linux-omap, linux-sh
  Cc: linux-kernel, Magnus Damm, Rafael J. Wysocki, Grant Likely,
	Greg Kroah-Hartman

This reverts commit c64a0926710153b9d44c979d2942f4a8648fd74e.

The platform_bus_set_pm_ops() is deprecated in favor of the new device
power domain infrastructre implemented in commit
7538e3db6e015e890825fbd9f8659952896ddd5b (PM: add support for device
power domains)

Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 drivers/base/platform.c         |   35 -----------------------------------
 include/linux/platform_device.h |    3 ---
 2 files changed, 0 insertions(+), 38 deletions(-)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index f051cff..46335ca 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -976,41 +976,6 @@ struct bus_type platform_bus_type = {
 };
 EXPORT_SYMBOL_GPL(platform_bus_type);
 
-/**
- * platform_bus_get_pm_ops() - return pointer to busses dev_pm_ops
- *
- * This function can be used by platform code to get the current
- * set of dev_pm_ops functions used by the platform_bus_type.
- */
-const struct dev_pm_ops * __init platform_bus_get_pm_ops(void)
-{
-	return platform_bus_type.pm;
-}
-
-/**
- * platform_bus_set_pm_ops() - update dev_pm_ops for the platform_bus_type
- *
- * @pm: pointer to new dev_pm_ops struct to be used for platform_bus_type
- *
- * Platform code can override the dev_pm_ops methods of
- * platform_bus_type by using this function.  It is expected that
- * platform code will first do a platform_bus_get_pm_ops(), then
- * kmemdup it, then customize selected methods and pass a pointer to
- * the new struct dev_pm_ops to this function.
- *
- * Since platform-specific code is customizing methods for *all*
- * devices (not just platform-specific devices) it is expected that
- * any custom overrides of these functions will keep existing behavior
- * and simply extend it.  For example, any customization of the
- * runtime PM methods should continue to call the pm_generic_*
- * functions as the default ones do in addition to the
- * platform-specific behavior.
- */
-void __init platform_bus_set_pm_ops(const struct dev_pm_ops *pm)
-{
-	platform_bus_type.pm = pm;
-}
-
 int __init platform_bus_init(void)
 {
 	int error;
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index d96db98..53745dc 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -145,9 +145,6 @@ extern struct platform_device *platform_create_bundle(struct platform_driver *dr
 					struct resource *res, unsigned int n_res,
 					const void *data, size_t size);
 
-extern const struct dev_pm_ops * platform_bus_get_pm_ops(void);
-extern void platform_bus_set_pm_ops(const struct dev_pm_ops *pm);
-
 /* early platform driver interface */
 struct early_platform_driver {
 	const char *class_str;
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 66+ messages in thread

* [PATCH/RFC 6/6] Revert "driver core: platform_bus: allow runtime override of dev_pm_ops"
@ 2011-04-07  0:02   ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07  0:02 UTC (permalink / raw)
  To: linux-arm-kernel

This reverts commit c64a0926710153b9d44c979d2942f4a8648fd74e.

The platform_bus_set_pm_ops() is deprecated in favor of the new device
power domain infrastructre implemented in commit
7538e3db6e015e890825fbd9f8659952896ddd5b (PM: add support for device
power domains)

Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 drivers/base/platform.c         |   35 -----------------------------------
 include/linux/platform_device.h |    3 ---
 2 files changed, 0 insertions(+), 38 deletions(-)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index f051cff..46335ca 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -976,41 +976,6 @@ struct bus_type platform_bus_type = {
 };
 EXPORT_SYMBOL_GPL(platform_bus_type);
 
-/**
- * platform_bus_get_pm_ops() - return pointer to busses dev_pm_ops
- *
- * This function can be used by platform code to get the current
- * set of dev_pm_ops functions used by the platform_bus_type.
- */
-const struct dev_pm_ops * __init platform_bus_get_pm_ops(void)
-{
-	return platform_bus_type.pm;
-}
-
-/**
- * platform_bus_set_pm_ops() - update dev_pm_ops for the platform_bus_type
- *
- * @pm: pointer to new dev_pm_ops struct to be used for platform_bus_type
- *
- * Platform code can override the dev_pm_ops methods of
- * platform_bus_type by using this function.  It is expected that
- * platform code will first do a platform_bus_get_pm_ops(), then
- * kmemdup it, then customize selected methods and pass a pointer to
- * the new struct dev_pm_ops to this function.
- *
- * Since platform-specific code is customizing methods for *all*
- * devices (not just platform-specific devices) it is expected that
- * any custom overrides of these functions will keep existing behavior
- * and simply extend it.  For example, any customization of the
- * runtime PM methods should continue to call the pm_generic_*
- * functions as the default ones do in addition to the
- * platform-specific behavior.
- */
-void __init platform_bus_set_pm_ops(const struct dev_pm_ops *pm)
-{
-	platform_bus_type.pm = pm;
-}
-
 int __init platform_bus_init(void)
 {
 	int error;
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index d96db98..53745dc 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -145,9 +145,6 @@ extern struct platform_device *platform_create_bundle(struct platform_driver *dr
 					struct resource *res, unsigned int n_res,
 					const void *data, size_t size);
 
-extern const struct dev_pm_ops * platform_bus_get_pm_ops(void);
-extern void platform_bus_set_pm_ops(const struct dev_pm_ops *pm);
-
 /* early platform driver interface */
 struct early_platform_driver {
 	const char *class_str;
-- 
1.7.4

^ permalink raw reply related	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
  2011-04-07  0:02 ` Kevin Hilman
  (?)
@ 2011-04-07  5:38   ` Rafael J. Wysocki
  -1 siblings, 0 replies; 66+ messages in thread
From: Rafael J. Wysocki @ 2011-04-07  5:38 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday, April 07, 2011, Kevin Hilman wrote:
> This series aims to consolidate OMAP and SH-mobile runtime PM
> implementations around the new device power domains.
> 
> In 2.6.39, device power domains were added (commit
> 7538e3db6e015e890825fbd9f8659952896ddd5b, PM: add support for device
> power domains).  In converting both OMAP and SH-mobile to use device
> power domains, the overlap between implementations was almost 100%.  
> 
> To share the runtime PM implementation based on simple clock gating,
> move it to arch/arm/common and initialize it from OMAP and SH-mobile.
> 
> Also, OMAP was the only user of platform_bus_set_pm_ops().  Now that
> it has been converted to device power domains, remove
> platform_bus_set_pm_ops().

Please, don't do it this way.

First, we'll still need platform_bus_set_pm_ops() on shmobile and the reason
is that we want to override the platform bus type PM ops for _all_ devices on
that platform, which power domains are not really suitable for.

Second, we're going to introduce code for handling real power domains for
shmobile that would conflict with the way you're using power domains for
overriding the default PM ops.

Besides, the way you've used power domains appears to assume that drivers
will not define their own runtime PM callbacks, because if they do, those
callbacks will be called _in_ _addition_ to the power domain callbacks you're
trying to add (from the default platform bus type callbacks).

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
@ 2011-04-07  5:38   ` Rafael J. Wysocki
  0 siblings, 0 replies; 66+ messages in thread
From: Rafael J. Wysocki @ 2011-04-07  5:38 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: linux-arm-kernel, linux-omap, linux-sh, linux-kernel,
	Magnus Damm, Grant Likely, Greg Kroah-Hartman

On Thursday, April 07, 2011, Kevin Hilman wrote:
> This series aims to consolidate OMAP and SH-mobile runtime PM
> implementations around the new device power domains.
> 
> In 2.6.39, device power domains were added (commit
> 7538e3db6e015e890825fbd9f8659952896ddd5b, PM: add support for device
> power domains).  In converting both OMAP and SH-mobile to use device
> power domains, the overlap between implementations was almost 100%.  
> 
> To share the runtime PM implementation based on simple clock gating,
> move it to arch/arm/common and initialize it from OMAP and SH-mobile.
> 
> Also, OMAP was the only user of platform_bus_set_pm_ops().  Now that
> it has been converted to device power domains, remove
> platform_bus_set_pm_ops().

Please, don't do it this way.

First, we'll still need platform_bus_set_pm_ops() on shmobile and the reason
is that we want to override the platform bus type PM ops for _all_ devices on
that platform, which power domains are not really suitable for.

Second, we're going to introduce code for handling real power domains for
shmobile that would conflict with the way you're using power domains for
overriding the default PM ops.

Besides, the way you've used power domains appears to assume that drivers
will not define their own runtime PM callbacks, because if they do, those
callbacks will be called _in_ _addition_ to the power domain callbacks you're
trying to add (from the default platform bus type callbacks).

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 66+ messages in thread

* [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
@ 2011-04-07  5:38   ` Rafael J. Wysocki
  0 siblings, 0 replies; 66+ messages in thread
From: Rafael J. Wysocki @ 2011-04-07  5:38 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday, April 07, 2011, Kevin Hilman wrote:
> This series aims to consolidate OMAP and SH-mobile runtime PM
> implementations around the new device power domains.
> 
> In 2.6.39, device power domains were added (commit
> 7538e3db6e015e890825fbd9f8659952896ddd5b, PM: add support for device
> power domains).  In converting both OMAP and SH-mobile to use device
> power domains, the overlap between implementations was almost 100%.  
> 
> To share the runtime PM implementation based on simple clock gating,
> move it to arch/arm/common and initialize it from OMAP and SH-mobile.
> 
> Also, OMAP was the only user of platform_bus_set_pm_ops().  Now that
> it has been converted to device power domains, remove
> platform_bus_set_pm_ops().

Please, don't do it this way.

First, we'll still need platform_bus_set_pm_ops() on shmobile and the reason
is that we want to override the platform bus type PM ops for _all_ devices on
that platform, which power domains are not really suitable for.

Second, we're going to introduce code for handling real power domains for
shmobile that would conflict with the way you're using power domains for
overriding the default PM ops.

Besides, the way you've used power domains appears to assume that drivers
will not define their own runtime PM callbacks, because if they do, those
callbacks will be called _in_ _addition_ to the power domain callbacks you're
trying to add (from the default platform bus type callbacks).

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 2/6] OMAP2+: PM: move runtime PM implementation to
  2011-04-07  0:02   ` Kevin Hilman
  (?)
@ 2011-04-07  5:49     ` Grant Likely
  -1 siblings, 0 replies; 66+ messages in thread
From: Grant Likely @ 2011-04-07  5:49 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Apr 06, 2011 at 05:02:45PM -0700, Kevin Hilman wrote:
> In commit 7538e3db6e015e890825fbd9f8659952896ddd5b (PM: add support
> for device power domains) a better way for handling platform-specific
> power hooks was introduced.
> 
> Rather than using the platform_bus dev_pm_ops overrides
> (platform_bus_set_pm_ops()), this patch moves the OMAP runtime PM
> implementation over to using device power domains.
> 
> Since OMAP is the only user of platform_bus_set_pm_ops(), that
> interface can be removed (and will be in a forthcoming patch.)
> 
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Magnus Damm <magnus.damm@gmail.com>
> Cc: Rafael J. Wysocki <rjw@sisk.pl>
> Signed-off-by: Kevin Hilman <khilman@ti.com>

Looks right to me.

Reviewed-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  arch/arm/mach-omap2/Makefile     |    6 +-
>  arch/arm/mach-omap2/pm_bus.c     |   85 --------------------------------------
>  arch/arm/plat-omap/omap_device.c |   22 ++++++++++
>  3 files changed, 25 insertions(+), 88 deletions(-)
>  delete mode 100644 arch/arm/mach-omap2/pm_bus.c
> 
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> index a45cd64..b353584 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -59,10 +59,10 @@ endif
>  # Power Management
>  ifeq ($(CONFIG_PM),y)
>  obj-$(CONFIG_ARCH_OMAP2)		+= pm24xx.o
> -obj-$(CONFIG_ARCH_OMAP2)		+= sleep24xx.o pm_bus.o
> +obj-$(CONFIG_ARCH_OMAP2)		+= sleep24xx.o
>  obj-$(CONFIG_ARCH_OMAP3)		+= pm34xx.o sleep34xx.o \
> -					   cpuidle34xx.o pm_bus.o
> -obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o pm_bus.o
> +					   cpuidle34xx.o
> +obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o
>  obj-$(CONFIG_PM_DEBUG)			+= pm-debug.o
>  obj-$(CONFIG_OMAP_SMARTREFLEX)          += sr_device.o smartreflex.o
>  obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3)	+= smartreflex-class3.o
> diff --git a/arch/arm/mach-omap2/pm_bus.c b/arch/arm/mach-omap2/pm_bus.c
> deleted file mode 100644
> index 5acd2ab..0000000
> --- a/arch/arm/mach-omap2/pm_bus.c
> +++ /dev/null
> @@ -1,85 +0,0 @@
> -/*
> - * Runtime PM support code for OMAP
> - *
> - * Author: Kevin Hilman, Deep Root Systems, LLC
> - *
> - * Copyright (C) 2010 Texas Instruments, Inc.
> - *
> - * This file is licensed under the terms of the GNU General Public
> - * License version 2. This program is licensed "as is" without any
> - * warranty of any kind, whether express or implied.
> - */
> -#include <linux/init.h>
> -#include <linux/kernel.h>
> -#include <linux/io.h>
> -#include <linux/pm_runtime.h>
> -#include <linux/platform_device.h>
> -#include <linux/mutex.h>
> -
> -#include <plat/omap_device.h>
> -#include <plat/omap-pm.h>
> -
> -#ifdef CONFIG_PM_RUNTIME
> -static int omap_pm_runtime_suspend(struct device *dev)
> -{
> -	struct platform_device *pdev = to_platform_device(dev);
> -	int r, ret = 0;
> -
> -	dev_dbg(dev, "%s\n", __func__);
> -
> -	ret = pm_generic_runtime_suspend(dev);
> -
> -	if (!ret && dev->parent = &omap_device_parent) {
> -		r = omap_device_idle(pdev);
> -		WARN_ON(r);
> -	}
> -
> -	return ret;
> -};
> -
> -static int omap_pm_runtime_resume(struct device *dev)
> -{
> -	struct platform_device *pdev = to_platform_device(dev);
> -	int r;
> -
> -	dev_dbg(dev, "%s\n", __func__);
> -
> -	if (dev->parent = &omap_device_parent) {
> -		r = omap_device_enable(pdev);
> -		WARN_ON(r);
> -	}
> -
> -	return pm_generic_runtime_resume(dev);
> -};
> -#else
> -#define omap_pm_runtime_suspend NULL
> -#define omap_pm_runtime_resume NULL
> -#endif /* CONFIG_PM_RUNTIME */
> -
> -static int __init omap_pm_runtime_init(void)
> -{
> -	const struct dev_pm_ops *pm;
> -	struct dev_pm_ops *omap_pm;
> -
> -	pm = platform_bus_get_pm_ops();
> -	if (!pm) {
> -		pr_err("%s: unable to get dev_pm_ops from platform_bus\n",
> -			__func__);
> -		return -ENODEV;
> -	}
> -
> -	omap_pm = kmemdup(pm, sizeof(struct dev_pm_ops), GFP_KERNEL);
> -	if (!omap_pm) {
> -		pr_err("%s: unable to alloc memory for new dev_pm_ops\n",
> -			__func__);
> -		return -ENOMEM;
> -	}
> -
> -	omap_pm->runtime_suspend = omap_pm_runtime_suspend;
> -	omap_pm->runtime_resume = omap_pm_runtime_resume;
> -
> -	platform_bus_set_pm_ops(omap_pm);
> -
> -	return 0;
> -}
> -core_initcall(omap_pm_runtime_init);
> diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
> index 9bbda9a..93cd2fb 100644
> --- a/arch/arm/plat-omap/omap_device.c
> +++ b/arch/arm/plat-omap/omap_device.c
> @@ -536,6 +536,27 @@ int omap_early_device_register(struct omap_device *od)
>  	return 0;
>  }
>  
> +static int _od_runtime_suspend(struct device *dev)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +
> +	return omap_device_idle(pdev);
> +}
> +
> +static int _od_runtime_resume(struct device *dev)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +
> +	return omap_device_enable(pdev);
> +}
> +
> +static struct dev_power_domain omap_device_power_domain = {
> +	.ops = {
> +		.runtime_suspend = _od_runtime_suspend,
> +		.runtime_resume = _od_runtime_resume,
> +	}
> +};
> +
>  /**
>   * omap_device_register - register an omap_device with one omap_hwmod
>   * @od: struct omap_device * to register
> @@ -549,6 +570,7 @@ int omap_device_register(struct omap_device *od)
>  	pr_debug("omap_device: %s: registering\n", od->pdev.name);
>  
>  	od->pdev.dev.parent = &omap_device_parent;
> +	od->pdev.dev.pwr_domain = &omap_device_power_domain;
>  	return platform_device_register(&od->pdev);
>  }
>  
> -- 
> 1.7.4
> 

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 2/6] OMAP2+: PM: move runtime PM implementation to use device power domains
@ 2011-04-07  5:49     ` Grant Likely
  0 siblings, 0 replies; 66+ messages in thread
From: Grant Likely @ 2011-04-07  5:49 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: linux-arm-kernel, linux-omap, linux-sh, linux-kernel,
	Magnus Damm, Rafael J. Wysocki, Greg Kroah-Hartman,
	Rafael J. Wysocki

On Wed, Apr 06, 2011 at 05:02:45PM -0700, Kevin Hilman wrote:
> In commit 7538e3db6e015e890825fbd9f8659952896ddd5b (PM: add support
> for device power domains) a better way for handling platform-specific
> power hooks was introduced.
> 
> Rather than using the platform_bus dev_pm_ops overrides
> (platform_bus_set_pm_ops()), this patch moves the OMAP runtime PM
> implementation over to using device power domains.
> 
> Since OMAP is the only user of platform_bus_set_pm_ops(), that
> interface can be removed (and will be in a forthcoming patch.)
> 
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Magnus Damm <magnus.damm@gmail.com>
> Cc: Rafael J. Wysocki <rjw@sisk.pl>
> Signed-off-by: Kevin Hilman <khilman@ti.com>

Looks right to me.

Reviewed-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  arch/arm/mach-omap2/Makefile     |    6 +-
>  arch/arm/mach-omap2/pm_bus.c     |   85 --------------------------------------
>  arch/arm/plat-omap/omap_device.c |   22 ++++++++++
>  3 files changed, 25 insertions(+), 88 deletions(-)
>  delete mode 100644 arch/arm/mach-omap2/pm_bus.c
> 
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> index a45cd64..b353584 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -59,10 +59,10 @@ endif
>  # Power Management
>  ifeq ($(CONFIG_PM),y)
>  obj-$(CONFIG_ARCH_OMAP2)		+= pm24xx.o
> -obj-$(CONFIG_ARCH_OMAP2)		+= sleep24xx.o pm_bus.o
> +obj-$(CONFIG_ARCH_OMAP2)		+= sleep24xx.o
>  obj-$(CONFIG_ARCH_OMAP3)		+= pm34xx.o sleep34xx.o \
> -					   cpuidle34xx.o pm_bus.o
> -obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o pm_bus.o
> +					   cpuidle34xx.o
> +obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o
>  obj-$(CONFIG_PM_DEBUG)			+= pm-debug.o
>  obj-$(CONFIG_OMAP_SMARTREFLEX)          += sr_device.o smartreflex.o
>  obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3)	+= smartreflex-class3.o
> diff --git a/arch/arm/mach-omap2/pm_bus.c b/arch/arm/mach-omap2/pm_bus.c
> deleted file mode 100644
> index 5acd2ab..0000000
> --- a/arch/arm/mach-omap2/pm_bus.c
> +++ /dev/null
> @@ -1,85 +0,0 @@
> -/*
> - * Runtime PM support code for OMAP
> - *
> - * Author: Kevin Hilman, Deep Root Systems, LLC
> - *
> - * Copyright (C) 2010 Texas Instruments, Inc.
> - *
> - * This file is licensed under the terms of the GNU General Public
> - * License version 2. This program is licensed "as is" without any
> - * warranty of any kind, whether express or implied.
> - */
> -#include <linux/init.h>
> -#include <linux/kernel.h>
> -#include <linux/io.h>
> -#include <linux/pm_runtime.h>
> -#include <linux/platform_device.h>
> -#include <linux/mutex.h>
> -
> -#include <plat/omap_device.h>
> -#include <plat/omap-pm.h>
> -
> -#ifdef CONFIG_PM_RUNTIME
> -static int omap_pm_runtime_suspend(struct device *dev)
> -{
> -	struct platform_device *pdev = to_platform_device(dev);
> -	int r, ret = 0;
> -
> -	dev_dbg(dev, "%s\n", __func__);
> -
> -	ret = pm_generic_runtime_suspend(dev);
> -
> -	if (!ret && dev->parent == &omap_device_parent) {
> -		r = omap_device_idle(pdev);
> -		WARN_ON(r);
> -	}
> -
> -	return ret;
> -};
> -
> -static int omap_pm_runtime_resume(struct device *dev)
> -{
> -	struct platform_device *pdev = to_platform_device(dev);
> -	int r;
> -
> -	dev_dbg(dev, "%s\n", __func__);
> -
> -	if (dev->parent == &omap_device_parent) {
> -		r = omap_device_enable(pdev);
> -		WARN_ON(r);
> -	}
> -
> -	return pm_generic_runtime_resume(dev);
> -};
> -#else
> -#define omap_pm_runtime_suspend NULL
> -#define omap_pm_runtime_resume NULL
> -#endif /* CONFIG_PM_RUNTIME */
> -
> -static int __init omap_pm_runtime_init(void)
> -{
> -	const struct dev_pm_ops *pm;
> -	struct dev_pm_ops *omap_pm;
> -
> -	pm = platform_bus_get_pm_ops();
> -	if (!pm) {
> -		pr_err("%s: unable to get dev_pm_ops from platform_bus\n",
> -			__func__);
> -		return -ENODEV;
> -	}
> -
> -	omap_pm = kmemdup(pm, sizeof(struct dev_pm_ops), GFP_KERNEL);
> -	if (!omap_pm) {
> -		pr_err("%s: unable to alloc memory for new dev_pm_ops\n",
> -			__func__);
> -		return -ENOMEM;
> -	}
> -
> -	omap_pm->runtime_suspend = omap_pm_runtime_suspend;
> -	omap_pm->runtime_resume = omap_pm_runtime_resume;
> -
> -	platform_bus_set_pm_ops(omap_pm);
> -
> -	return 0;
> -}
> -core_initcall(omap_pm_runtime_init);
> diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
> index 9bbda9a..93cd2fb 100644
> --- a/arch/arm/plat-omap/omap_device.c
> +++ b/arch/arm/plat-omap/omap_device.c
> @@ -536,6 +536,27 @@ int omap_early_device_register(struct omap_device *od)
>  	return 0;
>  }
>  
> +static int _od_runtime_suspend(struct device *dev)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +
> +	return omap_device_idle(pdev);
> +}
> +
> +static int _od_runtime_resume(struct device *dev)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +
> +	return omap_device_enable(pdev);
> +}
> +
> +static struct dev_power_domain omap_device_power_domain = {
> +	.ops = {
> +		.runtime_suspend = _od_runtime_suspend,
> +		.runtime_resume = _od_runtime_resume,
> +	}
> +};
> +
>  /**
>   * omap_device_register - register an omap_device with one omap_hwmod
>   * @od: struct omap_device * to register
> @@ -549,6 +570,7 @@ int omap_device_register(struct omap_device *od)
>  	pr_debug("omap_device: %s: registering\n", od->pdev.name);
>  
>  	od->pdev.dev.parent = &omap_device_parent;
> +	od->pdev.dev.pwr_domain = &omap_device_power_domain;
>  	return platform_device_register(&od->pdev);
>  }
>  
> -- 
> 1.7.4
> 

^ permalink raw reply	[flat|nested] 66+ messages in thread

* [PATCH/RFC 2/6] OMAP2+: PM: move runtime PM implementation to use device power domains
@ 2011-04-07  5:49     ` Grant Likely
  0 siblings, 0 replies; 66+ messages in thread
From: Grant Likely @ 2011-04-07  5:49 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Apr 06, 2011 at 05:02:45PM -0700, Kevin Hilman wrote:
> In commit 7538e3db6e015e890825fbd9f8659952896ddd5b (PM: add support
> for device power domains) a better way for handling platform-specific
> power hooks was introduced.
> 
> Rather than using the platform_bus dev_pm_ops overrides
> (platform_bus_set_pm_ops()), this patch moves the OMAP runtime PM
> implementation over to using device power domains.
> 
> Since OMAP is the only user of platform_bus_set_pm_ops(), that
> interface can be removed (and will be in a forthcoming patch.)
> 
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Magnus Damm <magnus.damm@gmail.com>
> Cc: Rafael J. Wysocki <rjw@sisk.pl>
> Signed-off-by: Kevin Hilman <khilman@ti.com>

Looks right to me.

Reviewed-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  arch/arm/mach-omap2/Makefile     |    6 +-
>  arch/arm/mach-omap2/pm_bus.c     |   85 --------------------------------------
>  arch/arm/plat-omap/omap_device.c |   22 ++++++++++
>  3 files changed, 25 insertions(+), 88 deletions(-)
>  delete mode 100644 arch/arm/mach-omap2/pm_bus.c
> 
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> index a45cd64..b353584 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -59,10 +59,10 @@ endif
>  # Power Management
>  ifeq ($(CONFIG_PM),y)
>  obj-$(CONFIG_ARCH_OMAP2)		+= pm24xx.o
> -obj-$(CONFIG_ARCH_OMAP2)		+= sleep24xx.o pm_bus.o
> +obj-$(CONFIG_ARCH_OMAP2)		+= sleep24xx.o
>  obj-$(CONFIG_ARCH_OMAP3)		+= pm34xx.o sleep34xx.o \
> -					   cpuidle34xx.o pm_bus.o
> -obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o pm_bus.o
> +					   cpuidle34xx.o
> +obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o
>  obj-$(CONFIG_PM_DEBUG)			+= pm-debug.o
>  obj-$(CONFIG_OMAP_SMARTREFLEX)          += sr_device.o smartreflex.o
>  obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3)	+= smartreflex-class3.o
> diff --git a/arch/arm/mach-omap2/pm_bus.c b/arch/arm/mach-omap2/pm_bus.c
> deleted file mode 100644
> index 5acd2ab..0000000
> --- a/arch/arm/mach-omap2/pm_bus.c
> +++ /dev/null
> @@ -1,85 +0,0 @@
> -/*
> - * Runtime PM support code for OMAP
> - *
> - * Author: Kevin Hilman, Deep Root Systems, LLC
> - *
> - * Copyright (C) 2010 Texas Instruments, Inc.
> - *
> - * This file is licensed under the terms of the GNU General Public
> - * License version 2. This program is licensed "as is" without any
> - * warranty of any kind, whether express or implied.
> - */
> -#include <linux/init.h>
> -#include <linux/kernel.h>
> -#include <linux/io.h>
> -#include <linux/pm_runtime.h>
> -#include <linux/platform_device.h>
> -#include <linux/mutex.h>
> -
> -#include <plat/omap_device.h>
> -#include <plat/omap-pm.h>
> -
> -#ifdef CONFIG_PM_RUNTIME
> -static int omap_pm_runtime_suspend(struct device *dev)
> -{
> -	struct platform_device *pdev = to_platform_device(dev);
> -	int r, ret = 0;
> -
> -	dev_dbg(dev, "%s\n", __func__);
> -
> -	ret = pm_generic_runtime_suspend(dev);
> -
> -	if (!ret && dev->parent == &omap_device_parent) {
> -		r = omap_device_idle(pdev);
> -		WARN_ON(r);
> -	}
> -
> -	return ret;
> -};
> -
> -static int omap_pm_runtime_resume(struct device *dev)
> -{
> -	struct platform_device *pdev = to_platform_device(dev);
> -	int r;
> -
> -	dev_dbg(dev, "%s\n", __func__);
> -
> -	if (dev->parent == &omap_device_parent) {
> -		r = omap_device_enable(pdev);
> -		WARN_ON(r);
> -	}
> -
> -	return pm_generic_runtime_resume(dev);
> -};
> -#else
> -#define omap_pm_runtime_suspend NULL
> -#define omap_pm_runtime_resume NULL
> -#endif /* CONFIG_PM_RUNTIME */
> -
> -static int __init omap_pm_runtime_init(void)
> -{
> -	const struct dev_pm_ops *pm;
> -	struct dev_pm_ops *omap_pm;
> -
> -	pm = platform_bus_get_pm_ops();
> -	if (!pm) {
> -		pr_err("%s: unable to get dev_pm_ops from platform_bus\n",
> -			__func__);
> -		return -ENODEV;
> -	}
> -
> -	omap_pm = kmemdup(pm, sizeof(struct dev_pm_ops), GFP_KERNEL);
> -	if (!omap_pm) {
> -		pr_err("%s: unable to alloc memory for new dev_pm_ops\n",
> -			__func__);
> -		return -ENOMEM;
> -	}
> -
> -	omap_pm->runtime_suspend = omap_pm_runtime_suspend;
> -	omap_pm->runtime_resume = omap_pm_runtime_resume;
> -
> -	platform_bus_set_pm_ops(omap_pm);
> -
> -	return 0;
> -}
> -core_initcall(omap_pm_runtime_init);
> diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
> index 9bbda9a..93cd2fb 100644
> --- a/arch/arm/plat-omap/omap_device.c
> +++ b/arch/arm/plat-omap/omap_device.c
> @@ -536,6 +536,27 @@ int omap_early_device_register(struct omap_device *od)
>  	return 0;
>  }
>  
> +static int _od_runtime_suspend(struct device *dev)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +
> +	return omap_device_idle(pdev);
> +}
> +
> +static int _od_runtime_resume(struct device *dev)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +
> +	return omap_device_enable(pdev);
> +}
> +
> +static struct dev_power_domain omap_device_power_domain = {
> +	.ops = {
> +		.runtime_suspend = _od_runtime_suspend,
> +		.runtime_resume = _od_runtime_resume,
> +	}
> +};
> +
>  /**
>   * omap_device_register - register an omap_device with one omap_hwmod
>   * @od: struct omap_device * to register
> @@ -549,6 +570,7 @@ int omap_device_register(struct omap_device *od)
>  	pr_debug("omap_device: %s: registering\n", od->pdev.name);
>  
>  	od->pdev.dev.parent = &omap_device_parent;
> +	od->pdev.dev.pwr_domain = &omap_device_power_domain;
>  	return platform_device_register(&od->pdev);
>  }
>  
> -- 
> 1.7.4
> 

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
  2011-04-07  5:38   ` Rafael J. Wysocki
  (?)
@ 2011-04-07 14:58     ` Kevin Hilman
  -1 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07 14:58 UTC (permalink / raw)
  To: linux-arm-kernel

[adding linux-pm, which I forgot to add in original post]

"Rafael J. Wysocki" <rjw@suse.com> writes:

> On Thursday, April 07, 2011, Kevin Hilman wrote:
>> This series aims to consolidate OMAP and SH-mobile runtime PM
>> implementations around the new device power domains.
>> 
>> In 2.6.39, device power domains were added (commit
>> 7538e3db6e015e890825fbd9f8659952896ddd5b, PM: add support for device
>> power domains).  In converting both OMAP and SH-mobile to use device
>> power domains, the overlap between implementations was almost 100%.  
>> 
>> To share the runtime PM implementation based on simple clock gating,
>> move it to arch/arm/common and initialize it from OMAP and SH-mobile.
>> 
>> Also, OMAP was the only user of platform_bus_set_pm_ops().  Now that
>> it has been converted to device power domains, remove
>> platform_bus_set_pm_ops().
>
> Please, don't do it this way.
>
> First, we'll still need platform_bus_set_pm_ops() on shmobile and the reason
> is that we want to override the platform bus type PM ops for _all_ devices on
> that platform, which power domains are not really suitable for.

That doesn't sound quite right to me.

Magnus should step in here to clarify the situation on SH-mobile, but
like Grant, I'm pretty sure that we don't need (or want) to replace PM
ops for _all_ platform devices.

Looking at the replacement ops used, they simply manage device clocks,
and this probably only applies to on-chip devices (at least that's true
on OMAP.)

Replacing the PM ops for all devices was done on OMAP and SH-mobile
because that was the only approach we had.  Now that we have device
power domains (thanks Rafael!), we can be more selective about which
devices to apply them to.

Note that my RFC patch/series did not do the selective part of deciding
which devices to override and which ones not to, that part will be
platform specific.  

> Second, we're going to introduce code for handling real power domains for
> shmobile that would conflict with the way you're using power domains for
> overriding the default PM ops.

Conflict in what way?

If you have new device power domain callbacks for specific devices in a
an on-chp power domain, they would just override the "default" ones that
only do basic clock gating.  I'm guessing the new callbacks will do some
management of the SoC specific powerdomains in addition to clock gating.
That's how it works on OMAP.

Put a different way, the device power domain callbacks in this proposal
will be the defaults, providing a simple clock-gating only approach to
device power management.   However, when new code comes along to manage
the actual SoC power domains, devices in those power domains will just
override these default clock-gating-only versions.

This is exactly how things are working in OMAP.  On OMAP1, we use only
the simple, clock-gating only callbacks because the OMAP1 PM
capabilities are much more limited.  On OMAP2+, we override these
callbacks with different ones that in addition to managing clocks, also
manage the SoC power domains.

> Besides, the way you've used power domains appears to assume that drivers
> will not define their own runtime PM callbacks, because if they do, those
> callbacks will be called _in_ _addition_ to the power domain callbacks you're
> trying to add (from the default platform bus type callbacks).

That was intentional.

If all a driver needs to do for runtime PM is manage clocks, it doesn't
need runtime PM callbacks since it's hanlded by core code.  If it has
additional things to do (save context, quiesce hardware, wait for
somthing to finish etc.) it can do that in it's own callbacks, and then
the clock gating will happen in the device power domain callbacks.

The point is use both levels of callbacks. The device power domain
callbacks handle all the operations that are common to the device power
domain, and the driver callbacks handle driver specific stuff.  

It also means that drivers don't have to manage their own clocks, at
least for PM purposes.  This is a big win for drivers that are used on
multiple platforms, or even multiple SoCs in the same family where
clocking may be different.  Drivers that can remain ignorant of the
underlying clocking (and power domain layout) are much more portable.

Kevin




^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
@ 2011-04-07 14:58     ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07 14:58 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: linux-arm-kernel, linux-omap, linux-sh, linux-kernel,
	Magnus Damm, Grant Likely, Greg Kroah-Hartman,
	Linux-pm mailing list

[adding linux-pm, which I forgot to add in original post]

"Rafael J. Wysocki" <rjw@suse.com> writes:

> On Thursday, April 07, 2011, Kevin Hilman wrote:
>> This series aims to consolidate OMAP and SH-mobile runtime PM
>> implementations around the new device power domains.
>> 
>> In 2.6.39, device power domains were added (commit
>> 7538e3db6e015e890825fbd9f8659952896ddd5b, PM: add support for device
>> power domains).  In converting both OMAP and SH-mobile to use device
>> power domains, the overlap between implementations was almost 100%.  
>> 
>> To share the runtime PM implementation based on simple clock gating,
>> move it to arch/arm/common and initialize it from OMAP and SH-mobile.
>> 
>> Also, OMAP was the only user of platform_bus_set_pm_ops().  Now that
>> it has been converted to device power domains, remove
>> platform_bus_set_pm_ops().
>
> Please, don't do it this way.
>
> First, we'll still need platform_bus_set_pm_ops() on shmobile and the reason
> is that we want to override the platform bus type PM ops for _all_ devices on
> that platform, which power domains are not really suitable for.

That doesn't sound quite right to me.

Magnus should step in here to clarify the situation on SH-mobile, but
like Grant, I'm pretty sure that we don't need (or want) to replace PM
ops for _all_ platform devices.

Looking at the replacement ops used, they simply manage device clocks,
and this probably only applies to on-chip devices (at least that's true
on OMAP.)

Replacing the PM ops for all devices was done on OMAP and SH-mobile
because that was the only approach we had.  Now that we have device
power domains (thanks Rafael!), we can be more selective about which
devices to apply them to.

Note that my RFC patch/series did not do the selective part of deciding
which devices to override and which ones not to, that part will be
platform specific.  

> Second, we're going to introduce code for handling real power domains for
> shmobile that would conflict with the way you're using power domains for
> overriding the default PM ops.

Conflict in what way?

If you have new device power domain callbacks for specific devices in a
an on-chp power domain, they would just override the "default" ones that
only do basic clock gating.  I'm guessing the new callbacks will do some
management of the SoC specific powerdomains in addition to clock gating.
That's how it works on OMAP.

Put a different way, the device power domain callbacks in this proposal
will be the defaults, providing a simple clock-gating only approach to
device power management.   However, when new code comes along to manage
the actual SoC power domains, devices in those power domains will just
override these default clock-gating-only versions.

This is exactly how things are working in OMAP.  On OMAP1, we use only
the simple, clock-gating only callbacks because the OMAP1 PM
capabilities are much more limited.  On OMAP2+, we override these
callbacks with different ones that in addition to managing clocks, also
manage the SoC power domains.

> Besides, the way you've used power domains appears to assume that drivers
> will not define their own runtime PM callbacks, because if they do, those
> callbacks will be called _in_ _addition_ to the power domain callbacks you're
> trying to add (from the default platform bus type callbacks).

That was intentional.

If all a driver needs to do for runtime PM is manage clocks, it doesn't
need runtime PM callbacks since it's hanlded by core code.  If it has
additional things to do (save context, quiesce hardware, wait for
somthing to finish etc.) it can do that in it's own callbacks, and then
the clock gating will happen in the device power domain callbacks.

The point is use both levels of callbacks. The device power domain
callbacks handle all the operations that are common to the device power
domain, and the driver callbacks handle driver specific stuff.  

It also means that drivers don't have to manage their own clocks, at
least for PM purposes.  This is a big win for drivers that are used on
multiple platforms, or even multiple SoCs in the same family where
clocking may be different.  Drivers that can remain ignorant of the
underlying clocking (and power domain layout) are much more portable.

Kevin




^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
  2011-04-07  5:38   ` Rafael J. Wysocki
                     ` (2 preceding siblings ...)
  (?)
@ 2011-04-07 14:58   ` Kevin Hilman
  -1 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07 14:58 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: linux-sh, Greg Kroah-Hartman, linux-kernel, Grant Likely,
	Linux-pm mailing list, linux-omap, linux-arm-kernel

[adding linux-pm, which I forgot to add in original post]

"Rafael J. Wysocki" <rjw@suse.com> writes:

> On Thursday, April 07, 2011, Kevin Hilman wrote:
>> This series aims to consolidate OMAP and SH-mobile runtime PM
>> implementations around the new device power domains.
>> 
>> In 2.6.39, device power domains were added (commit
>> 7538e3db6e015e890825fbd9f8659952896ddd5b, PM: add support for device
>> power domains).  In converting both OMAP and SH-mobile to use device
>> power domains, the overlap between implementations was almost 100%.  
>> 
>> To share the runtime PM implementation based on simple clock gating,
>> move it to arch/arm/common and initialize it from OMAP and SH-mobile.
>> 
>> Also, OMAP was the only user of platform_bus_set_pm_ops().  Now that
>> it has been converted to device power domains, remove
>> platform_bus_set_pm_ops().
>
> Please, don't do it this way.
>
> First, we'll still need platform_bus_set_pm_ops() on shmobile and the reason
> is that we want to override the platform bus type PM ops for _all_ devices on
> that platform, which power domains are not really suitable for.

That doesn't sound quite right to me.

Magnus should step in here to clarify the situation on SH-mobile, but
like Grant, I'm pretty sure that we don't need (or want) to replace PM
ops for _all_ platform devices.

Looking at the replacement ops used, they simply manage device clocks,
and this probably only applies to on-chip devices (at least that's true
on OMAP.)

Replacing the PM ops for all devices was done on OMAP and SH-mobile
because that was the only approach we had.  Now that we have device
power domains (thanks Rafael!), we can be more selective about which
devices to apply them to.

Note that my RFC patch/series did not do the selective part of deciding
which devices to override and which ones not to, that part will be
platform specific.  

> Second, we're going to introduce code for handling real power domains for
> shmobile that would conflict with the way you're using power domains for
> overriding the default PM ops.

Conflict in what way?

If you have new device power domain callbacks for specific devices in a
an on-chp power domain, they would just override the "default" ones that
only do basic clock gating.  I'm guessing the new callbacks will do some
management of the SoC specific powerdomains in addition to clock gating.
That's how it works on OMAP.

Put a different way, the device power domain callbacks in this proposal
will be the defaults, providing a simple clock-gating only approach to
device power management.   However, when new code comes along to manage
the actual SoC power domains, devices in those power domains will just
override these default clock-gating-only versions.

This is exactly how things are working in OMAP.  On OMAP1, we use only
the simple, clock-gating only callbacks because the OMAP1 PM
capabilities are much more limited.  On OMAP2+, we override these
callbacks with different ones that in addition to managing clocks, also
manage the SoC power domains.

> Besides, the way you've used power domains appears to assume that drivers
> will not define their own runtime PM callbacks, because if they do, those
> callbacks will be called _in_ _addition_ to the power domain callbacks you're
> trying to add (from the default platform bus type callbacks).

That was intentional.

If all a driver needs to do for runtime PM is manage clocks, it doesn't
need runtime PM callbacks since it's hanlded by core code.  If it has
additional things to do (save context, quiesce hardware, wait for
somthing to finish etc.) it can do that in it's own callbacks, and then
the clock gating will happen in the device power domain callbacks.

The point is use both levels of callbacks. The device power domain
callbacks handle all the operations that are common to the device power
domain, and the driver callbacks handle driver specific stuff.  

It also means that drivers don't have to manage their own clocks, at
least for PM purposes.  This is a big win for drivers that are used on
multiple platforms, or even multiple SoCs in the same family where
clocking may be different.  Drivers that can remain ignorant of the
underlying clocking (and power domain layout) are much more portable.

Kevin

^ permalink raw reply	[flat|nested] 66+ messages in thread

* [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
@ 2011-04-07 14:58     ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07 14:58 UTC (permalink / raw)
  To: linux-arm-kernel

[adding linux-pm, which I forgot to add in original post]

"Rafael J. Wysocki" <rjw@suse.com> writes:

> On Thursday, April 07, 2011, Kevin Hilman wrote:
>> This series aims to consolidate OMAP and SH-mobile runtime PM
>> implementations around the new device power domains.
>> 
>> In 2.6.39, device power domains were added (commit
>> 7538e3db6e015e890825fbd9f8659952896ddd5b, PM: add support for device
>> power domains).  In converting both OMAP and SH-mobile to use device
>> power domains, the overlap between implementations was almost 100%.  
>> 
>> To share the runtime PM implementation based on simple clock gating,
>> move it to arch/arm/common and initialize it from OMAP and SH-mobile.
>> 
>> Also, OMAP was the only user of platform_bus_set_pm_ops().  Now that
>> it has been converted to device power domains, remove
>> platform_bus_set_pm_ops().
>
> Please, don't do it this way.
>
> First, we'll still need platform_bus_set_pm_ops() on shmobile and the reason
> is that we want to override the platform bus type PM ops for _all_ devices on
> that platform, which power domains are not really suitable for.

That doesn't sound quite right to me.

Magnus should step in here to clarify the situation on SH-mobile, but
like Grant, I'm pretty sure that we don't need (or want) to replace PM
ops for _all_ platform devices.

Looking at the replacement ops used, they simply manage device clocks,
and this probably only applies to on-chip devices (at least that's true
on OMAP.)

Replacing the PM ops for all devices was done on OMAP and SH-mobile
because that was the only approach we had.  Now that we have device
power domains (thanks Rafael!), we can be more selective about which
devices to apply them to.

Note that my RFC patch/series did not do the selective part of deciding
which devices to override and which ones not to, that part will be
platform specific.  

> Second, we're going to introduce code for handling real power domains for
> shmobile that would conflict with the way you're using power domains for
> overriding the default PM ops.

Conflict in what way?

If you have new device power domain callbacks for specific devices in a
an on-chp power domain, they would just override the "default" ones that
only do basic clock gating.  I'm guessing the new callbacks will do some
management of the SoC specific powerdomains in addition to clock gating.
That's how it works on OMAP.

Put a different way, the device power domain callbacks in this proposal
will be the defaults, providing a simple clock-gating only approach to
device power management.   However, when new code comes along to manage
the actual SoC power domains, devices in those power domains will just
override these default clock-gating-only versions.

This is exactly how things are working in OMAP.  On OMAP1, we use only
the simple, clock-gating only callbacks because the OMAP1 PM
capabilities are much more limited.  On OMAP2+, we override these
callbacks with different ones that in addition to managing clocks, also
manage the SoC power domains.

> Besides, the way you've used power domains appears to assume that drivers
> will not define their own runtime PM callbacks, because if they do, those
> callbacks will be called _in_ _addition_ to the power domain callbacks you're
> trying to add (from the default platform bus type callbacks).

That was intentional.

If all a driver needs to do for runtime PM is manage clocks, it doesn't
need runtime PM callbacks since it's hanlded by core code.  If it has
additional things to do (save context, quiesce hardware, wait for
somthing to finish etc.) it can do that in it's own callbacks, and then
the clock gating will happen in the device power domain callbacks.

The point is use both levels of callbacks. The device power domain
callbacks handle all the operations that are common to the device power
domain, and the driver callbacks handle driver specific stuff.  

It also means that drivers don't have to manage their own clocks, at
least for PM purposes.  This is a big win for drivers that are used on
multiple platforms, or even multiple SoCs in the same family where
clocking may be different.  Drivers that can remain ignorant of the
underlying clocking (and power domain layout) are much more portable.

Kevin

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 4/6] ARM: move SH-mobile runtime PM to arm/common for sharing with other platforms
  2011-04-07  0:02   ` Kevin Hilman
  (?)
@ 2011-04-07 16:56     ` Paul Mundt
  -1 siblings, 0 replies; 66+ messages in thread
From: Paul Mundt @ 2011-04-07 16:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Apr 06, 2011 at 05:02:47PM -0700, Kevin Hilman wrote:
> There is really nothing SH-mobile specific about this runtime PM
> implementation.  Any platform wanting to implement runtime PM based on
> simple clock gating can use this implementation.
> 
> Signed-off-by: Kevin Hilman <khilman@ti.com>

This observation is wholly architecture agnostic, so it's not clear that
keeping it in arch/arm/common is any better. It seems that this would be
better suited for drivers/base/power/ with a generic Kconfig symbol.

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 4/6] ARM: move SH-mobile runtime PM to arm/common for sharing with other platforms
@ 2011-04-07 16:56     ` Paul Mundt
  0 siblings, 0 replies; 66+ messages in thread
From: Paul Mundt @ 2011-04-07 16:56 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: linux-arm-kernel, linux-omap, linux-sh, linux-kernel,
	Magnus Damm, Rafael J. Wysocki, Grant Likely, Greg Kroah-Hartman

On Wed, Apr 06, 2011 at 05:02:47PM -0700, Kevin Hilman wrote:
> There is really nothing SH-mobile specific about this runtime PM
> implementation.  Any platform wanting to implement runtime PM based on
> simple clock gating can use this implementation.
> 
> Signed-off-by: Kevin Hilman <khilman@ti.com>

This observation is wholly architecture agnostic, so it's not clear that
keeping it in arch/arm/common is any better. It seems that this would be
better suited for drivers/base/power/ with a generic Kconfig symbol.

^ permalink raw reply	[flat|nested] 66+ messages in thread

* [PATCH/RFC 4/6] ARM: move SH-mobile runtime PM to arm/common for sharing with other platforms
@ 2011-04-07 16:56     ` Paul Mundt
  0 siblings, 0 replies; 66+ messages in thread
From: Paul Mundt @ 2011-04-07 16:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Apr 06, 2011 at 05:02:47PM -0700, Kevin Hilman wrote:
> There is really nothing SH-mobile specific about this runtime PM
> implementation.  Any platform wanting to implement runtime PM based on
> simple clock gating can use this implementation.
> 
> Signed-off-by: Kevin Hilman <khilman@ti.com>

This observation is wholly architecture agnostic, so it's not clear that
keeping it in arch/arm/common is any better. It seems that this would be
better suited for drivers/base/power/ with a generic Kconfig symbol.

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 4/6] ARM: move SH-mobile runtime PM to arm/common for sharing with other platforms
  2011-04-07 16:56     ` Paul Mundt
  (?)
@ 2011-04-07 17:08       ` Kevin Hilman
  -1 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07 17:08 UTC (permalink / raw)
  To: linux-arm-kernel

Paul Mundt <lethal@linux-sh.org> writes:

> On Wed, Apr 06, 2011 at 05:02:47PM -0700, Kevin Hilman wrote:
>> There is really nothing SH-mobile specific about this runtime PM
>> implementation.  Any platform wanting to implement runtime PM based on
>> simple clock gating can use this implementation.
>> 
>> Signed-off-by: Kevin Hilman <khilman@ti.com>
>
> This observation is wholly architecture agnostic, so it's not clear that
> keeping it in arch/arm/common is any better. It seems that this would be
> better suited for drivers/base/power/ with a generic Kconfig symbol.

Sounds fine to me.

Thanks for the review,

Kevin

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 4/6] ARM: move SH-mobile runtime PM to arm/common for sharing with other platforms
@ 2011-04-07 17:08       ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07 17:08 UTC (permalink / raw)
  To: Paul Mundt
  Cc: linux-arm-kernel, linux-omap, linux-sh, linux-kernel,
	Magnus Damm, Rafael J. Wysocki, Grant Likely, Greg Kroah-Hartman

Paul Mundt <lethal@linux-sh.org> writes:

> On Wed, Apr 06, 2011 at 05:02:47PM -0700, Kevin Hilman wrote:
>> There is really nothing SH-mobile specific about this runtime PM
>> implementation.  Any platform wanting to implement runtime PM based on
>> simple clock gating can use this implementation.
>> 
>> Signed-off-by: Kevin Hilman <khilman@ti.com>
>
> This observation is wholly architecture agnostic, so it's not clear that
> keeping it in arch/arm/common is any better. It seems that this would be
> better suited for drivers/base/power/ with a generic Kconfig symbol.

Sounds fine to me.

Thanks for the review,

Kevin

^ permalink raw reply	[flat|nested] 66+ messages in thread

* [PATCH/RFC 4/6] ARM: move SH-mobile runtime PM to arm/common for sharing with other platforms
@ 2011-04-07 17:08       ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07 17:08 UTC (permalink / raw)
  To: linux-arm-kernel

Paul Mundt <lethal@linux-sh.org> writes:

> On Wed, Apr 06, 2011 at 05:02:47PM -0700, Kevin Hilman wrote:
>> There is really nothing SH-mobile specific about this runtime PM
>> implementation.  Any platform wanting to implement runtime PM based on
>> simple clock gating can use this implementation.
>> 
>> Signed-off-by: Kevin Hilman <khilman@ti.com>
>
> This observation is wholly architecture agnostic, so it's not clear that
> keeping it in arch/arm/common is any better. It seems that this would be
> better suited for drivers/base/power/ with a generic Kconfig symbol.

Sounds fine to me.

Thanks for the review,

Kevin

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
  2011-04-07 14:58     ` Kevin Hilman
  (?)
@ 2011-04-07 17:17       ` Kevin Hilman
  -1 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07 17:17 UTC (permalink / raw)
  To: linux-arm-kernel

Kevin Hilman <khilman@ti.com> writes:

[...]

> Replacing the PM ops for all devices was done on OMAP and SH-mobile
> because that was the only approach we had.  Now that we have device
> power domains (thanks Rafael!), we can be more selective about which
> devices to apply them to.
>
> Note that my RFC patch/series did not do the selective part of deciding
> which devices to override and which ones not to, that part will be
> platform specific.  

Actually, thinking about this a little more, my patch actually does
select only relevant devices, and not *all* platform devices.

In my patch, the device power domain pointers are only added for devices
where a clk_get() actually succeeds.  In the original version, the
runtime PM hooks are overridden for *all* platform devices, but ones
that have no clock (or where clk_get() failed) have the additional
overhead of still calling the custom PM ops, but the custom ops have
nothing to do.

Kevin


^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
@ 2011-04-07 17:17       ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07 17:17 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: linux-arm-kernel, linux-omap, linux-sh, linux-kernel,
	Magnus Damm, Grant Likely, Greg Kroah-Hartman,
	Linux-pm mailing list

Kevin Hilman <khilman@ti.com> writes:

[...]

> Replacing the PM ops for all devices was done on OMAP and SH-mobile
> because that was the only approach we had.  Now that we have device
> power domains (thanks Rafael!), we can be more selective about which
> devices to apply them to.
>
> Note that my RFC patch/series did not do the selective part of deciding
> which devices to override and which ones not to, that part will be
> platform specific.  

Actually, thinking about this a little more, my patch actually does
select only relevant devices, and not *all* platform devices.

In my patch, the device power domain pointers are only added for devices
where a clk_get() actually succeeds.  In the original version, the
runtime PM hooks are overridden for *all* platform devices, but ones
that have no clock (or where clk_get() failed) have the additional
overhead of still calling the custom PM ops, but the custom ops have
nothing to do.

Kevin


^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
  2011-04-07 14:58     ` Kevin Hilman
                       ` (2 preceding siblings ...)
  (?)
@ 2011-04-07 17:17     ` Kevin Hilman
  -1 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07 17:17 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: linux-sh, Greg Kroah-Hartman, linux-kernel, Grant Likely,
	Linux-pm mailing list, linux-omap, linux-arm-kernel

Kevin Hilman <khilman@ti.com> writes:

[...]

> Replacing the PM ops for all devices was done on OMAP and SH-mobile
> because that was the only approach we had.  Now that we have device
> power domains (thanks Rafael!), we can be more selective about which
> devices to apply them to.
>
> Note that my RFC patch/series did not do the selective part of deciding
> which devices to override and which ones not to, that part will be
> platform specific.  

Actually, thinking about this a little more, my patch actually does
select only relevant devices, and not *all* platform devices.

In my patch, the device power domain pointers are only added for devices
where a clk_get() actually succeeds.  In the original version, the
runtime PM hooks are overridden for *all* platform devices, but ones
that have no clock (or where clk_get() failed) have the additional
overhead of still calling the custom PM ops, but the custom ops have
nothing to do.

Kevin

^ permalink raw reply	[flat|nested] 66+ messages in thread

* [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
@ 2011-04-07 17:17       ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-07 17:17 UTC (permalink / raw)
  To: linux-arm-kernel

Kevin Hilman <khilman@ti.com> writes:

[...]

> Replacing the PM ops for all devices was done on OMAP and SH-mobile
> because that was the only approach we had.  Now that we have device
> power domains (thanks Rafael!), we can be more selective about which
> devices to apply them to.
>
> Note that my RFC patch/series did not do the selective part of deciding
> which devices to override and which ones not to, that part will be
> platform specific.  

Actually, thinking about this a little more, my patch actually does
select only relevant devices, and not *all* platform devices.

In my patch, the device power domain pointers are only added for devices
where a clk_get() actually succeeds.  In the original version, the
runtime PM hooks are overridden for *all* platform devices, but ones
that have no clock (or where clk_get() failed) have the additional
overhead of still calling the custom PM ops, but the custom ops have
nothing to do.

Kevin

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
  2011-04-07 17:17       ` Kevin Hilman
  (?)
@ 2011-04-07 22:31         ` Rafael J. Wysocki
  -1 siblings, 0 replies; 66+ messages in thread
From: Rafael J. Wysocki @ 2011-04-07 22:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday, April 07, 2011, Kevin Hilman wrote:
> Kevin Hilman <khilman@ti.com> writes:
> 
> [...]
> 
> > Replacing the PM ops for all devices was done on OMAP and SH-mobile
> > because that was the only approach we had.  Now that we have device
> > power domains (thanks Rafael!), we can be more selective about which
> > devices to apply them to.
> >
> > Note that my RFC patch/series did not do the selective part of deciding
> > which devices to override and which ones not to, that part will be
> > platform specific.  
> 
> Actually, thinking about this a little more, my patch actually does
> select only relevant devices, and not *all* platform devices.
> 
> In my patch, the device power domain pointers are only added for devices
> where a clk_get() actually succeeds.  In the original version, the
> runtime PM hooks are overridden for *all* platform devices, but ones
> that have no clock (or where clk_get() failed) have the additional
> overhead of still calling the custom PM ops, but the custom ops have
> nothing to do.

As I wrote in another message to Grant, the problem basically is that
the platform bus type behavior is not the desirable one.  Namely, I don't
generally want device driver callbacks to be invoked until we know that
power will be removed from the devices.  However, the platform bus type
executes driver callbacks automatically if they exist.  This currently is
unavoidable, because power domain callbacks are executed in addition to and
not instead the bus type callbacks.

We've discussed that a bit at the LF Collab Summit with Grant and Paul and
the conclusion is that to address this particular problem we'll need to change
the core so that if there is a power domain for the given device, the
power domain callbacks will be executed first and if they return a specific
error code, the core will execute the bus type callbacks.  For devices that
don't belong to any power domain, the bus type callbacks will be executed
(which is the current behavior).

I'm going to post a patch along these lines early next week.  Then, we
can simply move the management of device clocks, the execution of device
driver callbacks and the power removal into power domain callbacks.

At that point it may be possible to share some code between shmobile and
OMAP, but I'm not sure yet how much of the code may be shared and it what
way exactly.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
@ 2011-04-07 22:31         ` Rafael J. Wysocki
  0 siblings, 0 replies; 66+ messages in thread
From: Rafael J. Wysocki @ 2011-04-07 22:31 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: linux-arm-kernel, linux-omap, linux-sh, linux-kernel,
	Magnus Damm, Grant Likely, Greg Kroah-Hartman,
	Linux-pm mailing list, Paul Mundt

On Thursday, April 07, 2011, Kevin Hilman wrote:
> Kevin Hilman <khilman@ti.com> writes:
> 
> [...]
> 
> > Replacing the PM ops for all devices was done on OMAP and SH-mobile
> > because that was the only approach we had.  Now that we have device
> > power domains (thanks Rafael!), we can be more selective about which
> > devices to apply them to.
> >
> > Note that my RFC patch/series did not do the selective part of deciding
> > which devices to override and which ones not to, that part will be
> > platform specific.  
> 
> Actually, thinking about this a little more, my patch actually does
> select only relevant devices, and not *all* platform devices.
> 
> In my patch, the device power domain pointers are only added for devices
> where a clk_get() actually succeeds.  In the original version, the
> runtime PM hooks are overridden for *all* platform devices, but ones
> that have no clock (or where clk_get() failed) have the additional
> overhead of still calling the custom PM ops, but the custom ops have
> nothing to do.

As I wrote in another message to Grant, the problem basically is that
the platform bus type behavior is not the desirable one.  Namely, I don't
generally want device driver callbacks to be invoked until we know that
power will be removed from the devices.  However, the platform bus type
executes driver callbacks automatically if they exist.  This currently is
unavoidable, because power domain callbacks are executed in addition to and
not instead the bus type callbacks.

We've discussed that a bit at the LF Collab Summit with Grant and Paul and
the conclusion is that to address this particular problem we'll need to change
the core so that if there is a power domain for the given device, the
power domain callbacks will be executed first and if they return a specific
error code, the core will execute the bus type callbacks.  For devices that
don't belong to any power domain, the bus type callbacks will be executed
(which is the current behavior).

I'm going to post a patch along these lines early next week.  Then, we
can simply move the management of device clocks, the execution of device
driver callbacks and the power removal into power domain callbacks.

At that point it may be possible to share some code between shmobile and
OMAP, but I'm not sure yet how much of the code may be shared and it what
way exactly.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
  2011-04-07 17:17       ` Kevin Hilman
  (?)
  (?)
@ 2011-04-07 22:31       ` Rafael J. Wysocki
  -1 siblings, 0 replies; 66+ messages in thread
From: Rafael J. Wysocki @ 2011-04-07 22:31 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: linux-sh, Greg Kroah-Hartman, linux-kernel, Grant Likely,
	Linux-pm mailing list, linux-omap, linux-arm-kernel

On Thursday, April 07, 2011, Kevin Hilman wrote:
> Kevin Hilman <khilman@ti.com> writes:
> 
> [...]
> 
> > Replacing the PM ops for all devices was done on OMAP and SH-mobile
> > because that was the only approach we had.  Now that we have device
> > power domains (thanks Rafael!), we can be more selective about which
> > devices to apply them to.
> >
> > Note that my RFC patch/series did not do the selective part of deciding
> > which devices to override and which ones not to, that part will be
> > platform specific.  
> 
> Actually, thinking about this a little more, my patch actually does
> select only relevant devices, and not *all* platform devices.
> 
> In my patch, the device power domain pointers are only added for devices
> where a clk_get() actually succeeds.  In the original version, the
> runtime PM hooks are overridden for *all* platform devices, but ones
> that have no clock (or where clk_get() failed) have the additional
> overhead of still calling the custom PM ops, but the custom ops have
> nothing to do.

As I wrote in another message to Grant, the problem basically is that
the platform bus type behavior is not the desirable one.  Namely, I don't
generally want device driver callbacks to be invoked until we know that
power will be removed from the devices.  However, the platform bus type
executes driver callbacks automatically if they exist.  This currently is
unavoidable, because power domain callbacks are executed in addition to and
not instead the bus type callbacks.

We've discussed that a bit at the LF Collab Summit with Grant and Paul and
the conclusion is that to address this particular problem we'll need to change
the core so that if there is a power domain for the given device, the
power domain callbacks will be executed first and if they return a specific
error code, the core will execute the bus type callbacks.  For devices that
don't belong to any power domain, the bus type callbacks will be executed
(which is the current behavior).

I'm going to post a patch along these lines early next week.  Then, we
can simply move the management of device clocks, the execution of device
driver callbacks and the power removal into power domain callbacks.

At that point it may be possible to share some code between shmobile and
OMAP, but I'm not sure yet how much of the code may be shared and it what
way exactly.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 66+ messages in thread

* [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
@ 2011-04-07 22:31         ` Rafael J. Wysocki
  0 siblings, 0 replies; 66+ messages in thread
From: Rafael J. Wysocki @ 2011-04-07 22:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday, April 07, 2011, Kevin Hilman wrote:
> Kevin Hilman <khilman@ti.com> writes:
> 
> [...]
> 
> > Replacing the PM ops for all devices was done on OMAP and SH-mobile
> > because that was the only approach we had.  Now that we have device
> > power domains (thanks Rafael!), we can be more selective about which
> > devices to apply them to.
> >
> > Note that my RFC patch/series did not do the selective part of deciding
> > which devices to override and which ones not to, that part will be
> > platform specific.  
> 
> Actually, thinking about this a little more, my patch actually does
> select only relevant devices, and not *all* platform devices.
> 
> In my patch, the device power domain pointers are only added for devices
> where a clk_get() actually succeeds.  In the original version, the
> runtime PM hooks are overridden for *all* platform devices, but ones
> that have no clock (or where clk_get() failed) have the additional
> overhead of still calling the custom PM ops, but the custom ops have
> nothing to do.

As I wrote in another message to Grant, the problem basically is that
the platform bus type behavior is not the desirable one.  Namely, I don't
generally want device driver callbacks to be invoked until we know that
power will be removed from the devices.  However, the platform bus type
executes driver callbacks automatically if they exist.  This currently is
unavoidable, because power domain callbacks are executed in addition to and
not instead the bus type callbacks.

We've discussed that a bit at the LF Collab Summit with Grant and Paul and
the conclusion is that to address this particular problem we'll need to change
the core so that if there is a power domain for the given device, the
power domain callbacks will be executed first and if they return a specific
error code, the core will execute the bus type callbacks.  For devices that
don't belong to any power domain, the bus type callbacks will be executed
(which is the current behavior).

I'm going to post a patch along these lines early next week.  Then, we
can simply move the management of device clocks, the execution of device
driver callbacks and the power removal into power domain callbacks.

At that point it may be possible to share some code between shmobile and
OMAP, but I'm not sure yet how much of the code may be shared and it what
way exactly.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 4/6] ARM: move SH-mobile runtime PM to arm/common for sharing with other platforms
  2011-04-07 17:08       ` Kevin Hilman
  (?)
@ 2011-04-07 22:35         ` Rafael J. Wysocki
  -1 siblings, 0 replies; 66+ messages in thread
From: Rafael J. Wysocki @ 2011-04-07 22:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday, April 07, 2011, Kevin Hilman wrote:
> Paul Mundt <lethal@linux-sh.org> writes:
> 
> > On Wed, Apr 06, 2011 at 05:02:47PM -0700, Kevin Hilman wrote:
> >> There is really nothing SH-mobile specific about this runtime PM
> >> implementation.  Any platform wanting to implement runtime PM based on
> >> simple clock gating can use this implementation.
> >> 
> >> Signed-off-by: Kevin Hilman <khilman@ti.com>
> >
> > This observation is wholly architecture agnostic, so it's not clear that
> > keeping it in arch/arm/common is any better. It seems that this would be
> > better suited for drivers/base/power/ with a generic Kconfig symbol.
> 
> Sounds fine to me.

Well, what platforms is the clock framework available on?

Rafael

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 4/6] ARM: move SH-mobile runtime PM to arm/common for sharing with other platforms
@ 2011-04-07 22:35         ` Rafael J. Wysocki
  0 siblings, 0 replies; 66+ messages in thread
From: Rafael J. Wysocki @ 2011-04-07 22:35 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: Paul Mundt, linux-arm-kernel, linux-omap, linux-sh, linux-kernel,
	Magnus Damm, Grant Likely, Greg Kroah-Hartman

On Thursday, April 07, 2011, Kevin Hilman wrote:
> Paul Mundt <lethal@linux-sh.org> writes:
> 
> > On Wed, Apr 06, 2011 at 05:02:47PM -0700, Kevin Hilman wrote:
> >> There is really nothing SH-mobile specific about this runtime PM
> >> implementation.  Any platform wanting to implement runtime PM based on
> >> simple clock gating can use this implementation.
> >> 
> >> Signed-off-by: Kevin Hilman <khilman@ti.com>
> >
> > This observation is wholly architecture agnostic, so it's not clear that
> > keeping it in arch/arm/common is any better. It seems that this would be
> > better suited for drivers/base/power/ with a generic Kconfig symbol.
> 
> Sounds fine to me.

Well, what platforms is the clock framework available on?

Rafael

^ permalink raw reply	[flat|nested] 66+ messages in thread

* [PATCH/RFC 4/6] ARM: move SH-mobile runtime PM to arm/common for sharing with other platforms
@ 2011-04-07 22:35         ` Rafael J. Wysocki
  0 siblings, 0 replies; 66+ messages in thread
From: Rafael J. Wysocki @ 2011-04-07 22:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday, April 07, 2011, Kevin Hilman wrote:
> Paul Mundt <lethal@linux-sh.org> writes:
> 
> > On Wed, Apr 06, 2011 at 05:02:47PM -0700, Kevin Hilman wrote:
> >> There is really nothing SH-mobile specific about this runtime PM
> >> implementation.  Any platform wanting to implement runtime PM based on
> >> simple clock gating can use this implementation.
> >> 
> >> Signed-off-by: Kevin Hilman <khilman@ti.com>
> >
> > This observation is wholly architecture agnostic, so it's not clear that
> > keeping it in arch/arm/common is any better. It seems that this would be
> > better suited for drivers/base/power/ with a generic Kconfig symbol.
> 
> Sounds fine to me.

Well, what platforms is the clock framework available on?

Rafael

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
  2011-04-07 22:31         ` Rafael J. Wysocki
  (?)
@ 2011-04-08  0:32           ` Kevin Hilman
  -1 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-08  0:32 UTC (permalink / raw)
  To: linux-arm-kernel

"Rafael J. Wysocki" <rjw@suse.com> writes:

> On Thursday, April 07, 2011, Kevin Hilman wrote:
>> Kevin Hilman <khilman@ti.com> writes:
>> 
>> [...]
>> 
>> > Replacing the PM ops for all devices was done on OMAP and SH-mobile
>> > because that was the only approach we had.  Now that we have device
>> > power domains (thanks Rafael!), we can be more selective about which
>> > devices to apply them to.
>> >
>> > Note that my RFC patch/series did not do the selective part of deciding
>> > which devices to override and which ones not to, that part will be
>> > platform specific.  
>> 
>> Actually, thinking about this a little more, my patch actually does
>> select only relevant devices, and not *all* platform devices.
>> 
>> In my patch, the device power domain pointers are only added for devices
>> where a clk_get() actually succeeds.  In the original version, the
>> runtime PM hooks are overridden for *all* platform devices, but ones
>> that have no clock (or where clk_get() failed) have the additional
>> overhead of still calling the custom PM ops, but the custom ops have
>> nothing to do.
>
> As I wrote in another message to Grant, the problem basically is that
> the platform bus type behavior is not the desirable one.  Namely, I don't
> generally want device driver callbacks to be invoked until we know that
> power will be removed from the devices.  

Ah, I didn't know that was a goal.  I totally agree there.

> However, the platform bus type executes driver callbacks automatically
> if they exist.  This currently is unavoidable, because power domain
> callbacks are executed in addition to and not instead the bus type
> callbacks.
>
> We've discussed that a bit at the LF Collab Summit with Grant and Paul and
> the conclusion is that to address this particular problem we'll need to change
> the core so that if there is a power domain for the given device, the
> power domain callbacks will be executed first and if they return a specific
> error code, the core will execute the bus type callbacks.  For devices that
> don't belong to any power domain, the bus type callbacks will be executed
> (which is the current behavior).
>
> I'm going to post a patch along these lines early next week.  Then, we
> can simply move the management of device clocks, the execution of device
> driver callbacks and the power removal into power domain callbacks.

Sounds good to me.

> At that point it may be possible to share some code between shmobile and
> OMAP, but I'm not sure yet how much of the code may be shared and it what
> way exactly.

I'll have a look again after you post your series, but I'm pretty sure
any runtime PM implementation based on basic clock gating could be
shared.  Basically, the idea is in the absence of real power domains, to
create a default "virtual" powerdomain that contains every device with a
clock.  This would capture all on-chip devices into a single power domain.
The device powerdomain callbacks for these would do the basic clock
gating (as is done in mach-shmobile/pm_runtime.c).

Kevin

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
@ 2011-04-08  0:32           ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-08  0:32 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: linux-arm-kernel, linux-omap, linux-sh, linux-kernel,
	Magnus Damm, Grant Likely, Greg Kroah-Hartman,
	Linux-pm mailing list, Paul Mundt

"Rafael J. Wysocki" <rjw@suse.com> writes:

> On Thursday, April 07, 2011, Kevin Hilman wrote:
>> Kevin Hilman <khilman@ti.com> writes:
>> 
>> [...]
>> 
>> > Replacing the PM ops for all devices was done on OMAP and SH-mobile
>> > because that was the only approach we had.  Now that we have device
>> > power domains (thanks Rafael!), we can be more selective about which
>> > devices to apply them to.
>> >
>> > Note that my RFC patch/series did not do the selective part of deciding
>> > which devices to override and which ones not to, that part will be
>> > platform specific.  
>> 
>> Actually, thinking about this a little more, my patch actually does
>> select only relevant devices, and not *all* platform devices.
>> 
>> In my patch, the device power domain pointers are only added for devices
>> where a clk_get() actually succeeds.  In the original version, the
>> runtime PM hooks are overridden for *all* platform devices, but ones
>> that have no clock (or where clk_get() failed) have the additional
>> overhead of still calling the custom PM ops, but the custom ops have
>> nothing to do.
>
> As I wrote in another message to Grant, the problem basically is that
> the platform bus type behavior is not the desirable one.  Namely, I don't
> generally want device driver callbacks to be invoked until we know that
> power will be removed from the devices.  

Ah, I didn't know that was a goal.  I totally agree there.

> However, the platform bus type executes driver callbacks automatically
> if they exist.  This currently is unavoidable, because power domain
> callbacks are executed in addition to and not instead the bus type
> callbacks.
>
> We've discussed that a bit at the LF Collab Summit with Grant and Paul and
> the conclusion is that to address this particular problem we'll need to change
> the core so that if there is a power domain for the given device, the
> power domain callbacks will be executed first and if they return a specific
> error code, the core will execute the bus type callbacks.  For devices that
> don't belong to any power domain, the bus type callbacks will be executed
> (which is the current behavior).
>
> I'm going to post a patch along these lines early next week.  Then, we
> can simply move the management of device clocks, the execution of device
> driver callbacks and the power removal into power domain callbacks.

Sounds good to me.

> At that point it may be possible to share some code between shmobile and
> OMAP, but I'm not sure yet how much of the code may be shared and it what
> way exactly.

I'll have a look again after you post your series, but I'm pretty sure
any runtime PM implementation based on basic clock gating could be
shared.  Basically, the idea is in the absence of real power domains, to
create a default "virtual" powerdomain that contains every device with a
clock.  This would capture all on-chip devices into a single power domain.
The device powerdomain callbacks for these would do the basic clock
gating (as is done in mach-shmobile/pm_runtime.c).

Kevin

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
  2011-04-07 22:31         ` Rafael J. Wysocki
  (?)
  (?)
@ 2011-04-08  0:32         ` Kevin Hilman
  -1 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-08  0:32 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: linux-sh, Greg Kroah-Hartman, linux-kernel, Grant Likely,
	Linux-pm mailing list, linux-omap, linux-arm-kernel

"Rafael J. Wysocki" <rjw@suse.com> writes:

> On Thursday, April 07, 2011, Kevin Hilman wrote:
>> Kevin Hilman <khilman@ti.com> writes:
>> 
>> [...]
>> 
>> > Replacing the PM ops for all devices was done on OMAP and SH-mobile
>> > because that was the only approach we had.  Now that we have device
>> > power domains (thanks Rafael!), we can be more selective about which
>> > devices to apply them to.
>> >
>> > Note that my RFC patch/series did not do the selective part of deciding
>> > which devices to override and which ones not to, that part will be
>> > platform specific.  
>> 
>> Actually, thinking about this a little more, my patch actually does
>> select only relevant devices, and not *all* platform devices.
>> 
>> In my patch, the device power domain pointers are only added for devices
>> where a clk_get() actually succeeds.  In the original version, the
>> runtime PM hooks are overridden for *all* platform devices, but ones
>> that have no clock (or where clk_get() failed) have the additional
>> overhead of still calling the custom PM ops, but the custom ops have
>> nothing to do.
>
> As I wrote in another message to Grant, the problem basically is that
> the platform bus type behavior is not the desirable one.  Namely, I don't
> generally want device driver callbacks to be invoked until we know that
> power will be removed from the devices.  

Ah, I didn't know that was a goal.  I totally agree there.

> However, the platform bus type executes driver callbacks automatically
> if they exist.  This currently is unavoidable, because power domain
> callbacks are executed in addition to and not instead the bus type
> callbacks.
>
> We've discussed that a bit at the LF Collab Summit with Grant and Paul and
> the conclusion is that to address this particular problem we'll need to change
> the core so that if there is a power domain for the given device, the
> power domain callbacks will be executed first and if they return a specific
> error code, the core will execute the bus type callbacks.  For devices that
> don't belong to any power domain, the bus type callbacks will be executed
> (which is the current behavior).
>
> I'm going to post a patch along these lines early next week.  Then, we
> can simply move the management of device clocks, the execution of device
> driver callbacks and the power removal into power domain callbacks.

Sounds good to me.

> At that point it may be possible to share some code between shmobile and
> OMAP, but I'm not sure yet how much of the code may be shared and it what
> way exactly.

I'll have a look again after you post your series, but I'm pretty sure
any runtime PM implementation based on basic clock gating could be
shared.  Basically, the idea is in the absence of real power domains, to
create a default "virtual" powerdomain that contains every device with a
clock.  This would capture all on-chip devices into a single power domain.
The device powerdomain callbacks for these would do the basic clock
gating (as is done in mach-shmobile/pm_runtime.c).

Kevin

^ permalink raw reply	[flat|nested] 66+ messages in thread

* [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations
@ 2011-04-08  0:32           ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-08  0:32 UTC (permalink / raw)
  To: linux-arm-kernel

"Rafael J. Wysocki" <rjw@suse.com> writes:

> On Thursday, April 07, 2011, Kevin Hilman wrote:
>> Kevin Hilman <khilman@ti.com> writes:
>> 
>> [...]
>> 
>> > Replacing the PM ops for all devices was done on OMAP and SH-mobile
>> > because that was the only approach we had.  Now that we have device
>> > power domains (thanks Rafael!), we can be more selective about which
>> > devices to apply them to.
>> >
>> > Note that my RFC patch/series did not do the selective part of deciding
>> > which devices to override and which ones not to, that part will be
>> > platform specific.  
>> 
>> Actually, thinking about this a little more, my patch actually does
>> select only relevant devices, and not *all* platform devices.
>> 
>> In my patch, the device power domain pointers are only added for devices
>> where a clk_get() actually succeeds.  In the original version, the
>> runtime PM hooks are overridden for *all* platform devices, but ones
>> that have no clock (or where clk_get() failed) have the additional
>> overhead of still calling the custom PM ops, but the custom ops have
>> nothing to do.
>
> As I wrote in another message to Grant, the problem basically is that
> the platform bus type behavior is not the desirable one.  Namely, I don't
> generally want device driver callbacks to be invoked until we know that
> power will be removed from the devices.  

Ah, I didn't know that was a goal.  I totally agree there.

> However, the platform bus type executes driver callbacks automatically
> if they exist.  This currently is unavoidable, because power domain
> callbacks are executed in addition to and not instead the bus type
> callbacks.
>
> We've discussed that a bit at the LF Collab Summit with Grant and Paul and
> the conclusion is that to address this particular problem we'll need to change
> the core so that if there is a power domain for the given device, the
> power domain callbacks will be executed first and if they return a specific
> error code, the core will execute the bus type callbacks.  For devices that
> don't belong to any power domain, the bus type callbacks will be executed
> (which is the current behavior).
>
> I'm going to post a patch along these lines early next week.  Then, we
> can simply move the management of device clocks, the execution of device
> driver callbacks and the power removal into power domain callbacks.

Sounds good to me.

> At that point it may be possible to share some code between shmobile and
> OMAP, but I'm not sure yet how much of the code may be shared and it what
> way exactly.

I'll have a look again after you post your series, but I'm pretty sure
any runtime PM implementation based on basic clock gating could be
shared.  Basically, the idea is in the absence of real power domains, to
create a default "virtual" powerdomain that contains every device with a
clock.  This would capture all on-chip devices into a single power domain.
The device powerdomain callbacks for these would do the basic clock
gating (as is done in mach-shmobile/pm_runtime.c).

Kevin

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 4/6] ARM: move SH-mobile runtime PM to arm/common for sharing with other platforms
  2011-04-07 22:35         ` Rafael J. Wysocki
  (?)
@ 2011-04-08  0:38           ` Kevin Hilman
  -1 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-08  0:38 UTC (permalink / raw)
  To: linux-arm-kernel

"Rafael J. Wysocki" <rjw@sisk.pl> writes:

> On Thursday, April 07, 2011, Kevin Hilman wrote:
>> Paul Mundt <lethal@linux-sh.org> writes:
>> 
>> > On Wed, Apr 06, 2011 at 05:02:47PM -0700, Kevin Hilman wrote:
>> >> There is really nothing SH-mobile specific about this runtime PM
>> >> implementation.  Any platform wanting to implement runtime PM based on
>> >> simple clock gating can use this implementation.
>> >> 
>> >> Signed-off-by: Kevin Hilman <khilman@ti.com>
>> >
>> > This observation is wholly architecture agnostic, so it's not clear that
>> > keeping it in arch/arm/common is any better. It seems that this would be
>> > better suited for drivers/base/power/ with a generic Kconfig symbol.
>> 
>> Sounds fine to me.
>
> Well, what platforms is the clock framework available on?

Well, the majority of implementations of <linux/clk.h> are certainly in
ARM, but I know it's also implemented for SH, and a quick grep shows
implementations in powerpc, mips and m68k also.

Kevin

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 4/6] ARM: move SH-mobile runtime PM to arm/common for sharing with other platforms
@ 2011-04-08  0:38           ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-08  0:38 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Paul Mundt, linux-arm-kernel, linux-omap, linux-sh, linux-kernel,
	Magnus Damm, Grant Likely, Greg Kroah-Hartman

"Rafael J. Wysocki" <rjw@sisk.pl> writes:

> On Thursday, April 07, 2011, Kevin Hilman wrote:
>> Paul Mundt <lethal@linux-sh.org> writes:
>> 
>> > On Wed, Apr 06, 2011 at 05:02:47PM -0700, Kevin Hilman wrote:
>> >> There is really nothing SH-mobile specific about this runtime PM
>> >> implementation.  Any platform wanting to implement runtime PM based on
>> >> simple clock gating can use this implementation.
>> >> 
>> >> Signed-off-by: Kevin Hilman <khilman@ti.com>
>> >
>> > This observation is wholly architecture agnostic, so it's not clear that
>> > keeping it in arch/arm/common is any better. It seems that this would be
>> > better suited for drivers/base/power/ with a generic Kconfig symbol.
>> 
>> Sounds fine to me.
>
> Well, what platforms is the clock framework available on?

Well, the majority of implementations of <linux/clk.h> are certainly in
ARM, but I know it's also implemented for SH, and a quick grep shows
implementations in powerpc, mips and m68k also.

Kevin

^ permalink raw reply	[flat|nested] 66+ messages in thread

* [PATCH/RFC 4/6] ARM: move SH-mobile runtime PM to arm/common for sharing with other platforms
@ 2011-04-08  0:38           ` Kevin Hilman
  0 siblings, 0 replies; 66+ messages in thread
From: Kevin Hilman @ 2011-04-08  0:38 UTC (permalink / raw)
  To: linux-arm-kernel

"Rafael J. Wysocki" <rjw@sisk.pl> writes:

> On Thursday, April 07, 2011, Kevin Hilman wrote:
>> Paul Mundt <lethal@linux-sh.org> writes:
>> 
>> > On Wed, Apr 06, 2011 at 05:02:47PM -0700, Kevin Hilman wrote:
>> >> There is really nothing SH-mobile specific about this runtime PM
>> >> implementation.  Any platform wanting to implement runtime PM based on
>> >> simple clock gating can use this implementation.
>> >> 
>> >> Signed-off-by: Kevin Hilman <khilman@ti.com>
>> >
>> > This observation is wholly architecture agnostic, so it's not clear that
>> > keeping it in arch/arm/common is any better. It seems that this would be
>> > better suited for drivers/base/power/ with a generic Kconfig symbol.
>> 
>> Sounds fine to me.
>
> Well, what platforms is the clock framework available on?

Well, the majority of implementations of <linux/clk.h> are certainly in
ARM, but I know it's also implemented for SH, and a quick grep shows
implementations in powerpc, mips and m68k also.

Kevin

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 4/6] ARM: move SH-mobile runtime PM to arm/common for sharing with other platforms
  2011-04-08  0:38           ` Kevin Hilman
  (?)
@ 2011-04-08  5:01             ` Paul Mundt
  -1 siblings, 0 replies; 66+ messages in thread
From: Paul Mundt @ 2011-04-08  5:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 07, 2011 at 05:38:38PM -0700, Kevin Hilman wrote:
> "Rafael J. Wysocki" <rjw@sisk.pl> writes:
> > On Thursday, April 07, 2011, Kevin Hilman wrote:
> >> Paul Mundt <lethal@linux-sh.org> writes:
> >> > This observation is wholly architecture agnostic, so it's not clear that
> >> > keeping it in arch/arm/common is any better. It seems that this would be
> >> > better suited for drivers/base/power/ with a generic Kconfig symbol.
> >> 
> >> Sounds fine to me.
> >
> > Well, what platforms is the clock framework available on?
> 
> Well, the majority of implementations of <linux/clk.h> are certainly in
> ARM, but I know it's also implemented for SH, and a quick grep shows
> implementations in powerpc, mips and m68k also.
> 
We also have CONFIG_HAVE_CLK that can be used as a dependency. In any
event, anything simply focusing on the clock bits can be completely
generic. On SH we still have these things lumped together with hwblk IDs,
but this is something we can likely transition off of with power domains.

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 4/6] ARM: move SH-mobile runtime PM to arm/common for sharing with other platforms
@ 2011-04-08  5:01             ` Paul Mundt
  0 siblings, 0 replies; 66+ messages in thread
From: Paul Mundt @ 2011-04-08  5:01 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: Rafael J. Wysocki, linux-arm-kernel, linux-omap, linux-sh,
	linux-kernel, Magnus Damm, Grant Likely, Greg Kroah-Hartman

On Thu, Apr 07, 2011 at 05:38:38PM -0700, Kevin Hilman wrote:
> "Rafael J. Wysocki" <rjw@sisk.pl> writes:
> > On Thursday, April 07, 2011, Kevin Hilman wrote:
> >> Paul Mundt <lethal@linux-sh.org> writes:
> >> > This observation is wholly architecture agnostic, so it's not clear that
> >> > keeping it in arch/arm/common is any better. It seems that this would be
> >> > better suited for drivers/base/power/ with a generic Kconfig symbol.
> >> 
> >> Sounds fine to me.
> >
> > Well, what platforms is the clock framework available on?
> 
> Well, the majority of implementations of <linux/clk.h> are certainly in
> ARM, but I know it's also implemented for SH, and a quick grep shows
> implementations in powerpc, mips and m68k also.
> 
We also have CONFIG_HAVE_CLK that can be used as a dependency. In any
event, anything simply focusing on the clock bits can be completely
generic. On SH we still have these things lumped together with hwblk IDs,
but this is something we can likely transition off of with power domains.

^ permalink raw reply	[flat|nested] 66+ messages in thread

* [PATCH/RFC 4/6] ARM: move SH-mobile runtime PM to arm/common for sharing with other platforms
@ 2011-04-08  5:01             ` Paul Mundt
  0 siblings, 0 replies; 66+ messages in thread
From: Paul Mundt @ 2011-04-08  5:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 07, 2011 at 05:38:38PM -0700, Kevin Hilman wrote:
> "Rafael J. Wysocki" <rjw@sisk.pl> writes:
> > On Thursday, April 07, 2011, Kevin Hilman wrote:
> >> Paul Mundt <lethal@linux-sh.org> writes:
> >> > This observation is wholly architecture agnostic, so it's not clear that
> >> > keeping it in arch/arm/common is any better. It seems that this would be
> >> > better suited for drivers/base/power/ with a generic Kconfig symbol.
> >> 
> >> Sounds fine to me.
> >
> > Well, what platforms is the clock framework available on?
> 
> Well, the majority of implementations of <linux/clk.h> are certainly in
> ARM, but I know it's also implemented for SH, and a quick grep shows
> implementations in powerpc, mips and m68k also.
> 
We also have CONFIG_HAVE_CLK that can be used as a dependency. In any
event, anything simply focusing on the clock bits can be completely
generic. On SH we still have these things lumped together with hwblk IDs,
but this is something we can likely transition off of with power domains.

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 2/6] OMAP2+: PM: move runtime PM implementation to use device power domains
  2011-04-07  0:02   ` Kevin Hilman
                     ` (3 preceding siblings ...)
  (?)
@ 2011-06-09 14:30   ` Sakari Ailus
  2011-06-09 16:37     ` Kevin Hilman
  -1 siblings, 1 reply; 66+ messages in thread
From: Sakari Ailus @ 2011-06-09 14:30 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: linux-omap, Laurent Pinchart, Rafael J. Wysocki, Felipe Balbi

Hi Kevin and Felipe,

Kevin Hilman wrote:
> In commit 7538e3db6e015e890825fbd9f8659952896ddd5b (PM: add support
> for device power domains) a better way for handling platform-specific
> power hooks was introduced.
> 
> Rather than using the platform_bus dev_pm_ops overrides
> (platform_bus_set_pm_ops()), this patch moves the OMAP runtime PM
> implementation over to using device power domains.
> 
> Since OMAP is the only user of platform_bus_set_pm_ops(), that
> interface can be removed (and will be in a forthcoming patch.)

I have little doubt of the correctness of the patch itself, but it
actually does break the USB on N900. I don't know PM so well that I
would have a good idea what might be going wrong here, so I'm not
certain that this is specific to the N900 either.

It looks strange to me also but I've tested it several times so I'm
fairly certain that the culprit is this very patch. :-) I'm using NFS
root and the device fails to respond to ping with the patch although it
can be clearly recognised by the host, and it also recognises the host.
It seems just that the data doesn't get through.

My .config may be found here:

<URL:http://www.retiisi.org.uk/~sakke/foo/.config>

And the respective boot logs, without and with the patch, are here:

<URL:http://www.retiisi.org.uk/~sakke/foo/boot-success.txt>
<URL:http://www.retiisi.org.uk/~sakke/foo/boot-fail.txt>

They're mostly the same.

There's no difference on host side logs either. The first connection is
with the patch, whereas the second one is without:

---
usb 5-2.1: new high speed USB device using ehci_hcd and address 42
cdc_ether 5-2.1:1.0: usb0: register 'cdc_ether' at usb-0000:00:1d.7-2.1,
CDC Ethernet Device, 0a:3b:20:fa:58:eb
device usb0 entered promiscuous mode
eth-usb: port 2(usb0) entering learning state
eth-usb: port 2(usb0) entering learning state
eth-usb: port 2(usb0) entering forwarding state
usb 5-2.1: USB disconnect, address 42
cdc_ether 5-2.1:1.0: usb0: unregister 'cdc_ether' usb-0000:00:1d.7-2.1,
CDC Ethernet Device
eth-usb: port 2(usb0) entering forwarding state
device usb0 left promiscuous mode
eth-usb: port 2(usb0) entering disabled state
usb 5-2.1: new high speed USB device using ehci_hcd and address 43
usb 5-2.1: USB disconnect, address 43
usb 5-2.1: new high speed USB device using ehci_hcd and address 44
cdc_ether 5-2.1:1.0: usb0: register 'cdc_ether' at usb-0000:00:1d.7-2.1,
CDC Ethernet Device, 4a:bc:09:bb:ba:98
device usb0 entered promiscuous mode
eth-usb: port 2(usb0) entering learning state
eth-usb: port 2(usb0) entering learning state
eth-usb: port 2(usb0) entering learning state
eth-usb: port 2(usb0) entering learning state
eth-usb: port 2(usb0) entering learning state
eth-usb: port 2(usb0) entering forwarding state
usb 5-2.1: USB disconnect, address 44
---

Any ideas?

The id of the patch in the mainline kernel is
638080c37ae08fd0c44cec13d7948ca5385ae851 .

Thanks.

> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Magnus Damm <magnus.damm@gmail.com>
> Cc: Rafael J. Wysocki <rjw@sisk.pl>
> Signed-off-by: Kevin Hilman <khilman@ti.com>
> ---
>  arch/arm/mach-omap2/Makefile     |    6 +-
>  arch/arm/mach-omap2/pm_bus.c     |   85 --------------------------------------
>  arch/arm/plat-omap/omap_device.c |   22 ++++++++++
>  3 files changed, 25 insertions(+), 88 deletions(-)
>  delete mode 100644 arch/arm/mach-omap2/pm_bus.c
> 
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> index a45cd64..b353584 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -59,10 +59,10 @@ endif
>  # Power Management
>  ifeq ($(CONFIG_PM),y)
>  obj-$(CONFIG_ARCH_OMAP2)		+= pm24xx.o
> -obj-$(CONFIG_ARCH_OMAP2)		+= sleep24xx.o pm_bus.o
> +obj-$(CONFIG_ARCH_OMAP2)		+= sleep24xx.o
>  obj-$(CONFIG_ARCH_OMAP3)		+= pm34xx.o sleep34xx.o \
> -					   cpuidle34xx.o pm_bus.o
> -obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o pm_bus.o
> +					   cpuidle34xx.o
> +obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o
>  obj-$(CONFIG_PM_DEBUG)			+= pm-debug.o
>  obj-$(CONFIG_OMAP_SMARTREFLEX)          += sr_device.o smartreflex.o
>  obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3)	+= smartreflex-class3.o
> diff --git a/arch/arm/mach-omap2/pm_bus.c b/arch/arm/mach-omap2/pm_bus.c
> deleted file mode 100644
> index 5acd2ab..0000000
> --- a/arch/arm/mach-omap2/pm_bus.c
> +++ /dev/null
> @@ -1,85 +0,0 @@
> -/*
> - * Runtime PM support code for OMAP
> - *
> - * Author: Kevin Hilman, Deep Root Systems, LLC
> - *
> - * Copyright (C) 2010 Texas Instruments, Inc.
> - *
> - * This file is licensed under the terms of the GNU General Public
> - * License version 2. This program is licensed "as is" without any
> - * warranty of any kind, whether express or implied.
> - */
> -#include <linux/init.h>
> -#include <linux/kernel.h>
> -#include <linux/io.h>
> -#include <linux/pm_runtime.h>
> -#include <linux/platform_device.h>
> -#include <linux/mutex.h>
> -
> -#include <plat/omap_device.h>
> -#include <plat/omap-pm.h>
> -
> -#ifdef CONFIG_PM_RUNTIME
> -static int omap_pm_runtime_suspend(struct device *dev)
> -{
> -	struct platform_device *pdev = to_platform_device(dev);
> -	int r, ret = 0;
> -
> -	dev_dbg(dev, "%s\n", __func__);
> -
> -	ret = pm_generic_runtime_suspend(dev);
> -
> -	if (!ret && dev->parent == &omap_device_parent) {
> -		r = omap_device_idle(pdev);
> -		WARN_ON(r);
> -	}
> -
> -	return ret;
> -};
> -
> -static int omap_pm_runtime_resume(struct device *dev)
> -{
> -	struct platform_device *pdev = to_platform_device(dev);
> -	int r;
> -
> -	dev_dbg(dev, "%s\n", __func__);
> -
> -	if (dev->parent == &omap_device_parent) {
> -		r = omap_device_enable(pdev);
> -		WARN_ON(r);
> -	}
> -
> -	return pm_generic_runtime_resume(dev);
> -};
> -#else
> -#define omap_pm_runtime_suspend NULL
> -#define omap_pm_runtime_resume NULL
> -#endif /* CONFIG_PM_RUNTIME */
> -
> -static int __init omap_pm_runtime_init(void)
> -{
> -	const struct dev_pm_ops *pm;
> -	struct dev_pm_ops *omap_pm;
> -
> -	pm = platform_bus_get_pm_ops();
> -	if (!pm) {
> -		pr_err("%s: unable to get dev_pm_ops from platform_bus\n",
> -			__func__);
> -		return -ENODEV;
> -	}
> -
> -	omap_pm = kmemdup(pm, sizeof(struct dev_pm_ops), GFP_KERNEL);
> -	if (!omap_pm) {
> -		pr_err("%s: unable to alloc memory for new dev_pm_ops\n",
> -			__func__);
> -		return -ENOMEM;
> -	}
> -
> -	omap_pm->runtime_suspend = omap_pm_runtime_suspend;
> -	omap_pm->runtime_resume = omap_pm_runtime_resume;
> -
> -	platform_bus_set_pm_ops(omap_pm);
> -
> -	return 0;
> -}
> -core_initcall(omap_pm_runtime_init);
> diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
> index 9bbda9a..93cd2fb 100644
> --- a/arch/arm/plat-omap/omap_device.c
> +++ b/arch/arm/plat-omap/omap_device.c
> @@ -536,6 +536,27 @@ int omap_early_device_register(struct omap_device *od)
>  	return 0;
>  }
>  
> +static int _od_runtime_suspend(struct device *dev)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +
> +	return omap_device_idle(pdev);
> +}
> +
> +static int _od_runtime_resume(struct device *dev)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +
> +	return omap_device_enable(pdev);
> +}
> +
> +static struct dev_power_domain omap_device_power_domain = {
> +	.ops = {
> +		.runtime_suspend = _od_runtime_suspend,
> +		.runtime_resume = _od_runtime_resume,
> +	}
> +};
> +
>  /**
>   * omap_device_register - register an omap_device with one omap_hwmod
>   * @od: struct omap_device * to register
> @@ -549,6 +570,7 @@ int omap_device_register(struct omap_device *od)
>  	pr_debug("omap_device: %s: registering\n", od->pdev.name);
>  
>  	od->pdev.dev.parent = &omap_device_parent;
> +	od->pdev.dev.pwr_domain = &omap_device_power_domain;
>  	return platform_device_register(&od->pdev);
>  }
>  


-- 
Sakari Ailus
sakari.ailus@maxwell.research.nokia.com

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: [PATCH/RFC 2/6] OMAP2+: PM: move runtime PM implementation to use device power domains
  2011-06-09 14:30   ` Sakari Ailus
@ 2011-06-09 16:37     ` Kevin Hilman
  2011-06-10  6:57       ` N900 USB fix (Was: Re: [PATCH/RFC 2/6] OMAP2+: PM: move runtime PM implementation to use device power domains) Sakari Ailus
  0 siblings, 1 reply; 66+ messages in thread
From: Kevin Hilman @ 2011-06-09 16:37 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: linux-omap, Laurent Pinchart, Rafael J. Wysocki, Felipe Balbi

Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> writes:

> Hi Kevin and Felipe,
>
> Kevin Hilman wrote:
>> In commit 7538e3db6e015e890825fbd9f8659952896ddd5b (PM: add support
>> for device power domains) a better way for handling platform-specific
>> power hooks was introduced.
>> 
>> Rather than using the platform_bus dev_pm_ops overrides
>> (platform_bus_set_pm_ops()), this patch moves the OMAP runtime PM
>> implementation over to using device power domains.
>> 
>> Since OMAP is the only user of platform_bus_set_pm_ops(), that
>> interface can be removed (and will be in a forthcoming patch.)
>
> I have little doubt of the correctness of the patch itself, but it
> actually does break the USB on N900. I don't know PM so well that I
> would have a good idea what might be going wrong here, so I'm not
> certain that this is specific to the N900 either.
>
> It looks strange to me also but I've tested it several times so I'm
> fairly certain that the culprit is this very patch. :-) 

You're correct, it's broken.

A fix has been posted (and pull req sent to Tony.)  Can you try my
for_3.0/pm-fixes branch which fixes this problem?  It's available in my
git tree:

  git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git

Thanks,

Kevin


^ permalink raw reply	[flat|nested] 66+ messages in thread

* N900 USB fix (Was: Re: [PATCH/RFC 2/6] OMAP2+: PM: move runtime PM implementation to use device power domains)
  2011-06-09 16:37     ` Kevin Hilman
@ 2011-06-10  6:57       ` Sakari Ailus
  2011-06-13  8:28         ` Jarkko Nikula
  0 siblings, 1 reply; 66+ messages in thread
From: Sakari Ailus @ 2011-06-10  6:57 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: linux-omap, Laurent Pinchart, Rafael J. Wysocki, Felipe Balbi

Kevin Hilman wrote:
> Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> writes:
> 
>> Hi Kevin and Felipe,
>>
>> Kevin Hilman wrote:
>>> In commit 7538e3db6e015e890825fbd9f8659952896ddd5b (PM: add support
>>> for device power domains) a better way for handling platform-specific
>>> power hooks was introduced.
>>>
>>> Rather than using the platform_bus dev_pm_ops overrides
>>> (platform_bus_set_pm_ops()), this patch moves the OMAP runtime PM
>>> implementation over to using device power domains.
>>>
>>> Since OMAP is the only user of platform_bus_set_pm_ops(), that
>>> interface can be removed (and will be in a forthcoming patch.)
>>
>> I have little doubt of the correctness of the patch itself, but it
>> actually does break the USB on N900. I don't know PM so well that I
>> would have a good idea what might be going wrong here, so I'm not
>> certain that this is specific to the N900 either.
>>
>> It looks strange to me also but I've tested it several times so I'm
>> fairly certain that the culprit is this very patch. :-) 
> 
> You're correct, it's broken.
> 
> A fix has been posted (and pull req sent to Tony.)  Can you try my
> for_3.0/pm-fixes branch which fixes this problem?  It's available in my
> git tree:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git

Hi, Kevin!

Many thanks to you! :-) The patches indeed fix the problem. I seem to
have used for_3.0/pm-fixes-2 branch, though. I guess that doesn't really
matter. :-)

Cheers,

-- 
Sakari Ailus
sakari.ailus@maxwell.research.nokia.com

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: N900 USB fix (Was: Re: [PATCH/RFC 2/6] OMAP2+: PM: move runtime PM implementation to use device power domains)
  2011-06-10  6:57       ` N900 USB fix (Was: Re: [PATCH/RFC 2/6] OMAP2+: PM: move runtime PM implementation to use device power domains) Sakari Ailus
@ 2011-06-13  8:28         ` Jarkko Nikula
  2011-06-13  8:46           ` Felipe Balbi
  0 siblings, 1 reply; 66+ messages in thread
From: Jarkko Nikula @ 2011-06-13  8:28 UTC (permalink / raw)
  To: Kalle Jokiniemi
  Cc: Kevin Hilman, linux-omap, Laurent Pinchart, Rafael J. Wysocki,
	Felipe Balbi, Sakari Ailus

On Fri, 10 Jun 2011 09:57:57 +0300
Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> wrote:

> > A fix has been posted (and pull req sent to Tony.)  Can you try my
> > for_3.0/pm-fixes branch which fixes this problem?  It's available in my
> > git tree:
> > 
> >   git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git
> 
> Hi, Kevin!
> 
> Many thanks to you! :-) The patches indeed fix the problem. I seem to
> have used for_3.0/pm-fixes-2 branch, though. I guess that doesn't really
> matter. :-)
> 
I was struggling also with non-working musb on N900. I traced primary
breakage to the same commit than Sakari. On top of that commit the
Kevin's fix made it working but it didn't work on top of 3.0-rc2 while
beagle was ok.

I bisected another issue to commit 10299e2 ("ARM: RX-51: Enable isp1704
power on/off").

3.0-rc2 works if I enable the CONFIG_CHARGER_ISP1704=y but do we
actually need to drive the ISP1704 into reset in
board-rx51-peripherals.c: rx51_charger_init as it breaks the musb when
the ISP1704 driver is missing and otherwise rx51_charger_set_power
should take care of ISP1704 reset control when the driver is there?

-- 
Jarkko

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: N900 USB fix (Was: Re: [PATCH/RFC 2/6] OMAP2+: PM: move runtime PM implementation to use device power domains)
  2011-06-13  8:28         ` Jarkko Nikula
@ 2011-06-13  8:46           ` Felipe Balbi
  2011-06-13  8:47             ` Felipe Balbi
  0 siblings, 1 reply; 66+ messages in thread
From: Felipe Balbi @ 2011-06-13  8:46 UTC (permalink / raw)
  To: Jarkko Nikula
  Cc: Kalle Jokiniemi, Kevin Hilman, linux-omap, Laurent Pinchart,
	Rafael J. Wysocki, Felipe Balbi, Sakari Ailus, Heikki Krogerus

[-- Attachment #1: Type: text/plain, Size: 1399 bytes --]

Hi,

On Mon, Jun 13, 2011 at 11:28:20AM +0300, Jarkko Nikula wrote:
> On Fri, 10 Jun 2011 09:57:57 +0300
> Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> wrote:
> 
> > > A fix has been posted (and pull req sent to Tony.)  Can you try my
> > > for_3.0/pm-fixes branch which fixes this problem?  It's available in my
> > > git tree:
> > > 
> > >   git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git
> > 
> > Hi, Kevin!
> > 
> > Many thanks to you! :-) The patches indeed fix the problem. I seem to
> > have used for_3.0/pm-fixes-2 branch, though. I guess that doesn't really
> > matter. :-)
> > 
> I was struggling also with non-working musb on N900. I traced primary
> breakage to the same commit than Sakari. On top of that commit the
> Kevin's fix made it working but it didn't work on top of 3.0-rc2 while
> beagle was ok.
> 
> I bisected another issue to commit 10299e2 ("ARM: RX-51: Enable isp1704
> power on/off").
> 
> 3.0-rc2 works if I enable the CONFIG_CHARGER_ISP1704=y but do we
> actually need to drive the ISP1704 into reset in
> board-rx51-peripherals.c: rx51_charger_init as it breaks the musb when
> the ISP1704 driver is missing and otherwise rx51_charger_set_power
> should take care of ISP1704 reset control when the driver is there?

You might want to ask from Heikki. He patched that part of the code.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 66+ messages in thread

* Re: N900 USB fix (Was: Re: [PATCH/RFC 2/6] OMAP2+: PM: move runtime PM implementation to use device power domains)
  2011-06-13  8:46           ` Felipe Balbi
@ 2011-06-13  8:47             ` Felipe Balbi
  0 siblings, 0 replies; 66+ messages in thread
From: Felipe Balbi @ 2011-06-13  8:47 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Jarkko Nikula, Kalle Jokiniemi, Kevin Hilman, linux-omap,
	Laurent Pinchart, Rafael J. Wysocki, Sakari Ailus,
	Heikki Krogerus

[-- Attachment #1: Type: text/plain, Size: 1571 bytes --]

Hi,

On Mon, Jun 13, 2011 at 11:46:04AM +0300, Felipe Balbi wrote:
> On Mon, Jun 13, 2011 at 11:28:20AM +0300, Jarkko Nikula wrote:
> > On Fri, 10 Jun 2011 09:57:57 +0300
> > Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> wrote:
> > 
> > > > A fix has been posted (and pull req sent to Tony.)  Can you try my
> > > > for_3.0/pm-fixes branch which fixes this problem?  It's available in my
> > > > git tree:
> > > > 
> > > >   git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git
> > > 
> > > Hi, Kevin!
> > > 
> > > Many thanks to you! :-) The patches indeed fix the problem. I seem to
> > > have used for_3.0/pm-fixes-2 branch, though. I guess that doesn't really
> > > matter. :-)
> > > 
> > I was struggling also with non-working musb on N900. I traced primary
> > breakage to the same commit than Sakari. On top of that commit the
> > Kevin's fix made it working but it didn't work on top of 3.0-rc2 while
> > beagle was ok.
> > 
> > I bisected another issue to commit 10299e2 ("ARM: RX-51: Enable isp1704
> > power on/off").
> > 
> > 3.0-rc2 works if I enable the CONFIG_CHARGER_ISP1704=y but do we
> > actually need to drive the ISP1704 into reset in
> > board-rx51-peripherals.c: rx51_charger_init as it breaks the musb when
> > the ISP1704 driver is missing and otherwise rx51_charger_set_power
> > should take care of ISP1704 reset control when the driver is there?
> 
> You might want to ask from Heikki. He patched that part of the code.

used wrong mail address for Heikki, fixing.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 66+ messages in thread

end of thread, other threads:[~2011-06-13  8:47 UTC | newest]

Thread overview: 66+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-07  0:02 [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations Kevin Hilman
2011-04-07  0:02 ` Kevin Hilman
2011-04-07  0:02 ` Kevin Hilman
2011-04-07  0:02 ` [PATCH/RFC 1/6] ARM: sh-mobile: runtime PM: convert to device powerdomains Kevin Hilman
2011-04-07  0:02   ` Kevin Hilman
2011-04-07  0:02   ` Kevin Hilman
2011-04-07  0:02 ` [PATCH/RFC 2/6] OMAP2+: PM: move runtime PM implementation to use device power domains Kevin Hilman
2011-04-07  0:02   ` Kevin Hilman
2011-04-07  0:02   ` Kevin Hilman
2011-04-07  0:02   ` Kevin Hilman
2011-04-07  5:49   ` [PATCH/RFC 2/6] OMAP2+: PM: move runtime PM implementation to Grant Likely
2011-04-07  5:49     ` [PATCH/RFC 2/6] OMAP2+: PM: move runtime PM implementation to use device power domains Grant Likely
2011-04-07  5:49     ` Grant Likely
2011-06-09 14:30   ` Sakari Ailus
2011-06-09 16:37     ` Kevin Hilman
2011-06-10  6:57       ` N900 USB fix (Was: Re: [PATCH/RFC 2/6] OMAP2+: PM: move runtime PM implementation to use device power domains) Sakari Ailus
2011-06-13  8:28         ` Jarkko Nikula
2011-06-13  8:46           ` Felipe Balbi
2011-06-13  8:47             ` Felipe Balbi
2011-04-07  0:02 ` [PATCH/RFC 3/6] OMAP1: runtime PM: drop platform bus implementation Kevin Hilman
2011-04-07  0:02   ` Kevin Hilman
2011-04-07  0:02   ` Kevin Hilman
2011-04-07  0:02   ` Kevin Hilman
2011-04-07  0:02 ` [PATCH/RFC 4/6] ARM: move SH-mobile runtime PM to arm/common for sharing with other platforms Kevin Hilman
2011-04-07  0:02   ` Kevin Hilman
2011-04-07  0:02   ` Kevin Hilman
2011-04-07 16:56   ` Paul Mundt
2011-04-07 16:56     ` Paul Mundt
2011-04-07 16:56     ` Paul Mundt
2011-04-07 17:08     ` Kevin Hilman
2011-04-07 17:08       ` Kevin Hilman
2011-04-07 17:08       ` Kevin Hilman
2011-04-07 22:35       ` Rafael J. Wysocki
2011-04-07 22:35         ` Rafael J. Wysocki
2011-04-07 22:35         ` Rafael J. Wysocki
2011-04-08  0:38         ` Kevin Hilman
2011-04-08  0:38           ` Kevin Hilman
2011-04-08  0:38           ` Kevin Hilman
2011-04-08  5:01           ` Paul Mundt
2011-04-08  5:01             ` Paul Mundt
2011-04-08  5:01             ` Paul Mundt
2011-04-07  0:02 ` [PATCH/RFC 5/6] ARM: use common clock-based runtime PM implementation on SH-mobile & OMAP1 Kevin Hilman
2011-04-07  0:02   ` Kevin Hilman
2011-04-07  0:02   ` Kevin Hilman
2011-04-07  0:02 ` [PATCH/RFC 6/6] Revert "driver core: platform_bus: allow runtime override of dev_pm_ops" Kevin Hilman
2011-04-07  0:02   ` Kevin Hilman
2011-04-07  0:02   ` Kevin Hilman
2011-04-07  5:38 ` [PATCH/RFC 0/6] ARM: runtime PM: consolidate runtime PM implementations Rafael J. Wysocki
2011-04-07  5:38   ` Rafael J. Wysocki
2011-04-07  5:38   ` Rafael J. Wysocki
2011-04-07 14:58   ` Kevin Hilman
2011-04-07 14:58     ` Kevin Hilman
2011-04-07 14:58     ` Kevin Hilman
2011-04-07 17:17     ` Kevin Hilman
2011-04-07 17:17       ` Kevin Hilman
2011-04-07 17:17       ` Kevin Hilman
2011-04-07 22:31       ` Rafael J. Wysocki
2011-04-07 22:31       ` Rafael J. Wysocki
2011-04-07 22:31         ` Rafael J. Wysocki
2011-04-07 22:31         ` Rafael J. Wysocki
2011-04-08  0:32         ` Kevin Hilman
2011-04-08  0:32         ` Kevin Hilman
2011-04-08  0:32           ` Kevin Hilman
2011-04-08  0:32           ` Kevin Hilman
2011-04-07 17:17     ` Kevin Hilman
2011-04-07 14:58   ` Kevin Hilman

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.