Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp406894ybm; Wed, 22 May 2019 05:22:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxUchyzzjPmkb00pIw/tdUqHFyGmJwXcSGvceU5bGL/+4mUcarg9t5lxTC8+hFtJyZ0+8su X-Received: by 2002:a17:902:bb89:: with SMTP id m9mr50511473pls.188.1558527744681; Wed, 22 May 2019 05:22:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558527744; cv=none; d=google.com; s=arc-20160816; b=KPhWqkiV+HKU3tiAbuAI2aVdd+hc/rAuFFJuVa2o439R+/sFAAXccsQD9T2B+3pSYO PS34xSktCbNZXYUuhNt4sSNSRTkXSekMiPhWCTGVgjavz9EBPYPF+pN1KxD/1guKkn2A T8HVVTW22pt4H2/wEntqNEUs73A+/LZHa+ddJ+JE3pIWh6TaAYY+361erA1CAJYBE5kK OQq0uudZPzBJp3gLKq42yqeRapzuJv6nXS7t2vh3FGeuqbbzxd7/47ln0pUWwVARKF6k bB4hf6zMtO6hGcWIn37FlRTS/HQpTPScJsGX59ufUg29cJDK1YZO/JaTgLluG3PATHYm 8uWg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=2ZhTk2acfpx8r4rFg+ynBi2h7n1lFX/B8oA8Vc1vWH4=; b=jynByJWZdhSt8cSYuMgaOCHZRaFVOYP/0zx7c1+Dul3/xFgJ4sTIMy3xxjII5rN7EU ODX6LIT7m36XmHfsSbI192093XfvI/sqObjrv2z2V3N8ACSCOZwT8ujB4cWrh635oKhE 6xwX/PJ0TIUW18HKoTbJAgcMGsOFEVLZzV0k7DZfSD63jQwOoPSH5Jmf0rbuPAV2C5uM EhBj0cv5Vi5F0UIEqX3CAabG6g1MiS2FB1ueP4Tmcif7B0jCBLhFBm99Isnqi5xIY7nk 45S/7WRbLeg15sgHwCQcyMSix4Zl0Molty1hnyOutGv02V/hXaFgqzKWSo+4QvFA9I+j MmIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KlvSGTvJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c20si27478573pfn.256.2019.05.22.05.22.09; Wed, 22 May 2019 05:22:24 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b=KlvSGTvJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729278AbfEVMUz (ORCPT + 99 others); Wed, 22 May 2019 08:20:55 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:42079 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728971AbfEVMUz (ORCPT ); Wed, 22 May 2019 08:20:55 -0400 Received: by mail-wr1-f66.google.com with SMTP id l2so2047079wrb.9 for ; Wed, 22 May 2019 05:20:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=2ZhTk2acfpx8r4rFg+ynBi2h7n1lFX/B8oA8Vc1vWH4=; b=KlvSGTvJ/VQA3qnYedKHobnQk8JkvV/4dnosj/hXZhcKYODa8MUB36fNKdt5ac2m15 /K5HRObcXkfT5oE73OIczs4h3yyFlnwNWpV0eIwpKeDQyqNXMBey1y4Kj+Gd6lt40yqb Sskay6gQq9Do8FehTN8k+XFjwK3e4xkSLOZfv6X1Ik0hV+S/+NsFuVkJ5LFlkBRO5qTR 6W6Hd+nx6WMOg0TXQl/51Rtg5OgYxSjAWczXesMFFyA6BOmJ7gVGE5KvPLZTuTKX8atI lw7A8PWcrPsN0G44hYBUtjWhFlfUSGQcRZKWwQP/5SaHhD2FXApIP+I5Omxfs/VSxdcy UsTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2ZhTk2acfpx8r4rFg+ynBi2h7n1lFX/B8oA8Vc1vWH4=; b=sbioeIBQuOcjA4HIzlL0xFKKnMZ+uWfQPOVpr0tWSXUnK5fW4QtDtXaupusUKnIjwX FpD+QIwnYBevO3fCkwFgV26moDT2JPPDIkgb1+fOmCWuU0+qlWbgZywdEelxccaFSNq7 9Ut+t6gqq5skX2xraKwlZ4TV6WNTcpdNujcWr2gXQFzQdQf08efIa4W4x3vNH8dchwBe qb/nupEw03/xPLp+gXaUZKNV57VgchBdgFsecQdGGXPTw6N8KdBYtAJmkja8YAe+lh2M 4b/ZUvTyqomXSccvOAt69GYaxb4iw1fcdPFtClxpPPZszJlZHCgbn2FTFtBBGaDZzm4V NnNA== X-Gm-Message-State: APjAAAXaJvWqNmLEUBOOa6KoEnBsbdU6Zt4r6T+ZOIxLakQ0UWmYas9m lzPmBElM/wZXNjtUjQc/bw0WEw== X-Received: by 2002:a5d:6a8c:: with SMTP id s12mr22488097wru.326.1558527652486; Wed, 22 May 2019 05:20:52 -0700 (PDT) Received: from [10.1.203.87] (nat-wifi.sssup.it. [193.205.81.22]) by smtp.googlemail.com with ESMTPSA id z8sm22338145wrs.84.2019.05.22.05.20.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 May 2019 05:20:51 -0700 (PDT) Subject: Re: [PATCH v3 1/3] thermal: rockchip: fix up the tsadc pinctrl setting error To: Elaine Zhang , heiko@sntech.de Cc: rui.zhang@intel.com, edubezval@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, xxx@rock-chips.com, xf@rock-chips.com, huangtao@rock-chips.com References: <1556618986-18923-1-git-send-email-zhangqing@rock-chips.com> <1556618986-18923-2-git-send-email-zhangqing@rock-chips.com> From: Daniel Lezcano Message-ID: <1d1063a5-3ec8-f430-febe-7e1471cd1812@linaro.org> Date: Wed, 22 May 2019 14:20:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <1556618986-18923-2-git-send-email-zhangqing@rock-chips.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Elaine, are you taking care of the issue related to this patch. If not fixed, it will be reverted. On 30/04/2019 12:09, Elaine Zhang wrote: > Explicitly use the pinctrl to set/unset the right mode > instead of relying on the pinctrl init mode. > And it requires setting the tshut polarity before select pinctrl. > > When the temperature sensor mode is set to 0, it will automatically > reset the board via the Clock-Reset-Unit (CRU) if the over temperature > threshold is reached. However, when the pinctrl initializes, it does a > transition to "otp_out" which may lead the SoC restart all the time. > > "otp_out" IO may be connected to the RESET circuit on the hardware. > If the IO is in the wrong state, it will trigger RESET. > (similar to the effect of pressing the RESET button) > which will cause the soc to restart all the time. > > Signed-off-by: Elaine Zhang > --- > drivers/thermal/rockchip_thermal.c | 36 +++++++++++++++++++++++++++++++++--- > 1 file changed, 33 insertions(+), 3 deletions(-) > > diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c > index 9c7643d62ed7..6dc7fc516abf 100644 > --- a/drivers/thermal/rockchip_thermal.c > +++ b/drivers/thermal/rockchip_thermal.c > @@ -172,6 +172,9 @@ struct rockchip_thermal_data { > int tshut_temp; > enum tshut_mode tshut_mode; > enum tshut_polarity tshut_polarity; > + struct pinctrl *pinctrl; > + struct pinctrl_state *gpio_state; > + struct pinctrl_state *otp_state; > }; > > /** > @@ -1242,6 +1245,8 @@ static int rockchip_thermal_probe(struct platform_device *pdev) > return error; > } > > + thermal->chip->control(thermal->regs, false); > + > error = clk_prepare_enable(thermal->clk); > if (error) { > dev_err(&pdev->dev, "failed to enable converter clock: %d\n", > @@ -1267,6 +1272,30 @@ static int rockchip_thermal_probe(struct platform_device *pdev) > thermal->chip->initialize(thermal->grf, thermal->regs, > thermal->tshut_polarity); > > + if (thermal->tshut_mode == TSHUT_MODE_GPIO) { > + thermal->pinctrl = devm_pinctrl_get(&pdev->dev); > + if (IS_ERR(thermal->pinctrl)) { > + dev_err(&pdev->dev, "failed to find thermal pinctrl\n"); > + return PTR_ERR(thermal->pinctrl); > + } > + > + thermal->gpio_state = pinctrl_lookup_state(thermal->pinctrl, > + "gpio"); > + if (IS_ERR_OR_NULL(thermal->gpio_state)) { > + dev_err(&pdev->dev, "failed to find thermal gpio state\n"); > + return -EINVAL; > + } > + > + thermal->otp_state = pinctrl_lookup_state(thermal->pinctrl, > + "otpout"); > + if (IS_ERR_OR_NULL(thermal->otp_state)) { > + dev_err(&pdev->dev, "failed to find thermal otpout state\n"); > + return -EINVAL; > + } > + > + pinctrl_select_state(thermal->pinctrl, thermal->otp_state); > + } > + > for (i = 0; i < thermal->chip->chn_num; i++) { > error = rockchip_thermal_register_sensor(pdev, thermal, > &thermal->sensors[i], > @@ -1337,8 +1366,8 @@ static int __maybe_unused rockchip_thermal_suspend(struct device *dev) > > clk_disable(thermal->pclk); > clk_disable(thermal->clk); > - > - pinctrl_pm_select_sleep_state(dev); > + if (thermal->tshut_mode == TSHUT_MODE_GPIO) > + pinctrl_select_state(thermal->pinctrl, thermal->gpio_state); > > return 0; > } > @@ -1383,7 +1412,8 @@ static int __maybe_unused rockchip_thermal_resume(struct device *dev) > for (i = 0; i < thermal->chip->chn_num; i++) > rockchip_thermal_toggle_sensor(&thermal->sensors[i], true); > > - pinctrl_pm_select_default_state(dev); > + if (thermal->tshut_mode == TSHUT_MODE_GPIO) > + pinctrl_select_state(thermal->pinctrl, thermal->otp_state); > > return 0; > } > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog