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: 7472081 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 39AD39F1C3 for ; Fri, 23 Oct 2015 11:26:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B1BE420968 for ; Fri, 23 Oct 2015 11:26:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5323620966 for ; Fri, 23 Oct 2015 11:26:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753192AbbJWL0j (ORCPT ); Fri, 23 Oct 2015 07:26:39 -0400 Received: from mail-pa0-f66.google.com ([209.85.220.66]:36461 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753114AbbJWL0E (ORCPT ); Fri, 23 Oct 2015 07:26:04 -0400 Received: by pacik9 with SMTP id ik9so12346396pac.3; 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 Cc: Dmitry Torokhov , dianders@chromium.org, Eduardo Valentin , Caesar Wang , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Zhang Rui , linux-arm-kernel@lists.infradead.org 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> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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; }