diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2011-10-30 14:32:42 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2011-10-30 14:32:42 +0000 |
commit | 4ad62b7656c656641c9176276acb73294871a220 (patch) | |
tree | d6bcdfaffed8a24a5e60f619915f855999429271 | |
parent | 01706d9c0ff5f4831892f524a9edcfcdec990833 (diff) | |
download | rockbox-4ad62b7656c656641c9176276acb73294871a220.tar.gz rockbox-4ad62b7656c656641c9176276acb73294871a220.zip |
Gigabeat S: Maintain power thread at realtime priority at all times so it may always service the watchdog on time regardless of playback priority.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30867 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/target/arm/imx31/gigabeat-s/powermgmt-gigabeat-s.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/powermgmt-gigabeat-s.c b/firmware/target/arm/imx31/gigabeat-s/powermgmt-gigabeat-s.c index 2df461015e..d87e367cba 100644 --- a/firmware/target/arm/imx31/gigabeat-s/powermgmt-gigabeat-s.c +++ b/firmware/target/arm/imx31/gigabeat-s/powermgmt-gigabeat-s.c | |||
@@ -193,16 +193,6 @@ static enum | |||
193 | TEMP_HIGH_LIMIT = 1, /* Max temp */ | 193 | TEMP_HIGH_LIMIT = 1, /* Max temp */ |
194 | } temp_state = TEMP_STATE_NORMAL; | 194 | } temp_state = TEMP_STATE_NORMAL; |
195 | 195 | ||
196 | /* Set power thread priority for charging mode or not */ | ||
197 | static inline void charging_set_thread_priority(bool charging) | ||
198 | { | ||
199 | #ifdef HAVE_PRIORITY_SCHEDULING | ||
200 | thread_set_priority(thread_self(), | ||
201 | charging ? PRIORITY_REALTIME : PRIORITY_SYSTEM); | ||
202 | #endif | ||
203 | (void)charging; | ||
204 | } | ||
205 | |||
206 | /* Update filtered charger current - exponential moving average */ | 196 | /* Update filtered charger current - exponential moving average */ |
207 | static bool charger_current_filter_step(void) | 197 | static bool charger_current_filter_step(void) |
208 | { | 198 | { |
@@ -411,8 +401,6 @@ static bool adjust_charger_current(void) | |||
411 | 401 | ||
412 | if (i != MC13783_DATA_ERROR) | 402 | if (i != MC13783_DATA_ERROR) |
413 | { | 403 | { |
414 | charging_set_thread_priority(true); | ||
415 | |||
416 | /* Turn regulator logically ON. Hardware may still override. | 404 | /* Turn regulator logically ON. Hardware may still override. |
417 | */ | 405 | */ |
418 | i = mc13783_write_masked(MC13783_CHARGER, charger_setting, | 406 | i = mc13783_write_masked(MC13783_CHARGER, charger_setting, |
@@ -467,7 +455,6 @@ static bool adjust_charger_current(void) | |||
467 | 455 | ||
468 | adc_enable_channel(ADC_CHARGER_CURRENT, false); | 456 | adc_enable_channel(ADC_CHARGER_CURRENT, false); |
469 | update_filtered_battery_voltage(); | 457 | update_filtered_battery_voltage(); |
470 | charging_set_thread_priority(false); | ||
471 | 458 | ||
472 | return success; | 459 | return success; |
473 | } | 460 | } |
@@ -615,6 +602,10 @@ void INIT_ATTR powermgmt_init_target(void) | |||
615 | MC13783_VCHRG_4_050V | MC13783_ICHRG_0MA | | 602 | MC13783_VCHRG_4_050V | MC13783_ICHRG_0MA | |
616 | MC13783_ICHRGTR_0MA | MC13783_OVCTRL_6_90V; | 603 | MC13783_ICHRGTR_0MA | MC13783_OVCTRL_6_90V; |
617 | 604 | ||
605 | /* Must maintain watchdog timer and charger thus must always be able to | ||
606 | run even if playback is starved. */ | ||
607 | thread_set_priority(thread_self(), PRIORITY_REALTIME); | ||
608 | |||
618 | /* Use watchdog to shut system down if we lose control of the charging | 609 | /* Use watchdog to shut system down if we lose control of the charging |
619 | * hardware. */ | 610 | * hardware. */ |
620 | watchdog_init(WATCHDOG_TIMEOUT); | 611 | watchdog_init(WATCHDOG_TIMEOUT); |
@@ -809,8 +800,6 @@ static void charger_control(void) | |||
809 | 800 | ||
810 | autorecharge_counter = 0; | 801 | autorecharge_counter = 0; |
811 | 802 | ||
812 | charging_set_thread_priority(true); | ||
813 | |||
814 | if (stat_battery_reading(ADC_BATTERY) < BATT_VTRICKLE_CHARGE) | 803 | if (stat_battery_reading(ADC_BATTERY) < BATT_VTRICKLE_CHARGE) |
815 | { | 804 | { |
816 | /* Battery is deeply discharged - precharge at lower current. */ | 805 | /* Battery is deeply discharged - precharge at lower current. */ |