linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org>
To: linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
Cc: Linus Walleij
	<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Florian Fainelli
	<f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCH] pinctrl/rockchip: Don't call pinctrl_force_* for nothing
Date: Sat, 24 Feb 2018 20:07:31 +0000	[thread overview]
Message-ID: <20180224200732.6116-1-marc.zyngier@arm.com> (raw)

The rockchip pinctl driver calls pinctrl_force_default and
pinctrl_force_sleep on suspend resume, but seems to expect
that the outcome of these calls will be that nothing happens,
as the core code checks whether we're already in the right
state or not.

Or at least, that was what the core code was doing until
981ed1bfbc ("pinctrl: Really force states during suspend/resume"),
which gives the "force" qualifier its actual meaning.

In turn, this breaks suspend/resume on the rk3399. So let's
change the rockchip code to do what it should have done from
the very begining, which is exactly *nothing*.

We take this opportunity to tidy-up the RK3288 GPIO6_C6 mux
resume workaround, making it symetrical to the suspend path.

Tested on a rk3399-based kevin Chromebook.

Fixes: 9198f509c888 ("pinctrl: rockchip: add suspend/resume functions")
Signed-off-by: Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org>
---
 drivers/pinctrl/pinctrl-rockchip.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 3924779f5578..a3a503e684dc 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -3114,22 +3114,18 @@ static u32 rk3288_grf_gpio6c_iomux;
 static int __maybe_unused rockchip_pinctrl_suspend(struct device *dev)
 {
 	struct rockchip_pinctrl *info = dev_get_drvdata(dev);
-	int ret = pinctrl_force_sleep(info->pctl_dev);
-
-	if (ret)
-		return ret;
 
 	/*
 	 * RK3288 GPIO6_C6 mux would be modified by Maskrom when resume, so save
 	 * the setting here, and restore it at resume.
 	 */
 	if (info->ctrl->type == RK3288) {
+		int ret;
+
 		ret = regmap_read(info->regmap_base, RK3288_GRF_GPIO6C_IOMUX,
 				  &rk3288_grf_gpio6c_iomux);
-		if (ret) {
-			pinctrl_force_default(info->pctl_dev);
+		if (ret)
 			return ret;
-		}
 	}
 
 	return 0;
@@ -3138,14 +3134,18 @@ static int __maybe_unused rockchip_pinctrl_suspend(struct device *dev)
 static int __maybe_unused rockchip_pinctrl_resume(struct device *dev)
 {
 	struct rockchip_pinctrl *info = dev_get_drvdata(dev);
-	int ret = regmap_write(info->regmap_base, RK3288_GRF_GPIO6C_IOMUX,
-			       rk3288_grf_gpio6c_iomux |
-			       GPIO6C6_SEL_WRITE_ENABLE);
 
-	if (ret)
-		return ret;
+	if (info->ctrl->type == RK3288) {
+		int ret;
 
-	return pinctrl_force_default(info->pctl_dev);
+		ret = regmap_write(info->regmap_base, RK3288_GRF_GPIO6C_IOMUX,
+				   rk3288_grf_gpio6c_iomux |
+				   GPIO6C6_SEL_WRITE_ENABLE);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
 }
 
 static SIMPLE_DEV_PM_OPS(rockchip_pinctrl_dev_pm_ops, rockchip_pinctrl_suspend,
-- 
2.14.2

             reply	other threads:[~2018-02-24 20:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-24 20:07 Marc Zyngier [this message]
     [not found] ` <20180224200732.6116-1-marc.zyngier-5wv7dgnIgG8@public.gmane.org>
2018-02-27  3:37   ` [PATCH] pinctrl/rockchip: Don't call pinctrl_force_* for nothing Florian Fainelli
2018-02-27 15:05   ` Heiko Stuebner
2018-02-27 18:47     ` Doug Anderson
     [not found]       ` <CAD=FV=XDc9Npn-ZensiYSPy6gVs81oGfnL+Q=_hpHRT+FgKc7g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-02-27 19:06         ` Marc Zyngier
     [not found]           ` <24eb9ab9-e5b5-5f31-036a-a72cb6e8c300-5wv7dgnIgG8@public.gmane.org>
2018-02-27 20:51             ` Doug Anderson
2018-03-01  9:32   ` Linus Walleij
     [not found]     ` <CACRpkdaBbH_2KiQdrE9yZfJd0c97rTr_tF7vhSA_vCJF0L_sGw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-03-01  9:40       ` Marc Zyngier
2018-03-01  9:52       ` Heiko Stübner

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=20180224200732.6116-1-marc.zyngier@arm.com \
    --to=marc.zyngier-5wv7dgnigg8@public.gmane.org \
    --cc=f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    /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).