diff options
author | Jonathan Corbet <corbet@lwn.net> | 2010-10-28 13:23:21 -0400 |
---|---|---|
committer | Florian Tobias Schandinat <FlorianSchandinat@gmx.de> | 2010-11-09 11:18:29 -0500 |
commit | 67eb6f9617a24dfb033b584d6b1b42b39cc9297a (patch) | |
tree | 52cdf39d5a27a44935b5f15724b62cad0d436418 /drivers/video/via | |
parent | 751305d9b2fd3e03eaab7808e976241d85ca4353 (diff) |
viafb: suspend/resume for GPIOs
Be sure to re-enable GPIO lines on resume. Users still have to
be sure to set them properly.
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers/video/via')
-rw-r--r-- | drivers/video/via/via-gpio.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/video/via/via-gpio.c b/drivers/video/via/via-gpio.c index 39acb37e7a1d..c2a0a1cfd3b3 100644 --- a/drivers/video/via/via-gpio.c +++ b/drivers/video/via/via-gpio.c | |||
@@ -172,6 +172,28 @@ static void viafb_gpio_disable(struct viafb_gpio *gpio) | |||
172 | via_write_reg_mask(VIASR, gpio->vg_port_index, 0, 0x02); | 172 | via_write_reg_mask(VIASR, gpio->vg_port_index, 0, 0x02); |
173 | } | 173 | } |
174 | 174 | ||
175 | #ifdef CONFIG_PM | ||
176 | |||
177 | static int viafb_gpio_suspend(void *private) | ||
178 | { | ||
179 | return 0; | ||
180 | } | ||
181 | |||
182 | static int viafb_gpio_resume(void *private) | ||
183 | { | ||
184 | int i; | ||
185 | |||
186 | for (i = 0; i < gpio_config.gpio_chip.ngpio; i += 2) | ||
187 | viafb_gpio_enable(gpio_config.active_gpios[i]); | ||
188 | return 0; | ||
189 | } | ||
190 | |||
191 | static struct viafb_pm_hooks viafb_gpio_pm_hooks = { | ||
192 | .suspend = viafb_gpio_suspend, | ||
193 | .resume = viafb_gpio_resume | ||
194 | }; | ||
195 | #endif /* CONFIG_PM */ | ||
196 | |||
175 | /* | 197 | /* |
176 | * Look up a specific gpio and return the number it was assigned. | 198 | * Look up a specific gpio and return the number it was assigned. |
177 | */ | 199 | */ |
@@ -236,6 +258,9 @@ static __devinit int viafb_gpio_probe(struct platform_device *platdev) | |||
236 | printk(KERN_ERR "viafb: failed to add gpios (%d)\n", ret); | 258 | printk(KERN_ERR "viafb: failed to add gpios (%d)\n", ret); |
237 | gpio_config.gpio_chip.ngpio = 0; | 259 | gpio_config.gpio_chip.ngpio = 0; |
238 | } | 260 | } |
261 | #ifdef CONFIG_PM | ||
262 | viafb_pm_register(&viafb_gpio_pm_hooks); | ||
263 | #endif | ||
239 | return ret; | 264 | return ret; |
240 | } | 265 | } |
241 | 266 | ||
@@ -245,6 +270,10 @@ static int viafb_gpio_remove(struct platform_device *platdev) | |||
245 | unsigned long flags; | 270 | unsigned long flags; |
246 | int ret = 0, i; | 271 | int ret = 0, i; |
247 | 272 | ||
273 | #ifdef CONFIG_PM | ||
274 | viafb_pm_unregister(&viafb_gpio_pm_hooks); | ||
275 | #endif | ||
276 | |||
248 | /* | 277 | /* |
249 | * Get unregistered. | 278 | * Get unregistered. |
250 | */ | 279 | */ |