sst-linux/drivers/pinctrl/mediatek
Nícolas F. R. A. Prado 82b0e1cf75 pinctrl: mediatek: common-v2: Fix broken bias-disable for PULL_PU_PD_RSEL_TYPE
[ Upstream commit 166bf8af91225576f85208a31eaedbadd182d1ea ]

Despite its name, commit fed74d7527 ("pinctrl: mediatek: common-v2:
Fix bias-disable for PULL_PU_PD_RSEL_TYPE") actually broke bias-disable
for PULL_PU_PD_RSEL_TYPE.

mtk_pinconf_bias_set_combo() tries every bias method supported by the
pin until one succeeds. For PULL_PU_PD_RSEL_TYPE pins, before the
breaking commit, mtk_pinconf_bias_set_rsel() would be called first to
try and set the RSEL value (as well as PU and PD), and if that failed,
the only other valid option was that bias-disable was specified, which
would then be handled by calling mtk_pinconf_bias_set_pu_pd() and
disabling both PU and PD.

The breaking commit misunderstood this logic and added an early "return
0" in mtk_pinconf_bias_set_rsel(). The result was that in the
bias-disable case, the bias was left unchanged, since by returning
success, mtk_pinconf_bias_set_combo() no longer tried calling
mtk_pinconf_bias_set_pu_pd() to disable the bias.

Since the logic for configuring bias-disable on PULL_PU_PD_RSEL_TYPE
pins required mtk_pinconf_bias_set_rsel() to fail first, in that case,
an error was printed to the log, eg:

  mt8195-pinctrl 10005000.pinctrl: Not support rsel value 0 Ohm for pin = 29 (GPIO29)

This is what the breaking commit actually got rid of, and likely part of
the reason why that commit was thought to be fixing functionality, while
in reality it was breaking it.

Instead of simply reverting that commit, restore the functionality but
in a way that avoids the error from being printed and makes the code
less confusing:
* Return 0 explicitly if a bias method was successful
* Introduce an extra function mtk_pinconf_bias_set_pu_pd_rsel() that
  calls both mtk_pinconf_bias_set_rsel() (only if needed) and
  mtk_pinconf_bias_set_pu_pd()
  * And analogously for the corresponding getters

Fixes: fed74d7527 ("pinctrl: mediatek: common-v2: Fix bias-disable for PULL_PU_PD_RSEL_TYPE")
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Link: https://lore.kernel.org/20240808-mtk-rsel-bias-disable-fix-v1-1-1b4e85bf596c@collabora.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-09-04 13:25:00 +02:00
..
Kconfig pinctrl: mediatek: add mt8188 driver 2022-08-25 14:50:44 +02:00
Makefile
mtk-eint.c pinctrl: meditatek: Startup with the IRQs disabled 2022-11-22 21:05:18 +01:00
mtk-eint.h pinctrl: mediatek: Fix EINT pins input debounce time configuration 2022-11-14 14:20:41 +01:00
pinctrl-moore.c pinctrl: mediatek: pinctrl-moore: Simplify with dev_err_probe() 2022-03-15 01:24:16 +01:00
pinctrl-moore.h pinctrl: mtk: Fix up GPIO includes 2018-09-18 16:38:27 -07:00
pinctrl-mt2701.c pinctrl: mediatek: Fix EINT pins input debounce time configuration 2022-11-14 14:20:41 +01:00
pinctrl-mt2712.c pinctrl: mediatek: Fix EINT pins input debounce time configuration 2022-11-14 14:20:41 +01:00
pinctrl-mt6397.c pinctrl: mediatek: don't hardcode mode encoding in common code 2021-05-27 16:50:15 +02:00
pinctrl-mt6765.c pinctrl: mediatek: Fix EINT pins input debounce time configuration 2022-11-14 14:20:41 +01:00
pinctrl-mt6779.c pinctrl: mediatek: Fix EINT pins input debounce time configuration 2022-11-14 14:20:41 +01:00
pinctrl-mt6795.c pinctrl: mediatek: Fix EINT pins input debounce time configuration 2022-11-14 14:20:41 +01:00
pinctrl-mt6797.c pinctrl: mediatek: paris: Unify probe function by using OF match data 2022-03-17 02:06:52 +01:00
pinctrl-mt7622.c pinctrl: mediatek: Fix EINT pins input debounce time configuration 2022-11-14 14:20:41 +01:00
pinctrl-mt7623.c pinctrl: mediatek: Fix EINT pins input debounce time configuration 2022-11-14 14:20:41 +01:00
pinctrl-mt7629.c pinctrl: mediatek: Fix EINT pins input debounce time configuration 2022-11-14 14:20:41 +01:00
pinctrl-mt7986.c pinctrl: mediatek: fix the pinconf register offset of some pins 2022-12-31 13:32:10 +01:00
pinctrl-mt8127.c pinctrl: mediatek: Fix EINT pins input debounce time configuration 2022-11-14 14:20:41 +01:00
pinctrl-mt8135.c pinctrl: mediatek: Fix EINT pins input debounce time configuration 2022-11-14 14:20:41 +01:00
pinctrl-mt8167.c pinctrl: mediatek: Fix EINT pins input debounce time configuration 2022-11-14 14:20:41 +01:00
pinctrl-mt8173.c pinctrl: mediatek: Fix EINT pins input debounce time configuration 2022-11-14 14:20:41 +01:00
pinctrl-mt8183.c pinctrl: mediatek: Fix EINT pins input debounce time configuration 2022-11-14 14:20:41 +01:00
pinctrl-mt8186.c pinctrl: mediatek: Drop bogus slew rate register range for MT8186 2024-03-26 18:20:46 -04:00
pinctrl-mt8188.c pinctrl: mediatek: Fix EINT pins input debounce time configuration 2022-11-14 14:20:41 +01:00
pinctrl-mt8192.c pinctrl: mediatek: Drop bogus slew rate register range for MT8192 2024-03-26 18:20:46 -04:00
pinctrl-mt8195.c pinctrl: mediatek: Fix the drive register definition of some Pins 2023-02-14 19:11:50 +01:00
pinctrl-mt8365.c pinctrl: mediatek: Fix EINT pins input debounce time configuration 2022-11-14 14:20:41 +01:00
pinctrl-mt8516.c pinctrl: mediatek: Fix EINT pins input debounce time configuration 2022-11-14 14:20:41 +01:00
pinctrl-mtk-common-v2.c pinctrl: mediatek: common-v2: Fix broken bias-disable for PULL_PU_PD_RSEL_TYPE 2024-09-04 13:25:00 +02:00
pinctrl-mtk-common-v2.h pinctrl: mediatek: support rsel feature 2021-10-03 00:43:36 +02:00
pinctrl-mtk-common.c pinctrl: mediatek: common-v1: fix semicolon.cocci warnings 2022-03-27 14:00:42 +02:00
pinctrl-mtk-common.h pinctrl: mediatek: common-v1: Commonize spec_ies_smt_set callback 2022-03-17 02:06:53 +01:00
pinctrl-mtk-mt2701.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
pinctrl-mtk-mt2712.h pinctrl: mediatek: Use the correct style for SPDX License Identifier 2019-12-12 11:30:33 +01:00
pinctrl-mtk-mt6397.h pinctrl: mtk: fix check warnings. 2018-03-26 10:58:33 +02:00
pinctrl-mtk-mt6765.h pinctrl: mediatek: add MT6765 pinctrl driver 2018-09-21 09:12:55 -07:00
pinctrl-mtk-mt6779.h pinctrl: mediatek: add pinctrl support for MT6779 SoC 2020-08-04 01:29:09 +02:00
pinctrl-mtk-mt6795.h pinctrl: mediatek: Add pinctrl driver for MT6795 Helio X10 2022-05-19 15:11:15 +02:00
pinctrl-mtk-mt6797.h pinctrl: mediatek: Add initial pinctrl driver for MT6797 SoC 2018-11-15 11:05:54 +01:00
pinctrl-mtk-mt8127.h pinctrl: mtk: fix check warnings. 2018-03-26 10:58:33 +02:00
pinctrl-mtk-mt8135.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
pinctrl-mtk-mt8167.h pinctrl: mediatek: Add MT8167 Pinctrl driver 2020-09-27 11:20:09 +02:00
pinctrl-mtk-mt8173.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
pinctrl-mtk-mt8183.h pinctrl: mediatek: add MT8183 pinctrl driver 2018-09-18 14:53:29 -07:00
pinctrl-mtk-mt8186.h pinctrl: add pinctrl driver on mt8186 2022-03-15 01:00:03 +01:00
pinctrl-mtk-mt8188.h pinctrl: mediatek: add mt8188 driver 2022-08-25 14:50:44 +02:00
pinctrl-mtk-mt8192.h pinctrl: mediatek: Add pinctrl driver for mt8192 2020-08-27 10:50:57 +02:00
pinctrl-mtk-mt8195.h pinctrl: add pinctrl driver on mt8195 2021-04-22 01:53:02 +02:00
pinctrl-mtk-mt8365.h pinctrl: mediatek: add support for mt8365 SoC 2021-05-27 16:50:15 +02:00
pinctrl-mtk-mt8516.h pinctrl: mediatek: Add MT8516 Pinctrl driver 2019-05-03 07:53:13 +01:00
pinctrl-paris.c pinctrl: mediatek: paris: Rework support for PIN_CONFIG_{INPUT,OUTPUT}_ENABLE 2024-05-17 11:55:54 +02:00
pinctrl-paris.h pinctrl: mediatek: paris: Unify probe function by using OF match data 2022-03-17 02:06:52 +01:00