All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keerthy <j-keerthy@ti.com>
To: <tony@atomide.com>, <edubezval@gmail.com>
Cc: <rui.zhang@intel.com>, <linux-omap@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux-pm@vger.kernel.org>,
	<robh+dt@kernel.org>, <t-kristo@ti.com>, <j-keerthy@ti.com>
Subject: [PATCH 5/7] thermal: ti-soc-thermal: Fetch slope and offset from DT
Date: Wed, 1 Mar 2017 15:59:48 +0530	[thread overview]
Message-ID: <1488364190-23488-6-git-send-email-j-keerthy@ti.com> (raw)
In-Reply-To: <1488364190-23488-1-git-send-email-j-keerthy@ti.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: Keerthy <j-keerthy@ti.com>
To: tony@atomide.com, edubezval@gmail.com
Cc: linux-pm@vger.kernel.org, j-keerthy@ti.com,
	linux-kernel@vger.kernel.org, t-kristo@ti.com,
	robh+dt@kernel.org, rui.zhang@intel.com,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/7] thermal: ti-soc-thermal: Fetch slope and offset from DT
Date: Wed, 1 Mar 2017 15:59:48 +0530	[thread overview]
Message-ID: <1488364190-23488-6-git-send-email-j-keerthy@ti.com> (raw)
In-Reply-To: <1488364190-23488-1-git-send-email-j-keerthy@ti.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: j-keerthy@ti.com (Keerthy)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/7] thermal: ti-soc-thermal: Fetch slope and offset from DT
Date: Wed, 1 Mar 2017 15:59:48 +0530	[thread overview]
Message-ID: <1488364190-23488-6-git-send-email-j-keerthy@ti.com> (raw)
In-Reply-To: <1488364190-23488-1-git-send-email-j-keerthy@ti.com>

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

  parent reply	other threads:[~2017-03-01 10:51 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-01 10:29 [PATCH 0/7] thermal: ti-soc-thermal: Migrate slope/offset data to device tree Keerthy
2017-03-01 10:29 ` Keerthy
2017-03-01 10:29 ` Keerthy
2017-03-01 10:29 ` [PATCH 1/7] ARM: DRA7: Thermal: Add slope and offset values Keerthy
2017-03-01 10:29   ` Keerthy
2017-03-01 10:29   ` Keerthy
2017-03-01 10:29 ` [PATCH 2/7] ARM: OMAP5: " Keerthy
2017-03-01 10:29   ` Keerthy
2017-03-01 10:29   ` Keerthy
2017-03-01 10:29 ` [PATCH 3/7] ARM: OMAP443x: " Keerthy
2017-03-01 10:29   ` Keerthy
2017-03-01 10:29   ` Keerthy
2017-03-01 10:29 ` [PATCH 4/7] ARM: OMAP4460: " Keerthy
2017-03-01 10:29   ` Keerthy
2017-03-01 10:29   ` Keerthy
2017-03-01 10:29 ` Keerthy [this message]
2017-03-01 10:29   ` [PATCH 5/7] thermal: ti-soc-thermal: Fetch slope and offset from DT Keerthy
2017-03-01 10:29   ` Keerthy
2017-03-01 10:29 ` [PATCH 6/7] thermal: ti-soc-thermal: Remove redundant constants Keerthy
2017-03-01 10:29   ` Keerthy
2017-03-01 10:29   ` Keerthy
2017-03-01 10:29 ` [PATCH 7/7] thermal: ti-soc-thermal: Remove redundant code Keerthy
2017-03-01 10:29   ` Keerthy
2017-03-01 10:29   ` Keerthy
2017-03-06 18:42 ` [PATCH 0/7] thermal: ti-soc-thermal: Migrate slope/offset data to device tree Tony Lindgren
2017-03-06 18:42   ` Tony Lindgren
2017-03-06 18:42   ` Tony Lindgren
2017-03-07  7:13   ` Keerthy
2017-03-07  7:13     ` Keerthy
2017-03-07  7:13     ` Keerthy
2017-03-07 15:12     ` Tony Lindgren
2017-03-07 15:12       ` Tony Lindgren

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=1488364190-23488-6-git-send-email-j-keerthy@ti.com \
    --to=j-keerthy@ti.com \
    --cc=edubezval@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=t-kristo@ti.com \
    --cc=tony@atomide.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.