mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 20:55:17 -05:00
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
This commit is contained in:
parent
01706d9c0f
commit
4ad62b7656
1 changed files with 4 additions and 15 deletions
|
|
@ -193,16 +193,6 @@ static enum
|
||||||
TEMP_HIGH_LIMIT = 1, /* Max temp */
|
TEMP_HIGH_LIMIT = 1, /* Max temp */
|
||||||
} temp_state = TEMP_STATE_NORMAL;
|
} temp_state = TEMP_STATE_NORMAL;
|
||||||
|
|
||||||
/* Set power thread priority for charging mode or not */
|
|
||||||
static inline void charging_set_thread_priority(bool charging)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_PRIORITY_SCHEDULING
|
|
||||||
thread_set_priority(thread_self(),
|
|
||||||
charging ? PRIORITY_REALTIME : PRIORITY_SYSTEM);
|
|
||||||
#endif
|
|
||||||
(void)charging;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Update filtered charger current - exponential moving average */
|
/* Update filtered charger current - exponential moving average */
|
||||||
static bool charger_current_filter_step(void)
|
static bool charger_current_filter_step(void)
|
||||||
{
|
{
|
||||||
|
|
@ -411,8 +401,6 @@ static bool adjust_charger_current(void)
|
||||||
|
|
||||||
if (i != MC13783_DATA_ERROR)
|
if (i != MC13783_DATA_ERROR)
|
||||||
{
|
{
|
||||||
charging_set_thread_priority(true);
|
|
||||||
|
|
||||||
/* Turn regulator logically ON. Hardware may still override.
|
/* Turn regulator logically ON. Hardware may still override.
|
||||||
*/
|
*/
|
||||||
i = mc13783_write_masked(MC13783_CHARGER, charger_setting,
|
i = mc13783_write_masked(MC13783_CHARGER, charger_setting,
|
||||||
|
|
@ -467,7 +455,6 @@ static bool adjust_charger_current(void)
|
||||||
|
|
||||||
adc_enable_channel(ADC_CHARGER_CURRENT, false);
|
adc_enable_channel(ADC_CHARGER_CURRENT, false);
|
||||||
update_filtered_battery_voltage();
|
update_filtered_battery_voltage();
|
||||||
charging_set_thread_priority(false);
|
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
@ -615,6 +602,10 @@ void INIT_ATTR powermgmt_init_target(void)
|
||||||
MC13783_VCHRG_4_050V | MC13783_ICHRG_0MA |
|
MC13783_VCHRG_4_050V | MC13783_ICHRG_0MA |
|
||||||
MC13783_ICHRGTR_0MA | MC13783_OVCTRL_6_90V;
|
MC13783_ICHRGTR_0MA | MC13783_OVCTRL_6_90V;
|
||||||
|
|
||||||
|
/* Must maintain watchdog timer and charger thus must always be able to
|
||||||
|
run even if playback is starved. */
|
||||||
|
thread_set_priority(thread_self(), PRIORITY_REALTIME);
|
||||||
|
|
||||||
/* Use watchdog to shut system down if we lose control of the charging
|
/* Use watchdog to shut system down if we lose control of the charging
|
||||||
* hardware. */
|
* hardware. */
|
||||||
watchdog_init(WATCHDOG_TIMEOUT);
|
watchdog_init(WATCHDOG_TIMEOUT);
|
||||||
|
|
@ -809,8 +800,6 @@ static void charger_control(void)
|
||||||
|
|
||||||
autorecharge_counter = 0;
|
autorecharge_counter = 0;
|
||||||
|
|
||||||
charging_set_thread_priority(true);
|
|
||||||
|
|
||||||
if (stat_battery_reading(ADC_BATTERY) < BATT_VTRICKLE_CHARGE)
|
if (stat_battery_reading(ADC_BATTERY) < BATT_VTRICKLE_CHARGE)
|
||||||
{
|
{
|
||||||
/* Battery is deeply discharged - precharge at lower current. */
|
/* Battery is deeply discharged - precharge at lower current. */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue