diff options
author | Julien Delacou <julien.delacou@stericsson.com> | 2012-12-11 03:17:47 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-01-11 15:49:20 -0500 |
commit | 8d99b32d7b9fb542c5efb00a8ec3b96e77be86fd (patch) | |
tree | 22bcddd8d17595dde8cb3deb537b40648ae5ca4d | |
parent | 840a47ba43a2aefbd9834924228549879ee3cb49 (diff) |
pinctrl/nomadik: adopt pinctrl sleep mode management
This fix makes pinctrl-nomadik able to handle
suspend/resume events and change hogged pins states
accordingly.
Signed-off-by: Julien Delacou <julien.delacou@stericsson.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/pinctrl/pinctrl-nomadik.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index 1bb16ffb4e41..5d8a0066ab60 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <asm/mach/irq.h> | 34 | #include <asm/mach/irq.h> |
35 | #include <mach/irqs.h> | 35 | #include <mach/irqs.h> |
36 | #include "pinctrl-nomadik.h" | 36 | #include "pinctrl-nomadik.h" |
37 | #include "core.h" | ||
37 | 38 | ||
38 | /* | 39 | /* |
39 | * The GPIO module in the Nomadik family of Systems-on-Chip is an | 40 | * The GPIO module in the Nomadik family of Systems-on-Chip is an |
@@ -1852,6 +1853,28 @@ static const struct of_device_id nmk_pinctrl_match[] = { | |||
1852 | {}, | 1853 | {}, |
1853 | }; | 1854 | }; |
1854 | 1855 | ||
1856 | static int nmk_pinctrl_suspend(struct platform_device *pdev, pm_message_t state) | ||
1857 | { | ||
1858 | struct nmk_pinctrl *npct; | ||
1859 | |||
1860 | npct = platform_get_drvdata(pdev); | ||
1861 | if (!npct) | ||
1862 | return -EINVAL; | ||
1863 | |||
1864 | return pinctrl_force_sleep(npct->pctl); | ||
1865 | } | ||
1866 | |||
1867 | static int nmk_pinctrl_resume(struct platform_device *pdev) | ||
1868 | { | ||
1869 | struct nmk_pinctrl *npct; | ||
1870 | |||
1871 | npct = platform_get_drvdata(pdev); | ||
1872 | if (!npct) | ||
1873 | return -EINVAL; | ||
1874 | |||
1875 | return pinctrl_force_default(npct->pctl); | ||
1876 | } | ||
1877 | |||
1855 | static int nmk_pinctrl_probe(struct platform_device *pdev) | 1878 | static int nmk_pinctrl_probe(struct platform_device *pdev) |
1856 | { | 1879 | { |
1857 | const struct platform_device_id *platid = platform_get_device_id(pdev); | 1880 | const struct platform_device_id *platid = platform_get_device_id(pdev); |
@@ -1963,6 +1986,10 @@ static struct platform_driver nmk_pinctrl_driver = { | |||
1963 | }, | 1986 | }, |
1964 | .probe = nmk_pinctrl_probe, | 1987 | .probe = nmk_pinctrl_probe, |
1965 | .id_table = nmk_pinctrl_id, | 1988 | .id_table = nmk_pinctrl_id, |
1989 | #ifdef CONFIG_PM | ||
1990 | .suspend = nmk_pinctrl_suspend, | ||
1991 | .resume = nmk_pinctrl_resume, | ||
1992 | #endif | ||
1966 | }; | 1993 | }; |
1967 | 1994 | ||
1968 | static int __init nmk_gpio_init(void) | 1995 | static int __init nmk_gpio_init(void) |