linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] pinctrl: mediatek: Fix fallback behavior for bias_set_combo
@ 2021-07-01  8:09 Hsin-Yi Wang
  2021-07-01  8:41 ` Chen-Yu Tsai
  2021-07-23 15:42 ` Linus Walleij
  0 siblings, 2 replies; 4+ messages in thread
From: Hsin-Yi Wang @ 2021-07-01  8:09 UTC (permalink / raw)
  To: Sean Wang, Linus Walleij, zhiyong.tao
  Cc: Matthias Brugger, linux-mediatek, linux-gpio, linux-arm-kernel,
	linux-kernel

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 <hsinyi@chromium.org>
---
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] pinctrl: mediatek: Fix fallback behavior for bias_set_combo
  2021-07-01  8:09 [PATCH v2] pinctrl: mediatek: Fix fallback behavior for bias_set_combo Hsin-Yi Wang
@ 2021-07-01  8:41 ` Chen-Yu Tsai
  2021-07-01 11:26   ` zhiyong tao
  2021-07-23 15:42 ` Linus Walleij
  1 sibling, 1 reply; 4+ messages in thread
From: Chen-Yu Tsai @ 2021-07-01  8:41 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Sean Wang, Linus Walleij, zhiyong.tao, Matthias Brugger,
	linux-mediatek, linux-gpio, linux-arm-kernel, linux-kernel

On Thu, Jul 1, 2021 at 4:10 PM Hsin-Yi Wang <hsinyi@chromium.org> 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 <hsinyi@chromium.org>

Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] pinctrl: mediatek: Fix fallback behavior for bias_set_combo
  2021-07-01  8:41 ` Chen-Yu Tsai
@ 2021-07-01 11:26   ` zhiyong tao
  0 siblings, 0 replies; 4+ messages in thread
From: zhiyong tao @ 2021-07-01 11:26 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: hui.liu, Hsin-Yi Wang, Sean Wang, Linus Walleij,
	Matthias Brugger, linux-mediatek, linux-gpio, linux-arm-kernel,
	linux-kernel

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 <hsinyi@chromium.org> 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 <hsinyi@chromium.org>
> 
> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: Zhiyong Tao <zhiyong.tao@mediatek.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] pinctrl: mediatek: Fix fallback behavior for bias_set_combo
  2021-07-01  8:09 [PATCH v2] pinctrl: mediatek: Fix fallback behavior for bias_set_combo Hsin-Yi Wang
  2021-07-01  8:41 ` Chen-Yu Tsai
@ 2021-07-23 15:42 ` Linus Walleij
  1 sibling, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2021-07-23 15:42 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Sean Wang, Zhiyong Tao, Matthias Brugger,
	moderated list:ARM/Mediatek SoC support,
	open list:GPIO SUBSYSTEM, Linux ARM, linux-kernel

Hi Hsin-Yi,

On Thu, Jul 1, 2021 at 10:10 AM Hsin-Yi Wang <hsinyi@chromium.org> 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 <hsinyi@chromium.org>
> ---
> v2: fix v1 comments

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

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-23 15:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-01  8:09 [PATCH v2] pinctrl: mediatek: Fix fallback behavior for bias_set_combo Hsin-Yi Wang
2021-07-01  8:41 ` Chen-Yu Tsai
2021-07-01 11:26   ` zhiyong tao
2021-07-23 15:42 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).