* [PATCH 0/12] PM: Make ARM/shmobile PM domains initialization more straightforward
@ 2012-08-06 23:05 Rafael J. Wysocki
2012-08-06 23:06 ` [PATCH 1/12] PM / Domains: Make it possible to use domain names when adding devices Rafael J. Wysocki
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2012-08-06 23:05 UTC (permalink / raw)
To: Linux-sh list; +Cc: LKML, Linux PM list, Magnus Damm
Hi all,
The majority of patches in this series were sent previously in this RFC:
http://marc.info/?l=linux-pm&m\x134247432010192&w=4
but they do not have anything to do with DTs and clean up the code quite
a bit, so I thought they are worth resending in a different context.
Patch [8/12] is new and replaces a patch that removed some code I thought
could never be used, which was wrong.
[1/12] - Make it possible to use domain names for adding devices to PM domains.
[2/12] - Make ARM/shmobile use domain names for adding devices to PM domains.
[3/12] - Drop the r8a7779's "add device to domain" function.
[4/12] - Make it possible to use domain names for adding subdomains to PM domains.
[5/12] - Make ARM/shmobile use domain names for adding subdomains to PM domains.
[6/12] - Add ARM/shmobile function for "batch" initialization of PM domains.
[7/12] - Make it possible to power on a PM domain using its name.
[8/12] - Avoid accessing A4S internals directly in the SH7372 system suspend code.
[9/12] - Put SH7372 PM domain objects into a table and initialize them in a loop.
[10/12] - Put R8A7740 PM domain objects into a table and initialize them in a loop.
[11/12] - Put R8A7779 PM domain objects into a table and initialize them in a loop.
[12/12] - Unexport rmobile_init_pm_domain() which may be a static function now.
The present series is on top of this patch set sent yesterday:
http://marc.info/?l=linux-pm&m\x134421084022735&w=4
Thanks,
Rafael
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/12] PM / Domains: Make it possible to use domain names when adding devices
2012-08-06 23:05 [PATCH 0/12] PM: Make ARM/shmobile PM domains initialization more straightforward Rafael J. Wysocki
@ 2012-08-06 23:06 ` Rafael J. Wysocki
2012-08-06 23:07 ` [PATCH 2/12] ARM: shmobile: Use names of power domains for adding devices to them Rafael J. Wysocki
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2012-08-06 23:06 UTC (permalink / raw)
To: Linux-sh list; +Cc: LKML, Linux PM list, Magnus Damm
Add a new helper function __pm_genpd_name_add_device() allowing
a device to be added to a (registered) generic PM domain identified
by name. Add a wrapper around it, pm_genpd_name_add_device(),
passing NULL as the last argument and reorganize pm_domains.h for the
new functions to be defined consistently with the existing ones.
These functions are useful for adding devices to PM domains whose
representations are stored in tables, when the caller doesn't know
the index of the domain to add the device to, but it knows the
domain's name.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
drivers/base/power/domain.c | 27 +++++++++++++++++++++++++++
include/linux/pm_domain.h | 42 +++++++++++++++++++++++++++++-------------
2 files changed, 56 insertions(+), 13 deletions(-)
Index: linux/drivers/base/power/domain.c
=================================--- linux.orig/drivers/base/power/domain.c
+++ linux/drivers/base/power/domain.c
@@ -1465,6 +1465,33 @@ int __pm_genpd_of_add_device(struct devi
return __pm_genpd_add_device(genpd, dev, td);
}
+
+/**
+ * __pm_genpd_name_add_device - Find I/O PM domain and add a device to it.
+ * @domain_name: Name of the PM domain to add the device to.
+ * @dev: Device to be added.
+ * @td: Set of PM QoS timing parameters to attach to the device.
+ */
+int __pm_genpd_name_add_device(const char *domain_name, struct device *dev,
+ struct gpd_timing_data *td)
+{
+ struct generic_pm_domain *genpd = NULL, *gpd;
+
+ if (IS_ERR_OR_NULL(domain_name) || IS_ERR_OR_NULL(dev))
+ return -EINVAL;
+
+ mutex_lock(&gpd_list_lock);
+ list_for_each_entry(gpd, &gpd_list, gpd_list_node) {
+ if (!strcmp(gpd->name, domain_name)) {
+ genpd = gpd;
+ break;
+ }
+ }
+ mutex_unlock(&gpd_list_lock);
+
+ return __pm_genpd_add_device(genpd, dev, td);
+}
+
/**
* pm_genpd_remove_device - Remove a device from an I/O PM domain.
* @genpd: PM domain to remove the device from.
Index: linux/include/linux/pm_domain.h
=================================--- linux.orig/include/linux/pm_domain.h
+++ linux/include/linux/pm_domain.h
@@ -138,17 +138,9 @@ extern int __pm_genpd_of_add_device(stru
struct device *dev,
struct gpd_timing_data *td);
-static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
- struct device *dev)
-{
- return __pm_genpd_add_device(genpd, dev, NULL);
-}
-
-static inline int pm_genpd_of_add_device(struct device_node *genpd_node,
- struct device *dev)
-{
- return __pm_genpd_of_add_device(genpd_node, dev, NULL);
-}
+extern int __pm_genpd_name_add_device(const char *domain_name,
+ struct device *dev,
+ struct gpd_timing_data *td);
extern int pm_genpd_remove_device(struct generic_pm_domain *genpd,
struct device *dev);
@@ -187,8 +179,14 @@ static inline int __pm_genpd_add_device(
{
return -ENOSYS;
}
-static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
- struct device *dev)
+static inline int __pm_genpd_of_add_device(struct device_node *genpd_node,
+ struct device *dev)
+{
+ return -ENOSYS;
+}
+static inline int __pm_genpd_name_add_device(char *domain_name,
+ struct device *dev,
+ struct gpd_timing_data *td)
{
return -ENOSYS;
}
@@ -242,6 +240,24 @@ static inline bool default_stop_ok(struc
#define pm_domain_always_on_gov NULL
#endif
+static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
+ struct device *dev)
+{
+ return __pm_genpd_add_device(genpd, dev, NULL);
+}
+
+static inline int pm_genpd_of_add_device(struct device_node *genpd_node,
+ struct device *dev)
+{
+ return __pm_genpd_of_add_device(genpd_node, dev, NULL);
+}
+
+static inline int pm_genpd_name_add_device(const char *domain_name,
+ struct device *dev)
+{
+ return __pm_genpd_name_add_device(domain_name, dev, NULL);
+}
+
static inline int pm_genpd_remove_callbacks(struct device *dev)
{
return __pm_genpd_remove_callbacks(dev, true);
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/12] ARM: shmobile: Use names of power domains for adding devices to them
2012-08-06 23:05 [PATCH 0/12] PM: Make ARM/shmobile PM domains initialization more straightforward Rafael J. Wysocki
2012-08-06 23:06 ` [PATCH 1/12] PM / Domains: Make it possible to use domain names when adding devices Rafael J. Wysocki
@ 2012-08-06 23:07 ` Rafael J. Wysocki
2012-08-06 23:07 ` [PATCH 3/12] ARM: shmobile: Drop r8a7779_add_device_to_domain() Rafael J. Wysocki
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2012-08-06 23:07 UTC (permalink / raw)
To: Linux-sh list; +Cc: LKML, Linux PM list, Magnus Damm
Make the power management code under arch/arm/mach-shmobile/ use
names of power domains instead of pointers to domain objects for
adding devices to the domains. This will allow us to put the
domain objects into tables and register them all in one shot
going forward.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
arch/arm/mach-shmobile/board-ap4evb.c | 14 +++---
arch/arm/mach-shmobile/board-armadillo800eva.c | 6 +-
arch/arm/mach-shmobile/board-mackerel.c | 24 +++++------
arch/arm/mach-shmobile/include/mach/pm-rmobile.h | 4 -
arch/arm/mach-shmobile/pm-rmobile.c | 4 -
arch/arm/mach-shmobile/setup-r8a7740.c | 20 ++++-----
arch/arm/mach-shmobile/setup-sh7372.c | 48 +++++++++++------------
7 files changed, 60 insertions(+), 60 deletions(-)
Index: linux/arch/arm/mach-shmobile/pm-rmobile.c
=================================--- linux.orig/arch/arm/mach-shmobile/pm-rmobile.c
+++ linux/arch/arm/mach-shmobile/pm-rmobile.c
@@ -149,12 +149,12 @@ void rmobile_init_pm_domain(struct rmobi
__rmobile_pd_power_up(rmobile_pd, false);
}
-void rmobile_add_device_to_domain(struct rmobile_pm_domain *rmobile_pd,
+void rmobile_add_device_to_domain(const char *domain_name,
struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
- pm_genpd_add_device(&rmobile_pd->genpd, dev);
+ pm_genpd_name_add_device(domain_name, dev);
if (pm_clk_no_clocks(dev))
pm_clk_add(dev, NULL);
}
Index: linux/arch/arm/mach-shmobile/include/mach/pm-rmobile.h
=================================--- linux.orig/arch/arm/mach-shmobile/include/mach/pm-rmobile.h
+++ linux/arch/arm/mach-shmobile/include/mach/pm-rmobile.h
@@ -31,13 +31,13 @@ struct rmobile_pm_domain *to_rmobile_pd(
#ifdef CONFIG_PM
extern void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd);
-extern void rmobile_add_device_to_domain(struct rmobile_pm_domain *rmobile_pd,
+extern void rmobile_add_device_to_domain(const char *domain_name,
struct platform_device *pdev);
extern void rmobile_pm_add_subdomain(struct rmobile_pm_domain *rmobile_pd,
struct rmobile_pm_domain *rmobile_sd);
#else
#define rmobile_init_pm_domain(pd) do { } while (0)
-#define rmobile_add_device_to_domain(pd, pdev) do { } while (0)
+#define rmobile_add_device_to_domain(name, pdev) do { } while (0)
#define rmobile_pm_add_subdomain(pd, sd) do { } while (0)
#endif /* CONFIG_PM */
Index: linux/arch/arm/mach-shmobile/board-mackerel.c
=================================--- linux.orig/arch/arm/mach-shmobile/board-mackerel.c
+++ linux/arch/arm/mach-shmobile/board-mackerel.c
@@ -1623,20 +1623,20 @@ static void __init mackerel_init(void)
platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices));
- rmobile_add_device_to_domain(&sh7372_pd_a4lc, &lcdc_device);
- rmobile_add_device_to_domain(&sh7372_pd_a4lc, &hdmi_lcdc_device);
- rmobile_add_device_to_domain(&sh7372_pd_a4lc, &meram_device);
- rmobile_add_device_to_domain(&sh7372_pd_a4mp, &fsi_device);
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &usbhs0_device);
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &usbhs1_device);
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &nand_flash_device);
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sh_mmcif_device);
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi0_device);
+ rmobile_add_device_to_domain("A4LC", &lcdc_device);
+ rmobile_add_device_to_domain("A4LC", &hdmi_lcdc_device);
+ rmobile_add_device_to_domain("A4LC", &meram_device);
+ rmobile_add_device_to_domain("A4MP", &fsi_device);
+ rmobile_add_device_to_domain("A3SP", &usbhs0_device);
+ rmobile_add_device_to_domain("A3SP", &usbhs1_device);
+ rmobile_add_device_to_domain("A3SP", &nand_flash_device);
+ rmobile_add_device_to_domain("A3SP", &sh_mmcif_device);
+ rmobile_add_device_to_domain("A3SP", &sdhi0_device);
#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi1_device);
+ rmobile_add_device_to_domain("A3SP", &sdhi1_device);
#endif
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi2_device);
- rmobile_add_device_to_domain(&sh7372_pd_a4r, &ceu_device);
+ rmobile_add_device_to_domain("A3SP", &sdhi2_device);
+ rmobile_add_device_to_domain("A4R", &ceu_device);
hdmi_init_pm_clock();
sh7372_pm_init();
Index: linux/arch/arm/mach-shmobile/setup-sh7372.c
=================================--- linux.orig/arch/arm/mach-shmobile/setup-sh7372.c
+++ linux/arch/arm/mach-shmobile/setup-sh7372.c
@@ -1023,30 +1023,30 @@ void __init sh7372_add_standard_devices(
platform_add_devices(sh7372_late_devices,
ARRAY_SIZE(sh7372_late_devices));
- rmobile_add_device_to_domain(&sh7372_pd_a3rv, &vpu_device);
- rmobile_add_device_to_domain(&sh7372_pd_a4mp, &spu0_device);
- rmobile_add_device_to_domain(&sh7372_pd_a4mp, &spu1_device);
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif0_device);
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif1_device);
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif2_device);
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif3_device);
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif4_device);
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif5_device);
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif6_device);
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &iic1_device);
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &dma0_device);
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &dma1_device);
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &dma2_device);
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &usb_dma0_device);
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &usb_dma1_device);
- rmobile_add_device_to_domain(&sh7372_pd_a4r, &iic0_device);
- rmobile_add_device_to_domain(&sh7372_pd_a4r, &veu0_device);
- rmobile_add_device_to_domain(&sh7372_pd_a4r, &veu1_device);
- rmobile_add_device_to_domain(&sh7372_pd_a4r, &veu2_device);
- rmobile_add_device_to_domain(&sh7372_pd_a4r, &veu3_device);
- rmobile_add_device_to_domain(&sh7372_pd_a4r, &jpu_device);
- rmobile_add_device_to_domain(&sh7372_pd_a4r, &tmu00_device);
- rmobile_add_device_to_domain(&sh7372_pd_a4r, &tmu01_device);
+ rmobile_add_device_to_domain("A3RV", &vpu_device);
+ rmobile_add_device_to_domain("A4MP", &spu0_device);
+ rmobile_add_device_to_domain("A4MP", &spu1_device);
+ rmobile_add_device_to_domain("A3SP", &scif0_device);
+ rmobile_add_device_to_domain("A3SP", &scif1_device);
+ rmobile_add_device_to_domain("A3SP", &scif2_device);
+ rmobile_add_device_to_domain("A3SP", &scif3_device);
+ rmobile_add_device_to_domain("A3SP", &scif4_device);
+ rmobile_add_device_to_domain("A3SP", &scif5_device);
+ rmobile_add_device_to_domain("A3SP", &scif6_device);
+ rmobile_add_device_to_domain("A3SP", &iic1_device);
+ rmobile_add_device_to_domain("A3SP", &dma0_device);
+ rmobile_add_device_to_domain("A3SP", &dma1_device);
+ rmobile_add_device_to_domain("A3SP", &dma2_device);
+ rmobile_add_device_to_domain("A3SP", &usb_dma0_device);
+ rmobile_add_device_to_domain("A3SP", &usb_dma1_device);
+ rmobile_add_device_to_domain("A4R", &iic0_device);
+ rmobile_add_device_to_domain("A4R", &veu0_device);
+ rmobile_add_device_to_domain("A4R", &veu1_device);
+ rmobile_add_device_to_domain("A4R", &veu2_device);
+ rmobile_add_device_to_domain("A4R", &veu3_device);
+ rmobile_add_device_to_domain("A4R", &jpu_device);
+ rmobile_add_device_to_domain("A4R", &tmu00_device);
+ rmobile_add_device_to_domain("A4R", &tmu01_device);
}
static void __init sh7372_earlytimer_init(void)
Index: linux/arch/arm/mach-shmobile/board-ap4evb.c
=================================--- linux.orig/arch/arm/mach-shmobile/board-ap4evb.c
+++ linux/arch/arm/mach-shmobile/board-ap4evb.c
@@ -1461,14 +1461,14 @@ static void __init ap4evb_init(void)
platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices));
- rmobile_add_device_to_domain(&sh7372_pd_a4lc, &lcdc1_device);
- rmobile_add_device_to_domain(&sh7372_pd_a4lc, &lcdc_device);
- rmobile_add_device_to_domain(&sh7372_pd_a4mp, &fsi_device);
+ rmobile_add_device_to_domain("A4LC", &lcdc1_device);
+ rmobile_add_device_to_domain("A4LC", &lcdc_device);
+ rmobile_add_device_to_domain("A4MP", &fsi_device);
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sh_mmcif_device);
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi0_device);
- rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi1_device);
- rmobile_add_device_to_domain(&sh7372_pd_a4r, &ceu_device);
+ rmobile_add_device_to_domain("A3SP", &sh_mmcif_device);
+ rmobile_add_device_to_domain("A3SP", &sdhi0_device);
+ rmobile_add_device_to_domain("A3SP", &sdhi1_device);
+ rmobile_add_device_to_domain("A4R", &ceu_device);
hdmi_init_pm_clock();
fsi_init_pm_clock();
Index: linux/arch/arm/mach-shmobile/setup-r8a7740.c
=================================--- linux.orig/arch/arm/mach-shmobile/setup-r8a7740.c
+++ linux/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -688,16 +688,16 @@ void __init r8a7740_add_standard_devices
/* add devices to PM domain */
- rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif0_device);
- rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif1_device);
- rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif2_device);
- rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif3_device);
- rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif4_device);
- rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif5_device);
- rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif6_device);
- rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif7_device);
- rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scifb_device);
- rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &i2c1_device);
+ rmobile_add_device_to_domain("A3SP", &scif0_device);
+ rmobile_add_device_to_domain("A3SP", &scif1_device);
+ rmobile_add_device_to_domain("A3SP", &scif2_device);
+ rmobile_add_device_to_domain("A3SP", &scif3_device);
+ rmobile_add_device_to_domain("A3SP", &scif4_device);
+ rmobile_add_device_to_domain("A3SP", &scif5_device);
+ rmobile_add_device_to_domain("A3SP", &scif6_device);
+ rmobile_add_device_to_domain("A3SP", &scif7_device);
+ rmobile_add_device_to_domain("A3SP", &scifb_device);
+ rmobile_add_device_to_domain("A3SP", &i2c1_device);
}
static void __init r8a7740_earlytimer_init(void)
Index: linux/arch/arm/mach-shmobile/board-armadillo800eva.c
=================================--- linux.orig/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ linux/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -1181,10 +1181,10 @@ static void __init eva_init(void)
eva_clock_init();
- rmobile_add_device_to_domain(&r8a7740_pd_a4lc, &lcdc0_device);
- rmobile_add_device_to_domain(&r8a7740_pd_a4lc, &hdmi_lcdc_device);
+ rmobile_add_device_to_domain("A4LC", &lcdc0_device);
+ rmobile_add_device_to_domain("A4LC", &hdmi_lcdc_device);
if (usb)
- rmobile_add_device_to_domain(&r8a7740_pd_a3sp, usb);
+ rmobile_add_device_to_domain("A3SP", usb);
}
static void __init eva_earlytimer_init(void)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 3/12] ARM: shmobile: Drop r8a7779_add_device_to_domain()
2012-08-06 23:05 [PATCH 0/12] PM: Make ARM/shmobile PM domains initialization more straightforward Rafael J. Wysocki
2012-08-06 23:06 ` [PATCH 1/12] PM / Domains: Make it possible to use domain names when adding devices Rafael J. Wysocki
2012-08-06 23:07 ` [PATCH 2/12] ARM: shmobile: Use names of power domains for adding devices to them Rafael J. Wysocki
@ 2012-08-06 23:07 ` Rafael J. Wysocki
2012-08-06 23:08 ` [PATCH 4/12] PM / Domains: Make it possible to use names when adding subdomains Rafael J. Wysocki
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2012-08-06 23:07 UTC (permalink / raw)
To: Linux-sh list; +Cc: LKML, Linux PM list, Magnus Damm
If the r8a7779's PM domains are given names, this SoC and its boards
will be able to use rmobile_add_device_to_domain() for adding devices
to those domains and r8a7779_add_device_to_domain(), which is not
used anywhere at the moment anyway, may be dopped.
Accordingly, give names to the r8a7779's PM domains and drop
r8a7779_add_device_to_domain().
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
arch/arm/mach-shmobile/include/mach/r8a7779.h | 3 ---
arch/arm/mach-shmobile/pm-r8a7779.c | 14 ++++----------
2 files changed, 4 insertions(+), 13 deletions(-)
Index: linux/arch/arm/mach-shmobile/include/mach/r8a7779.h
=================================--- linux.orig/arch/arm/mach-shmobile/include/mach/r8a7779.h
+++ linux/arch/arm/mach-shmobile/include/mach/r8a7779.h
@@ -353,11 +353,8 @@ extern struct r8a7779_pm_domain r8a7779_
extern struct r8a7779_pm_domain r8a7779_impx3;
extern void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd);
-extern void r8a7779_add_device_to_domain(struct r8a7779_pm_domain *r8a7779_pd,
- struct platform_device *pdev);
#else
#define r8a7779_init_pm_domain(pd) do { } while (0)
-#define r8a7779_add_device_to_domain(pd, pdev) do { } while (0)
#endif /* CONFIG_PM */
#endif /* __ASM_R8A7779_H__ */
Index: linux/arch/arm/mach-shmobile/pm-r8a7779.c
=================================--- linux.orig/arch/arm/mach-shmobile/pm-r8a7779.c
+++ linux/arch/arm/mach-shmobile/pm-r8a7779.c
@@ -199,17 +199,8 @@ void r8a7779_init_pm_domain(struct r8a77
pd_power_up(&r8a7779_pd->genpd);
}
-void r8a7779_add_device_to_domain(struct r8a7779_pm_domain *r8a7779_pd,
- struct platform_device *pdev)
-{
- struct device *dev = &pdev->dev;
-
- pm_genpd_add_device(&r8a7779_pd->genpd, dev);
- if (pm_clk_no_clocks(dev))
- pm_clk_add(dev, NULL);
-}
-
struct r8a7779_pm_domain r8a7779_sh4a = {
+ .genpd_name = "SH4A",
.ch = {
.chan_offs = 0x80, /* PWRSR1 .. PWRER1 */
.isr_bit = 16, /* SH4A */
@@ -217,6 +208,7 @@ struct r8a7779_pm_domain r8a7779_sh4a };
struct r8a7779_pm_domain r8a7779_sgx = {
+ .genpd_name = "SGX",
.ch = {
.chan_offs = 0xc0, /* PWRSR2 .. PWRER2 */
.isr_bit = 20, /* SGX */
@@ -224,6 +216,7 @@ struct r8a7779_pm_domain r8a7779_sgx = {
};
struct r8a7779_pm_domain r8a7779_vdp1 = {
+ .genpd_name = "VDP1",
.ch = {
.chan_offs = 0x100, /* PWRSR3 .. PWRER3 */
.isr_bit = 21, /* VDP */
@@ -231,6 +224,7 @@ struct r8a7779_pm_domain r8a7779_vdp1 };
struct r8a7779_pm_domain r8a7779_impx3 = {
+ .genpd_name = "IMPX3",
.ch = {
.chan_offs = 0x140, /* PWRSR4 .. PWRER4 */
.isr_bit = 24, /* IMP */
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 4/12] PM / Domains: Make it possible to use names when adding subdomains
2012-08-06 23:05 [PATCH 0/12] PM: Make ARM/shmobile PM domains initialization more straightforward Rafael J. Wysocki
` (2 preceding siblings ...)
2012-08-06 23:07 ` [PATCH 3/12] ARM: shmobile: Drop r8a7779_add_device_to_domain() Rafael J. Wysocki
@ 2012-08-06 23:08 ` Rafael J. Wysocki
2012-08-06 23:09 ` [PATCH 5/12] ARM: shmobile: Use domain names when adding subdomains to power domains Rafael J. Wysocki
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2012-08-06 23:08 UTC (permalink / raw)
To: Linux-sh list; +Cc: LKML, Linux PM list, Magnus Damm
Add a new helper function, pm_genpd_add_subdomain_names(), allowing
the caller to add a subdomain to a generic PM domain using names for
domain identification (both domains have to be initialized before).
This function is useful for adding subdomains to PM domains whose
representations are stored in tables, when the caller doesn't know
the indices of the domain to add the subdomain to and of the
subdomain itself, but it knows the domains' names.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
drivers/base/power/domain.c | 32 +++++++++++++++++++++++++++++++-
include/linux/pm_domain.h | 7 +++++++
2 files changed, 38 insertions(+), 1 deletion(-)
Index: linux/drivers/base/power/domain.c
=================================--- linux.orig/drivers/base/power/domain.c
+++ linux/drivers/base/power/domain.c
@@ -1584,7 +1584,8 @@ int pm_genpd_add_subdomain(struct generi
struct gpd_link *link;
int ret = 0;
- if (IS_ERR_OR_NULL(genpd) || IS_ERR_OR_NULL(subdomain))
+ if (IS_ERR_OR_NULL(genpd) || IS_ERR_OR_NULL(subdomain)
+ || genpd = subdomain)
return -EINVAL;
start:
@@ -1631,6 +1632,35 @@ int pm_genpd_add_subdomain(struct generi
}
/**
+ * pm_genpd_add_subdomain_names - Add a subdomain to an I/O PM domain.
+ * @master_name: Name of the master PM domain to add the subdomain to.
+ * @subdomain_name: Name of the subdomain to be added.
+ */
+int pm_genpd_add_subdomain_names(const char *master_name,
+ const char *subdomain_name)
+{
+ struct generic_pm_domain *master = NULL, *subdomain = NULL, *gpd;
+
+ if (IS_ERR_OR_NULL(master_name) || IS_ERR_OR_NULL(subdomain_name))
+ return -EINVAL;
+
+ mutex_lock(&gpd_list_lock);
+ list_for_each_entry(gpd, &gpd_list, gpd_list_node) {
+ if (!master && !strcmp(gpd->name, master_name))
+ master = gpd;
+
+ if (!subdomain && !strcmp(gpd->name, subdomain_name))
+ subdomain = gpd;
+
+ if (master && subdomain)
+ break;
+ }
+ mutex_unlock(&gpd_list_lock);
+
+ return pm_genpd_add_subdomain(master, subdomain);
+}
+
+/**
* pm_genpd_remove_subdomain - Remove a subdomain from an I/O PM domain.
* @genpd: Master PM domain to remove the subdomain from.
* @subdomain: Subdomain to be removed.
Index: linux/include/linux/pm_domain.h
=================================--- linux.orig/include/linux/pm_domain.h
+++ linux/include/linux/pm_domain.h
@@ -147,6 +147,8 @@ extern int pm_genpd_remove_device(struct
extern void pm_genpd_dev_need_restore(struct device *dev, bool val);
extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
struct generic_pm_domain *new_subdomain);
+extern int pm_genpd_add_subdomain_names(const char *master_name,
+ const char *subdomain_name);
extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
struct generic_pm_domain *target);
extern int pm_genpd_add_callbacks(struct device *dev,
@@ -201,6 +203,11 @@ static inline int pm_genpd_add_subdomain
{
return -ENOSYS;
}
+static inline int pm_genpd_add_subdomain_names(const char *master_name,
+ const char *subdomain_name)
+{
+ return -ENOSYS;
+}
static inline int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
struct generic_pm_domain *target)
{
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 5/12] ARM: shmobile: Use domain names when adding subdomains to power domains
2012-08-06 23:05 [PATCH 0/12] PM: Make ARM/shmobile PM domains initialization more straightforward Rafael J. Wysocki
` (3 preceding siblings ...)
2012-08-06 23:08 ` [PATCH 4/12] PM / Domains: Make it possible to use names when adding subdomains Rafael J. Wysocki
@ 2012-08-06 23:09 ` Rafael J. Wysocki
2012-08-06 23:10 ` [PATCH 6/12] ARM: shmobile: Add routine for automatic PM domains initialization Rafael J. Wysocki
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2012-08-06 23:09 UTC (permalink / raw)
To: Linux-sh list; +Cc: LKML, Linux PM list, Magnus Damm
Make the power management code under arch/arm/mach-shmobile/
use pm_genpd_add_subdomain_names() for adding subdomains to power
domains, which makes it possible to drop
rmobile_pm_add_subdomain() and will allow us to carry out those
operations for domain objects stored in tables in a straightforward
way.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
arch/arm/mach-shmobile/include/mach/pm-rmobile.h | 3 ---
arch/arm/mach-shmobile/pm-rmobile.c | 6 ------
arch/arm/mach-shmobile/setup-r8a7740.c | 2 +-
arch/arm/mach-shmobile/setup-sh7372.c | 8 ++++----
4 files changed, 5 insertions(+), 14 deletions(-)
Index: linux/arch/arm/mach-shmobile/include/mach/pm-rmobile.h
=================================--- linux.orig/arch/arm/mach-shmobile/include/mach/pm-rmobile.h
+++ linux/arch/arm/mach-shmobile/include/mach/pm-rmobile.h
@@ -33,12 +33,9 @@ struct rmobile_pm_domain *to_rmobile_pd(
extern void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd);
extern void rmobile_add_device_to_domain(const char *domain_name,
struct platform_device *pdev);
-extern void rmobile_pm_add_subdomain(struct rmobile_pm_domain *rmobile_pd,
- struct rmobile_pm_domain *rmobile_sd);
#else
#define rmobile_init_pm_domain(pd) do { } while (0)
#define rmobile_add_device_to_domain(name, pdev) do { } while (0)
-#define rmobile_pm_add_subdomain(pd, sd) do { } while (0)
#endif /* CONFIG_PM */
#endif /* PM_RMOBILE_H */
Index: linux/arch/arm/mach-shmobile/pm-rmobile.c
=================================--- linux.orig/arch/arm/mach-shmobile/pm-rmobile.c
+++ linux/arch/arm/mach-shmobile/pm-rmobile.c
@@ -158,10 +158,4 @@ void rmobile_add_device_to_domain(const
if (pm_clk_no_clocks(dev))
pm_clk_add(dev, NULL);
}
-
-void rmobile_pm_add_subdomain(struct rmobile_pm_domain *rmobile_pd,
- struct rmobile_pm_domain *rmobile_sd)
-{
- pm_genpd_add_subdomain(&rmobile_pd->genpd, &rmobile_sd->genpd);
-}
#endif /* CONFIG_PM */
Index: linux/arch/arm/mach-shmobile/setup-r8a7740.c
=================================--- linux.orig/arch/arm/mach-shmobile/setup-r8a7740.c
+++ linux/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -678,7 +678,7 @@ void __init r8a7740_add_standard_devices
rmobile_init_pm_domain(&r8a7740_pd_a3sp);
rmobile_init_pm_domain(&r8a7740_pd_a4lc);
- rmobile_pm_add_subdomain(&r8a7740_pd_a4s, &r8a7740_pd_a3sp);
+ pm_genpd_add_subdomain_names("A4S", "A3SP");
/* add devices */
platform_add_devices(r8a7740_early_devices,
Index: linux/arch/arm/mach-shmobile/setup-sh7372.c
=================================--- linux.orig/arch/arm/mach-shmobile/setup-sh7372.c
+++ linux/arch/arm/mach-shmobile/setup-sh7372.c
@@ -1011,11 +1011,11 @@ void __init sh7372_add_standard_devices(
rmobile_init_pm_domain(&sh7372_pd_a3sp);
rmobile_init_pm_domain(&sh7372_pd_a3sg);
- rmobile_pm_add_subdomain(&sh7372_pd_a4lc, &sh7372_pd_a3rv);
- rmobile_pm_add_subdomain(&sh7372_pd_a4r, &sh7372_pd_a4lc);
+ pm_genpd_add_subdomain_names("A4LC", "A3RV");
+ pm_genpd_add_subdomain_names("A4R", "A4LC");
- rmobile_pm_add_subdomain(&sh7372_pd_a4s, &sh7372_pd_a3sg);
- rmobile_pm_add_subdomain(&sh7372_pd_a4s, &sh7372_pd_a3sp);
+ pm_genpd_add_subdomain_names("A4S", "A3SG");
+ pm_genpd_add_subdomain_names("A4S", "A3SP");
platform_add_devices(sh7372_early_devices,
ARRAY_SIZE(sh7372_early_devices));
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 6/12] ARM: shmobile: Add routine for automatic PM domains initialization
2012-08-06 23:05 [PATCH 0/12] PM: Make ARM/shmobile PM domains initialization more straightforward Rafael J. Wysocki
` (4 preceding siblings ...)
2012-08-06 23:09 ` [PATCH 5/12] ARM: shmobile: Use domain names when adding subdomains to power domains Rafael J. Wysocki
@ 2012-08-06 23:10 ` Rafael J. Wysocki
2012-08-06 23:11 ` [PATCH 7/12] PM / Domains: Add power-on function using names to identify domains Rafael J. Wysocki
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2012-08-06 23:10 UTC (permalink / raw)
To: Linux-sh list; +Cc: LKML, Linux PM list, Magnus Damm
Add a new routine, rmobile_init_domains(), allowing the caller
to initialize all generic PM objects stored in a table in one
operation.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
arch/arm/mach-shmobile/include/mach/pm-rmobile.h | 2 ++
arch/arm/mach-shmobile/pm-rmobile.c | 8 ++++++++
2 files changed, 10 insertions(+)
Index: linux/arch/arm/mach-shmobile/pm-rmobile.c
=================================--- linux.orig/arch/arm/mach-shmobile/pm-rmobile.c
+++ linux/arch/arm/mach-shmobile/pm-rmobile.c
@@ -149,6 +149,14 @@ void rmobile_init_pm_domain(struct rmobi
__rmobile_pd_power_up(rmobile_pd, false);
}
+void rmobile_init_domains(struct rmobile_pm_domain domains[], int num)
+{
+ int j;
+
+ for (j = 0; j < num; j++)
+ rmobile_init_pm_domain(&domains[j]);
+}
+
void rmobile_add_device_to_domain(const char *domain_name,
struct platform_device *pdev)
{
Index: linux/arch/arm/mach-shmobile/include/mach/pm-rmobile.h
=================================--- linux.orig/arch/arm/mach-shmobile/include/mach/pm-rmobile.h
+++ linux/arch/arm/mach-shmobile/include/mach/pm-rmobile.h
@@ -31,10 +31,12 @@ struct rmobile_pm_domain *to_rmobile_pd(
#ifdef CONFIG_PM
extern void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd);
+extern void rmobile_init_domains(struct rmobile_pm_domain domains[], int num);
extern void rmobile_add_device_to_domain(const char *domain_name,
struct platform_device *pdev);
#else
#define rmobile_init_pm_domain(pd) do { } while (0)
+#define rmobile_init_domains(domains, num) do { } while (0)
#define rmobile_add_device_to_domain(name, pdev) do { } while (0)
#endif /* CONFIG_PM */
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 7/12] PM / Domains: Add power-on function using names to identify domains
2012-08-06 23:05 [PATCH 0/12] PM: Make ARM/shmobile PM domains initialization more straightforward Rafael J. Wysocki
` (5 preceding siblings ...)
2012-08-06 23:10 ` [PATCH 6/12] ARM: shmobile: Add routine for automatic PM domains initialization Rafael J. Wysocki
@ 2012-08-06 23:11 ` Rafael J. Wysocki
2012-08-06 23:11 ` [PATCH 8/12] PM / shmobile: Do not access sh7372 A4S domain internals directly Rafael J. Wysocki
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2012-08-06 23:11 UTC (permalink / raw)
To: Linux-sh list; +Cc: LKML, Linux PM list, Magnus Damm
It sometimes is necessary to turn on a given PM domain when only
the name of it is known and the domain pointer is not readily
available. For this reason, add a new helper function,
pm_genpd_name_poweron(), allowing the caller to turn on a PM domain
using its name for identification. To avoid code duplication,
move the domain lookup code to a separate function.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
drivers/base/power/domain.c | 46 +++++++++++++++++++++++++++++---------------
include/linux/pm_domain.h | 5 ++++
2 files changed, 36 insertions(+), 15 deletions(-)
Index: linux/drivers/base/power/domain.c
=================================--- linux.orig/drivers/base/power/domain.c
+++ linux/drivers/base/power/domain.c
@@ -53,6 +53,24 @@
static LIST_HEAD(gpd_list);
static DEFINE_MUTEX(gpd_list_lock);
+static struct generic_pm_domain *pm_genpd_lookup_name(const char *domain_name)
+{
+ struct generic_pm_domain *genpd = NULL, *gpd;
+
+ if (IS_ERR_OR_NULL(domain_name))
+ return NULL;
+
+ mutex_lock(&gpd_list_lock);
+ list_for_each_entry(gpd, &gpd_list, gpd_list_node) {
+ if (!strcmp(gpd->name, domain_name)) {
+ genpd = gpd;
+ break;
+ }
+ }
+ mutex_unlock(&gpd_list_lock);
+ return genpd;
+}
+
#ifdef CONFIG_PM
struct generic_pm_domain *dev_to_genpd(struct device *dev)
@@ -262,6 +280,18 @@ int pm_genpd_poweron(struct generic_pm_d
return ret;
}
+/**
+ * pm_genpd_name_poweron - Restore power to a given PM domain and its masters.
+ * @domain_name: Name of the PM domain to power up.
+ */
+int pm_genpd_name_poweron(const char *domain_name)
+{
+ struct generic_pm_domain *genpd;
+
+ genpd = pm_genpd_lookup_name(domain_name);
+ return genpd ? pm_genpd_poweron(genpd) : -EINVAL;
+}
+
#endif /* CONFIG_PM */
#ifdef CONFIG_PM_RUNTIME
@@ -1475,21 +1505,7 @@ int __pm_genpd_of_add_device(struct devi
int __pm_genpd_name_add_device(const char *domain_name, struct device *dev,
struct gpd_timing_data *td)
{
- struct generic_pm_domain *genpd = NULL, *gpd;
-
- if (IS_ERR_OR_NULL(domain_name) || IS_ERR_OR_NULL(dev))
- return -EINVAL;
-
- mutex_lock(&gpd_list_lock);
- list_for_each_entry(gpd, &gpd_list, gpd_list_node) {
- if (!strcmp(gpd->name, domain_name)) {
- genpd = gpd;
- break;
- }
- }
- mutex_unlock(&gpd_list_lock);
-
- return __pm_genpd_add_device(genpd, dev, td);
+ return __pm_genpd_add_device(pm_genpd_lookup_name(domain_name), dev, td);
}
/**
Index: linux/include/linux/pm_domain.h
=================================--- linux.orig/include/linux/pm_domain.h
+++ linux/include/linux/pm_domain.h
@@ -161,6 +161,7 @@ extern void pm_genpd_init(struct generic
struct dev_power_governor *gov, bool is_off);
extern int pm_genpd_poweron(struct generic_pm_domain *genpd);
+extern int pm_genpd_name_poweron(const char *domain_name);
extern bool default_stop_ok(struct device *dev);
@@ -239,6 +240,10 @@ static inline int pm_genpd_poweron(struc
{
return -ENOSYS;
}
+static inline int pm_genpd_name_poweron(const char *domain_name)
+{
+ return -ENOSYS;
+}
static inline bool default_stop_ok(struct device *dev)
{
return false;
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 8/12] PM / shmobile: Do not access sh7372 A4S domain internals directly
2012-08-06 23:05 [PATCH 0/12] PM: Make ARM/shmobile PM domains initialization more straightforward Rafael J. Wysocki
` (6 preceding siblings ...)
2012-08-06 23:11 ` [PATCH 7/12] PM / Domains: Add power-on function using names to identify domains Rafael J. Wysocki
@ 2012-08-06 23:11 ` Rafael J. Wysocki
2012-08-06 23:12 ` [PATCH 9/12] ARM: shmobile: Move sh7372's PM domain objects to a table Rafael J. Wysocki
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2012-08-06 23:11 UTC (permalink / raw)
To: Linux-sh list; +Cc: LKML, Linux PM list, Magnus Damm
The sh7372_enter_suspend() routine checks the status field of the
generic PM domain object corresponding to the A4S domain in order to
check if it can turn that domain off when entering system sleep.
However, it shouldn't rely on the specific values of the generic
data structures this way, so make it use its own mechanism to
recognize when it is safe to turn that domain off.
For this purpos, introduce a boolean variable a4s_suspend_ready
that will be set by the A4S' suspend routine and unset by its
resume routine executed by rmobile_pd_power_down() and
__rmobile_pd_power_up(), respectively.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
arch/arm/mach-shmobile/pm-sh7372.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
Index: linux/arch/arm/mach-shmobile/pm-sh7372.c
=================================--- linux.orig/arch/arm/mach-shmobile/pm-sh7372.c
+++ linux/arch/arm/mach-shmobile/pm-sh7372.c
@@ -110,21 +110,33 @@ struct rmobile_pm_domain sh7372_pd_a3ri
.bit_shift = 8,
};
+static bool a4s_suspend_ready;
+
static int sh7372_pd_a4s_suspend(void)
{
/*
* The A4S domain contains the CPU core and therefore it should
- * only be turned off if the CPU is in use.
+ * only be turned off if the CPU is not in use. This may happen
+ * during system suspend, when SYSC is going to be used for generating
+ * resume signals and a4s_suspend_ready is set to let
+ * sh7372_enter_suspend() know that it can turn A4S off.
*/
+ a4s_suspend_ready = true;
return -EBUSY;
}
+static void sh7372_pd_a4s_resume(void)
+{
+ a4s_suspend_ready = false;
+}
+
struct rmobile_pm_domain sh7372_pd_a4s = {
.genpd.name = "A4S",
.bit_shift = 10,
.gov = &pm_domain_always_on_gov,
.no_debug = true,
.suspend = sh7372_pd_a4s_suspend,
+ .resume = sh7372_pd_a4s_resume,
};
static int sh7372_a3sp_pd_suspend(void)
@@ -390,8 +402,7 @@ static int sh7372_enter_suspend(suspend_
/* check active clocks to determine potential wakeup sources */
if (sh7372_sysc_valid(&msk, &msk2)) {
- if (!console_suspend_enabled &&
- sh7372_pd_a4s.genpd.status = GPD_STATE_POWER_OFF) {
+ if (!console_suspend_enabled && a4s_suspend_ready) {
/* convert INTC mask/sense to SYSC mask/sense */
sh7372_setup_sysc(msk, msk2);
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 9/12] ARM: shmobile: Move sh7372's PM domain objects to a table
2012-08-06 23:05 [PATCH 0/12] PM: Make ARM/shmobile PM domains initialization more straightforward Rafael J. Wysocki
` (7 preceding siblings ...)
2012-08-06 23:11 ` [PATCH 8/12] PM / shmobile: Do not access sh7372 A4S domain internals directly Rafael J. Wysocki
@ 2012-08-06 23:12 ` Rafael J. Wysocki
2012-08-06 23:13 ` [PATCH 10/12] ARM: shmobile: Move r8a7740's " Rafael J. Wysocki
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2012-08-06 23:12 UTC (permalink / raw)
To: Linux-sh list; +Cc: LKML, Linux PM list, Magnus Damm
Instead of giving a name to every sh7372's PM domain object, put them
all into a table and use rmobile_init_domains(), introduced by a
previous patch, for initializing them all altogether. Also, use
pm_genpd_add_subdomain_names() for adding subdomains to the PM
domains and pm_genpd_poweron_name() for turning on the A4S domain
when preparing for system suspend.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
arch/arm/mach-shmobile/include/mach/sh7372.h | 18 +---
arch/arm/mach-shmobile/pm-sh7372.c | 111 +++++++++++++--------------
arch/arm/mach-shmobile/setup-sh7372.c | 16 ---
3 files changed, 64 insertions(+), 81 deletions(-)
Index: linux/arch/arm/mach-shmobile/pm-sh7372.c
=================================--- linux.orig/arch/arm/mach-shmobile/pm-sh7372.c
+++ linux/arch/arm/mach-shmobile/pm-sh7372.c
@@ -71,21 +71,6 @@
#ifdef CONFIG_PM
-struct rmobile_pm_domain sh7372_pd_a4lc = {
- .genpd.name = "A4LC",
- .bit_shift = 1,
-};
-
-struct rmobile_pm_domain sh7372_pd_a4mp = {
- .genpd.name = "A4MP",
- .bit_shift = 2,
-};
-
-struct rmobile_pm_domain sh7372_pd_d4 = {
- .genpd.name = "D4",
- .bit_shift = 3,
-};
-
static int sh7372_a4r_pd_suspend(void)
{
sh7372_intcs_suspend();
@@ -93,26 +78,9 @@ static int sh7372_a4r_pd_suspend(void)
return 0;
}
-struct rmobile_pm_domain sh7372_pd_a4r = {
- .genpd.name = "A4R",
- .bit_shift = 5,
- .suspend = sh7372_a4r_pd_suspend,
- .resume = sh7372_intcs_resume,
-};
-
-struct rmobile_pm_domain sh7372_pd_a3rv = {
- .genpd.name = "A3RV",
- .bit_shift = 6,
-};
-
-struct rmobile_pm_domain sh7372_pd_a3ri = {
- .genpd.name = "A3RI",
- .bit_shift = 8,
-};
-
static bool a4s_suspend_ready;
-static int sh7372_pd_a4s_suspend(void)
+static int sh7372_a4s_pd_suspend(void)
{
/*
* The A4S domain contains the CPU core and therefore it should
@@ -125,20 +93,11 @@ static int sh7372_pd_a4s_suspend(void)
return -EBUSY;
}
-static void sh7372_pd_a4s_resume(void)
+static void sh7372_a4s_pd_resume(void)
{
a4s_suspend_ready = false;
}
-struct rmobile_pm_domain sh7372_pd_a4s = {
- .genpd.name = "A4S",
- .bit_shift = 10,
- .gov = &pm_domain_always_on_gov,
- .no_debug = true,
- .suspend = sh7372_pd_a4s_suspend,
- .resume = sh7372_pd_a4s_resume,
-};
-
static int sh7372_a3sp_pd_suspend(void)
{
/*
@@ -148,18 +107,62 @@ static int sh7372_a3sp_pd_suspend(void)
return console_suspend_enabled ? 0 : -EBUSY;
}
-struct rmobile_pm_domain sh7372_pd_a3sp = {
- .genpd.name = "A3SP",
- .bit_shift = 11,
- .gov = &pm_domain_always_on_gov,
- .no_debug = true,
- .suspend = sh7372_a3sp_pd_suspend,
+static struct rmobile_pm_domain sh7372_pm_domains[] = {
+ {
+ .genpd.name = "A4LC",
+ .bit_shift = 1,
+ },
+ {
+ .genpd.name = "A4MP",
+ .bit_shift = 2,
+ },
+ {
+ .genpd.name = "D4",
+ .bit_shift = 3,
+ },
+ {
+ .genpd.name = "A4R",
+ .bit_shift = 5,
+ .suspend = sh7372_a4r_pd_suspend,
+ .resume = sh7372_intcs_resume,
+ },
+ {
+ .genpd.name = "A3RV",
+ .bit_shift = 6,
+ },
+ {
+ .genpd.name = "A3RI",
+ .bit_shift = 8,
+ },
+ {
+ .genpd.name = "A4S",
+ .bit_shift = 10,
+ .gov = &pm_domain_always_on_gov,
+ .no_debug = true,
+ .suspend = sh7372_a4s_pd_suspend,
+ .resume = sh7372_a4s_pd_resume,
+ },
+ {
+ .genpd.name = "A3SP",
+ .bit_shift = 11,
+ .gov = &pm_domain_always_on_gov,
+ .no_debug = true,
+ .suspend = sh7372_a3sp_pd_suspend,
+ },
+ {
+ .genpd.name = "A3SG",
+ .bit_shift = 13,
+ },
};
-struct rmobile_pm_domain sh7372_pd_a3sg = {
- .genpd.name = "A3SG",
- .bit_shift = 13,
-};
+void __init sh7372_init_pm_domains(void)
+{
+ rmobile_init_domains(sh7372_pm_domains, ARRAY_SIZE(sh7372_pm_domains));
+ pm_genpd_add_subdomain_names("A4LC", "A3RV");
+ pm_genpd_add_subdomain_names("A4R", "A4LC");
+ pm_genpd_add_subdomain_names("A4S", "A3SG");
+ pm_genpd_add_subdomain_names("A4S", "A3SP");
+}
#endif /* CONFIG_PM */
@@ -436,7 +439,7 @@ static int sh7372_pm_notifier_fn(struct
* executed during system suspend and resume, respectively, so
* that those functions don't crash while accessing the INTCS.
*/
- pm_genpd_poweron(&sh7372_pd_a4r.genpd);
+ pm_genpd_name_poweron("A4R");
break;
case PM_POST_SUSPEND:
pm_genpd_poweroff_unused();
Index: linux/arch/arm/mach-shmobile/setup-sh7372.c
=================================--- linux.orig/arch/arm/mach-shmobile/setup-sh7372.c
+++ linux/arch/arm/mach-shmobile/setup-sh7372.c
@@ -1001,21 +1001,7 @@ static struct platform_device *sh7372_la
void __init sh7372_add_standard_devices(void)
{
- rmobile_init_pm_domain(&sh7372_pd_a4lc);
- rmobile_init_pm_domain(&sh7372_pd_a4mp);
- rmobile_init_pm_domain(&sh7372_pd_d4);
- rmobile_init_pm_domain(&sh7372_pd_a4r);
- rmobile_init_pm_domain(&sh7372_pd_a3rv);
- rmobile_init_pm_domain(&sh7372_pd_a3ri);
- rmobile_init_pm_domain(&sh7372_pd_a4s);
- rmobile_init_pm_domain(&sh7372_pd_a3sp);
- rmobile_init_pm_domain(&sh7372_pd_a3sg);
-
- pm_genpd_add_subdomain_names("A4LC", "A3RV");
- pm_genpd_add_subdomain_names("A4R", "A4LC");
-
- pm_genpd_add_subdomain_names("A4S", "A3SG");
- pm_genpd_add_subdomain_names("A4S", "A3SP");
+ sh7372_init_pm_domains();
platform_add_devices(sh7372_early_devices,
ARRAY_SIZE(sh7372_early_devices));
Index: linux/arch/arm/mach-shmobile/include/mach/sh7372.h
=================================--- linux.orig/arch/arm/mach-shmobile/include/mach/sh7372.h
+++ linux/arch/arm/mach-shmobile/include/mach/sh7372.h
@@ -478,21 +478,15 @@ extern struct clk sh7372_fsibck_clk;
extern struct clk sh7372_fsidiva_clk;
extern struct clk sh7372_fsidivb_clk;
-#ifdef CONFIG_PM
-extern struct rmobile_pm_domain sh7372_pd_a4lc;
-extern struct rmobile_pm_domain sh7372_pd_a4mp;
-extern struct rmobile_pm_domain sh7372_pd_d4;
-extern struct rmobile_pm_domain sh7372_pd_a4r;
-extern struct rmobile_pm_domain sh7372_pd_a3rv;
-extern struct rmobile_pm_domain sh7372_pd_a3ri;
-extern struct rmobile_pm_domain sh7372_pd_a4s;
-extern struct rmobile_pm_domain sh7372_pd_a3sp;
-extern struct rmobile_pm_domain sh7372_pd_a3sg;
-#endif /* CONFIG_PM */
-
extern void sh7372_intcs_suspend(void);
extern void sh7372_intcs_resume(void);
extern void sh7372_intca_suspend(void);
extern void sh7372_intca_resume(void);
+#ifdef CONFIG_PM
+extern void __init sh7372_init_pm_domains(void);
+#else
+static inline void sh7372_init_pm_domains(void) {}
+#endif
+
#endif /* __ASM_SH7372_H__ */
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 10/12] ARM: shmobile: Move r8a7740's PM domain objects to a table
2012-08-06 23:05 [PATCH 0/12] PM: Make ARM/shmobile PM domains initialization more straightforward Rafael J. Wysocki
` (8 preceding siblings ...)
2012-08-06 23:12 ` [PATCH 9/12] ARM: shmobile: Move sh7372's PM domain objects to a table Rafael J. Wysocki
@ 2012-08-06 23:13 ` Rafael J. Wysocki
2012-08-06 23:14 ` [PATCH 11/12] ARM: shmobile: Move r8a7779's " Rafael J. Wysocki
2012-08-06 23:15 ` [PATCH 12/12] ARM: shmobile: Make rmobile_init_pm_domain() static Rafael J. Wysocki
11 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2012-08-06 23:13 UTC (permalink / raw)
To: Linux-sh list; +Cc: LKML, Linux PM list, Magnus Damm
Instead of giving a name to every r8a7740's PM domain object, put
them all into a table and use rmobile_init_domains(), introduced by a
previous patch, for initializing them all altogether. Also, use
pm_genpd_add_subdomain_names() for adding A3SP as a subdomain of A4S.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
arch/arm/mach-shmobile/include/mach/r8a7740.h | 6 +--
arch/arm/mach-shmobile/pm-r8a7740.c | 42 ++++++++++++++------------
arch/arm/mach-shmobile/setup-r8a7740.c | 7 ----
3 files changed, 28 insertions(+), 27 deletions(-)
Index: linux/arch/arm/mach-shmobile/pm-r8a7740.c
=================================--- linux.orig/arch/arm/mach-shmobile/pm-r8a7740.c
+++ linux/arch/arm/mach-shmobile/pm-r8a7740.c
@@ -21,14 +21,6 @@ static int r8a7740_pd_a4s_suspend(void)
return -EBUSY;
}
-struct rmobile_pm_domain r8a7740_pd_a4s = {
- .genpd.name = "A4S",
- .bit_shift = 10,
- .gov = &pm_domain_always_on_gov,
- .no_debug = true,
- .suspend = r8a7740_pd_a4s_suspend,
-};
-
static int r8a7740_pd_a3sp_suspend(void)
{
/*
@@ -38,17 +30,31 @@ static int r8a7740_pd_a3sp_suspend(void)
return console_suspend_enabled ? 0 : -EBUSY;
}
-struct rmobile_pm_domain r8a7740_pd_a3sp = {
- .genpd.name = "A3SP",
- .bit_shift = 11,
- .gov = &pm_domain_always_on_gov,
- .no_debug = true,
- .suspend = r8a7740_pd_a3sp_suspend,
+static struct rmobile_pm_domain r8a7740_pm_domains[] = {
+ {
+ .genpd.name = "A4S",
+ .bit_shift = 10,
+ .gov = &pm_domain_always_on_gov,
+ .no_debug = true,
+ .suspend = r8a7740_pd_a4s_suspend,
+ },
+ {
+ .genpd.name = "A3SP",
+ .bit_shift = 11,
+ .gov = &pm_domain_always_on_gov,
+ .no_debug = true,
+ .suspend = r8a7740_pd_a3sp_suspend,
+ },
+ {
+ .genpd.name = "A4LC",
+ .bit_shift = 1,
+ },
};
-struct rmobile_pm_domain r8a7740_pd_a4lc = {
- .genpd.name = "A4LC",
- .bit_shift = 1,
-};
+void __init r8a7740_init_pm_domains(void)
+{
+ rmobile_init_domains(r8a7740_pm_domains, ARRAY_SIZE(r8a7740_pm_domains));
+ pm_genpd_add_subdomain_names("A4S", "A3SP");
+}
#endif /* CONFIG_PM */
Index: linux/arch/arm/mach-shmobile/setup-r8a7740.c
=================================--- linux.orig/arch/arm/mach-shmobile/setup-r8a7740.c
+++ linux/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -673,12 +673,7 @@ void __init r8a7740_add_standard_devices
r8a7740_i2c_workaround(&i2c0_device);
r8a7740_i2c_workaround(&i2c1_device);
- /* PM domain */
- rmobile_init_pm_domain(&r8a7740_pd_a4s);
- rmobile_init_pm_domain(&r8a7740_pd_a3sp);
- rmobile_init_pm_domain(&r8a7740_pd_a4lc);
-
- pm_genpd_add_subdomain_names("A4S", "A3SP");
+ r8a7740_init_pm_domains();
/* add devices */
platform_add_devices(r8a7740_early_devices,
Index: linux/arch/arm/mach-shmobile/include/mach/r8a7740.h
=================================--- linux.orig/arch/arm/mach-shmobile/include/mach/r8a7740.h
+++ linux/arch/arm/mach-shmobile/include/mach/r8a7740.h
@@ -607,9 +607,9 @@ enum {
};
#ifdef CONFIG_PM
-extern struct rmobile_pm_domain r8a7740_pd_a4s;
-extern struct rmobile_pm_domain r8a7740_pd_a3sp;
-extern struct rmobile_pm_domain r8a7740_pd_a4lc;
+extern void __init r8a7740_init_pm_domains(void);
+#else
+static inline void r8a7740_init_pm_domains(void) {}
#endif /* CONFIG_PM */
#endif /* __ASM_R8A7740_H__ */
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 11/12] ARM: shmobile: Move r8a7779's PM domain objects to a table
2012-08-06 23:05 [PATCH 0/12] PM: Make ARM/shmobile PM domains initialization more straightforward Rafael J. Wysocki
` (9 preceding siblings ...)
2012-08-06 23:13 ` [PATCH 10/12] ARM: shmobile: Move r8a7740's " Rafael J. Wysocki
@ 2012-08-06 23:14 ` Rafael J. Wysocki
2012-08-06 23:15 ` [PATCH 12/12] ARM: shmobile: Make rmobile_init_pm_domain() static Rafael J. Wysocki
11 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2012-08-06 23:14 UTC (permalink / raw)
To: Linux-sh list; +Cc: LKML, Linux PM list, Magnus Damm
Instead of giving a name to every r8a7779's PM domain object, put
them all into a table and initialize them all together in a loop.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
arch/arm/mach-shmobile/include/mach/r8a7779.h | 9 ---
arch/arm/mach-shmobile/pm-r8a7779.c | 65 ++++++++++++++------------
arch/arm/mach-shmobile/setup-r8a7779.c | 5 --
3 files changed, 39 insertions(+), 40 deletions(-)
Index: linux/arch/arm/mach-shmobile/include/mach/r8a7779.h
=================================--- linux.orig/arch/arm/mach-shmobile/include/mach/r8a7779.h
+++ linux/arch/arm/mach-shmobile/include/mach/r8a7779.h
@@ -347,14 +347,9 @@ extern int r8a7779_sysc_power_down(struc
extern int r8a7779_sysc_power_up(struct r8a7779_pm_ch *r8a7779_ch);
#ifdef CONFIG_PM
-extern struct r8a7779_pm_domain r8a7779_sh4a;
-extern struct r8a7779_pm_domain r8a7779_sgx;
-extern struct r8a7779_pm_domain r8a7779_vdp1;
-extern struct r8a7779_pm_domain r8a7779_impx3;
-
-extern void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd);
+extern void __init r8a7779_init_pm_domains(void);
#else
-#define r8a7779_init_pm_domain(pd) do { } while (0)
+static inline void r8a7779_init_pm_domains(void) {}
#endif /* CONFIG_PM */
#endif /* __ASM_R8A7779_H__ */
Index: linux/arch/arm/mach-shmobile/pm-r8a7779.c
=================================--- linux.orig/arch/arm/mach-shmobile/pm-r8a7779.c
+++ linux/arch/arm/mach-shmobile/pm-r8a7779.c
@@ -183,7 +183,7 @@ static bool pd_active_wakeup(struct devi
return true;
}
-void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd)
+static void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd)
{
struct generic_pm_domain *genpd = &r8a7779_pd->genpd;
@@ -199,37 +199,44 @@ void r8a7779_init_pm_domain(struct r8a77
pd_power_up(&r8a7779_pd->genpd);
}
-struct r8a7779_pm_domain r8a7779_sh4a = {
- .genpd_name = "SH4A",
- .ch = {
- .chan_offs = 0x80, /* PWRSR1 .. PWRER1 */
- .isr_bit = 16, /* SH4A */
- }
+static struct r8a7779_pm_domain r8a7779_pm_domains[] = {
+ {
+ .genpd_name = "SH4A",
+ .ch = {
+ .chan_offs = 0x80, /* PWRSR1 .. PWRER1 */
+ .isr_bit = 16, /* SH4A */
+ },
+ },
+ {
+ .genpd_name = "SGX",
+ .ch = {
+ .chan_offs = 0xc0, /* PWRSR2 .. PWRER2 */
+ .isr_bit = 20, /* SGX */
+ },
+ },
+ {
+ .genpd_name = "VDP1",
+ .ch = {
+ .chan_offs = 0x100, /* PWRSR3 .. PWRER3 */
+ .isr_bit = 21, /* VDP */
+ },
+ },
+ {
+ .genpd_name = "IMPX3",
+ .ch = {
+ .chan_offs = 0x140, /* PWRSR4 .. PWRER4 */
+ .isr_bit = 24, /* IMP */
+ },
+ },
};
-struct r8a7779_pm_domain r8a7779_sgx = {
- .genpd_name = "SGX",
- .ch = {
- .chan_offs = 0xc0, /* PWRSR2 .. PWRER2 */
- .isr_bit = 20, /* SGX */
- }
-};
-
-struct r8a7779_pm_domain r8a7779_vdp1 = {
- .genpd_name = "VDP1",
- .ch = {
- .chan_offs = 0x100, /* PWRSR3 .. PWRER3 */
- .isr_bit = 21, /* VDP */
- }
-};
+void __init r8a7779_init_pm_domains(void)
+{
+ int j;
-struct r8a7779_pm_domain r8a7779_impx3 = {
- .genpd_name = "IMPX3",
- .ch = {
- .chan_offs = 0x140, /* PWRSR4 .. PWRER4 */
- .isr_bit = 24, /* IMP */
- }
-};
+ for (j = 0; j < ARRAY_SIZE(r8a7779_pm_domains); j++)
+ r8a7779_init_pm_domain(&r8a7779_pm_domains[j]);
+}
#endif /* CONFIG_PM */
Index: linux/arch/arm/mach-shmobile/setup-r8a7779.c
=================================--- linux.orig/arch/arm/mach-shmobile/setup-r8a7779.c
+++ linux/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -251,10 +251,7 @@ void __init r8a7779_add_standard_devices
#endif
r8a7779_pm_init();
- r8a7779_init_pm_domain(&r8a7779_sh4a);
- r8a7779_init_pm_domain(&r8a7779_sgx);
- r8a7779_init_pm_domain(&r8a7779_vdp1);
- r8a7779_init_pm_domain(&r8a7779_impx3);
+ r8a7779_init_pm_domains();
platform_add_devices(r8a7779_early_devices,
ARRAY_SIZE(r8a7779_early_devices));
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 12/12] ARM: shmobile: Make rmobile_init_pm_domain() static
2012-08-06 23:05 [PATCH 0/12] PM: Make ARM/shmobile PM domains initialization more straightforward Rafael J. Wysocki
` (10 preceding siblings ...)
2012-08-06 23:14 ` [PATCH 11/12] ARM: shmobile: Move r8a7779's " Rafael J. Wysocki
@ 2012-08-06 23:15 ` Rafael J. Wysocki
11 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2012-08-06 23:15 UTC (permalink / raw)
To: Linux-sh list; +Cc: LKML, Linux PM list, Magnus Damm
Since rmobile_init_pm_domain() is not called anywhere outside of
arch/arm/mach-shmobile/pm-rmobile.c any more, it can be made static
and its header may be removed from pm-rmobile.h. Modify the code
accordingly.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
arch/arm/mach-shmobile/include/mach/pm-rmobile.h | 2 --
arch/arm/mach-shmobile/pm-rmobile.c | 2 +-
2 files changed, 1 insertion(+), 3 deletions(-)
Index: linux/arch/arm/mach-shmobile/include/mach/pm-rmobile.h
=================================--- linux.orig/arch/arm/mach-shmobile/include/mach/pm-rmobile.h
+++ linux/arch/arm/mach-shmobile/include/mach/pm-rmobile.h
@@ -30,12 +30,10 @@ struct rmobile_pm_domain *to_rmobile_pd(
}
#ifdef CONFIG_PM
-extern void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd);
extern void rmobile_init_domains(struct rmobile_pm_domain domains[], int num);
extern void rmobile_add_device_to_domain(const char *domain_name,
struct platform_device *pdev);
#else
-#define rmobile_init_pm_domain(pd) do { } while (0)
#define rmobile_init_domains(domains, num) do { } while (0)
#define rmobile_add_device_to_domain(name, pdev) do { } while (0)
#endif /* CONFIG_PM */
Index: linux/arch/arm/mach-shmobile/pm-rmobile.c
=================================--- linux.orig/arch/arm/mach-shmobile/pm-rmobile.c
+++ linux/arch/arm/mach-shmobile/pm-rmobile.c
@@ -134,7 +134,7 @@ static int rmobile_pd_start_dev(struct d
return ret;
}
-void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
+static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
{
struct generic_pm_domain *genpd = &rmobile_pd->genpd;
struct dev_power_governor *gov = rmobile_pd->gov;
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2012-08-06 23:15 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-06 23:05 [PATCH 0/12] PM: Make ARM/shmobile PM domains initialization more straightforward Rafael J. Wysocki
2012-08-06 23:06 ` [PATCH 1/12] PM / Domains: Make it possible to use domain names when adding devices Rafael J. Wysocki
2012-08-06 23:07 ` [PATCH 2/12] ARM: shmobile: Use names of power domains for adding devices to them Rafael J. Wysocki
2012-08-06 23:07 ` [PATCH 3/12] ARM: shmobile: Drop r8a7779_add_device_to_domain() Rafael J. Wysocki
2012-08-06 23:08 ` [PATCH 4/12] PM / Domains: Make it possible to use names when adding subdomains Rafael J. Wysocki
2012-08-06 23:09 ` [PATCH 5/12] ARM: shmobile: Use domain names when adding subdomains to power domains Rafael J. Wysocki
2012-08-06 23:10 ` [PATCH 6/12] ARM: shmobile: Add routine for automatic PM domains initialization Rafael J. Wysocki
2012-08-06 23:11 ` [PATCH 7/12] PM / Domains: Add power-on function using names to identify domains Rafael J. Wysocki
2012-08-06 23:11 ` [PATCH 8/12] PM / shmobile: Do not access sh7372 A4S domain internals directly Rafael J. Wysocki
2012-08-06 23:12 ` [PATCH 9/12] ARM: shmobile: Move sh7372's PM domain objects to a table Rafael J. Wysocki
2012-08-06 23:13 ` [PATCH 10/12] ARM: shmobile: Move r8a7740's " Rafael J. Wysocki
2012-08-06 23:14 ` [PATCH 11/12] ARM: shmobile: Move r8a7779's " Rafael J. Wysocki
2012-08-06 23:15 ` [PATCH 12/12] ARM: shmobile: Make rmobile_init_pm_domain() static Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).