mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
pinctrl: mediatek: paris: Fix PIN_CONFIG_BIAS_* readback
[ Upstream commit3e8c6bc608] 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:805250982b("pinctrl: mediatek: add pinctrl-paris that implements the vendor dt-bindings") Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20220308100956.2750295-3-wenst@chromium.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
72ea0fefea
commit
901e192ac9
|
|
@ -96,20 +96,16 @@ static int mtk_pinconf_get(struct pinctrl_dev *pctldev,
|
||||||
err = hw->soc->bias_get_combo(hw, desc, &pullup, &ret);
|
err = hw->soc->bias_get_combo(hw, desc, &pullup, &ret);
|
||||||
if (err)
|
if (err)
|
||||||
goto out;
|
goto out;
|
||||||
|
if (ret == MTK_PUPD_SET_R1R0_00)
|
||||||
|
ret = MTK_DISABLE;
|
||||||
if (param == PIN_CONFIG_BIAS_DISABLE) {
|
if (param == PIN_CONFIG_BIAS_DISABLE) {
|
||||||
if (ret == MTK_PUPD_SET_R1R0_00)
|
if (ret != MTK_DISABLE)
|
||||||
ret = MTK_DISABLE;
|
err = -EINVAL;
|
||||||
} else if (param == PIN_CONFIG_BIAS_PULL_UP) {
|
} else if (param == PIN_CONFIG_BIAS_PULL_UP) {
|
||||||
/* When desire to get pull-up value, return
|
if (!pullup || ret == MTK_DISABLE)
|
||||||
* error if current setting is pull-down
|
|
||||||
*/
|
|
||||||
if (!pullup)
|
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
} else if (param == PIN_CONFIG_BIAS_PULL_DOWN) {
|
} else if (param == PIN_CONFIG_BIAS_PULL_DOWN) {
|
||||||
/* When desire to get pull-down value, return
|
if (pullup || ret == MTK_DISABLE)
|
||||||
* error if current setting is pull-up
|
|
||||||
*/
|
|
||||||
if (pullup)
|
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user