Commit 3e8c6bc6 authored by Chen-Yu Tsai's avatar Chen-Yu Tsai Committed by Linus Walleij
Browse files

pinctrl: mediatek: paris: Fix PIN_CONFIG_BIAS_* readback



When reading back pin bias settings, if the pin is not in the
corresponding bias state, the function should return -EINVAL.

Fix this in the mediatek-paris pinctrl library so that the read back
state is not littered with bogus a "input bias disabled" combined with
"pull up" or "pull down" states.

Fixes: 80525098 ("pinctrl: mediatek: add pinctrl-paris that implements the vendor dt-bindings")
Signed-off-by: default avatarChen-Yu Tsai <wenst@chromium.org>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220308100956.2750295-3-wenst@chromium.org


Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 188e5834
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -96,20 +96,16 @@ static int mtk_pinconf_get(struct pinctrl_dev *pctldev,
			err = hw->soc->bias_get_combo(hw, desc, &pullup, &ret);
			if (err)
				goto out;
			if (param == PIN_CONFIG_BIAS_DISABLE) {
			if (ret == MTK_PUPD_SET_R1R0_00)
				ret = MTK_DISABLE;
			if (param == PIN_CONFIG_BIAS_DISABLE) {
				if (ret != MTK_DISABLE)
					err = -EINVAL;
			} else if (param == PIN_CONFIG_BIAS_PULL_UP) {
				/* When desire to get pull-up value, return
				 *  error if current setting is pull-down
				 */
				if (!pullup)
				if (!pullup || ret == MTK_DISABLE)
					err = -EINVAL;
			} else if (param == PIN_CONFIG_BIAS_PULL_DOWN) {
				/* When desire to get pull-down value, return
				 *  error if current setting is pull-up
				 */
				if (pullup)
				if (pullup || ret == MTK_DISABLE)
					err = -EINVAL;
			}
		} else {