* [PATCH 2/2] staging: ti-soc-thermal: remove external heat while extrapolating hotspot
2013-03-22 21:13 [PATCH 0/2] thermal: lookup temperature Eduardo Valentin
@ 2013-03-22 21:13 ` Eduardo Valentin
2013-03-25 6:23 ` Zhang Rui
0 siblings, 1 reply; 6+ messages in thread
From: Eduardo Valentin @ 2013-03-22 21:13 UTC (permalink / raw)
To: Zhang Rui; +Cc: linux-pm, linux-kernel, Eduardo Valentin
For boards that provide a PCB sensor close to SoC junction
temperature, it is possible to remove the cumulative heat
reported by the SoC temperature sensor.
This patch changes the extrapolation computation to consider
an external sensor in the extrapolation equations.
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
---
drivers/staging/ti-soc-thermal/ti-thermal-common.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/ti-soc-thermal/ti-thermal-common.c b/drivers/staging/ti-soc-thermal/ti-thermal-common.c
index 231c549..52d3c1b 100644
--- a/drivers/staging/ti-soc-thermal/ti-thermal-common.c
+++ b/drivers/staging/ti-soc-thermal/ti-thermal-common.c
@@ -92,10 +92,9 @@ static inline int ti_thermal_get_temp(struct thermal_zone_device *thermal,
if (ret)
return ret;
- pcb_temp = 0;
- /* TODO: Introduce pcb temperature lookup */
+ ret = thermal_zone_lookup_temperature("pcb", &pcb_temp);
/* In case pcb zone is available, use the extrapolation rule with it */
- if (pcb_temp) {
+ if (!ret) {
tmp -= pcb_temp;
slope = s->slope_pcb;
constant = s->constant_pcb;
--
1.7.7.1.488.ge8e1c
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] staging: ti-soc-thermal: remove external heat while extrapolating hotspot
2013-03-22 21:13 ` [PATCH 2/2] staging: ti-soc-thermal: remove external heat while extrapolating hotspot Eduardo Valentin
@ 2013-03-25 6:23 ` Zhang Rui
2013-03-25 11:18 ` Eduardo Valentin
0 siblings, 1 reply; 6+ messages in thread
From: Zhang Rui @ 2013-03-25 6:23 UTC (permalink / raw)
To: Eduardo Valentin; +Cc: linux-pm, linux-kernel
On Fri, 2013-03-22 at 17:13 -0400, Eduardo Valentin wrote:
> For boards that provide a PCB sensor close to SoC junction
> temperature, it is possible to remove the cumulative heat
> reported by the SoC temperature sensor.
>
> This patch changes the extrapolation computation to consider
> an external sensor in the extrapolation equations.
>
> Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
> ---
> drivers/staging/ti-soc-thermal/ti-thermal-common.c | 5 ++---
> 1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/ti-soc-thermal/ti-thermal-common.c b/drivers/staging/ti-soc-thermal/ti-thermal-common.c
> index 231c549..52d3c1b 100644
> --- a/drivers/staging/ti-soc-thermal/ti-thermal-common.c
> +++ b/drivers/staging/ti-soc-thermal/ti-thermal-common.c
> @@ -92,10 +92,9 @@ static inline int ti_thermal_get_temp(struct thermal_zone_device *thermal,
> if (ret)
> return ret;
>
> - pcb_temp = 0;
> - /* TODO: Introduce pcb temperature lookup */
> + ret = thermal_zone_lookup_temperature("pcb", &pcb_temp);
> /* In case pcb zone is available, use the extrapolation rule with it */
> - if (pcb_temp) {
> + if (!ret) {
> tmp -= pcb_temp;
> slope = s->slope_pcb;
> constant = s->constant_pcb;
I can not see this piece of code.
But I assume that the thermal_zone_device is registered in another
driver, right?
or else you can use the thermal_zone_device pointer directly instead.
thanks,
rui
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] staging: ti-soc-thermal: remove external heat while extrapolating hotspot
2013-03-25 6:23 ` Zhang Rui
@ 2013-03-25 11:18 ` Eduardo Valentin
0 siblings, 0 replies; 6+ messages in thread
From: Eduardo Valentin @ 2013-03-25 11:18 UTC (permalink / raw)
To: Zhang Rui; +Cc: linux-pm, linux-kernel
On 25-03-2013 02:23, Zhang Rui wrote:
> On Fri, 2013-03-22 at 17:13 -0400, Eduardo Valentin wrote:
>> For boards that provide a PCB sensor close to SoC junction
>> temperature, it is possible to remove the cumulative heat
>> reported by the SoC temperature sensor.
>>
>> This patch changes the extrapolation computation to consider
>> an external sensor in the extrapolation equations.
>>
>> Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
>> ---
>> drivers/staging/ti-soc-thermal/ti-thermal-common.c | 5 ++---
>> 1 files changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/staging/ti-soc-thermal/ti-thermal-common.c b/drivers/staging/ti-soc-thermal/ti-thermal-common.c
>> index 231c549..52d3c1b 100644
>> --- a/drivers/staging/ti-soc-thermal/ti-thermal-common.c
>> +++ b/drivers/staging/ti-soc-thermal/ti-thermal-common.c
>> @@ -92,10 +92,9 @@ static inline int ti_thermal_get_temp(struct thermal_zone_device *thermal,
>> if (ret)
>> return ret;
>>
>> - pcb_temp = 0;
>> - /* TODO: Introduce pcb temperature lookup */
>> + ret = thermal_zone_lookup_temperature("pcb", &pcb_temp);
>> /* In case pcb zone is available, use the extrapolation rule with it */
>> - if (pcb_temp) {
>> + if (!ret) {
>> tmp -= pcb_temp;
>> slope = s->slope_pcb;
>> constant = s->constant_pcb;
>
> I can not see this piece of code.
> But I assume that the thermal_zone_device is registered in another
> driver, right?
It is because I made this patch based on staging-next. But you will find
the same under drivers/stating/omap-thermal/omap-bandgap.c
Yes. The sensor managed by another driver. And the temperature lookup is
assumed to be done by the fw.
> or else you can use the thermal_zone_device pointer directly instead.
>
I'd not recommend this because of the above statements
> thanks,
> rui
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 0/2] staging: ti-soc-thermal: couple of fixes
@ 2013-04-24 18:16 Eduardo Valentin
2013-04-24 18:16 ` [PATCH 1/2] staging: ti-soc-thermal: update DT reference for OMAP5430 Eduardo Valentin
2013-04-24 18:16 ` [PATCH 2/2] staging: ti-soc-thermal: remove external heat while extrapolating hotspot Eduardo Valentin
0 siblings, 2 replies; 6+ messages in thread
From: Eduardo Valentin @ 2013-04-24 18:16 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-omap, linux-kernel, linux-pm, Eduardo Valentin
Hello Greg,
Here are two patches on ti-soc-thermal driver.
One is to update the documentation of the OMAP5430 DT entry reference.
The other one adds the support to extrapolation rules with PCB sensor
querying. The second one depends on the API change, that is going
via the thermal tree [1].
These two patches are also available here:
git@gitorious.org:thermal-framework/thermal-framework.git thermal_work/ti-soc-thermal/fixes
https://git.gitorious.org/thermal-framework/thermal-framework.git thermal_work/ti-soc-thermal/fixes
All best,
[1] - http://git.kernel.org/cgit/linux/kernel/git/rzhang/linux.git/commit/?h=next&id=63c4d919cf66b1b3ffa7861bddb50a697914af5b
[2] - http://git.kernel.org/cgit/linux/kernel/git/rzhang/linux.git/commit/?h=next&id=837b26bb2e4a83d224e725f07a1d9ca824bf905c
Eduardo Valentin (2):
staging: ti-soc-thermal: update DT reference for OMAP5430
staging: ti-soc-thermal: remove external heat while extrapolating
hotspot
drivers/staging/ti-soc-thermal/ti-thermal-common.c | 30 ++++++++++++++--------
drivers/staging/ti-soc-thermal/ti_soc_thermal.txt | 1 +
2 files changed, 21 insertions(+), 10 deletions(-)
--
1.8.2.1.342.gfa7285d
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] staging: ti-soc-thermal: update DT reference for OMAP5430
2013-04-24 18:16 [PATCH 0/2] staging: ti-soc-thermal: couple of fixes Eduardo Valentin
@ 2013-04-24 18:16 ` Eduardo Valentin
2013-04-24 18:16 ` [PATCH 2/2] staging: ti-soc-thermal: remove external heat while extrapolating hotspot Eduardo Valentin
1 sibling, 0 replies; 6+ messages in thread
From: Eduardo Valentin @ 2013-04-24 18:16 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-omap, linux-kernel, linux-pm, Eduardo Valentin
Add missing irq line for TALERT on DT entry for OMAP5430.
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
---
drivers/staging/ti-soc-thermal/ti_soc_thermal.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/staging/ti-soc-thermal/ti_soc_thermal.txt b/drivers/staging/ti-soc-thermal/ti_soc_thermal.txt
index a4a33d1..1629652 100644
--- a/drivers/staging/ti-soc-thermal/ti_soc_thermal.txt
+++ b/drivers/staging/ti-soc-thermal/ti_soc_thermal.txt
@@ -57,4 +57,5 @@ bandgap {
0x4a002380 0x2c
0x4a0023C0 0x3c>;
compatible = "ti,omap5430-bandgap";
+ interrupts = <0 126 4>; /* talert */
};
--
1.8.2.1.342.gfa7285d
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] staging: ti-soc-thermal: remove external heat while extrapolating hotspot
2013-04-24 18:16 [PATCH 0/2] staging: ti-soc-thermal: couple of fixes Eduardo Valentin
2013-04-24 18:16 ` [PATCH 1/2] staging: ti-soc-thermal: update DT reference for OMAP5430 Eduardo Valentin
@ 2013-04-24 18:16 ` Eduardo Valentin
1 sibling, 0 replies; 6+ messages in thread
From: Eduardo Valentin @ 2013-04-24 18:16 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-omap, linux-kernel, linux-pm, Eduardo Valentin
For boards that provide a PCB sensor close to SoC junction
temperature, it is possible to remove the cumulative heat
reported by the SoC temperature sensor.
This patch changes the extrapolation computation to consider
an external sensor in the extrapolation equations.
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
---
drivers/staging/ti-soc-thermal/ti-thermal-common.c | 30 ++++++++++++++--------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/ti-soc-thermal/ti-thermal-common.c b/drivers/staging/ti-soc-thermal/ti-thermal-common.c
index e3c5e67..8e67ebf 100644
--- a/drivers/staging/ti-soc-thermal/ti-thermal-common.c
+++ b/drivers/staging/ti-soc-thermal/ti-thermal-common.c
@@ -38,6 +38,7 @@
/* common data structures */
struct ti_thermal_data {
struct thermal_zone_device *ti_thermal;
+ struct thermal_zone_device *pcb_tz;
struct thermal_cooling_device *cool_dev;
struct ti_bandgap *bgp;
enum thermal_device_mode mode;
@@ -77,10 +78,12 @@ static inline int ti_thermal_hotspot_temperature(int t, int s, int c)
static inline int ti_thermal_get_temp(struct thermal_zone_device *thermal,
unsigned long *temp)
{
+ struct thermal_zone_device *pcb_tz = NULL;
struct ti_thermal_data *data = thermal->devdata;
struct ti_bandgap *bgp;
const struct ti_temp_sensor *s;
- int ret, tmp, pcb_temp, slope, constant;
+ int ret, tmp, slope, constant;
+ unsigned long pcb_temp;
if (!data)
return 0;
@@ -92,16 +95,22 @@ static inline int ti_thermal_get_temp(struct thermal_zone_device *thermal,
if (ret)
return ret;
- pcb_temp = 0;
- /* TODO: Introduce pcb temperature lookup */
+ /* Default constants */
+ slope = s->slope;
+ constant = s->constant;
+
+ pcb_tz = data->pcb_tz;
/* In case pcb zone is available, use the extrapolation rule with it */
- if (pcb_temp) {
- tmp -= pcb_temp;
- slope = s->slope_pcb;
- constant = s->constant_pcb;
- } else {
- slope = s->slope;
- constant = s->constant;
+ if (!IS_ERR_OR_NULL(pcb_tz)) {
+ ret = thermal_zone_get_temp(pcb_tz, &pcb_temp);
+ if (!ret) {
+ tmp -= pcb_temp; /* got a valid PCB temp */
+ slope = s->slope_pcb;
+ constant = s->constant_pcb;
+ } else {
+ dev_err(bgp->dev,
+ "Failed to read PCB state. Using defaults\n");
+ }
}
*temp = ti_thermal_hotspot_temperature(tmp, slope, constant);
@@ -273,6 +282,7 @@ static struct ti_thermal_data
data->sensor_id = id;
data->bgp = bgp;
data->mode = THERMAL_DEVICE_ENABLED;
+ data->pcb_tz = thermal_zone_get_zone_by_name("pcb");
INIT_WORK(&data->thermal_wq, ti_thermal_work);
return data;
--
1.8.2.1.342.gfa7285d
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-04-24 18:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-24 18:16 [PATCH 0/2] staging: ti-soc-thermal: couple of fixes Eduardo Valentin
2013-04-24 18:16 ` [PATCH 1/2] staging: ti-soc-thermal: update DT reference for OMAP5430 Eduardo Valentin
2013-04-24 18:16 ` [PATCH 2/2] staging: ti-soc-thermal: remove external heat while extrapolating hotspot Eduardo Valentin
-- strict thread matches above, loose matches on Subject: below --
2013-03-22 21:13 [PATCH 0/2] thermal: lookup temperature Eduardo Valentin
2013-03-22 21:13 ` [PATCH 2/2] staging: ti-soc-thermal: remove external heat while extrapolating hotspot Eduardo Valentin
2013-03-25 6:23 ` Zhang Rui
2013-03-25 11:18 ` Eduardo Valentin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).