diff options
author | Cástor Muñoz <cmvidal@gmail.com> | 2013-01-09 21:01:22 +0100 |
---|---|---|
committer | Cástor Muñoz <cmvidal@gmail.com> | 2013-01-09 22:08:27 +0100 |
commit | 1d901a82fdd0e2620fcdc70f08e414ace24331a2 (patch) | |
tree | 49ab609504149e6ac22b0dd27861da78064dead2 /firmware/target/arm | |
parent | d798c721e5e702028f6eabf416ffa9883e45fb39 (diff) |
iPod Classic/6G: fix battery voltage ADC scale
Scale battery voltage ADC readings by 1023 instead of 1000,
using ADC1 (substractor) instead of ADC0 (multiplicator) to
get better resolution.
Percent charge/discharge tables are also modified to return
a similar value than the old ones.
Change-Id: I2951c75faa02f4302599ec24f9156cfd209c36eb
Diffstat (limited to 'firmware/target/arm')
-rw-r--r-- | firmware/target/arm/s5l8702/ipod6g/pmu-ipod6g.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/s5l8702/ipod6g/powermgmt-ipod6g.c | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/firmware/target/arm/s5l8702/ipod6g/pmu-ipod6g.c b/firmware/target/arm/s5l8702/ipod6g/pmu-ipod6g.c index c11c0ad416..946beb1519 100644 --- a/firmware/target/arm/s5l8702/ipod6g/pmu-ipod6g.c +++ b/firmware/target/arm/s5l8702/ipod6g/pmu-ipod6g.c @@ -73,7 +73,7 @@ int pmu_read_adc(unsigned int adc) /* millivolts */ int pmu_read_battery_voltage(void) { - return pmu_read_adc(0) * 6; + return (pmu_read_adc(1) * 2000 / 1023) + 2250; } /* milliamps */ diff --git a/firmware/target/arm/s5l8702/ipod6g/powermgmt-ipod6g.c b/firmware/target/arm/s5l8702/ipod6g/powermgmt-ipod6g.c index b88ac16d55..ace66295f8 100644 --- a/firmware/target/arm/s5l8702/ipod6g/powermgmt-ipod6g.c +++ b/firmware/target/arm/s5l8702/ipod6g/powermgmt-ipod6g.c @@ -27,25 +27,25 @@ const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = { - 3600 + 3500 }; const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = { - 3350 + 3300 }; /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = { - { 3600, 3730, 3780, 3810, 3840, 3880, 3930, 3990, 4080, 4170, 4270 } + { 3500, 3670, 3720, 3750, 3770, 3800, 3860, 3920, 3980, 4070, 4170 } }; #if CONFIG_CHARGING /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ const unsigned short percent_to_volt_charge[11] = { - 3800, 3900, 3990, 4070, 4140, 4200, 4250, 4290, 4320, 4340, 4350 + 3700, 3820, 3900, 3950, 3990, 4030, 4070, 4120, 4170, 4190, 4200 }; #endif /* CONFIG_CHARGING */ |