From patchwork Fri Oct 23 11:25:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caesar Wang X-Patchwork-Id: 7472111 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0BE23BEEA4 for ; Fri, 23 Oct 2015 11:28:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2B00320968 for ; Fri, 23 Oct 2015 11:28:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3868D2068E for ; Fri, 23 Oct 2015 11:28:39 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZpaUu-0005PS-Sl; Fri, 23 Oct 2015 11:27:00 +0000 Received: from mail-pa0-f65.google.com ([209.85.220.65]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZpaUK-0004yY-Of; Fri, 23 Oct 2015 11:26:26 +0000 Received: by padda3 with SMTP id da3so12407690pad.1; Fri, 23 Oct 2015 04:26:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7oj3zMwXcvl4pQA+AB+pYXeWICWc39I3qPFNm0OyGhQ=; b=O9pMb+v6kCbKHHHjbhe0RFKlroRoYzk8PuvDL18bFkwzXAE/Uw8ZhBfuSxYck+aNW/ KU03ntzny2Ct0W2mvaVcw68xcD3xGsCyupSPAfwWchU0aeUxKcEC/dknxGFFjTHnt2Tb UGerdx10OlXHPSRnbQWVYm9w1e8IsX2bTXJHV34r6CTl1nL+TB51RHbNr299hRjvGn8a tpsxLpLI/djtxhsjnqiVUmQ68vBxd5jaBIFLO7XLTGgE0wvvJQ8VzdSBjjZS75X6ak/w nq+Lj/UoZUS2/CoB4jtAHmrDGQ/+vBOOcnUlP2+CqO5xnwVm1W3BTFyFz1SOu1R4fshF AdWw== X-Received: by 10.68.221.133 with SMTP id qe5mr4575228pbc.93.1445599564132; Fri, 23 Oct 2015 04:26:04 -0700 (PDT) Received: from localhost.localdomain ([103.47.144.9]) by smtp.gmail.com with ESMTPSA id oi3sm1394274pbb.53.2015.10.23.04.25.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 23 Oct 2015 04:26:03 -0700 (PDT) From: Caesar Wang To: Heiko Stuebner Subject: [PATCH v4 2/3] thermal: rockchip: support the sleep pinctrl state to avoid glitches in s2r Date: Fri, 23 Oct 2015 19:25:27 +0800 Message-Id: <1445599528-18825-3-git-send-email-wxt@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445599528-18825-1-git-send-email-wxt@rock-chips.com> References: <1445599528-18825-1-git-send-email-wxt@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151023_042625_017763_6C487577 X-CRM114-Status: GOOD ( 11.25 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pm@vger.kernel.org, Dmitry Torokhov , linux-kernel@vger.kernel.org, dianders@chromium.org, Eduardo Valentin , linux-rockchip@lists.infradead.org, Zhang Rui , linux-arm-kernel@lists.infradead.org, Caesar Wang MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When we come out of system suspend state (S3) the tsadc will have been reset and back at its default state. While reprogramming the tsadc it's possible that we'll glitch the output and unintentionally cause the "over temperature" GPIO to be asserted. Since the over temperature GPIO is often hooked up to something that will cause a reboot or shutdown in hardware, this glitch can be catastrophic on some boards. We'll add support for selecting the "sleep" pinctrl state at suspend time. Boards can use this to effectively disable the tsadc at suspend time and avoid glitches when the system is resumed. Signed-off-by: Caesar Wang Reviewed-by: Douglas Anderson --- Changes in v4: - take the Doug's commit as correct decription. Changes in v3: - Add the pinctrl state for in the suspend/resume. Changes in v2: None Changes in v1: None drivers/thermal/rockchip_thermal.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index c89ffb2..3b8fbda 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -642,6 +642,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); + return 0; } @@ -678,6 +680,8 @@ static int __maybe_unused rockchip_thermal_resume(struct device *dev) for (i = 0; i < ARRAY_SIZE(thermal->sensors); i++) rockchip_thermal_toggle_sensor(&thermal->sensors[i], true); + pinctrl_pm_select_default_state(dev); + return 0; }