lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 22 Nov 2016 20:34:48 +0800
From:   Caesar Wang <wxt@...k-chips.com>
To:     edubezval@...il.com, rui.zhang@...el.com
Cc:     linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
        linux-rockchip@...ts.infradead.org, briannorris@...omium.org,
        heiko@...ech.de, smbarber@...omium.org,
        Caesar Wang <wxt@...k-chips.com>
Subject: [PATCH 5/5] thermal: rockchip: handle the set_trips without the trip points.

In some cases, some sensors didn't need the trip points, the
set_trips will return {-INT_MAX, INT_MAX} to trigger thermal alarm.

Signed-off-by: Caesar Wang <wxt@...k-chips.com>
---

 drivers/thermal/rockchip_thermal.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index f4d4be9..5b9c346 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -200,6 +200,7 @@ struct rockchip_thermal_data {
 #define TSADCV3_AUTO_Q_SEL_EN			BIT(1)
 
 #define TSADCV2_INT_SRC_EN(chn)			BIT(chn)
+#define TSADCV2_INT_SRC_SHIFT(chn)		chn
 #define TSADCV2_SHUT_2GPIO_SRC_EN(chn)		BIT(4 + (chn))
 #define TSADCV2_SHUT_2CRU_SRC_EN(chn)		BIT(8 + (chn))
 
@@ -903,10 +904,22 @@ static int rockchip_thermal_set_trips(void *_sensor, int low, int high)
 	struct rockchip_thermal_sensor *sensor = _sensor;
 	struct rockchip_thermal_data *thermal = sensor->thermal;
 	const struct rockchip_tsadc_chip *tsadc = thermal->chip;
+	u32 int_clr;
 
 	dev_dbg(&thermal->pdev->dev, "%s: sensor %d: low: %d, high %d\n",
 		__func__, sensor->id, low, high);
 
+	/*
+	 * In some cases, some sensors didn't need the trip points, the
+	 * set_trips will return {-INT_MAX, INT_MAX} to trigger thermal alarm.
+	 */
+	if (high == INT_MAX) {
+		int_clr = readl_relaxed(thermal->regs + TSADCV2_INT_EN);
+		int_clr |= 0 << TSADCV2_INT_SRC_SHIFT(sensor->id);
+		writel_relaxed(int_clr, thermal->regs + TSADCV2_INT_EN);
+		return 0;
+	}
+
 	tsadc->set_alarm_temp(&tsadc->table,
 			      sensor->id, thermal->regs, high);
 
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ