Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 462aa2ce authored by Jishnu Prakash's avatar Jishnu Prakash Committed by Gerrit - the friendly Code Review server
Browse files

thermal: tsens: Apply scaling to temp read from sensor



Thresholds are specified in degrees C, and sensor temperatures are
in milli-degrees C. Scale the sensor temperature to degrees C
before comparing to the threshold value to check if threshold
has been breached.

Change-Id: Id2435b9e3d19d7777769ccd412ce8943dec0d1b6
Signed-off-by: default avatarJishnu Prakash <jprakash@codeaurora.org>
parent ec400f15
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -351,8 +351,8 @@ static irqreturn_t tsens_irq_thread(int irq, void *data)
			th_temp = code_to_degc((threshold &
					TSENS_UPPER_THRESHOLD_MASK) >>
					TSENS_UPPER_THRESHOLD_SHIFT,
					tm->sensor);
			if (th_temp > temp) {
					(tm->sensor + i));
			if (th_temp > (temp/TSENS_SCALE_MILLIDEG)) {
				pr_debug("Re-arm high threshold\n");
				rc = tsens_tz_activate_trip_type(
						&tm->sensor[i],
@@ -373,8 +373,8 @@ static irqreturn_t tsens_irq_thread(int irq, void *data)
					tm->tsens_tm_addr + addr_offset));
			th_temp = code_to_degc((threshold &
					TSENS_LOWER_THRESHOLD_MASK),
					tm->sensor);
			if (th_temp < temp) {
					(tm->sensor + i));
			if (th_temp < (temp/TSENS_SCALE_MILLIDEG)) {
				pr_debug("Re-arm Low threshold\n");
				rc = tsens_tz_activate_trip_type(
						&tm->sensor[i],