linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: cix: sky1: Provide pin control dummy states
@ 2025-11-04 13:01 Linus Walleij
  2025-11-05  1:24 ` 回复: " Fugang Duan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Linus Walleij @ 2025-11-04 13:01 UTC (permalink / raw)
  To: Gary Yang, Peter Chen, Fugang Duan,
	CIX Linux Kernel Upstream Group
  Cc: linux-gpio, Linus Walleij

This exports and calls the pinctrl_provide_dummies() function from
the CIX SKY1 driver.

The reasons are explained in a comment in the commit, in essence the
two pin controllers need to go through explicit state transitions
default->sleep->default despite they only handle one single state
each.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/pinctrl/cix/pinctrl-sky1-base.c | 15 +++++++++++++++
 drivers/pinctrl/core.c                  |  1 +
 2 files changed, 16 insertions(+)

diff --git a/drivers/pinctrl/cix/pinctrl-sky1-base.c b/drivers/pinctrl/cix/pinctrl-sky1-base.c
index b03e10147b09fc4b69593d5cd9851b74ba1aaac1..a5b583f10441e42cea34c275bc61fb36b949c0e4 100644
--- a/drivers/pinctrl/cix/pinctrl-sky1-base.c
+++ b/drivers/pinctrl/cix/pinctrl-sky1-base.c
@@ -560,6 +560,21 @@ int sky1_base_pinctrl_probe(struct platform_device *pdev,
 		return ret;
 	}
 
+	/*
+	 * The SKY1 SoC has two pin controllers: one for normal working state
+	 * and one for sleep state. Since one controller only has working
+	 * states and the other only sleep states, it will seem to the
+	 * controller is always in the first configured state, so no
+	 * transitions between default->sleep->default are detected and no
+	 * new pin states are applied when we go in and out of sleep state.
+	 *
+	 * To counter this, provide dummies, so that the sleep-only pin
+	 * controller still get some default states, and the working state pin
+	 * controller get some sleep states, so that state transitions occur
+	 * and we re-configure pins for default and sleep states.
+	 */
+	pinctrl_provide_dummies();
+
 	dev_dbg(&pdev->dev, "initialized SKY1 pinctrl driver\n");
 
 	return pinctrl_enable(spctl->pctl);
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 157510157d47aad96b459abf68cc0e4eed957f2d..83254a95ef1741eaf4784ba4e5a95176af497845 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -70,6 +70,7 @@ void pinctrl_provide_dummies(void)
 {
 	pinctrl_dummy_state = true;
 }
+EXPORT_SYMBOL_GPL(pinctrl_provide_dummies);
 
 const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev)
 {

---
base-commit: 99224c151c19b74e1930d236dd348b6b22a607a5
change-id: 20251104-cix-dummies-f5f400e3ce94

Best regards,
-- 
Linus Walleij <linus.walleij@linaro.org>


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

* 回复: [PATCH] pinctrl: cix: sky1: Provide pin control dummy states
  2025-11-04 13:01 [PATCH] pinctrl: cix: sky1: Provide pin control dummy states Linus Walleij
@ 2025-11-05  1:24 ` Fugang Duan
  2025-11-05  1:42 ` Hans Zhang
  2025-11-06 14:01 ` Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Fugang Duan @ 2025-11-05  1:24 UTC (permalink / raw)
  To: Linus Walleij, Gary Yang, Peter Chen, cix-kernel-upstream
  Cc: linux-gpio@vger.kernel.org

发件人: Linus Walleij <linus.walleij@linaro.org> 发送时间: 2025年11月4日 21:01
>This exports and calls the pinctrl_provide_dummies() function from the CIX SKY1
>driver.
>
>The reasons are explained in a comment in the commit, in essence the two pin
>controllers need to go through explicit state transitions
>default->sleep->default despite they only handle one single state
>each.
>
>Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Reviewed-by: Fugang Duan <fugang.duan@cixtech.com>

>---
> drivers/pinctrl/cix/pinctrl-sky1-base.c | 15 +++++++++++++++
> drivers/pinctrl/core.c                  |  1 +
> 2 files changed, 16 insertions(+)
>
>diff --git a/drivers/pinctrl/cix/pinctrl-sky1-base.c
>b/drivers/pinctrl/cix/pinctrl-sky1-base.c
>index
>b03e10147b09fc4b69593d5cd9851b74ba1aaac1..a5b583f10441e42cea34c275bc61fb36b
>949c0e4 100644
>--- a/drivers/pinctrl/cix/pinctrl-sky1-base.c
>+++ b/drivers/pinctrl/cix/pinctrl-sky1-base.c
>@@ -560,6 +560,21 @@ int sky1_base_pinctrl_probe(struct platform_device *pdev,
>                return ret;
>        }
>
>+       /*
>+        * The SKY1 SoC has two pin controllers: one for normal working state
>+        * and one for sleep state. Since one controller only has working
>+        * states and the other only sleep states, it will seem to the
>+        * controller is always in the first configured state, so no
>+        * transitions between default->sleep->default are detected and no
>+        * new pin states are applied when we go in and out of sleep state.
>+        *
>+        * To counter this, provide dummies, so that the sleep-only pin
>+        * controller still get some default states, and the working state pin
>+        * controller get some sleep states, so that state transitions occur
>+        * and we re-configure pins for default and sleep states.
>+        */
>+       pinctrl_provide_dummies();
>+
>        dev_dbg(&pdev->dev, "initialized SKY1 pinctrl driver\n");
>
>        return pinctrl_enable(spctl->pctl); diff --git
>a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index
>157510157d47aad96b459abf68cc0e4eed957f2d..83254a95ef1741eaf4784ba4e5a95176a
>f497845 100644
>--- a/drivers/pinctrl/core.c
>+++ b/drivers/pinctrl/core.c
>@@ -70,6 +70,7 @@ void pinctrl_provide_dummies(void)  {
>        pinctrl_dummy_state = true;
> }
>+EXPORT_SYMBOL_GPL(pinctrl_provide_dummies);
>
> const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev)  {
>
>---
>base-commit: 99224c151c19b74e1930d236dd348b6b22a607a5
>change-id: 20251104-cix-dummies-f5f400e3ce94
>
>Best regards,
>--
>Linus Walleij <linus.walleij@linaro.org>

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

* Re: [PATCH] pinctrl: cix: sky1: Provide pin control dummy states
  2025-11-04 13:01 [PATCH] pinctrl: cix: sky1: Provide pin control dummy states Linus Walleij
  2025-11-05  1:24 ` 回复: " Fugang Duan
@ 2025-11-05  1:42 ` Hans Zhang
  2025-11-06 14:01 ` Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Hans Zhang @ 2025-11-05  1:42 UTC (permalink / raw)
  To: Linus Walleij, Gary Yang, Peter Chen, Fugang Duan,
	CIX Linux Kernel Upstream Group
  Cc: linux-gpio



On 11/4/2025 9:01 PM, Linus Walleij wrote:
> EXTERNAL EMAIL
> 
> This exports and calls the pinctrl_provide_dummies() function from
> the CIX SKY1 driver.
> 
> The reasons are explained in a comment in the commit, in essence the
> two pin controllers need to go through explicit state transitions
> default->sleep->default despite they only handle one single state
> each.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Reviewed-by: Hans Zhang <hans.zhang@cixtech.com>

> ---
>   drivers/pinctrl/cix/pinctrl-sky1-base.c | 15 +++++++++++++++
>   drivers/pinctrl/core.c                  |  1 +
>   2 files changed, 16 insertions(+)
> 
> diff --git a/drivers/pinctrl/cix/pinctrl-sky1-base.c b/drivers/pinctrl/cix/pinctrl-sky1-base.c
> index b03e10147b09fc4b69593d5cd9851b74ba1aaac1..a5b583f10441e42cea34c275bc61fb36b949c0e4 100644
> --- a/drivers/pinctrl/cix/pinctrl-sky1-base.c
> +++ b/drivers/pinctrl/cix/pinctrl-sky1-base.c
> @@ -560,6 +560,21 @@ int sky1_base_pinctrl_probe(struct platform_device *pdev,
>                  return ret;
>          }
> 
> +       /*
> +        * The SKY1 SoC has two pin controllers: one for normal working state
> +        * and one for sleep state. Since one controller only has working
> +        * states and the other only sleep states, it will seem to the
> +        * controller is always in the first configured state, so no
> +        * transitions between default->sleep->default are detected and no
> +        * new pin states are applied when we go in and out of sleep state.
> +        *
> +        * To counter this, provide dummies, so that the sleep-only pin
> +        * controller still get some default states, and the working state pin
> +        * controller get some sleep states, so that state transitions occur
> +        * and we re-configure pins for default and sleep states.
> +        */
> +       pinctrl_provide_dummies();
> +
>          dev_dbg(&pdev->dev, "initialized SKY1 pinctrl driver\n");
> 
>          return pinctrl_enable(spctl->pctl);
> diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
> index 157510157d47aad96b459abf68cc0e4eed957f2d..83254a95ef1741eaf4784ba4e5a95176af497845 100644
> --- a/drivers/pinctrl/core.c
> +++ b/drivers/pinctrl/core.c
> @@ -70,6 +70,7 @@ void pinctrl_provide_dummies(void)
>   {
>          pinctrl_dummy_state = true;
>   }
> +EXPORT_SYMBOL_GPL(pinctrl_provide_dummies);
> 
>   const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev)
>   {
> 
> ---
> base-commit: 99224c151c19b74e1930d236dd348b6b22a607a5
> change-id: 20251104-cix-dummies-f5f400e3ce94
> 
> Best regards,
> --
> Linus Walleij <linus.walleij@linaro.org>
> 


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

* Re: [PATCH] pinctrl: cix: sky1: Provide pin control dummy states
  2025-11-04 13:01 [PATCH] pinctrl: cix: sky1: Provide pin control dummy states Linus Walleij
  2025-11-05  1:24 ` 回复: " Fugang Duan
  2025-11-05  1:42 ` Hans Zhang
@ 2025-11-06 14:01 ` Linus Walleij
  2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2025-11-06 14:01 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Gary Yang, Peter Chen, Fugang Duan,
	CIX Linux Kernel Upstream Group, linux-gpio

On Tue, Nov 4, 2025 at 2:01 PM Linus Walleij <linus.walleij@linaro.org> wrote:

> This exports and calls the pinctrl_provide_dummies() function from
> the CIX SKY1 driver.
>
> The reasons are explained in a comment in the commit, in essence the
> two pin controllers need to go through explicit state transitions
> default->sleep->default despite they only handle one single state
> each.
>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

I've applied this patch, now looking forward to the
GPIO patches :)

Yours,
Linus Walleij

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

end of thread, other threads:[~2025-11-06 14:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-04 13:01 [PATCH] pinctrl: cix: sky1: Provide pin control dummy states Linus Walleij
2025-11-05  1:24 ` 回复: " Fugang Duan
2025-11-05  1:42 ` Hans Zhang
2025-11-06 14:01 ` 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).