[PATCH] thermal: rcar_gen3_thermal: Add Standby-Mode function support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Hoan Nguyen An <na-hoan@xxxxxxxxxxx>

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 <na-hoan@xxxxxxxxxxx>
---
 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..85fc4b2 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_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);
+	}
+
+	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);
+	rcar_gen3_thermal_standby(priv);
 
 	return 0;
 }
-- 
2.7.4




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux