diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2012-08-06 19:12:56 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2012-09-03 19:44:57 -0400 |
commit | e7e59a4b55706b0bbaba1cd8af46495553b6e876 (patch) | |
tree | 7f2a41260d1e4925769a1a890db1f48d58805c88 /arch/arm/mach-shmobile | |
parent | 70fe7b24672a988f8aab77a04329d6331a1f10a8 (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.h | 18 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/pm-sh7372.c | 111 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/setup-sh7372.c | 16 |
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; | |||
478 | extern struct clk sh7372_fsidiva_clk; | 478 | extern struct clk sh7372_fsidiva_clk; |
479 | extern struct clk sh7372_fsidivb_clk; | 479 | extern struct clk sh7372_fsidivb_clk; |
480 | 480 | ||
481 | #ifdef CONFIG_PM | ||
482 | extern struct rmobile_pm_domain sh7372_pd_a4lc; | ||
483 | extern struct rmobile_pm_domain sh7372_pd_a4mp; | ||
484 | extern struct rmobile_pm_domain sh7372_pd_d4; | ||
485 | extern struct rmobile_pm_domain sh7372_pd_a4r; | ||
486 | extern struct rmobile_pm_domain sh7372_pd_a3rv; | ||
487 | extern struct rmobile_pm_domain sh7372_pd_a3ri; | ||
488 | extern struct rmobile_pm_domain sh7372_pd_a4s; | ||
489 | extern struct rmobile_pm_domain sh7372_pd_a3sp; | ||
490 | extern struct rmobile_pm_domain sh7372_pd_a3sg; | ||
491 | #endif /* CONFIG_PM */ | ||
492 | |||
493 | extern void sh7372_intcs_suspend(void); | 481 | extern void sh7372_intcs_suspend(void); |
494 | extern void sh7372_intcs_resume(void); | 482 | extern void sh7372_intcs_resume(void); |
495 | extern void sh7372_intca_suspend(void); | 483 | extern void sh7372_intca_suspend(void); |
496 | extern void sh7372_intca_resume(void); | 484 | extern void sh7372_intca_resume(void); |
497 | 485 | ||
486 | #ifdef CONFIG_PM | ||
487 | extern void __init sh7372_init_pm_domains(void); | ||
488 | #else | ||
489 | static 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 | ||
74 | struct rmobile_pm_domain sh7372_pd_a4lc = { | ||
75 | .genpd.name = "A4LC", | ||
76 | .bit_shift = 1, | ||
77 | }; | ||
78 | |||
79 | struct rmobile_pm_domain sh7372_pd_a4mp = { | ||
80 | .genpd.name = "A4MP", | ||
81 | .bit_shift = 2, | ||
82 | }; | ||
83 | |||
84 | struct rmobile_pm_domain sh7372_pd_d4 = { | ||
85 | .genpd.name = "D4", | ||
86 | .bit_shift = 3, | ||
87 | }; | ||
88 | |||
89 | static int sh7372_a4r_pd_suspend(void) | 74 | static 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 | ||
96 | struct 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 | |||
103 | struct rmobile_pm_domain sh7372_pd_a3rv = { | ||
104 | .genpd.name = "A3RV", | ||
105 | .bit_shift = 6, | ||
106 | }; | ||
107 | |||
108 | struct rmobile_pm_domain sh7372_pd_a3ri = { | ||
109 | .genpd.name = "A3RI", | ||
110 | .bit_shift = 8, | ||
111 | }; | ||
112 | |||
113 | static bool a4s_suspend_ready; | 81 | static bool a4s_suspend_ready; |
114 | 82 | ||
115 | static int sh7372_pd_a4s_suspend(void) | 83 | static 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 | ||
128 | static void sh7372_pd_a4s_resume(void) | 96 | static void sh7372_a4s_pd_resume(void) |
129 | { | 97 | { |
130 | a4s_suspend_ready = false; | 98 | a4s_suspend_ready = false; |
131 | } | 99 | } |
132 | 100 | ||
133 | struct 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 | |||
142 | static int sh7372_a3sp_pd_suspend(void) | 101 | static 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 | ||
151 | struct rmobile_pm_domain sh7372_pd_a3sp = { | 110 | static 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 | ||
159 | struct rmobile_pm_domain sh7372_pd_a3sg = { | 158 | void __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 | ||
1002 | void __init sh7372_add_standard_devices(void) | 1002 | void __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)); |