2021-07-01 08:11:26

by Hsin-Yi Wang

[permalink] [raw]
Subject: [PATCH v2] 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")
Signed-off-by: Hsin-Yi Wang <[email protected]>
---
v2: fix v1 comments
---
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
index 7815426e7aeaa..10002b8497fea 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
@@ -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);
}
}

--
2.32.0.93.g670b81a890-goog


2021-07-01 08:43:10

by Chen-Yu Tsai

[permalink] [raw]
Subject: Re: [PATCH v2] pinctrl: mediatek: Fix fallback behavior for bias_set_combo

On Thu, Jul 1, 2021 at 4:10 PM Hsin-Yi Wang <[email protected]> wrote:
>
> 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")
> Signed-off-by: Hsin-Yi Wang <[email protected]>

Reviewed-by: Chen-Yu Tsai <[email protected]>

2021-07-01 11:28:43

by Zhiyong Tao

[permalink] [raw]
Subject: Re: [PATCH v2] pinctrl: mediatek: Fix fallback behavior for bias_set_combo

On Thu, 2021-07-01 at 16:41 +0800, Chen-Yu Tsai wrote:
> On Thu, Jul 1, 2021 at 4:10 PM Hsin-Yi Wang <[email protected]> wrote:
> >
> > 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")
> > Signed-off-by: Hsin-Yi Wang <[email protected]>
>
> Reviewed-by: Chen-Yu Tsai <[email protected]>
Reviewed-by: Zhiyong Tao <[email protected]>

2021-07-23 15:44:01

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v2] pinctrl: mediatek: Fix fallback behavior for bias_set_combo

Hi Hsin-Yi,

On Thu, Jul 1, 2021 at 10:10 AM Hsin-Yi Wang <[email protected]> wrote:
>
> 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")
> Signed-off-by: Hsin-Yi Wang <[email protected]>
> ---
> v2: fix v1 comments

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

Yours,
Linus Walleij