diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2012-11-07 10:01:32 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-11-08 16:23:18 -0500 |
commit | 8939ddc76a2f3399be98a60246ae0b365442f008 (patch) | |
tree | 60771f0178d62b5f0f7592931b1dafc93c25395c /drivers/gpio | |
parent | 5c868fc629b0e645a68aec3a6834d965e71531f4 (diff) |
gpio: tegra: fix suspend/resume apis
Following are changes done to fix the suspend/resume
functionality of tegra gpio driver:
- Protect suspend/resume callbacks with CONFIG_PM_SLEEP
because CONFIG_PM doesn't actually enable any of the PM callbacks, it
only allows to enable CONFIG_PM_SLEEP and CONFIG_PM_RUNTIME.
This means if CONFIG_PM is used to protect system sleep callbacks
then it may end up unreferenced if only runtime PM is enabled.
- Fix the suspend/resume APIs declaration as per callback prototype.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-tegra.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index c7c175a4aff1..da32754fb25b 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/irqdomain.h> | 28 | #include <linux/irqdomain.h> |
29 | #include <linux/pinctrl/consumer.h> | 29 | #include <linux/pinctrl/consumer.h> |
30 | #include <linux/pm.h> | ||
30 | 31 | ||
31 | #include <asm/mach/irq.h> | 32 | #include <asm/mach/irq.h> |
32 | 33 | ||
@@ -64,7 +65,7 @@ struct tegra_gpio_bank { | |||
64 | int bank; | 65 | int bank; |
65 | int irq; | 66 | int irq; |
66 | spinlock_t lvl_lock[4]; | 67 | spinlock_t lvl_lock[4]; |
67 | #ifdef CONFIG_PM | 68 | #ifdef CONFIG_PM_SLEEP |
68 | u32 cnf[4]; | 69 | u32 cnf[4]; |
69 | u32 out[4]; | 70 | u32 out[4]; |
70 | u32 oe[4]; | 71 | u32 oe[4]; |
@@ -285,8 +286,8 @@ static void tegra_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) | |||
285 | 286 | ||
286 | } | 287 | } |
287 | 288 | ||
288 | #ifdef CONFIG_PM | 289 | #ifdef CONFIG_PM_SLEEP |
289 | void tegra_gpio_resume(void) | 290 | static int tegra_gpio_resume(struct device *dev) |
290 | { | 291 | { |
291 | unsigned long flags; | 292 | unsigned long flags; |
292 | int b; | 293 | int b; |
@@ -308,9 +309,10 @@ void tegra_gpio_resume(void) | |||
308 | } | 309 | } |
309 | 310 | ||
310 | local_irq_restore(flags); | 311 | local_irq_restore(flags); |
312 | return 0; | ||
311 | } | 313 | } |
312 | 314 | ||
313 | void tegra_gpio_suspend(void) | 315 | static int tegra_gpio_suspend(struct device *dev) |
314 | { | 316 | { |
315 | unsigned long flags; | 317 | unsigned long flags; |
316 | int b; | 318 | int b; |
@@ -330,6 +332,7 @@ void tegra_gpio_suspend(void) | |||
330 | } | 332 | } |
331 | } | 333 | } |
332 | local_irq_restore(flags); | 334 | local_irq_restore(flags); |
335 | return 0; | ||
333 | } | 336 | } |
334 | 337 | ||
335 | static int tegra_gpio_wake_enable(struct irq_data *d, unsigned int enable) | 338 | static int tegra_gpio_wake_enable(struct irq_data *d, unsigned int enable) |
@@ -345,11 +348,15 @@ static struct irq_chip tegra_gpio_irq_chip = { | |||
345 | .irq_mask = tegra_gpio_irq_mask, | 348 | .irq_mask = tegra_gpio_irq_mask, |
346 | .irq_unmask = tegra_gpio_irq_unmask, | 349 | .irq_unmask = tegra_gpio_irq_unmask, |
347 | .irq_set_type = tegra_gpio_irq_set_type, | 350 | .irq_set_type = tegra_gpio_irq_set_type, |
348 | #ifdef CONFIG_PM | 351 | #ifdef CONFIG_PM_SLEEP |
349 | .irq_set_wake = tegra_gpio_wake_enable, | 352 | .irq_set_wake = tegra_gpio_wake_enable, |
350 | #endif | 353 | #endif |
351 | }; | 354 | }; |
352 | 355 | ||
356 | static const struct dev_pm_ops tegra_gpio_pm_ops = { | ||
357 | SET_SYSTEM_SLEEP_PM_OPS(tegra_gpio_suspend, tegra_gpio_resume) | ||
358 | }; | ||
359 | |||
353 | struct tegra_gpio_soc_config { | 360 | struct tegra_gpio_soc_config { |
354 | u32 bank_stride; | 361 | u32 bank_stride; |
355 | u32 upper_offset; | 362 | u32 upper_offset; |
@@ -489,6 +496,7 @@ static struct platform_driver tegra_gpio_driver = { | |||
489 | .driver = { | 496 | .driver = { |
490 | .name = "tegra-gpio", | 497 | .name = "tegra-gpio", |
491 | .owner = THIS_MODULE, | 498 | .owner = THIS_MODULE, |
499 | .pm = &tegra_gpio_pm_ops, | ||
492 | .of_match_table = tegra_gpio_of_match, | 500 | .of_match_table = tegra_gpio_of_match, |
493 | }, | 501 | }, |
494 | .probe = tegra_gpio_probe, | 502 | .probe = tegra_gpio_probe, |