/* interrupt active */
pmx_ts_int_active {
ts_int_active: ts_int_active {
mux {
pins = "gpio65";
function = "gpio";
};
config {
pins = "gpio65";
drive-strength = <8>;
bias-pull-up;
};
};
};
/* interrupt suspend */
pmx_ts_int_suspend {
ts_int_suspend: ts_int_suspend {
mux {
pins = "gpio65";
function = "gpio";
};
config {
pins = "gpio65";
drive-strength = <2>;
bias-pull-down;
};
};
};
pinctrl-names = "cyttsp_ts_active",
"cyttsp_ts_suspend","cyttsp_ts_release";
pinctrl-0 = <&ts_int_active &ts_reset_active>;
pinctrl-1 = <&ts_int_suspend &ts_reset_suspend>;
pinctrl-2 = <&ts_release>;
#define PINCTRL_STATE_ACTIVE "cyttsp_ts_active"
#define PINCTRL_STATE_SUSPEND "cyttsp_ts_suspend"
#define PINCTRL_STATE_RELEASE "cyttsp_ts_release"
struct pinctrl *ts_pinctrl;
struct pinctrl_state *pinctrl_state;
/* get pinctrl handle */
ts_pinctrl = devm_pinctrl_get(dev);
if (IS_ERR_OR_NULL(ts_pinctrl)) {
rc = PTR_ERR(ts_pinctrl);
dev_err(dev, "%s: Target does not use pinctrl %d\n", __func__, rc);
return rc;
}
/* find pinctrl state by name */
pinctrl_state = pinctrl_lookup_state(ts_pinctrl, PINCTRL_STATE_ACTIVE);
if (IS_ERR_OR_NULL(pinctrl_state)) {
rc = PTR_ERR(pinctrl_state);
dev_err(dev, "%s: Can not lookup cyttsp_ts_active pinstate %d\n", __func__, rc);
return rc;
}
/* select the pinctrl state */
rc = pinctrl_select_state(ts_pinctrl, pinctrl_state);
if (rc < 0)
dev_err(dev, "%s: Cannot get active pinctrl state\n", __func__);
Pinctrl子系统之一了解基础概念_白鲸入海的博客-CSDN博客_pinctrl