From patchwork Sat Feb 24 20:07:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 10240481 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7606360209 for ; Sat, 24 Feb 2018 20:08:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 668DA2996B for ; Sat, 24 Feb 2018 20:08:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5AE25299D1; Sat, 24 Feb 2018 20:08:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B37A52996B for ; Sat, 24 Feb 2018 20:08:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=Ze5TYP8+zs+8Pbh/Alod2TiT5bP+lRBNBPR2hL67Hhs=; b=M0M f++8o1HnlYS7QG4sScxIJBRL0BmdY5NBpkqx9Snwn6aQ4hVd0QYiFlgrTfqrJF64FJQf2ZcrmUuIq fi6db3JnjDFAdafLJTXGhaziDNCbonRq5tEsKFUNTFIksSiayBSmLjoaeqxNtwZ4zTQ4ixRJ8poIy eiD+J73eef/ZTcYydhsZ5+k+cAFHlIqxUtjr2ANRJHj+8jT02FS1nVv9tN6J8DjxKud3O97s1/LXB ZInanPaLr0/PWFwgLgXjriZDDhGsTNG/FKMBBrZz81kD9ABigYgFVYMIVY4T4w/Q+7J++wfcjM/HA VsbvjU23NqQqnlEr5ld/oDAXtg7AA1g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1epg6w-0005jq-MF; Sat, 24 Feb 2018 20:07:58 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1epg6t-0005hT-Jk for linux-rockchip@lists.infradead.org; Sat, 24 Feb 2018 20:07:57 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 41F2B80D; Sat, 24 Feb 2018 12:07:41 -0800 (PST) Received: from big-swifty.lan (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8D3BC3F487; Sat, 24 Feb 2018 12:07:39 -0800 (PST) From: Marc Zyngier To: linux-gpio@vger.kernel.org, linux-rockchip@lists.infradead.org, Heiko Stuebner Subject: [PATCH] pinctrl/rockchip: Don't call pinctrl_force_* for nothing Date: Sat, 24 Feb 2018 20:07:31 +0000 Message-Id: <20180224200732.6116-1-marc.zyngier@arm.com> X-Mailer: git-send-email 2.14.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180224_120755_666992_57572CE9 X-CRM114-Status: GOOD ( 11.89 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij , Florian Fainelli MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Florian Fainelli --- 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,