mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
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 <[email protected]> Cc: Dmitry Torokhov <[email protected]> Cc: Stephen Warren <[email protected]> Acked-by: Wolfram Sang <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Reviewed-by: Mark Brown <[email protected]> Reviewed-by: Kevin Hilman <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
This commit is contained in:
parent
7970cb770d
commit
14005ee270
4 changed files with 118 additions and 0 deletions
|
|
@ -48,6 +48,25 @@ int pinctrl_bind_pins(struct device *dev)
|
|||
goto cleanup_get;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
/*
|
||||
* If power management is enabled, we also look for the optional
|
||||
* sleep and idle pin states, with semantics as defined in
|
||||
* <linux/pinctrl/pinctrl-state.h>
|
||||
*/
|
||||
dev->pins->sleep_state = pinctrl_lookup_state(dev->pins->p,
|
||||
PINCTRL_STATE_SLEEP);
|
||||
if (IS_ERR(dev->pins->sleep_state))
|
||||
/* Not supplying this state is perfectly legal */
|
||||
dev_dbg(dev, "no sleep pinctrl state\n");
|
||||
|
||||
dev->pins->idle_state = pinctrl_lookup_state(dev->pins->p,
|
||||
PINCTRL_STATE_IDLE);
|
||||
if (IS_ERR(dev->pins->idle_state))
|
||||
/* Not supplying this state is perfectly legal */
|
||||
dev_dbg(dev, "no idle pinctrl state\n");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue