linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Gary Yang <gary.yang@cixtech.com>,
	Peter Chen <peter.chen@cixtech.com>,
	 Fugang Duan <fugang.duan@cixtech.com>,
	 CIX Linux Kernel Upstream Group
	<cix-kernel-upstream@cixtech.com>
Cc: linux-gpio@vger.kernel.org, Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH] pinctrl: cix: sky1: Provide pin control dummy states
Date: Tue, 04 Nov 2025 14:01:03 +0100	[thread overview]
Message-ID: <20251104-cix-dummies-v1-1-331fc0c71115@linaro.org> (raw)

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>


             reply	other threads:[~2025-11-04 13:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-04 13:01 Linus Walleij [this message]
2025-11-05  1:24 ` 回复: [PATCH] pinctrl: cix: sky1: Provide pin control dummy states Fugang Duan
2025-11-05  1:42 ` Hans Zhang
2025-11-06 14:01 ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251104-cix-dummies-v1-1-331fc0c71115@linaro.org \
    --to=linus.walleij@linaro.org \
    --cc=cix-kernel-upstream@cixtech.com \
    --cc=fugang.duan@cixtech.com \
    --cc=gary.yang@cixtech.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=peter.chen@cixtech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).