From patchwork Fri Nov 2 06:55:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?44Kw44Kn44Oz44O744Ki44Oz44O744Ob44Kh44Oz?= X-Patchwork-Id: 10665089 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D54A13A4 for ; Fri, 2 Nov 2018 06:56:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73FB22BEC7 for ; Fri, 2 Nov 2018 06:56:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 675952BECB; Fri, 2 Nov 2018 06:56:11 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4F962BEC7 for ; Fri, 2 Nov 2018 06:56:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728128AbeKBQCR (ORCPT ); Fri, 2 Nov 2018 12:02:17 -0400 Received: from www3345.sakura.ne.jp ([49.212.235.55]:28534 "EHLO www3345.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727546AbeKBQCR (ORCPT ); Fri, 2 Nov 2018 12:02:17 -0400 Received: from fsav302.sakura.ne.jp (fsav302.sakura.ne.jp [153.120.85.133]) by www3345.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id wA26u5U7083719; Fri, 2 Nov 2018 15:56:05 +0900 (JST) (envelope-from na-hoan@jinso.co.jp) Received: from www3345.sakura.ne.jp (49.212.235.55) by fsav302.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav302.sakura.ne.jp); Fri, 02 Nov 2018 15:56:05 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav302.sakura.ne.jp) Received: from localhost (p14010-ipadfx41marunouchi.tokyo.ocn.ne.jp [61.118.107.10]) (authenticated bits=0) by www3345.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id wA26txU8083691 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 2 Nov 2018 15:56:04 +0900 (JST) (envelope-from na-hoan@jinso.co.jp) From: Nguyen An Hoan To: linux-renesas-soc@vger.kernel.org, geert+renesas@glider.be, wsa@sang-engineering.com Cc: niklas.soderlund@ragnatech.se, kuninori.morimoto.gx@renesas.com, yoshihiro.shimoda.uh@renesas.com, h-inayoshi@jinso.co.jp, nv-dung@jinso.co.jp, na-hoan@jinso.co.jp, cv-dong@jinso.co.jp Subject: [PATCH] thermal: rcar_gen3_thermal: Add Standby-mode function support Date: Fri, 2 Nov 2018 15:55:59 +0900 Message-Id: <1541141759-14690-1-git-send-email-na-hoan@jinso.co.jp> X-Mailer: git-send-email 2.7.4 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hoan Nguyen An According to the hardware manual, Gen3 supports Standby-mode, Add this function, and we should use this function while suspend to reduce the energy consumption. Signed-off-by: Hoan Nguyen An --- drivers/thermal/rcar_gen3_thermal.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c index 7aed533..7f3bd7f 100644 --- a/drivers/thermal/rcar_gen3_thermal.c +++ b/drivers/thermal/rcar_gen3_thermal.c @@ -447,11 +447,30 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) return ret; } +static int rcar_gen3_thermal_standby(struct rcar_gen3_thermal_priv* priv) +{ + unsigned int i; + u32 reg_val; + + for (i = 0; i < TSC_MAX_NUM; i++) { + struct rcar_gen3_thermal_tsc *tsc = priv->tscs[i]; + + rcar_gen3_thermal_write(tsc, REG_GEN3_IRQEN, 0); + rcar_gen3_thermal_write(tsc, REG_GEN3_IRQMSK, 0); + + reg_val = rcar_gen3_thermal_read(tsc, REG_GEN3_THCTR); + rcar_gen3_thermal_write(tsc, REG_GEN3_THCTR, reg_val & ~THCTR_THSST); + + + usleep_range(1000, 2000); + } +} + static int __maybe_unused rcar_gen3_thermal_suspend(struct device *dev) { struct rcar_gen3_thermal_priv *priv = dev_get_drvdata(dev); - rcar_thermal_irq_set(priv, false); + rcar_gen3_thermal_standby(priv); return 0; }