Skip to contentSkip to conversation

pinctrl: mediatek: Fix fallback behavior for bias_set_combo

PATCH In review Hsin-Yi Wang 4 participants 4 messages Jul 1, 2021 – Jul 23, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 pinctrl: mediatek: Fix fallback behavior for bias_set_combo

Some pin doesn't support PUPD register, if it fails and fallbacks with bias_set_combo case, it will call mtk_pinconf_bias_set_pupd_r1_r0() to modify the PUPD pin again.

Since the general bias set are either PU/PD or PULLSEL/PULLEN, try bias_set or bias_set_rev1 for the other fallback case. If the pin doesn't support neither PU/PD nor PULLSEL/PULLEN, it will return -ENOTSUPP.

Fixes 81bd1579b43e ("pinctrl: mediatek: Fix fallback call path")

---
v2: fix v1 comments

---
 drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c +3 -5
index 7815426e7aeaa..10002b8497fea 100644
@@ -926,12 +926,10 @@ int mtk_pinconf_adv_pull_set(struct mtk_pinctrl *hw,
 			err = hw->soc->bias_set(hw, desc, pullup);
 			if (err)
 				return err;
-		} else if (hw->soc->bias_set_combo) {
-			err = hw->soc->bias_set_combo(hw, desc, pullup, arg);
-			if (err)
-				return err;
 		} else {
-			return -ENOTSUPP;
+			err = mtk_pinconf_bias_set_rev1(hw, desc, pullup);
+			if (err)
+				err = mtk_pinconf_bias_set(hw, desc, pullup);
 		}
 	}
 
Signature · 1 line
2.32.0.93.g670b81a890-goog
Reviewed-by on v2 1/1
#1 lore raw
Quoted 5 lines · Hsin-Yi Wang

Some pin doesn't support PUPD register, if it fails and fallbacks with bias_set_combo case, it will call mtk_pinconf_bias_set_pupd_r1_r0() to modify the PUPD pin again.

Quoted 7 lines

Since the general bias set are either PU/PD or PULLSEL/PULLEN, try bias_set or bias_set_rev1 for the other fallback case. If the pin doesn't support neither PU/PD nor PULLSEL/PULLEN, it will return -ENOTSUPP.

Fixes 81bd1579b43e ("pinctrl: mediatek: Fix fallback call path")
Reviewed-by
#2 lore raw
Quoted 11 lines · Chen-Yu Tsai
Quoted 10 lines · Hsin-Yi Wang

Some pin doesn't support PUPD register, if it fails and fallbacks with bias_set_combo case, it will call mtk_pinconf_bias_set_pupd_r1_r0() to modify the PUPD pin again.

Since the general bias set are either PU/PD or PULLSEL/PULLEN, try bias_set or bias_set_rev1 for the other fallback case. If the pin doesn't support neither PU/PD nor PULLSEL/PULLEN, it will return -ENOTSUPP.

Quoted 4 lines
Quoted 2 lines
Fixes 81bd1579b43e ("pinctrl: mediatek: Fix fallback call path")
#3 lore raw
In reply to Hsin-Yi Wang

Hi Hsin-Yi,

Quoted 10 lines · Hsin-Yi Wang

Some pin doesn't support PUPD register, if it fails and fallbacks with bias_set_combo case, it will call mtk_pinconf_bias_set_pupd_r1_r0() to modify the PUPD pin again.

Since the general bias set are either PU/PD or PULLSEL/PULLEN, try bias_set or bias_set_rev1 for the other fallback case. If the pin doesn't support neither PU/PD nor PULLSEL/PULLEN, it will return -ENOTSUPP.

Quoted 4 lines
Fixes 81bd1579b43e ("pinctrl: mediatek: Fix fallback call path")

---
v2: fix v1 comments

Thanks for fixing this up so nicely, great work.
Patch applied for fixes!

Yours,
Linus Walleij