linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: rockchip: fix reading pull type on rk3568
@ 2023-01-10 17:29 Jonas Karlman
  2023-01-10 22:09 ` Heiko Stübner
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jonas Karlman @ 2023-01-10 17:29 UTC (permalink / raw)
  To: Linus Walleij, Heiko Stuebner
  Cc: Jianqun Xu, linux-gpio, linux-rockchip, linux-arm-kernel, Jonas Karlman

When reading pinconf-pins from debugfs it fails to get the configured pull
type on RK3568, "unsupported pinctrl type" error messages is also reported.

Fix this by adding support for RK3568 in rockchip_get_pull, including a
reverse of the pull-up value swap applied in rockchip_set_pull so that
pull-up is correctly reported in pinconf-pins.
Also update the workaround comment to reflect affected pins, GPIO0_D3-D6.

Fixes: c0dadc0e47a8 ("pinctrl: rockchip: add support for rk3568")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
 drivers/pinctrl/pinctrl-rockchip.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 849d5fa2a362..5eeac92f610a 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -2436,10 +2436,19 @@ static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num)
 	case RK3308:
 	case RK3368:
 	case RK3399:
+	case RK3568:
 	case RK3588:
 		pull_type = bank->pull_type[pin_num / 8];
 		data >>= bit;
 		data &= (1 << RK3188_PULL_BITS_PER_PIN) - 1;
+		/*
+		 * In the TRM, pull-up being 1 for everything except the GPIO0_D3-D6,
+		 * where that pull up value becomes 3.
+		 */
+		if (ctrl->type == RK3568 && bank->bank_num == 0 && pin_num >= 27 && pin_num <= 30) {
+			if (data == 3)
+				data = 1;
+		}
 
 		return rockchip_pull_list[pull_type][data];
 	default:
@@ -2497,7 +2506,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank,
 			}
 		}
 		/*
-		 * In the TRM, pull-up being 1 for everything except the GPIO0_D0-D6,
+		 * In the TRM, pull-up being 1 for everything except the GPIO0_D3-D6,
 		 * where that pull up value becomes 3.
 		 */
 		if (ctrl->type == RK3568 && bank->bank_num == 0 && pin_num >= 27 && pin_num <= 30) {
-- 
2.39.0


_______________________________________________
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] 6+ messages in thread

* Re: [PATCH] pinctrl: rockchip: fix reading pull type on rk3568
  2023-01-10 17:29 [PATCH] pinctrl: rockchip: fix reading pull type on rk3568 Jonas Karlman
@ 2023-01-10 22:09 ` Heiko Stübner
  2023-01-11 10:26 ` jay.xu
  2023-01-16 12:43 ` Linus Walleij
  2 siblings, 0 replies; 6+ messages in thread
From: Heiko Stübner @ 2023-01-10 22:09 UTC (permalink / raw)
  To: Linus Walleij, Jonas Karlman
  Cc: Jianqun Xu, linux-gpio, linux-rockchip, linux-arm-kernel, Jonas Karlman

Am Dienstag, 10. Januar 2023, 18:29:58 CET schrieb Jonas Karlman:
> When reading pinconf-pins from debugfs it fails to get the configured pull
> type on RK3568, "unsupported pinctrl type" error messages is also reported.
> 
> Fix this by adding support for RK3568 in rockchip_get_pull, including a
> reverse of the pull-up value swap applied in rockchip_set_pull so that
> pull-up is correctly reported in pinconf-pins.
> Also update the workaround comment to reflect affected pins, GPIO0_D3-D6.
> 
> Fixes: c0dadc0e47a8 ("pinctrl: rockchip: add support for rk3568")
> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>

Reviewed-by: Heiko Stuebner <heiko@sntech.de>

> ---
>  drivers/pinctrl/pinctrl-rockchip.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
> index 849d5fa2a362..5eeac92f610a 100644
> --- a/drivers/pinctrl/pinctrl-rockchip.c
> +++ b/drivers/pinctrl/pinctrl-rockchip.c
> @@ -2436,10 +2436,19 @@ static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num)
>  	case RK3308:
>  	case RK3368:
>  	case RK3399:
> +	case RK3568:
>  	case RK3588:
>  		pull_type = bank->pull_type[pin_num / 8];
>  		data >>= bit;
>  		data &= (1 << RK3188_PULL_BITS_PER_PIN) - 1;
> +		/*
> +		 * In the TRM, pull-up being 1 for everything except the GPIO0_D3-D6,
> +		 * where that pull up value becomes 3.
> +		 */
> +		if (ctrl->type == RK3568 && bank->bank_num == 0 && pin_num >= 27 && pin_num <= 30) {
> +			if (data == 3)
> +				data = 1;
> +		}
>  
>  		return rockchip_pull_list[pull_type][data];
>  	default:
> @@ -2497,7 +2506,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank,
>  			}
>  		}
>  		/*
> -		 * In the TRM, pull-up being 1 for everything except the GPIO0_D0-D6,
> +		 * In the TRM, pull-up being 1 for everything except the GPIO0_D3-D6,
>  		 * where that pull up value becomes 3.
>  		 */
>  		if (ctrl->type == RK3568 && bank->bank_num == 0 && pin_num >= 27 && pin_num <= 30) {
> 





_______________________________________________
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] 6+ messages in thread

* Re: [PATCH] pinctrl: rockchip: fix reading pull type on rk3568
  2023-01-10 17:29 [PATCH] pinctrl: rockchip: fix reading pull type on rk3568 Jonas Karlman
  2023-01-10 22:09 ` Heiko Stübner
@ 2023-01-11 10:26 ` jay.xu
  2023-01-11 10:45   ` Heiko Stübner
  2023-01-16 12:43 ` Linus Walleij
  2 siblings, 1 reply; 6+ messages in thread
From: jay.xu @ 2023-01-11 10:26 UTC (permalink / raw)
  To: Jonas Karlman, linus.walleij, Heiko Stübner
  Cc: linux-gpio, open list:ARM/Rockchip SoC...,
	linux-arm-kernel, Jonas Karlman

Hi Jonas

--------------
jay.xu@rock-chips.com
>When reading pinconf-pins from debugfs it fails to get the configured pull
>type on RK3568, "unsupported pinctrl type" error messages is also reported.
>
>Fix this by adding support for RK3568 in rockchip_get_pull, including a
>reverse of the pull-up value swap applied in rockchip_set_pull so that
>pull-up is correctly reported in pinconf-pins.
>Also update the workaround comment to reflect affected pins, GPIO0_D3-D6.
>
>Fixes: c0dadc0e47a8 ("pinctrl: rockchip: add support for rk3568")
>Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
>--- 

Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>

> drivers/pinctrl/pinctrl-rockchip.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
>index 849d5fa2a362..5eeac92f610a 100644
>--- a/drivers/pinctrl/pinctrl-rockchip.c
>+++ b/drivers/pinctrl/pinctrl-rockchip.c
>@@ -2436,10 +2436,19 @@ static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num)
> case RK3308:
> case RK3368:
> case RK3399:
>+	case RK3568:
> case RK3588:
> pull_type = bank->pull_type[pin_num / 8];
> data >>= bit;
> data &= (1 << RK3188_PULL_BITS_PER_PIN) - 1;
>+	/*
>+	* In the TRM, pull-up being 1 for everything except the GPIO0_D3-D6,
>+	* where that pull up value becomes 3.
>+	*/
>+	if (ctrl->type == RK3568 && bank->bank_num == 0 && pin_num >= 27 && pin_num <= 30) {
>+	if (data == 3)
>+	data = 1;
>+	}
>
> return rockchip_pull_list[pull_type][data];
> default:
>@@ -2497,7 +2506,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank,
> }
> }
> /*
>-	* In the TRM, pull-up being 1 for everything except the GPIO0_D0-D6,
>+	* In the TRM, pull-up being 1 for everything except the GPIO0_D3-D6,
> * where that pull up value becomes 3.
> */
> if (ctrl->type == RK3568 && bank->bank_num == 0 && pin_num >= 27 && pin_num <= 30) {
>--
>2.39.0
>
_______________________________________________
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] 6+ messages in thread

* Re: [PATCH] pinctrl: rockchip: fix reading pull type on rk3568
  2023-01-11 10:26 ` jay.xu
@ 2023-01-11 10:45   ` Heiko Stübner
  2023-01-11 11:12     ` jay.xu
  0 siblings, 1 reply; 6+ messages in thread
From: Heiko Stübner @ 2023-01-11 10:45 UTC (permalink / raw)
  To: Jonas Karlman, linus. walleij, jay.xu
  Cc: linux-gpio, open list:ARM/Rockchip SoC...,
	linux-arm-kernel, Jonas Karlman

Hi Jay,

Am Mittwoch, 11. Januar 2023, 11:26:18 CET schrieb jay.xu@rock-chips.com:
> Hi Jonas
> 
> --------------
> jay.xu@rock-chips.com
> >When reading pinconf-pins from debugfs it fails to get the configured pull
> >type on RK3568, "unsupported pinctrl type" error messages is also reported.
> >
> >Fix this by adding support for RK3568 in rockchip_get_pull, including a
> >reverse of the pull-up value swap applied in rockchip_set_pull so that
> >pull-up is correctly reported in pinconf-pins.
> >Also update the workaround comment to reflect affected pins, GPIO0_D3-D6.
> >
> >Fixes: c0dadc0e47a8 ("pinctrl: rockchip: add support for rk3568")
> >Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
> >--- 
> 
> Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>

Did you want one of

- Reviewed-by:
- Tested-by:
- Acked-by:

instead?


Heiko

> > drivers/pinctrl/pinctrl-rockchip.c | 11 ++++++++++-
> > 1 file changed, 10 insertions(+), 1 deletion(-)
> >
> >diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
> >index 849d5fa2a362..5eeac92f610a 100644
> >--- a/drivers/pinctrl/pinctrl-rockchip.c
> >+++ b/drivers/pinctrl/pinctrl-rockchip.c
> >@@ -2436,10 +2436,19 @@ static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num)
> > case RK3308:
> > case RK3368:
> > case RK3399:
> >+	case RK3568:
> > case RK3588:
> > pull_type = bank->pull_type[pin_num / 8];
> > data >>= bit;
> > data &= (1 << RK3188_PULL_BITS_PER_PIN) - 1;
> >+	/*
> >+	* In the TRM, pull-up being 1 for everything except the GPIO0_D3-D6,
> >+	* where that pull up value becomes 3.
> >+	*/
> >+	if (ctrl->type == RK3568 && bank->bank_num == 0 && pin_num >= 27 && pin_num <= 30) {
> >+	if (data == 3)
> >+	data = 1;
> >+	}
> >
> > return rockchip_pull_list[pull_type][data];
> > default:
> >@@ -2497,7 +2506,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank,
> > }
> > }
> > /*
> >-	* In the TRM, pull-up being 1 for everything except the GPIO0_D0-D6,
> >+	* In the TRM, pull-up being 1 for everything except the GPIO0_D3-D6,
> > * where that pull up value becomes 3.
> > */
> > if (ctrl->type == RK3568 && bank->bank_num == 0 && pin_num >= 27 && pin_num <= 30) {
> >--
> >2.39.0
> >
> 





_______________________________________________
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] 6+ messages in thread

* Re: Re: [PATCH] pinctrl: rockchip: fix reading pull type on rk3568
  2023-01-11 10:45   ` Heiko Stübner
@ 2023-01-11 11:12     ` jay.xu
  0 siblings, 0 replies; 6+ messages in thread
From: jay.xu @ 2023-01-11 11:12 UTC (permalink / raw)
  To: Heiko Stübner, Jonas Karlman, linus.walleij
  Cc: linux-gpio, open list:ARM/Rockchip SoC...,
	linux-arm-kernel, Jonas Karlman

Hi Heiko:

--------------
jay.xu@rock-chips.com
>Hi Jay,
>
>Am Mittwoch, 11. Januar 2023, 11:26:18 CET schrieb jay.xu@rock-chips.com:
>> Hi Jonas
>>
>> --------------
>> jay.xu@rock-chips.com
>> >When reading pinconf-pins from debugfs it fails to get the configured pull
>> >type on RK3568, "unsupported pinctrl type" error messages is also reported.
>> >
>> >Fix this by adding support for RK3568 in rockchip_get_pull, including a
>> >reverse of the pull-up value swap applied in rockchip_set_pull so that
>> >pull-up is correctly reported in pinconf-pins.
>> >Also update the workaround comment to reflect affected pins, GPIO0_D3-D6.
>> >
>> >Fixes: c0dadc0e47a8 ("pinctrl: rockchip: add support for rk3568")
>> >Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
>> >---
>>
>> Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
>
>Did you want one of
>
>- Reviewed-by:
>- Tested-by:
>- Acked-by:
>
>instead? 
thanks, 

Reviewed-by: Jianqun Xu <jay.xu@rock-chips.com>
>
>
>Heiko
>
>> > drivers/pinctrl/pinctrl-rockchip.c | 11 ++++++++++-
>> > 1 file changed, 10 insertions(+), 1 deletion(-)
>> >
>> >diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
>> >index 849d5fa2a362..5eeac92f610a 100644
>> >--- a/drivers/pinctrl/pinctrl-rockchip.c
>> >+++ b/drivers/pinctrl/pinctrl-rockchip.c
>> >@@ -2436,10 +2436,19 @@ static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num)
>> > case RK3308:
>> > case RK3368:
>> > case RK3399:
>> >+	case RK3568:
>> > case RK3588:
>> > pull_type = bank->pull_type[pin_num / 8];
>> > data >>= bit;
>> > data &= (1 << RK3188_PULL_BITS_PER_PIN) - 1;
>> >+	/*
>> >+	* In the TRM, pull-up being 1 for everything except the GPIO0_D3-D6,
>> >+	* where that pull up value becomes 3.
>> >+	*/
>> >+	if (ctrl->type == RK3568 && bank->bank_num == 0 && pin_num >= 27 && pin_num <= 30) {
>> >+	if (data == 3)
>> >+	data = 1;
>> >+	}
>> >
>> > return rockchip_pull_list[pull_type][data];
>> > default:
>> >@@ -2497,7 +2506,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank,
>> > }
>> > }
>> > /*
>> >-	* In the TRM, pull-up being 1 for everything except the GPIO0_D0-D6,
>> >+	* In the TRM, pull-up being 1 for everything except the GPIO0_D3-D6,
>> > * where that pull up value becomes 3.
>> > */
>> > if (ctrl->type == RK3568 && bank->bank_num == 0 && pin_num >= 27 && pin_num <= 30) {
>> >--
>> >2.39.0
>> >
>>
>
>
>
>
_______________________________________________
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] 6+ messages in thread

* Re: [PATCH] pinctrl: rockchip: fix reading pull type on rk3568
  2023-01-10 17:29 [PATCH] pinctrl: rockchip: fix reading pull type on rk3568 Jonas Karlman
  2023-01-10 22:09 ` Heiko Stübner
  2023-01-11 10:26 ` jay.xu
@ 2023-01-16 12:43 ` Linus Walleij
  2 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2023-01-16 12:43 UTC (permalink / raw)
  To: Jonas Karlman
  Cc: Heiko Stuebner, Jianqun Xu, linux-gpio, linux-rockchip, linux-arm-kernel

On Tue, Jan 10, 2023 at 6:29 PM Jonas Karlman <jonas@kwiboo.se> wrote:

> When reading pinconf-pins from debugfs it fails to get the configured pull
> type on RK3568, "unsupported pinctrl type" error messages is also reported.
>
> Fix this by adding support for RK3568 in rockchip_get_pull, including a
> reverse of the pull-up value swap applied in rockchip_set_pull so that
> pull-up is correctly reported in pinconf-pins.
> Also update the workaround comment to reflect affected pins, GPIO0_D3-D6.
>
> Fixes: c0dadc0e47a8 ("pinctrl: rockchip: add support for rk3568")
> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>

Patch applied for fixes. Thanks for fixing this!

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] 6+ messages in thread

end of thread, other threads:[~2023-01-16 12:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-10 17:29 [PATCH] pinctrl: rockchip: fix reading pull type on rk3568 Jonas Karlman
2023-01-10 22:09 ` Heiko Stübner
2023-01-11 10:26 ` jay.xu
2023-01-11 10:45   ` Heiko Stübner
2023-01-11 11:12     ` jay.xu
2023-01-16 12:43 ` 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).