diff options
author | Dana Conrad <dconrad@fastmail.com> | 2021-11-10 17:31:03 -0600 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-11-12 16:31:27 -0500 |
commit | 59ef877c94c9cabd9007e86994bc858c35fd5c95 (patch) | |
tree | 2e4bb88ec310ee073e376920c0cf3e6c6cc00423 | |
parent | ee27ba416feaa9e0efe67981021338f6516258b7 (diff) | |
download | rockbox-59ef877c94c9cabd9007e86994bc858c35fd5c95.tar.gz rockbox-59ef877c94c9cabd9007e86994bc858c35fd5c95.zip |
x1000: delay power thread until valid battery read
Appears to return 0 until the axp has (presumably) completed
its first real measurement.
Note about erosq: keep the power_inint() delay large to ensure
nothing breaks in the bootloader for the time being.
Change-Id: I444e858207cc401c42f1e6ceacf067ad543d4ff8
-rw-r--r-- | firmware/powermgmt.c | 10 | ||||
-rw-r--r-- | firmware/target/mips/ingenic_x1000/erosqnative/power-erosqnative.c | 6 |
2 files changed, 13 insertions, 3 deletions
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index aaec959f50..519823611f 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c | |||
@@ -693,10 +693,18 @@ static void power_thread(void) | |||
693 | /* Delay reading the first battery level */ | 693 | /* Delay reading the first battery level */ |
694 | #ifdef MROBE_100 | 694 | #ifdef MROBE_100 |
695 | while (_battery_voltage() > 4200) /* gives false readings initially */ | 695 | while (_battery_voltage() > 4200) /* gives false readings initially */ |
696 | { | ||
696 | #elif defined(DX50) || defined(DX90) | 697 | #elif defined(DX50) || defined(DX90) |
697 | while (_battery_voltage() < 1) /* can give false readings initially */ | 698 | while (_battery_voltage() < 1) /* can give false readings initially */ |
698 | #endif | ||
699 | { | 699 | { |
700 | #elif defined(EROS_QN) || defined(FIIO_M3K) || defined(SHANLING_Q1) | ||
701 | |||
702 | /* wait until the first battery read is ready */ | ||
703 | while (_battery_voltage() <= 0) | ||
704 | { | ||
705 | #else | ||
706 | { | ||
707 | #endif | ||
700 | sleep(HZ/100); | 708 | sleep(HZ/100); |
701 | } | 709 | } |
702 | 710 | ||
diff --git a/firmware/target/mips/ingenic_x1000/erosqnative/power-erosqnative.c b/firmware/target/mips/ingenic_x1000/erosqnative/power-erosqnative.c index cea8f35a40..5573919aa2 100644 --- a/firmware/target/mips/ingenic_x1000/erosqnative/power-erosqnative.c +++ b/firmware/target/mips/ingenic_x1000/erosqnative/power-erosqnative.c | |||
@@ -79,8 +79,10 @@ void power_init(void) | |||
79 | axp_set_charge_current(780); | 79 | axp_set_charge_current(780); |
80 | 80 | ||
81 | /* Delay to give power outputs time to stabilize. | 81 | /* Delay to give power outputs time to stabilize. |
82 | * Had one report that 190 was not long enough, let's do 250. */ | 82 | * With the power thread delay, this can apparently go as low as 50, |
83 | mdelay(250); | 83 | * Keeping a higher value here just to ensure the bootloader works |
84 | * correctly. */ | ||
85 | mdelay(200); | ||
84 | } | 86 | } |
85 | 87 | ||
86 | #ifdef HAVE_USB_CHARGING_ENABLE | 88 | #ifdef HAVE_USB_CHARGING_ENABLE |