All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nguyen An Hoan <na-hoan@jinso.co.jp>
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: [v2 PATCH] thermal: rcar_gen3_thermal: Add Standby/Reset Mode support
Date: Tue,  6 Nov 2018 15:08:26 +0900	[thread overview]
Message-ID: <1541484506-30736-1-git-send-email-na-hoan@jinso.co.jp> (raw)

From: Hoan Nguyen An <na-hoan@jinso.co.jp>

According to the hardware manual, Gen3 supports Standby/Reset mode.
Add this function, and we should use this function while suspend
to reduce the energy consumption.

Signed-off-by: Hoan Nguyen An <na-hoan@jinso.co.jp>
---
 drivers/thermal/rcar_gen3_thermal.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
index 7aed533..e654519 100644
--- a/drivers/thermal/rcar_gen3_thermal.c
+++ b/drivers/thermal/rcar_gen3_thermal.c
@@ -447,11 +447,32 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
 	return ret;
 }
 
+static int rcar_gen3_thermal_reset(struct rcar_gen3_thermal_priv* priv)
+{
+	unsigned int i;
+	u32 reg_val;
+
+	for (i = 0; i < priv->num_tscs; 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);
+
+	return 0;
+}
+
 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);
+	/* Reset to enter standby mode */
+	rcar_gen3_thermal_reset(priv);
 
 	return 0;
 }
-- 
2.7.4

             reply	other threads:[~2018-11-06 15:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06  6:08 Nguyen An Hoan [this message]
2019-04-11 19:45 ` Niklas Söderlund
2019-04-16  3:16   ` Hoan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1541484506-30736-1-git-send-email-na-hoan@jinso.co.jp \
    --to=na-hoan@jinso.co.jp \
    --cc=cv-dong@jinso.co.jp \
    --cc=geert+renesas@glider.be \
    --cc=h-inayoshi@jinso.co.jp \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=niklas.soderlund@ragnatech.se \
    --cc=nv-dung@jinso.co.jp \
    --cc=wsa@sang-engineering.com \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    --subject='Re: [v2 PATCH] thermal: rcar_gen3_thermal: Add Standby/Reset Mode support' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.