diff options
Diffstat (limited to 'firmware/target/arm/tcc780x/cowond2/powermgmt-cowond2.c')
-rw-r--r-- | firmware/target/arm/tcc780x/cowond2/powermgmt-cowond2.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/firmware/target/arm/tcc780x/cowond2/powermgmt-cowond2.c b/firmware/target/arm/tcc780x/cowond2/powermgmt-cowond2.c index b52d5c46ba..9b2320b7cf 100644 --- a/firmware/target/arm/tcc780x/cowond2/powermgmt-cowond2.c +++ b/firmware/target/arm/tcc780x/cowond2/powermgmt-cowond2.c | |||
@@ -23,7 +23,9 @@ | |||
23 | #include "adc.h" | 23 | #include "adc.h" |
24 | #include "powermgmt.h" | 24 | #include "powermgmt.h" |
25 | #include "kernel.h" | 25 | #include "kernel.h" |
26 | #include "power-target.h" | ||
26 | #include "pcf50606.h" | 27 | #include "pcf50606.h" |
28 | #include "pcf50635.h" | ||
27 | 29 | ||
28 | unsigned short current_voltage = 3910; | 30 | unsigned short current_voltage = 3910; |
29 | 31 | ||
@@ -66,7 +68,11 @@ unsigned int battery_adc_voltage(void) | |||
66 | if (TIME_BEFORE(last_tick+HZ, current_tick)) | 68 | if (TIME_BEFORE(last_tick+HZ, current_tick)) |
67 | { | 69 | { |
68 | short adc_val; | 70 | short adc_val; |
69 | pcf50606_read_adc(PCF5060X_ADC_BATVOLT_RES, &adc_val, NULL); | 71 | |
72 | if (get_pmu_type() == PCF50606) | ||
73 | pcf50606_read_adc(PCF5060X_ADC_BATVOLT_RES, &adc_val, NULL); | ||
74 | else | ||
75 | pcf50635_read_adc(PCF5063X_ADCC1_MUX_BATSNS_RES, &adc_val, NULL); | ||
70 | 76 | ||
71 | current_voltage = (adc_val * BATTERY_SCALE_FACTOR) >> 10; | 77 | current_voltage = (adc_val * BATTERY_SCALE_FACTOR) >> 10; |
72 | 78 | ||
@@ -75,4 +81,3 @@ unsigned int battery_adc_voltage(void) | |||
75 | 81 | ||
76 | return current_voltage; | 82 | return current_voltage; |
77 | } | 83 | } |
78 | |||