* [PATCH] pinctrl: mediatek: common-v2: Fix bias-disable for PULL_PU_PD_RSEL_TYPE
@ 2022-11-04 10:56 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 4+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-11-04 10:56 UTC (permalink / raw)
To: linus.walleij
Cc: sean.wang, matthias.bgg, zhiyong.tao, wenst, linux-mediatek,
linux-gpio, linux-arm-kernel, linux-kernel,
AngeloGioacchino Del Regno
In pinctrl-paris we're calling the .bias_set_combo() callback when we
are asked to set the pin bias to either pull up/down or pull disable.
On newer platforms, this callback is mtk_pinconf_bias_set_combo(),
located in pinctrl-mtk-common-v2.c: this will check the "pull type"
assigned to the requested pin and in case said pin's pull type is
MTK_PULL_PU_PD_RSEL_TYPE, this function will set RSEL first, PUPD
last, which is fine.
The issue comes when we're requesting PIN_CONFIG_BIAS_DISABLE, as
this does *not* require setting RSEL but only PU_PD: in this case,
the arg is MTK_DISABLE (zero), which is not a supported RSEL, due
to which function mtk_pinconf_bias_set_rsel() returns a failure;
because of that, mtk_pinconf_bias_set_pu_pd() is never called,
hence the pin bias is never set to DISABLE.
To fix this issue, add a check to mtk_pinconf_bias_set_rsel(): if
we are entering that function with no pullup requested and at the
same time the arg is MTK_DISABLE, this means that we're trying to
disable pin bias, hence it's safe to return cleanly without ever
setting any RSEL register.
This makes mtk_pinconf_bias_set_combo() happy, going on with setting
the PU_PD registers, which is the only action to actually take to
disable bias on a pin/pingroup.
Fixes: fb34a9ae383a ("pinctrl: mediatek: support rsel feature")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
index e1ae3beb9f72..b7921b59eb7b 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
@@ -709,6 +709,9 @@ static int mtk_pinconf_bias_set_rsel(struct mtk_pinctrl *hw,
{
int err, rsel_val;
+ if (!pullup && arg == MTK_DISABLE)
+ return 0;
+
if (hw->rsel_si_unit) {
/* find pin rsel_index from pin_rsel array*/
err = mtk_hw_pin_rsel_lookup(hw, desc, pullup, arg, &rsel_val);
--
2.37.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] pinctrl: mediatek: common-v2: Fix bias-disable for PULL_PU_PD_RSEL_TYPE
@ 2022-11-04 10:56 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 4+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-11-04 10:56 UTC (permalink / raw)
To: linus.walleij
Cc: sean.wang, matthias.bgg, zhiyong.tao, wenst, linux-mediatek,
linux-gpio, linux-arm-kernel, linux-kernel,
AngeloGioacchino Del Regno
In pinctrl-paris we're calling the .bias_set_combo() callback when we
are asked to set the pin bias to either pull up/down or pull disable.
On newer platforms, this callback is mtk_pinconf_bias_set_combo(),
located in pinctrl-mtk-common-v2.c: this will check the "pull type"
assigned to the requested pin and in case said pin's pull type is
MTK_PULL_PU_PD_RSEL_TYPE, this function will set RSEL first, PUPD
last, which is fine.
The issue comes when we're requesting PIN_CONFIG_BIAS_DISABLE, as
this does *not* require setting RSEL but only PU_PD: in this case,
the arg is MTK_DISABLE (zero), which is not a supported RSEL, due
to which function mtk_pinconf_bias_set_rsel() returns a failure;
because of that, mtk_pinconf_bias_set_pu_pd() is never called,
hence the pin bias is never set to DISABLE.
To fix this issue, add a check to mtk_pinconf_bias_set_rsel(): if
we are entering that function with no pullup requested and at the
same time the arg is MTK_DISABLE, this means that we're trying to
disable pin bias, hence it's safe to return cleanly without ever
setting any RSEL register.
This makes mtk_pinconf_bias_set_combo() happy, going on with setting
the PU_PD registers, which is the only action to actually take to
disable bias on a pin/pingroup.
Fixes: fb34a9ae383a ("pinctrl: mediatek: support rsel feature")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
index e1ae3beb9f72..b7921b59eb7b 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
@@ -709,6 +709,9 @@ static int mtk_pinconf_bias_set_rsel(struct mtk_pinctrl *hw,
{
int err, rsel_val;
+ if (!pullup && arg == MTK_DISABLE)
+ return 0;
+
if (hw->rsel_si_unit) {
/* find pin rsel_index from pin_rsel array*/
err = mtk_hw_pin_rsel_lookup(hw, desc, pullup, arg, &rsel_val);
--
2.37.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] pinctrl: mediatek: common-v2: Fix bias-disable for PULL_PU_PD_RSEL_TYPE
2022-11-04 10:56 ` AngeloGioacchino Del Regno
@ 2022-11-09 8:35 ` Linus Walleij
-1 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2022-11-09 8:35 UTC (permalink / raw)
To: AngeloGioacchino Del Regno
Cc: sean.wang, matthias.bgg, zhiyong.tao, wenst, linux-mediatek,
linux-gpio, linux-arm-kernel, linux-kernel
On Fri, Nov 4, 2022 at 11:56 AM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
> In pinctrl-paris we're calling the .bias_set_combo() callback when we
> are asked to set the pin bias to either pull up/down or pull disable.
>
> On newer platforms, this callback is mtk_pinconf_bias_set_combo(),
> located in pinctrl-mtk-common-v2.c: this will check the "pull type"
> assigned to the requested pin and in case said pin's pull type is
> MTK_PULL_PU_PD_RSEL_TYPE, this function will set RSEL first, PUPD
> last, which is fine.
>
> The issue comes when we're requesting PIN_CONFIG_BIAS_DISABLE, as
> this does *not* require setting RSEL but only PU_PD: in this case,
> the arg is MTK_DISABLE (zero), which is not a supported RSEL, due
> to which function mtk_pinconf_bias_set_rsel() returns a failure;
> because of that, mtk_pinconf_bias_set_pu_pd() is never called,
> hence the pin bias is never set to DISABLE.
>
> To fix this issue, add a check to mtk_pinconf_bias_set_rsel(): if
> we are entering that function with no pullup requested and at the
> same time the arg is MTK_DISABLE, this means that we're trying to
> disable pin bias, hence it's safe to return cleanly without ever
> setting any RSEL register.
> This makes mtk_pinconf_bias_set_combo() happy, going on with setting
> the PU_PD registers, which is the only action to actually take to
> disable bias on a pin/pingroup.
>
> Fixes: fb34a9ae383a ("pinctrl: mediatek: support rsel feature")
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Patch applied for fixes.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] pinctrl: mediatek: common-v2: Fix bias-disable for PULL_PU_PD_RSEL_TYPE
@ 2022-11-09 8:35 ` Linus Walleij
0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2022-11-09 8:35 UTC (permalink / raw)
To: AngeloGioacchino Del Regno
Cc: sean.wang, matthias.bgg, zhiyong.tao, wenst, linux-mediatek,
linux-gpio, linux-arm-kernel, linux-kernel
On Fri, Nov 4, 2022 at 11:56 AM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
> In pinctrl-paris we're calling the .bias_set_combo() callback when we
> are asked to set the pin bias to either pull up/down or pull disable.
>
> On newer platforms, this callback is mtk_pinconf_bias_set_combo(),
> located in pinctrl-mtk-common-v2.c: this will check the "pull type"
> assigned to the requested pin and in case said pin's pull type is
> MTK_PULL_PU_PD_RSEL_TYPE, this function will set RSEL first, PUPD
> last, which is fine.
>
> The issue comes when we're requesting PIN_CONFIG_BIAS_DISABLE, as
> this does *not* require setting RSEL but only PU_PD: in this case,
> the arg is MTK_DISABLE (zero), which is not a supported RSEL, due
> to which function mtk_pinconf_bias_set_rsel() returns a failure;
> because of that, mtk_pinconf_bias_set_pu_pd() is never called,
> hence the pin bias is never set to DISABLE.
>
> To fix this issue, add a check to mtk_pinconf_bias_set_rsel(): if
> we are entering that function with no pullup requested and at the
> same time the arg is MTK_DISABLE, this means that we're trying to
> disable pin bias, hence it's safe to return cleanly without ever
> setting any RSEL register.
> This makes mtk_pinconf_bias_set_combo() happy, going on with setting
> the PU_PD registers, which is the only action to actually take to
> disable bias on a pin/pingroup.
>
> Fixes: fb34a9ae383a ("pinctrl: mediatek: support rsel feature")
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Patch applied for fixes.
Yours,
Linus Walleij
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-11-09 8:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04 10:56 [PATCH] pinctrl: mediatek: common-v2: Fix bias-disable for PULL_PU_PD_RSEL_TYPE AngeloGioacchino Del Regno
2022-11-04 10:56 ` AngeloGioacchino Del Regno
2022-11-09 8:35 ` Linus Walleij
2022-11-09 8:35 ` Linus Walleij
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.