aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/amba/bus.c
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2013-12-09 04:38:20 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2013-12-09 15:25:19 -0500
commit26825cfd90f94f47068519901b3670ae7da320fe (patch)
treeb01332dabbfdf52f8d70d8f4baf803960e2f7068 /drivers/amba/bus.c
parentdc1ccc48159d63eca5089e507c82c7d22ef60839 (diff)
ARM: 7914/1: amba: Drop legacy PM support and use the pm_generic functions
All AMBA drivers have converted to use the modern PM ops thus we can safely drop the legacy PM support from the bus. While using the modern PM ops it also makes sense to convert to use the pm_generic callback functions. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/amba/bus.c')
-rw-r--r--drivers/amba/bus.c180
1 files changed, 7 insertions, 173 deletions
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index c4876ac9151a..b90dc1ec109d 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -83,162 +83,6 @@ static struct device_attribute amba_dev_attrs[] = {
83 __ATTR_NULL, 83 __ATTR_NULL,
84}; 84};
85 85
86#ifdef CONFIG_PM_SLEEP
87
88static int amba_legacy_suspend(struct device *dev, pm_message_t mesg)
89{
90 struct amba_driver *adrv = to_amba_driver(dev->driver);
91 struct amba_device *adev = to_amba_device(dev);
92 int ret = 0;
93
94 if (dev->driver && adrv->suspend)
95 ret = adrv->suspend(adev, mesg);
96
97 return ret;
98}
99
100static int amba_legacy_resume(struct device *dev)
101{
102 struct amba_driver *adrv = to_amba_driver(dev->driver);
103 struct amba_device *adev = to_amba_device(dev);
104 int ret = 0;
105
106 if (dev->driver && adrv->resume)
107 ret = adrv->resume(adev);
108
109 return ret;
110}
111
112#endif /* CONFIG_PM_SLEEP */
113
114#ifdef CONFIG_SUSPEND
115
116static int amba_pm_suspend(struct device *dev)
117{
118 struct device_driver *drv = dev->driver;
119 int ret = 0;
120
121 if (!drv)
122 return 0;
123
124 if (drv->pm) {
125 if (drv->pm->suspend)
126 ret = drv->pm->suspend(dev);
127 } else {
128 ret = amba_legacy_suspend(dev, PMSG_SUSPEND);
129 }
130
131 return ret;
132}
133
134static int amba_pm_resume(struct device *dev)
135{
136 struct device_driver *drv = dev->driver;
137 int ret = 0;
138
139 if (!drv)
140 return 0;
141
142 if (drv->pm) {
143 if (drv->pm->resume)
144 ret = drv->pm->resume(dev);
145 } else {
146 ret = amba_legacy_resume(dev);
147 }
148
149 return ret;
150}
151
152#else /* !CONFIG_SUSPEND */
153
154#define amba_pm_suspend NULL
155#define amba_pm_resume NULL
156
157#endif /* !CONFIG_SUSPEND */
158
159#ifdef CONFIG_HIBERNATE_CALLBACKS
160
161static int amba_pm_freeze(struct device *dev)
162{
163 struct device_driver *drv = dev->driver;
164 int ret = 0;
165
166 if (!drv)
167 return 0;
168
169 if (drv->pm) {
170 if (drv->pm->freeze)
171 ret = drv->pm->freeze(dev);
172 } else {
173 ret = amba_legacy_suspend(dev, PMSG_FREEZE);
174 }
175
176 return ret;
177}
178
179static int amba_pm_thaw(struct device *dev)
180{
181 struct device_driver *drv = dev->driver;
182 int ret = 0;
183
184 if (!drv)
185 return 0;
186
187 if (drv->pm) {
188 if (drv->pm->thaw)
189 ret = drv->pm->thaw(dev);
190 } else {
191 ret = amba_legacy_resume(dev);
192 }
193
194 return ret;
195}
196
197static int amba_pm_poweroff(struct device *dev)
198{
199 struct device_driver *drv = dev->driver;
200 int ret = 0;
201
202 if (!drv)
203 return 0;
204
205 if (drv->pm) {
206 if (drv->pm->poweroff)
207 ret = drv->pm->poweroff(dev);
208 } else {
209 ret = amba_legacy_suspend(dev, PMSG_HIBERNATE);
210 }
211
212 return ret;
213}
214
215static int amba_pm_restore(struct device *dev)
216{
217 struct device_driver *drv = dev->driver;
218 int ret = 0;
219
220 if (!drv)
221 return 0;
222
223 if (drv->pm) {
224 if (drv->pm->restore)
225 ret = drv->pm->restore(dev);
226 } else {
227 ret = amba_legacy_resume(dev);
228 }
229
230 return ret;
231}
232
233#else /* !CONFIG_HIBERNATE_CALLBACKS */
234
235#define amba_pm_freeze NULL
236#define amba_pm_thaw NULL
237#define amba_pm_poweroff NULL
238#define amba_pm_restore NULL
239
240#endif /* !CONFIG_HIBERNATE_CALLBACKS */
241
242#ifdef CONFIG_PM_RUNTIME 86#ifdef CONFIG_PM_RUNTIME
243/* 87/*
244 * Hooks to provide runtime PM of the pclk (bus clock). It is safe to 88 * Hooks to provide runtime PM of the pclk (bus clock). It is safe to
@@ -272,15 +116,13 @@ static int amba_pm_runtime_resume(struct device *dev)
272} 116}
273#endif 117#endif
274 118
275#ifdef CONFIG_PM
276
277static const struct dev_pm_ops amba_pm = { 119static const struct dev_pm_ops amba_pm = {
278 .suspend = amba_pm_suspend, 120 .suspend = pm_generic_suspend,
279 .resume = amba_pm_resume, 121 .resume = pm_generic_resume,
280 .freeze = amba_pm_freeze, 122 .freeze = pm_generic_freeze,
281 .thaw = amba_pm_thaw, 123 .thaw = pm_generic_thaw,
282 .poweroff = amba_pm_poweroff, 124 .poweroff = pm_generic_poweroff,
283 .restore = amba_pm_restore, 125 .restore = pm_generic_restore,
284 SET_RUNTIME_PM_OPS( 126 SET_RUNTIME_PM_OPS(
285 amba_pm_runtime_suspend, 127 amba_pm_runtime_suspend,
286 amba_pm_runtime_resume, 128 amba_pm_runtime_resume,
@@ -288,14 +130,6 @@ static const struct dev_pm_ops amba_pm = {
288 ) 130 )
289}; 131};
290 132
291#define AMBA_PM (&amba_pm)
292
293#else /* !CONFIG_PM */
294
295#define AMBA_PM NULL
296
297#endif /* !CONFIG_PM */
298
299/* 133/*
300 * Primecells are part of the Advanced Microcontroller Bus Architecture, 134 * Primecells are part of the Advanced Microcontroller Bus Architecture,
301 * so we call the bus "amba". 135 * so we call the bus "amba".
@@ -305,7 +139,7 @@ struct bus_type amba_bustype = {
305 .dev_attrs = amba_dev_attrs, 139 .dev_attrs = amba_dev_attrs,
306 .match = amba_match, 140 .match = amba_match,
307 .uevent = amba_uevent, 141 .uevent = amba_uevent,
308 .pm = AMBA_PM, 142 .pm = &amba_pm,
309}; 143};
310 144
311static int __init amba_init(void) 145static int __init amba_init(void)