Received: by 10.223.185.116 with SMTP id b49csp4093498wrg; Mon, 19 Feb 2018 10:58:26 -0800 (PST) X-Google-Smtp-Source: AH8x225knjfHDEDnTWkFgTgS7LbXatdlbA7z7am605MPrK1fPKKt4tLN+X0Sd7xJmwbNZgErr8xg X-Received: by 2002:a17:902:a712:: with SMTP id w18-v6mr3831013plq.81.1519066706325; Mon, 19 Feb 2018 10:58:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519066706; cv=none; d=google.com; s=arc-20160816; b=H/6fA0DzzdrH0/7WWUoIu+GQ4HtxY1A/OoLA85S8OvncT0Z2jmQMAVVsWnwhpfyhsB iCakK413b0g/3ooB1/SDMdSCUgGrXSSAL5NOv87TXhX5QZY/yFDUWJ+Vleo06ZS8dJUq aj1iSp//z17PlRfC2s1GjI8ruCYzXSTeO3BS5idT8w3G/tFrDEq64cZMmyrRwVEbFTVk NwjzVDCy6Pam/BMiEvCkCwH8+0w+JiKu92hn5C9b2Jn874cYvyVgoz+REJrqpw0jCXhG YppgG59MvauA+X0ViXhAghdFN3gEUaHlJ87lBHwTQQA411zekpyeSZINOmoSTcCk0LoK Z8Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=3kvku9TSUjVXfkZjQvq16kLZZvU6rWPvYPo8h63DkTA=; b=dCVK/UDFB0waGIfKfRv6z10Pxc4U+ywupZvtJs+dT8dlIym+8VXfpkSkyXiF5Mr3EJ IDxBWhVu07lqC2OZgio0dRvpWI69MhyxsLh3Vzo9xuZctCMI9KvkOtiVQh8PO1S+FbYf lI5nQAfZv1/fBU6n69AxLDViOUv2BeYc2Fd4L/fHitMa6XwloSkRZkOtzo4ZOXDaeyzd 6sO+FbPWXNtb17AR2jddLB5o8lYX1VSskhSvihz6mE5sFDcBzJxqO94Gmi2/Yv3U5OBT GucAbEN0nuIouYS7pJpCXu6LEWgReB82A0rlg7icoeEpj3gdKwuTlmzPNtq9akN+kE7/ 8yxg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l86si9359735pfg.187.2018.02.19.10.58.11; Mon, 19 Feb 2018 10:58:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753515AbeBSS5d (ORCPT + 99 others); Mon, 19 Feb 2018 13:57:33 -0500 Received: from gloria.sntech.de ([95.129.55.99]:58058 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753456AbeBSS5c (ORCPT ); Mon, 19 Feb 2018 13:57:32 -0500 Received: from 92-111-167-82.static.v4.ziggozakelijk.nl ([92.111.167.82] helo=phil.localnet) by gloria.sntech.de with esmtpsa (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1enqcu-0004eU-Lx; Mon, 19 Feb 2018 19:57:24 +0100 From: Heiko Stuebner To: Florian Fainelli Cc: Marc Zyngier , linux-kernel@vger.kernel.org, linus.walleij@linaro.org, swarren@nvidia.com, andy.shevchenko@gmail.com, alcooperx@gmail.com, linux-gpio@vger.kernel.org Subject: Re: [PATCH fixes v3] pinctrl: Really force states during suspend/resume Date: Mon, 19 Feb 2018 19:57:23 +0100 Message-ID: <3136391.js9qjGvjLN@phil> In-Reply-To: <913ED32F-36F8-4F31-9221-263DD5599FB2@gmail.com> References: <20170301183257.6554-1-f.fainelli@gmail.com> <83d6bd0da9254d868d3f713bd3bc282c@www.loen.fr> <913ED32F-36F8-4F31-9221-263DD5599FB2@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Montag, 19. Februar 2018, 19:03:27 CET schrieb Florian Fainelli: > On February 19, 2018 9:25:26 AM PST, Marc Zyngier wrote: > >Hi all, > > > >On 2017-03-01 18:32, Florian Fainelli wrote: > >> In case a platform only defaults a "default" set of pins, but not a > >> "sleep" set of pins, and this particular platform suspends and > >> resumes > >> in a way that the pin states are not preserved by the hardware, when > >> we > >> resume, we would call pinctrl_single_resume() -> > >> pinctrl_force_default() > >> -> pinctrl_select_state() and the first thing we do is check that the > >> pins state is the same as before, and do nothing. > >> > >> In order to fix this, decouple the actual state change from > >> pinctrl_select_state() and move it pinctrl_commit_state(), while > >> keeping > >> the p->state == state check in pinctrl_select_state() not to change > >> the > >> caller assumptions. pinctrl_force_sleep() and pinctrl_force_default() > >> are updated to bypass the state check by calling > >> pinctrl_commit_state(). > >> > >> Fixes: 6e5e959dde0d ("pinctrl: API changes to support multiple states > >> per device") > >> Signed-off-by: Florian Fainelli > >> --- > >> Changes in v3: > >> > >> - move the state check to pinctrl_select_state > >> > >> Changes in v2: > >> > >> - rename __pinctrl_select_state to pinctrl_commit_state > >> > >> drivers/pinctrl/core.c | 24 +++++++++++++++++------- > >> 1 file changed, 17 insertions(+), 7 deletions(-) > >> > >> diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c > >> index fb38e208f32d..735d8f7f9d71 100644 > >> --- a/drivers/pinctrl/core.c > >> +++ b/drivers/pinctrl/core.c > >> @@ -992,19 +992,16 @@ struct pinctrl_state > >> *pinctrl_lookup_state(struct pinctrl *p, > >> EXPORT_SYMBOL_GPL(pinctrl_lookup_state); > >> > >> /** > >> - * pinctrl_select_state() - select/activate/program a pinctrl state > >> to HW > >> + * pinctrl_commit_state() - select/activate/program a pinctrl state > >> to HW > >> * @p: the pinctrl handle for the device that requests configuration > >> * @state: the state handle to select/activate/program > >> */ > >> -int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state > >> *state) > >> +static int pinctrl_commit_state(struct pinctrl *p, struct > >> pinctrl_state *state) > >> { > >> struct pinctrl_setting *setting, *setting2; > >> struct pinctrl_state *old_state = p->state; > >> int ret; > >> > >> - if (p->state == state) > >> - return 0; > >> - > >> if (p->state) { > >> /* > >> * For each pinmux setting in the old state, forget SW's record > >> @@ -1068,6 +1065,19 @@ int pinctrl_select_state(struct pinctrl *p, > >> struct pinctrl_state *state) > >> > >> return ret; > >> } > >> + > >> +/** > >> + * pinctrl_select_state() - select/activate/program a pinctrl state > >> to HW > >> + * @p: the pinctrl handle for the device that requests configuration > >> + * @state: the state handle to select/activate/program > >> + */ > >> +int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state > >> *state) > >> +{ > >> + if (p->state == state) > >> + return 0; > >> + > >> + return pinctrl_commit_state(p, state); > >> +} > >> EXPORT_SYMBOL_GPL(pinctrl_select_state); > >> > >> static void devm_pinctrl_release(struct device *dev, void *res) > >> @@ -1236,7 +1246,7 @@ void pinctrl_unregister_map(struct pinctrl_map > >> const *map) > >> int pinctrl_force_sleep(struct pinctrl_dev *pctldev) > >> { > >> if (!IS_ERR(pctldev->p) && !IS_ERR(pctldev->hog_sleep)) > >> - return pinctrl_select_state(pctldev->p, pctldev->hog_sleep); > >> + return pinctrl_commit_state(pctldev->p, pctldev->hog_sleep); > >> return 0; > >> } > >> EXPORT_SYMBOL_GPL(pinctrl_force_sleep); > >> @@ -1248,7 +1258,7 @@ EXPORT_SYMBOL_GPL(pinctrl_force_sleep); > >> int pinctrl_force_default(struct pinctrl_dev *pctldev) > >> { > >> if (!IS_ERR(pctldev->p) && !IS_ERR(pctldev->hog_default)) > >> - return pinctrl_select_state(pctldev->p, pctldev->hog_default); > >> + return pinctrl_commit_state(pctldev->p, pctldev->hog_default); > >> return 0; > >> } > >> EXPORT_SYMBOL_GPL(pinctrl_force_default); > > Hey Marc, > > > > >I don't often go back over a year worth of LKML, but since this patch > >recently landed in mainline as 981ed1bfbc6c, I though I'd use it as an > >anchor to report the following: > > > >It turns out that this patch completely breaks resume on my > >rk3399-based Chromebook. Most things are timing out, the box is > >unusable. And since this is my everyday tool, I'm mildly grumpy. Please > > > >don't break my toys! ;-) Reverting this patch on top of 4.16-rc2 makes > >me productive again... > > > >More seriously, I have no idea what's wrong here. It could be a > >SoC-related issue, hence Heiko on Cc. I'm happy to test any idea you > >could have. > > Can you indicate which DTS file is used for your Chromebook model? Sorry about the breakage. that should be https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dts I'm vacationing right now, so don't think I'll find time to dive into Rockchip pinctrl this week. But I'd guess it could be somehow related to the ATF touching pins during suspend/resume?