Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a502b343 authored by Alexandre Torgue's avatar Alexandre Torgue Committed by Linus Walleij
Browse files

pinctrl: stmfx: update pinconf settings



According to the following tab (coming from STMFX datasheet), updates
have to done in stmfx_pinconf_set function:

-"type" has to be set when "bias" is configured as "pull-up or pull-down"
-PIN_CONFIG_DRIVE_PUSH_PULL should only be used when gpio is configured as
 output. There is so no need to check direction.

DIR | TYPE | PUPD | MFX GPIO configuration
----|------|------|---------------------------------------------------
1   | 1    | 1    | OUTPUT open drain with internal pull-up resistor
----|------|------|---------------------------------------------------
1   | 1    | 0    | OUTPUT open drain with internal pull-down resistor
----|------|------|---------------------------------------------------
1   | 0    | 0/1  | OUTPUT push pull no pull
----|------|------|---------------------------------------------------
0   | 1    | 1    | INPUT with internal pull-up resistor
----|------|------|---------------------------------------------------
0   | 1    | 0    | INPUT with internal pull-down resistor
----|------|------|---------------------------------------------------
0   | 0    | 1    | INPUT floating
----|------|------|---------------------------------------------------
0   | 0    | 0    | analog (GPIO not used, default setting)

Signed-off-by: default avatarAlexandre Torgue <alexandre.torgue@st.com>
Signed-off-by: default avatarAmelie Delaunay <amelie.delaunay@st.com>
Link: https://lore.kernel.org/r/1564053416-32192-1-git-send-email-amelie.delaunay@st.com


Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 2f22e202
Loading
Loading
Loading
Loading
+12 −12
Original line number Original line Diff line number Diff line
@@ -296,28 +296,28 @@ static int stmfx_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
		switch (param) {
		switch (param) {
		case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT:
		case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT:
		case PIN_CONFIG_BIAS_DISABLE:
		case PIN_CONFIG_BIAS_DISABLE:
		case PIN_CONFIG_DRIVE_PUSH_PULL:
			ret = stmfx_pinconf_set_type(pctl, pin, 0);
			if (ret)
				return ret;
			break;
		case PIN_CONFIG_BIAS_PULL_DOWN:
		case PIN_CONFIG_BIAS_PULL_DOWN:
			ret = stmfx_pinconf_set_type(pctl, pin, 1);
			if (ret)
				return ret;
			ret = stmfx_pinconf_set_pupd(pctl, pin, 0);
			ret = stmfx_pinconf_set_pupd(pctl, pin, 0);
			if (ret)
			if (ret)
				return ret;
				return ret;
			break;
			break;
		case PIN_CONFIG_BIAS_PULL_UP:
		case PIN_CONFIG_BIAS_PULL_UP:
			ret = stmfx_pinconf_set_pupd(pctl, pin, 1);
			ret = stmfx_pinconf_set_type(pctl, pin, 1);
			if (ret)
			if (ret)
				return ret;
				return ret;
			break;
			ret = stmfx_pinconf_set_pupd(pctl, pin, 1);
		case PIN_CONFIG_DRIVE_OPEN_DRAIN:
			if (!dir)
				ret = stmfx_pinconf_set_type(pctl, pin, 1);
			else
				ret = stmfx_pinconf_set_type(pctl, pin, 0);
			if (ret)
			if (ret)
				return ret;
				return ret;
			break;
			break;
		case PIN_CONFIG_DRIVE_PUSH_PULL:
		case PIN_CONFIG_DRIVE_OPEN_DRAIN:
			if (!dir)
				ret = stmfx_pinconf_set_type(pctl, pin, 0);
			else
			ret = stmfx_pinconf_set_type(pctl, pin, 1);
			ret = stmfx_pinconf_set_type(pctl, pin, 1);
			if (ret)
			if (ret)
				return ret;
				return ret;