Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1590235 > unrolled thread

[PATCH 5/7] thermal: ti-soc-thermal: Fetch slope and offset from DT

Started byKeerthy <j-keerthy@ti.com>
First post2017-03-01 12:00 +0100
Last post2017-03-01 12:00 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 5/7] thermal: ti-soc-thermal: Fetch slope and offset from DT Keerthy <j-keerthy@ti.com> - 2017-03-01 12:00 +0100

#1590235 — [PATCH 5/7] thermal: ti-soc-thermal: Fetch slope and offset from DT

FromKeerthy <j-keerthy@ti.com>
Date2017-03-01 12:00 +0100
Subject[PATCH 5/7] thermal: ti-soc-thermal: Fetch slope and offset from DT
Message-ID<tga9c-1UD-7@gated-at.bofh.it>
Currently slope and offset values for calculating the hot spot
temperature of a thermal zone is being taken directly from driver
data. So try fetching it from device tree if not present only then
take it from driver data.

Signed-off-by: Keerthy <j-keerthy@ti.com>
---
 drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
index 0586bd0..6d9399f 100644
--- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
+++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
@@ -96,8 +96,14 @@ static inline int __ti_thermal_get_temp(void *devdata, int *temp)
 		return ret;
 
 	/* Default constants */
-	slope = s->slope;
-	constant = s->constant;
+	slope = thermal_zone_get_slope(data->ti_thermal);
+	constant = thermal_zone_get_offset(data->ti_thermal);
+
+	if (slope == 1 && constant == 0) {
+		/* In case of default values fallback to driver data */
+		slope = s->slope;
+		constant = s->constant;
+	}
 
 	pcb_tz = data->pcb_tz;
 	/* In case pcb zone is available, use the extrapolation rule with it */
-- 
1.9.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web