linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] thermal: consider emul_temperature while computing trend
@ 2013-05-29 21:37 Eduardo Valentin
  2013-06-13  2:31 ` Zhang Rui
  2013-06-13  4:54 ` R, Durgadoss
  0 siblings, 2 replies; 3+ messages in thread
From: Eduardo Valentin @ 2013-05-29 21:37 UTC (permalink / raw)
  To: rui.zhang
  Cc: Eduardo Valentin, Amit Daniel Kachhap, Durgadoss R, linux-pm,
	linux-kernel

In case emulated temperature is in use, using the trend
provided by driver layer can lead to bogus situation.
In this case, debugger user would set a temperature value,
but the trend would be from driver computation.

To avoid this situation, this patch changes the get_tz_trend()
to consider the emulated temperature whenever that is in use.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Amit Daniel Kachhap <amit.daniel@samsung.com>
Cc: Durgadoss R <durgadoss.r@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
---
 drivers/thermal/thermal_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index d755440..c00dc92 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -155,7 +155,8 @@ int get_tz_trend(struct thermal_zone_device *tz, int trip)
 {
 	enum thermal_trend trend;
 
-	if (!tz->ops->get_trend || tz->ops->get_trend(tz, trip, &trend)) {
+	if (tz->emul_temperature || !tz->ops->get_trend ||
+	    tz->ops->get_trend(tz, trip, &trend)) {
 		if (tz->temperature > tz->last_temperature)
 			trend = THERMAL_TREND_RAISING;
 		else if (tz->temperature < tz->last_temperature)
-- 
1.8.2.1.342.gfa7285d


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] thermal: consider emul_temperature while computing trend
  2013-05-29 21:37 [PATCH 1/1] thermal: consider emul_temperature while computing trend Eduardo Valentin
@ 2013-06-13  2:31 ` Zhang Rui
  2013-06-13  4:54 ` R, Durgadoss
  1 sibling, 0 replies; 3+ messages in thread
From: Zhang Rui @ 2013-06-13  2:31 UTC (permalink / raw)
  To: Eduardo Valentin; +Cc: Amit Daniel Kachhap, Durgadoss R, linux-pm, linux-kernel

On Wed, 2013-05-29 at 17:37 -0400, Eduardo Valentin wrote:
> In case emulated temperature is in use, using the trend
> provided by driver layer can lead to bogus situation.
> In this case, debugger user would set a temperature value,
> but the trend would be from driver computation.
> 
> To avoid this situation, this patch changes the get_tz_trend()
> to consider the emulated temperature whenever that is in use.
> 
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Amit Daniel Kachhap <amit.daniel@samsung.com>
> Cc: Durgadoss R <durgadoss.r@intel.com>
> Cc: linux-pm@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>

patch applied.

thanks,
rui
> ---
>  drivers/thermal/thermal_core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index d755440..c00dc92 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -155,7 +155,8 @@ int get_tz_trend(struct thermal_zone_device *tz, int trip)
>  {
>  	enum thermal_trend trend;
>  
> -	if (!tz->ops->get_trend || tz->ops->get_trend(tz, trip, &trend)) {
> +	if (tz->emul_temperature || !tz->ops->get_trend ||
> +	    tz->ops->get_trend(tz, trip, &trend)) {
>  		if (tz->temperature > tz->last_temperature)
>  			trend = THERMAL_TREND_RAISING;
>  		else if (tz->temperature < tz->last_temperature)



^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH 1/1] thermal: consider emul_temperature while computing trend
  2013-05-29 21:37 [PATCH 1/1] thermal: consider emul_temperature while computing trend Eduardo Valentin
  2013-06-13  2:31 ` Zhang Rui
@ 2013-06-13  4:54 ` R, Durgadoss
  1 sibling, 0 replies; 3+ messages in thread
From: R, Durgadoss @ 2013-06-13  4:54 UTC (permalink / raw)
  To: Eduardo Valentin, Zhang, Rui; +Cc: Amit Daniel Kachhap, linux-pm, linux-kernel

> -----Original Message-----
> From: linux-pm-owner@vger.kernel.org [mailto:linux-pm-
> owner@vger.kernel.org] On Behalf Of Eduardo Valentin
> Sent: Thursday, May 30, 2013 3:07 AM
> To: Zhang, Rui
> Cc: Eduardo Valentin; Amit Daniel Kachhap; R, Durgadoss; linux-
> pm@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH 1/1] thermal: consider emul_temperature while computing
> trend
> 
> In case emulated temperature is in use, using the trend
> provided by driver layer can lead to bogus situation.
> In this case, debugger user would set a temperature value,
> but the trend would be from driver computation.
> 
> To avoid this situation, this patch changes the get_tz_trend()
> to consider the emulated temperature whenever that is in use.

Nice catch.
Sorry, I missed looking at it earlier. Just got woken up by Rui's reply
on this. The patch looks fine to me.

Thanks,
Durga
> 
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Amit Daniel Kachhap <amit.daniel@samsung.com>
> Cc: Durgadoss R <durgadoss.r@intel.com>
> Cc: linux-pm@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
> ---
>  drivers/thermal/thermal_core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/thermal_core.c
> b/drivers/thermal/thermal_core.c
> index d755440..c00dc92 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -155,7 +155,8 @@ int get_tz_trend(struct thermal_zone_device *tz, int
> trip)
>  {
>  	enum thermal_trend trend;
> 
> -	if (!tz->ops->get_trend || tz->ops->get_trend(tz, trip, &trend)) {
> +	if (tz->emul_temperature || !tz->ops->get_trend ||
> +	    tz->ops->get_trend(tz, trip, &trend)) {
>  		if (tz->temperature > tz->last_temperature)
>  			trend = THERMAL_TREND_RAISING;
>  		else if (tz->temperature < tz->last_temperature)
> --
> 1.8.2.1.342.gfa7285d
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-13  4:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-29 21:37 [PATCH 1/1] thermal: consider emul_temperature while computing trend Eduardo Valentin
2013-06-13  2:31 ` Zhang Rui
2013-06-13  4:54 ` R, Durgadoss

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).