diff options
-rw-r--r-- | firmware/target/arm/philips/hdd6330/powermgmt-hdd6330.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/firmware/target/arm/philips/hdd6330/powermgmt-hdd6330.c b/firmware/target/arm/philips/hdd6330/powermgmt-hdd6330.c index 7d132523e6..938d8ce14c 100644 --- a/firmware/target/arm/philips/hdd6330/powermgmt-hdd6330.c +++ b/firmware/target/arm/philips/hdd6330/powermgmt-hdd6330.c | |||
@@ -24,11 +24,6 @@ | |||
24 | #include "adc.h" | 24 | #include "adc.h" |
25 | #include "powermgmt.h" | 25 | #include "powermgmt.h" |
26 | 26 | ||
27 | #define SMLAL(lo, hi, x, y) \ | ||
28 | asm volatile ("smlal %0, %1, %2, %3" \ | ||
29 | : "+r" (lo), "+r" (hi) \ | ||
30 | : "%r" (x), "r" (y)) | ||
31 | |||
32 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | 27 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = |
33 | { | 28 | { |
34 | 3550 | 29 | 3550 |
@@ -53,20 +48,11 @@ const unsigned short percent_to_volt_charge[11] = | |||
53 | }; | 48 | }; |
54 | #endif /* CONFIG_CHARGING */ | 49 | #endif /* CONFIG_CHARGING */ |
55 | 50 | ||
56 | #define BATTERY_SCALE_FACTOR 4200 | 51 | #define BATTERY_SCALE_FACTOR 4536 |
57 | /* full-scale ADC readout (2^10) in millivolt */ | 52 | /* full-scale ADC readout (2^10) in millivolt */ |
58 | 53 | ||
59 | /* Returns battery voltage from ADC [millivolts] */ | 54 | /* Returns battery voltage from ADC [millivolts] */ |
60 | int _battery_voltage(void) | 55 | int _battery_voltage(void) |
61 | { | 56 | { |
62 | /* return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; */ | 57 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; |
63 | |||
64 | /* This may be overly complicated (pulled from the OF) */ | ||
65 | int lo = 0; | ||
66 | int val = adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR; | ||
67 | |||
68 | SMLAL(lo, val, 0x8a42f871, val); | ||
69 | val>>= 9; | ||
70 | val -= (val >> 31); | ||
71 | return val; | ||
72 | } | 58 | } |