Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[cascardo/linux.git] / drivers / base / pinctrl.c
index 67a274e..5fb74b4 100644 (file)
@@ -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;
 
        /*