aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power/ab8500_btemp.c
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-01-11 08:12:56 -0500
committerAnton Vorontsov <anton@enomsg.org>2013-01-15 20:44:28 -0500
commit5b41aa9f2b3a4e44ca4f68cd3076856bd3d93462 (patch)
treeac47729034c49bbdf8e8e83dd4e68db7a1f424cf /drivers/power/ab8500_btemp.c
parent129d583b4432375a9559708882172320e4c8fb94 (diff)
ab8500_btemp: Allign battery temperature resolution with the framework
The Linux Power Supply framework expects battery temperatures to have a resolution of 0.1 degree Celsius; however, the AB8500 btemp driver supplies a battery temperature resolution of 1 degree Celsius. We therefore have to use a factor 10 on the measured values. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
Diffstat (limited to 'drivers/power/ab8500_btemp.c')
-rw-r--r--drivers/power/ab8500_btemp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c
index 4a570b6c9e47..adebf6c6d146 100644
--- a/drivers/power/ab8500_btemp.c
+++ b/drivers/power/ab8500_btemp.c
@@ -746,22 +746,22 @@ static int ab8500_btemp_get_temp(struct ab8500_btemp *di)
746 } else { 746 } else {
747 if (di->events.btemp_low) { 747 if (di->events.btemp_low) {
748 if (temp > di->btemp_ranges.btemp_low_limit) 748 if (temp > di->btemp_ranges.btemp_low_limit)
749 temp = di->btemp_ranges.btemp_low_limit; 749 temp = di->btemp_ranges.btemp_low_limit * 10;
750 else 750 else
751 temp = di->bat_temp * 10; 751 temp = di->bat_temp * 10;
752 } else if (di->events.btemp_high) { 752 } else if (di->events.btemp_high) {
753 if (temp < di->btemp_ranges.btemp_high_limit) 753 if (temp < di->btemp_ranges.btemp_high_limit)
754 temp = di->btemp_ranges.btemp_high_limit; 754 temp = di->btemp_ranges.btemp_high_limit * 10;
755 else 755 else
756 temp = di->bat_temp * 10; 756 temp = di->bat_temp * 10;
757 } else if (di->events.btemp_lowmed) { 757 } else if (di->events.btemp_lowmed) {
758 if (temp > di->btemp_ranges.btemp_med_limit) 758 if (temp > di->btemp_ranges.btemp_med_limit)
759 temp = di->btemp_ranges.btemp_med_limit; 759 temp = di->btemp_ranges.btemp_med_limit * 10;
760 else 760 else
761 temp = di->bat_temp * 10; 761 temp = di->bat_temp * 10;
762 } else if (di->events.btemp_medhigh) { 762 } else if (di->events.btemp_medhigh) {
763 if (temp < di->btemp_ranges.btemp_med_limit) 763 if (temp < di->btemp_ranges.btemp_med_limit)
764 temp = di->btemp_ranges.btemp_med_limit; 764 temp = di->btemp_ranges.btemp_med_limit * 10;
765 else 765 else
766 temp = di->bat_temp * 10; 766 temp = di->bat_temp * 10;
767 } else 767 } else
@@ -1030,8 +1030,8 @@ static int ab8500_btemp_probe(struct platform_device *pdev)
1030 ab8500_btemp_periodic_work); 1030 ab8500_btemp_periodic_work);
1031 1031
1032 /* Set BTEMP thermal limits. Low and Med are fixed */ 1032 /* Set BTEMP thermal limits. Low and Med are fixed */
1033 di->btemp_ranges.btemp_low_limit = BTEMP_THERMAL_LOW_LIMIT; 1033 di->btemp_ranges.btemp_low_limit = BTEMP_THERMAL_LOW_LIMIT * 10;
1034 di->btemp_ranges.btemp_med_limit = BTEMP_THERMAL_MED_LIMIT; 1034 di->btemp_ranges.btemp_med_limit = BTEMP_THERMAL_MED_LIMIT * 10;
1035 1035
1036 ret = abx500_get_register_interruptible(di->dev, AB8500_CHARGER, 1036 ret = abx500_get_register_interruptible(di->dev, AB8500_CHARGER,
1037 AB8500_BTEMP_HIGH_TH, &val); 1037 AB8500_BTEMP_HIGH_TH, &val);