aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pinctrl
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2013-06-05 09:30:33 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-06-16 05:56:52 -0400
commit14005ee270cad7078adbce6b7f3687b992a8334e (patch)
tree65771454d8f060007a489927cf9f70847503f4ce /include/linux/pinctrl
parent7970cb770dffa23cb20a36f46602e688e075f5d9 (diff)
drivers: pinctrl sleep and idle states in the core
If a device have sleep and idle states in addition to the default state, look up these in the core and stash them in the pinctrl state container. Add accessor functions for pinctrl consumers to put the pins into "default", "sleep" and "idle" states passing nothing but the struct device * affected. Solution suggested by Kevin Hilman, Mark Brown and Dmitry Torokhov in response to a patch series from Hebbar Gururaja. Cc: Hebbar Gururaja <gururaja.hebbar@ti.com> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: Stephen Warren <swarren@wwwdotorg.org> Acked-by: Wolfram Sang <wsa@the-dreams.de> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Mark Brown <broonie@kernel.org> Reviewed-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'include/linux/pinctrl')
-rw-r--r--include/linux/pinctrl/consumer.h34
-rw-r--r--include/linux/pinctrl/devinfo.h4
2 files changed, 38 insertions, 0 deletions
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 4aad3cea69ae..0f32f10e347d 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -40,6 +40,25 @@ extern int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s);
40extern struct pinctrl * __must_check devm_pinctrl_get(struct device *dev); 40extern struct pinctrl * __must_check devm_pinctrl_get(struct device *dev);
41extern void devm_pinctrl_put(struct pinctrl *p); 41extern void devm_pinctrl_put(struct pinctrl *p);
42 42
43#ifdef CONFIG_PM
44extern int pinctrl_pm_select_default_state(struct device *dev);
45extern int pinctrl_pm_select_sleep_state(struct device *dev);
46extern int pinctrl_pm_select_idle_state(struct device *dev);
47#else
48static inline int pinctrl_pm_select_default_state(struct device *dev)
49{
50 return 0;
51}
52static inline int pinctrl_pm_select_sleep_state(struct device *dev)
53{
54 return 0;
55}
56static inline int pinctrl_pm_select_idle_state(struct device *dev)
57{
58 return 0;
59}
60#endif
61
43#else /* !CONFIG_PINCTRL */ 62#else /* !CONFIG_PINCTRL */
44 63
45static inline int pinctrl_request_gpio(unsigned gpio) 64static inline int pinctrl_request_gpio(unsigned gpio)
@@ -199,6 +218,21 @@ static inline int pin_config_group_set(const char *dev_name,
199 return 0; 218 return 0;
200} 219}
201 220
221static inline int pinctrl_pm_select_default_state(struct device *dev)
222{
223 return 0;
224}
225
226static inline int pinctrl_pm_select_sleep_state(struct device *dev)
227{
228 return 0;
229}
230
231static inline int pinctrl_pm_select_idle_state(struct device *dev)
232{
233 return 0;
234}
235
202#endif 236#endif
203 237
204#endif /* __LINUX_PINCTRL_CONSUMER_H */ 238#endif /* __LINUX_PINCTRL_CONSUMER_H */
diff --git a/include/linux/pinctrl/devinfo.h b/include/linux/pinctrl/devinfo.h
index 6e5f8a985ea7..281cb91ddcf5 100644
--- a/include/linux/pinctrl/devinfo.h
+++ b/include/linux/pinctrl/devinfo.h
@@ -28,6 +28,10 @@
28struct dev_pin_info { 28struct dev_pin_info {
29 struct pinctrl *p; 29 struct pinctrl *p;
30 struct pinctrl_state *default_state; 30 struct pinctrl_state *default_state;
31#ifdef CONFIG_PM
32 struct pinctrl_state *sleep_state;
33 struct pinctrl_state *idle_state;
34#endif
31}; 35};
32 36
33extern int pinctrl_bind_pins(struct device *dev); 37extern int pinctrl_bind_pins(struct device *dev);