diff mbox

battery: max17042: Fix temperature unit to milli centigrade.

Message ID 1382676798-27835-1-git-send-email-jonghwa3.lee@samsung.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Jonghwa Lee Oct. 25, 2013, 4:53 a.m. UTC
Standard temp node represents temperature of power supply class
in milli centigrade. So fix max17042 fuel gauge driver to follow
the standard. (deci-centigrade --> milli-centigrade)

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
---
 drivers/power/max17042_battery.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Anton Vorontsov Oct. 25, 2013, 11:17 p.m. UTC | #1
On Fri, Oct 25, 2013 at 01:53:18PM +0900, Jonghwa Lee wrote:
> Standard temp node represents temperature of power supply class
> in milli centigrade. So fix max17042 fuel gauge driver to follow
> the standard. (deci-centigrade --> milli-centigrade)

Maybe I am confused, but the doc says:

 * All voltages, currents, charges, energies, time and temperatures in uV,      
 * µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise          
 * stated

So, the current code seems to be correct.

Thanks,

Anton

> Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
> ---
>  drivers/power/max17042_battery.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c
> index d664ef5..892ecfc 100644
> --- a/drivers/power/max17042_battery.c
> +++ b/drivers/power/max17042_battery.c
> @@ -220,9 +220,9 @@ static int max17042_get_property(struct power_supply *psy,
>  			val->intval = (0x7fff & ~val->intval) + 1;
>  			val->intval *= -1;
>  		}
> -		/* The value is converted into deci-centigrade scale */
> +		/* The value is converted into milli-centigrade scale */
>  		/* Units of LSB = 1 / 256 degree Celsius */
> -		val->intval = val->intval * 10 / 256;
> +		val->intval = val->intval * 1000 / 256;
>  		break;
>  	case POWER_SUPPLY_PROP_CURRENT_NOW:
>  		if (chip->pdata->enable_current_sense) {
> -- 
> 1.7.9.5
--
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
Jonghwa Lee Oct. 28, 2013, 2 a.m. UTC | #2
Hi,
On 2013? 10? 26? 08:17, Anton Vorontsov wrote:

> On Fri, Oct 25, 2013 at 01:53:18PM +0900, Jonghwa Lee wrote:
>> Standard temp node represents temperature of power supply class
>> in milli centigrade. So fix max17042 fuel gauge driver to follow
>> the standard. (deci-centigrade --> milli-centigrade)
> 
> Maybe I am confused, but the doc says:
> 
>  * All voltages, currents, charges, energies, time and temperatures in uV,      
>  * µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise          
>  * stated
> 
> So, the current code seems to be correct.
> 


Honestly, I missed the above paragraph you showed rather I read following one.

TEMP - temperature of the power supply.
TEMP_ALERT_MIN - minimum battery temperature alert value in milli centigrade.
TEMP_ALERT_MAX - maximum battery temperature alert value in milli centigrade.
TEMP_AMBIENT - ambient temperature.
TEMP_AMBIENT_ALERT_MIN - minimum ambient temperature alert value in milli
centigrade.
TEMP_AMBIENT_ALERT_MAX - maximum ambient temperature alert value in milli
centigrade.

So, we use different unit for properties related temperature, right?
current temperature is in tenth of centigrade and threshold temperatures and
ambient temperature are in milli centigrade. Wouldn't it have to be in same unit?

Thanks,
Jonghwa

> Thanks,
> 
> Anton
> 
>> Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
>> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
>> ---
>>  drivers/power/max17042_battery.c |    4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c
>> index d664ef5..892ecfc 100644
>> --- a/drivers/power/max17042_battery.c
>> +++ b/drivers/power/max17042_battery.c
>> @@ -220,9 +220,9 @@ static int max17042_get_property(struct power_supply *psy,
>>  			val->intval = (0x7fff & ~val->intval) + 1;
>>  			val->intval *= -1;
>>  		}
>> -		/* The value is converted into deci-centigrade scale */
>> +		/* The value is converted into milli-centigrade scale */
>>  		/* Units of LSB = 1 / 256 degree Celsius */
>> -		val->intval = val->intval * 10 / 256;
>> +		val->intval = val->intval * 1000 / 256;
>>  		break;
>>  	case POWER_SUPPLY_PROP_CURRENT_NOW:
>>  		if (chip->pdata->enable_current_sense) {
>> -- 
>> 1.7.9.5
> 


--
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
diff mbox

Patch

diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c
index d664ef5..892ecfc 100644
--- a/drivers/power/max17042_battery.c
+++ b/drivers/power/max17042_battery.c
@@ -220,9 +220,9 @@  static int max17042_get_property(struct power_supply *psy,
 			val->intval = (0x7fff & ~val->intval) + 1;
 			val->intval *= -1;
 		}
-		/* The value is converted into deci-centigrade scale */
+		/* The value is converted into milli-centigrade scale */
 		/* Units of LSB = 1 / 256 degree Celsius */
-		val->intval = val->intval * 10 / 256;
+		val->intval = val->intval * 1000 / 256;
 		break;
 	case POWER_SUPPLY_PROP_CURRENT_NOW:
 		if (chip->pdata->enable_current_sense) {