From: 남영민 <youngmin.nam@samsung.com>
To: tomasz.figa@gmail.com, krzk@kernel.org, s.nawrocki@samsung.com
Cc: linus.walleij@linaro.org, linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, linux-gpio@vger.kernel.org
Subject: [PATCH] pinctrl: samsung: add pinctrl_force_sleep() for "sleep" pinctrl state
Date: Thu, 21 Sep 2017 21:32:29 +0900 [thread overview]
Message-ID: <006801d332d5$b0ca09d0$125e1d70$@samsung.com> (raw)
In-Reply-To: CGME20170921123230epcas1p4d3c1de108af7d34053d2c4f40dd42119@epcas1p4.samsung.com
This patch adds pinctrl_for_sleep() in samsung_pinctrl_suspend()
to support configuration of "sleep" pinctrl state.
For example, we can configure "sleep" pinctrl state of "gpf1-6"
as "INPUT, PULL DOWN" by configuring power down mode register.
&pinctrl_5 {
pinctrl-names = "default","sleep";
pinctrl-0 = <&initial5>;
pinctrl-1 = <&sleep5>;
initial5: initial-state {
samsung,pins = gpf1-6;
samsung,pin-function = <EXYNOS_PIN_FUNC_INPUT>;
};
sleep5: sleep-state {
samsung,pins = gpf1-6;
samsung,pin-con-pdn = <EXYNOS_PIN_PDN_INPUT>;
samsung,pin-pud-pdn = <EXYNOS_PIN_PULL_DOWN>;
};
};
Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com>
---
drivers/pinctrl/samsung/pinctrl-samsung.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
index e04f7fe0a65d..b4d12f8db475 100644
--- a/drivers/pinctrl/samsung/pinctrl-samsung.c
+++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
@@ -1099,6 +1099,11 @@ static int __maybe_unused samsung_pinctrl_suspend(struct device *dev)
{
struct samsung_pinctrl_drv_data *drvdata = dev_get_drvdata(dev);
int i;
+ int ret;
+
+ ret = pinctrl_force_sleep(drvdata->pctl_dev);
+ if (ret)
+ dev_err(dev, "could not set sleep pinstate %d\n", ret);
for (i = 0; i < drvdata->nr_banks; i++) {
struct samsung_pin_bank *bank = &drvdata->pin_banks[i];
@@ -1187,6 +1192,11 @@ static int __maybe_unused samsung_pinctrl_resume(struct device *dev)
if (drvdata->retention_ctrl && drvdata->retention_ctrl->disable)
drvdata->retention_ctrl->disable(drvdata);
+ /* For changing state without writing register. */
+ if (!IS_ERR(drvdata->pctl_dev->p) &&
+ !IS_ERR(drvdata->pctl_dev->hog_default))
+ drvdata->pctl_dev->p->state = drvdata->pctl_dev->hog_default;
+
return 0;
}
--
2.13.0
next parent reply other threads:[~2017-09-21 12:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170921123230epcas1p4d3c1de108af7d34053d2c4f40dd42119@epcas1p4.samsung.com>
2017-09-21 12:32 ` 남영민 [this message]
2017-09-21 16:14 ` [PATCH] pinctrl: samsung: add pinctrl_force_sleep() for "sleep" pinctrl state Tomasz Figa
2017-09-22 13:14 ` Linus Walleij
2017-09-22 13:09 ` 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='006801d332d5$b0ca09d0$125e1d70$@samsung.com' \
--to=youngmin.nam@samsung.com \
--cc=krzk@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=s.nawrocki@samsung.com \
--cc=tomasz.figa@gmail.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).