diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2014-12-03 08:41:42 -0500 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2015-01-12 19:33:19 -0500 |
commit | 4b9d62e02a0124d06fbbb9c4b01bd69f3c4dcd35 (patch) | |
tree | 04274aee83c20d7bcd01f9bfa15cec9a8ebc1414 | |
parent | 39695882d3d642a73bca551e682426e4e3bcd158 (diff) |
ARM: shmobile: R-Mobile: Use generic_pm_domain.attach_dev() for pm_clk setup
Use the just introduced genpd attach/detach callbacks to register the
devices' module clocks, instead of doing it directly, to make it
DT-proof.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-rw-r--r-- | arch/arm/mach-shmobile/pm-rmobile.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c index 6f7d56ecf969..4ea458d268fb 100644 --- a/arch/arm/mach-shmobile/pm-rmobile.c +++ b/arch/arm/mach-shmobile/pm-rmobile.c | |||
@@ -101,6 +101,36 @@ static bool rmobile_pd_active_wakeup(struct device *dev) | |||
101 | return true; | 101 | return true; |
102 | } | 102 | } |
103 | 103 | ||
104 | static int rmobile_pd_attach_dev(struct generic_pm_domain *domain, | ||
105 | struct device *dev) | ||
106 | { | ||
107 | int error; | ||
108 | |||
109 | error = pm_clk_create(dev); | ||
110 | if (error) { | ||
111 | dev_err(dev, "pm_clk_create failed %d\n", error); | ||
112 | return error; | ||
113 | } | ||
114 | |||
115 | error = pm_clk_add(dev, NULL); | ||
116 | if (error) { | ||
117 | dev_err(dev, "pm_clk_add failed %d\n", error); | ||
118 | goto fail; | ||
119 | } | ||
120 | |||
121 | return 0; | ||
122 | |||
123 | fail: | ||
124 | pm_clk_destroy(dev); | ||
125 | return error; | ||
126 | } | ||
127 | |||
128 | static void rmobile_pd_detach_dev(struct generic_pm_domain *domain, | ||
129 | struct device *dev) | ||
130 | { | ||
131 | pm_clk_destroy(dev); | ||
132 | } | ||
133 | |||
104 | static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) | 134 | static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) |
105 | { | 135 | { |
106 | struct generic_pm_domain *genpd = &rmobile_pd->genpd; | 136 | struct generic_pm_domain *genpd = &rmobile_pd->genpd; |
@@ -111,6 +141,8 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) | |||
111 | genpd->dev_ops.active_wakeup = rmobile_pd_active_wakeup; | 141 | genpd->dev_ops.active_wakeup = rmobile_pd_active_wakeup; |
112 | genpd->power_off = rmobile_pd_power_down; | 142 | genpd->power_off = rmobile_pd_power_down; |
113 | genpd->power_on = rmobile_pd_power_up; | 143 | genpd->power_on = rmobile_pd_power_up; |
144 | genpd->attach_dev = rmobile_pd_attach_dev; | ||
145 | genpd->detach_dev = rmobile_pd_detach_dev; | ||
114 | __rmobile_pd_power_up(rmobile_pd, false); | 146 | __rmobile_pd_power_up(rmobile_pd, false); |
115 | } | 147 | } |
116 | 148 | ||
@@ -129,8 +161,6 @@ void rmobile_add_device_to_domain_td(const char *domain_name, | |||
129 | struct device *dev = &pdev->dev; | 161 | struct device *dev = &pdev->dev; |
130 | 162 | ||
131 | __pm_genpd_name_add_device(domain_name, dev, td); | 163 | __pm_genpd_name_add_device(domain_name, dev, td); |
132 | if (pm_clk_no_clocks(dev)) | ||
133 | pm_clk_add(dev, NULL); | ||
134 | } | 164 | } |
135 | 165 | ||
136 | void rmobile_add_devices_to_domains(struct pm_domain_device data[], | 166 | void rmobile_add_devices_to_domains(struct pm_domain_device data[], |