linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Thermal/int3403: Fix thermal hysteresis unit conversion
@ 2014-04-03  6:04 Lan Tianyu
  0 siblings, 0 replies; 4+ messages in thread
From: Lan Tianyu @ 2014-04-03  6:04 UTC (permalink / raw)
  To: rui.zhang, eduardo.valentin, srinivas.pandruvada
  Cc: Lan Tianyu, linux-pm, linux-kernel

Thermal hysteresis represents a temperature difference.
But the original code treats it as a temperature value,
Convert it from tenths of degree Kelvin to Milli-Celsius
by deducing 273200. This is not right.

Kelvin and Celsius have same degree size. From temperature
difference view, the conversion between tenths of degree
Kelvin unit and Milli-Celsius unit is just to multiply 100.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
 drivers/thermal/int3403_thermal.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/int3403_thermal.c b/drivers/thermal/int3403_thermal.c
index 1301681..e93f025 100644
--- a/drivers/thermal/int3403_thermal.c
+++ b/drivers/thermal/int3403_thermal.c
@@ -62,7 +62,13 @@ static int sys_get_trip_hyst(struct thermal_zone_device *tzone,
 	if (ACPI_FAILURE(status))
 		return -EIO;
 
-	*temp = DECI_KELVIN_TO_MILLI_CELSIUS(hyst, KELVIN_OFFSET);
+	/*
+	 * Thermal hysteresis represents a temperature difference.
+	 * Kelvin and Celsius have same degree size. So the
+	 * conversion here between tenths of degree Kelvin unit
+	 * and Milli-Celsius unit is just to multiply 100.
+	 */
+	*temp = hyst * 100;
 
 	return 0;
 }
-- 
1.8.4.rc0.1.g8f6a3e5.dirty


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

* [PATCH] Thermal/int3403: Fix thermal hysteresis unit conversion
@ 2014-11-03  9:53 Srinivas Pandruvada
  2014-11-04  1:50 ` Zhang Rui
  0 siblings, 1 reply; 4+ messages in thread
From: Srinivas Pandruvada @ 2014-11-03  9:53 UTC (permalink / raw)
  To: rui.zhang; +Cc: tianyu.lan, linux-pm

From: "lan,Tianyu" <tianyu.lan@intel.com>

Thermal hysteresis represents a temperature difference.
But the original code treats it as a temperature value,
Convert it from tenths of degree Kelvin to Milli-Celsius
by deducing 273200. This is not right.

Kelvin and Celsius have same degree size. From temperature
difference view, the conversion between tenths of degree
Kelvin unit and Milli-Celsius unit is just to multiply 100.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 drivers/thermal/int340x_thermal/int3403_thermal.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/int340x_thermal/int3403_thermal.c b/drivers/thermal/int340x_thermal/int3403_thermal.c
index d20dba9..6e9fb62 100644
--- a/drivers/thermal/int340x_thermal/int3403_thermal.c
+++ b/drivers/thermal/int340x_thermal/int3403_thermal.c
@@ -92,7 +92,13 @@ static int sys_get_trip_hyst(struct thermal_zone_device *tzone,
 	if (ACPI_FAILURE(status))
 		return -EIO;
 
-	*temp = DECI_KELVIN_TO_MILLI_CELSIUS(hyst, KELVIN_OFFSET);
+	/*
+	 * Thermal hysteresis represents a temperature difference.
+	 * Kelvin and Celsius have same degree size. So the
+	 * conversion here between tenths of degree Kelvin unit
+	 * and Milli-Celsius unit is just to multiply 100.
+	 */
+	*temp = hyst * 100;
 
 	return 0;
 }
-- 
1.9.1


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

* Re: [PATCH] Thermal/int3403: Fix thermal hysteresis unit conversion
  2014-11-03  9:53 [PATCH] Thermal/int3403: Fix thermal hysteresis unit conversion Srinivas Pandruvada
@ 2014-11-04  1:50 ` Zhang Rui
  2014-11-04 23:31   ` Eduardo Valentin
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang Rui @ 2014-11-04  1:50 UTC (permalink / raw)
  To: Eduardo Valentin; +Cc: tianyu.lan, linux-pm, Srinivas Pandruvada

On 一, 2014-11-03 at 01:53 -0800, Srinivas Pandruvada wrote:
> From: "lan,Tianyu" <tianyu.lan@intel.com>
> 
> Thermal hysteresis represents a temperature difference.
> But the original code treats it as a temperature value,
> Convert it from tenths of degree Kelvin to Milli-Celsius
> by deducing 273200. This is not right.
> 
> Kelvin and Celsius have same degree size. From temperature
> difference view, the conversion between tenths of degree
> Kelvin unit and Milli-Celsius unit is just to multiply 100.
> 
> Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Signed-off-by: Zhang Rui <rui.zhang@intel.com>

Hi, Eduardo,

can you please queue this patch for 3.18-rc5?

thanks,
rui
> ---
>  drivers/thermal/int340x_thermal/int3403_thermal.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/int340x_thermal/int3403_thermal.c b/drivers/thermal/int340x_thermal/int3403_thermal.c
> index d20dba9..6e9fb62 100644
> --- a/drivers/thermal/int340x_thermal/int3403_thermal.c
> +++ b/drivers/thermal/int340x_thermal/int3403_thermal.c
> @@ -92,7 +92,13 @@ static int sys_get_trip_hyst(struct thermal_zone_device *tzone,
>  	if (ACPI_FAILURE(status))
>  		return -EIO;
>  
> -	*temp = DECI_KELVIN_TO_MILLI_CELSIUS(hyst, KELVIN_OFFSET);
> +	/*
> +	 * Thermal hysteresis represents a temperature difference.
> +	 * Kelvin and Celsius have same degree size. So the
> +	 * conversion here between tenths of degree Kelvin unit
> +	 * and Milli-Celsius unit is just to multiply 100.
> +	 */
> +	*temp = hyst * 100;
>  
>  	return 0;
>  }



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

* Re: [PATCH] Thermal/int3403: Fix thermal hysteresis unit conversion
  2014-11-04  1:50 ` Zhang Rui
@ 2014-11-04 23:31   ` Eduardo Valentin
  0 siblings, 0 replies; 4+ messages in thread
From: Eduardo Valentin @ 2014-11-04 23:31 UTC (permalink / raw)
  To: Zhang Rui; +Cc: tianyu.lan, linux-pm, Srinivas Pandruvada

[-- Attachment #1: Type: text/plain, Size: 1896 bytes --]

Rui,

On Tue, Nov 04, 2014 at 09:50:34AM +0800, Zhang Rui wrote:
> On 一, 2014-11-03 at 01:53 -0800, Srinivas Pandruvada wrote:
> > From: "lan,Tianyu" <tianyu.lan@intel.com>
> > 
> > Thermal hysteresis represents a temperature difference.
> > But the original code treats it as a temperature value,
> > Convert it from tenths of degree Kelvin to Milli-Celsius
> > by deducing 273200. This is not right.
> > 
> > Kelvin and Celsius have same degree size. From temperature
> > difference view, the conversion between tenths of degree
> > Kelvin unit and Milli-Celsius unit is just to multiply 100.
> > 
> > Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
> > Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> > Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> 
> Hi, Eduardo,
> 
> can you please queue this patch for 3.18-rc5?
> 

Pulled into my -fixes queue. Thanks.

> thanks,
> rui
> > ---
> >  drivers/thermal/int340x_thermal/int3403_thermal.c | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/thermal/int340x_thermal/int3403_thermal.c b/drivers/thermal/int340x_thermal/int3403_thermal.c
> > index d20dba9..6e9fb62 100644
> > --- a/drivers/thermal/int340x_thermal/int3403_thermal.c
> > +++ b/drivers/thermal/int340x_thermal/int3403_thermal.c
> > @@ -92,7 +92,13 @@ static int sys_get_trip_hyst(struct thermal_zone_device *tzone,
> >  	if (ACPI_FAILURE(status))
> >  		return -EIO;
> >  
> > -	*temp = DECI_KELVIN_TO_MILLI_CELSIUS(hyst, KELVIN_OFFSET);
> > +	/*
> > +	 * Thermal hysteresis represents a temperature difference.
> > +	 * Kelvin and Celsius have same degree size. So the
> > +	 * conversion here between tenths of degree Kelvin unit
> > +	 * and Milli-Celsius unit is just to multiply 100.
> > +	 */
> > +	*temp = hyst * 100;
> >  
> >  	return 0;
> >  }
> 
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

end of thread, other threads:[~2014-11-04 23:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-03  9:53 [PATCH] Thermal/int3403: Fix thermal hysteresis unit conversion Srinivas Pandruvada
2014-11-04  1:50 ` Zhang Rui
2014-11-04 23:31   ` Eduardo Valentin
  -- strict thread matches above, loose matches on Subject: below --
2014-04-03  6:04 Lan Tianyu

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