aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2012-08-06 19:12:56 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2012-09-03 19:44:57 -0400
commite7e59a4b55706b0bbaba1cd8af46495553b6e876 (patch)
tree7f2a41260d1e4925769a1a890db1f48d58805c88 /arch/arm/mach-shmobile
parent70fe7b24672a988f8aab77a04329d6331a1f10a8 (diff)
ARM: shmobile: Move sh7372's PM domain objects to a table
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> Acked-by: Magnus Damm <damm@opensource.se>
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r--arch/arm/mach-shmobile/include/mach/sh7372.h18
-rw-r--r--arch/arm/mach-shmobile/pm-sh7372.c111
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c16
3 files changed, 64 insertions, 81 deletions
diff --git a/arch/arm/mach-shmobile/include/mach/sh7372.h b/arch/arm/mach-shmobile/include/mach/sh7372.h
index b59048e6d8fd..40beb796d020 100644
--- a/arch/arm/mach-shmobile/include/mach/sh7372.h
+++ b/arch/arm/mach-shmobile/include/mach/sh7372.h
@@ -478,21 +478,15 @@ extern struct clk sh7372_fsibck_clk;
478extern struct clk sh7372_fsidiva_clk; 478extern struct clk sh7372_fsidiva_clk;
479extern struct clk sh7372_fsidivb_clk; 479extern struct clk sh7372_fsidivb_clk;
480 480
481#ifdef CONFIG_PM
482extern struct rmobile_pm_domain sh7372_pd_a4lc;
483extern struct rmobile_pm_domain sh7372_pd_a4mp;
484extern struct rmobile_pm_domain sh7372_pd_d4;
485extern struct rmobile_pm_domain sh7372_pd_a4r;
486extern struct rmobile_pm_domain sh7372_pd_a3rv;
487extern struct rmobile_pm_domain sh7372_pd_a3ri;
488extern struct rmobile_pm_domain sh7372_pd_a4s;
489extern struct rmobile_pm_domain sh7372_pd_a3sp;
490extern struct rmobile_pm_domain sh7372_pd_a3sg;
491#endif /* CONFIG_PM */
492
493extern void sh7372_intcs_suspend(void); 481extern void sh7372_intcs_suspend(void);
494extern void sh7372_intcs_resume(void); 482extern void sh7372_intcs_resume(void);
495extern void sh7372_intca_suspend(void); 483extern void sh7372_intca_suspend(void);
496extern void sh7372_intca_resume(void); 484extern void sh7372_intca_resume(void);
497 485
486#ifdef CONFIG_PM
487extern void __init sh7372_init_pm_domains(void);
488#else
489static inline void sh7372_init_pm_domains(void) {}
490#endif
491
498#endif /* __ASM_SH7372_H__ */ 492#endif /* __ASM_SH7372_H__ */
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
index 0a4804694dee..0d722b5b5219 100644
--- a/arch/arm/mach-shmobile/pm-sh7372.c
+++ b/arch/arm/mach-shmobile/pm-sh7372.c
@@ -71,21 +71,6 @@
71 71
72#ifdef CONFIG_PM 72#ifdef CONFIG_PM
73 73
74struct rmobile_pm_domain sh7372_pd_a4lc = {
75 .genpd.name = "A4LC",
76 .bit_shift = 1,
77};
78
79struct rmobile_pm_domain sh7372_pd_a4mp = {
80 .genpd.name = "A4MP",
81 .bit_shift = 2,
82};
83
84struct rmobile_pm_domain sh7372_pd_d4 = {
85 .genpd.name = "D4",
86 .bit_shift = 3,
87};
88
89static int sh7372_a4r_pd_suspend(void) 74static int sh7372_a4r_pd_suspend(void)
90{ 75{
91 sh7372_intcs_suspend(); 76 sh7372_intcs_suspend();
@@ -93,26 +78,9 @@ static int sh7372_a4r_pd_suspend(void)
93 return 0; 78 return 0;
94} 79}
95 80
96struct rmobile_pm_domain sh7372_pd_a4r = {
97 .genpd.name = "A4R",
98 .bit_shift = 5,
99 .suspend = sh7372_a4r_pd_suspend,
100 .resume = sh7372_intcs_resume,
101};
102
103struct rmobile_pm_domain sh7372_pd_a3rv = {
104 .genpd.name = "A3RV",
105 .bit_shift = 6,
106};
107
108struct rmobile_pm_domain sh7372_pd_a3ri = {
109 .genpd.name = "A3RI",
110 .bit_shift = 8,
111};
112
113static bool a4s_suspend_ready; 81static bool a4s_suspend_ready;
114 82
115static int sh7372_pd_a4s_suspend(void) 83static int sh7372_a4s_pd_suspend(void)
116{ 84{
117 /* 85 /*
118 * The A4S domain contains the CPU core and therefore it should 86 * The A4S domain contains the CPU core and therefore it should
@@ -125,20 +93,11 @@ static int sh7372_pd_a4s_suspend(void)
125 return -EBUSY; 93 return -EBUSY;
126} 94}
127 95
128static void sh7372_pd_a4s_resume(void) 96static void sh7372_a4s_pd_resume(void)
129{ 97{
130 a4s_suspend_ready = false; 98 a4s_suspend_ready = false;
131} 99}
132 100
133struct rmobile_pm_domain sh7372_pd_a4s = {
134 .genpd.name = "A4S",
135 .bit_shift = 10,
136 .gov = &pm_domain_always_on_gov,
137 .no_debug = true,
138 .suspend = sh7372_pd_a4s_suspend,
139 .resume = sh7372_pd_a4s_resume,
140};
141
142static int sh7372_a3sp_pd_suspend(void) 101static int sh7372_a3sp_pd_suspend(void)
143{ 102{
144 /* 103 /*
@@ -148,18 +107,62 @@ static int sh7372_a3sp_pd_suspend(void)
148 return console_suspend_enabled ? 0 : -EBUSY; 107 return console_suspend_enabled ? 0 : -EBUSY;
149} 108}
150 109
151struct rmobile_pm_domain sh7372_pd_a3sp = { 110static struct rmobile_pm_domain sh7372_pm_domains[] = {
152 .genpd.name = "A3SP", 111 {
153 .bit_shift = 11, 112 .genpd.name = "A4LC",
154 .gov = &pm_domain_always_on_gov, 113 .bit_shift = 1,
155 .no_debug = true, 114 },
156 .suspend = sh7372_a3sp_pd_suspend, 115 {
116 .genpd.name = "A4MP",
117 .bit_shift = 2,
118 },
119 {
120 .genpd.name = "D4",
121 .bit_shift = 3,
122 },
123 {
124 .genpd.name = "A4R",
125 .bit_shift = 5,
126 .suspend = sh7372_a4r_pd_suspend,
127 .resume = sh7372_intcs_resume,
128 },
129 {
130 .genpd.name = "A3RV",
131 .bit_shift = 6,
132 },
133 {
134 .genpd.name = "A3RI",
135 .bit_shift = 8,
136 },
137 {
138 .genpd.name = "A4S",
139 .bit_shift = 10,
140 .gov = &pm_domain_always_on_gov,
141 .no_debug = true,
142 .suspend = sh7372_a4s_pd_suspend,
143 .resume = sh7372_a4s_pd_resume,
144 },
145 {
146 .genpd.name = "A3SP",
147 .bit_shift = 11,
148 .gov = &pm_domain_always_on_gov,
149 .no_debug = true,
150 .suspend = sh7372_a3sp_pd_suspend,
151 },
152 {
153 .genpd.name = "A3SG",
154 .bit_shift = 13,
155 },
157}; 156};
158 157
159struct rmobile_pm_domain sh7372_pd_a3sg = { 158void __init sh7372_init_pm_domains(void)
160 .genpd.name = "A3SG", 159{
161 .bit_shift = 13, 160 rmobile_init_domains(sh7372_pm_domains, ARRAY_SIZE(sh7372_pm_domains));
162}; 161 pm_genpd_add_subdomain_names("A4LC", "A3RV");
162 pm_genpd_add_subdomain_names("A4R", "A4LC");
163 pm_genpd_add_subdomain_names("A4S", "A3SG");
164 pm_genpd_add_subdomain_names("A4S", "A3SP");
165}
163 166
164#endif /* CONFIG_PM */ 167#endif /* CONFIG_PM */
165 168
@@ -436,7 +439,7 @@ static int sh7372_pm_notifier_fn(struct notifier_block *notifier,
436 * executed during system suspend and resume, respectively, so 439 * executed during system suspend and resume, respectively, so
437 * that those functions don't crash while accessing the INTCS. 440 * that those functions don't crash while accessing the INTCS.
438 */ 441 */
439 pm_genpd_poweron(&sh7372_pd_a4r.genpd); 442 pm_genpd_name_poweron("A4R");
440 break; 443 break;
441 case PM_POST_SUSPEND: 444 case PM_POST_SUSPEND:
442 pm_genpd_poweroff_unused(); 445 pm_genpd_poweroff_unused();
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index a2e1eeafd1a1..c1f698f2b469 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -1001,21 +1001,7 @@ static struct platform_device *sh7372_late_devices[] __initdata = {
1001 1001
1002void __init sh7372_add_standard_devices(void) 1002void __init sh7372_add_standard_devices(void)
1003{ 1003{
1004 rmobile_init_pm_domain(&sh7372_pd_a4lc); 1004 sh7372_init_pm_domains();
1005 rmobile_init_pm_domain(&sh7372_pd_a4mp);
1006 rmobile_init_pm_domain(&sh7372_pd_d4);
1007 rmobile_init_pm_domain(&sh7372_pd_a4r);
1008 rmobile_init_pm_domain(&sh7372_pd_a3rv);
1009 rmobile_init_pm_domain(&sh7372_pd_a3ri);
1010 rmobile_init_pm_domain(&sh7372_pd_a4s);
1011 rmobile_init_pm_domain(&sh7372_pd_a3sp);
1012 rmobile_init_pm_domain(&sh7372_pd_a3sg);
1013
1014 pm_genpd_add_subdomain_names("A4LC", "A3RV");
1015 pm_genpd_add_subdomain_names("A4R", "A4LC");
1016
1017 pm_genpd_add_subdomain_names("A4S", "A3SG");
1018 pm_genpd_add_subdomain_names("A4S", "A3SP");
1019 1005
1020 platform_add_devices(sh7372_early_devices, 1006 platform_add_devices(sh7372_early_devices,
1021 ARRAY_SIZE(sh7372_early_devices)); 1007 ARRAY_SIZE(sh7372_early_devices));