@@ -977,18 +977,12 @@ struct pinctrl_state *pinctrl_lookup_state(struct pinctrl *p,
EXPORT_SYMBOL_GPL(pinctrl_lookup_state);
/**
- * pinctrl_select_state() - select/activate/program a pinctrl state to HW
- * @p: the pinctrl handle for the device that requests configuration
- * @state: the state handle to select/activate/program
+ * pinctrl_deselect_state() - deselect a pinctrl state to HW
+ * @p: the pinctrl handle for the device that requests deconfiguration
*/
-int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state)
+void pinctrl_deselect_state(struct pinctrl *p)
{
- struct pinctrl_setting *setting, *setting2;
- struct pinctrl_state *old_state = p->state;
- int ret;
-
- if (p->state == state)
- return 0;
+ struct pinctrl_setting *setting;
if (p->state) {
/*
@@ -1002,9 +996,27 @@ int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state)
continue;
pinmux_disable_setting(setting);
}
+
+ p->state = NULL;
}
+}
+EXPORT_SYMBOL_GPL(pinctrl_deselect_state);
+
+/**
+ * pinctrl_select_state() - select/activate/program a pinctrl state to HW
+ * @p: the pinctrl handle for the device that requests configuration
+ * @state: the state handle to select/activate/program
+ */
+int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state)
+{
+ struct pinctrl_setting *setting, *setting2;
+ struct pinctrl_state *old_state = p->state;
+ int ret;
+
+ if (p->state == state)
+ return 0;
- p->state = NULL;
+ pinctrl_deselect_state(p);
/* Apply all the settings for the new state */
list_for_each_entry(setting, &state->settings, node) {
@@ -36,6 +36,7 @@ extern struct pinctrl_state * __must_check pinctrl_lookup_state(
struct pinctrl *p,
const char *name);
extern int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s);
+extern void pinctrl_deselect_state(struct pinctrl *p);
extern struct pinctrl * __must_check devm_pinctrl_get(struct device *dev);
extern void devm_pinctrl_put(struct pinctrl *p);
@@ -102,6 +103,10 @@ static inline int pinctrl_select_state(struct pinctrl *p,
return 0;
}
+static inline void pinctrl_deselect_state(struct pinctrl *p)
+{
+}
+
static inline struct pinctrl * __must_check devm_pinctrl_get(struct device *dev)
{
return ERR_PTR(-ENOSYS);