You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AC power state bounces after plugging/unplugging AC power #88
if (extpower_presence==debounced_extpower_presence)
return;
debounced_extpower_presence=extpower_presence;
extpower_handle_update(extpower_presence);
}
DECLARE_DEFERRED(extpower_deferred);
voidextpower_interrupt(enumgpio_signalsignal)
{
/* Trigger deferred notification of external power change */
hook_call_deferred(&extpower_deferred_data,
CONFIG_EXTPOWER_DEBOUNCE_MS*MSEC);
}
charger_task() continues to charger_get_params() which reads from i2c and blocks/yields(?)1
extpower_deferred() runs, calling extpower_handle_update() which updates the mmap and notifies the system
charger_task() continues, hitting process_charge_state(), which updates the battery flags mmap with the now-outdated AC-state that was read at the beginning of the iteration
on the next iteration the updated state is read and is reverted
Footnotes
not very familiar with how zephyr scheduling works. this might be off the mark ↩
Activity
baodrate commentedon Sep 22, 2026
I'm not confident, but is the issue something like this?
charger_task()reads AC state in a loop, and reads the AC-stateEmbeddedController/common/charge_state.c
Lines 1566 to 1573 in 8cbd986
extpower_deferred()to be deferredEmbeddedController/common/extpower_gpio.c
Lines 25 to 42 in 8cbd986
charger_task()continues tocharger_get_params()which reads from i2c and blocks/yields(?)1extpower_deferred()runs, callingextpower_handle_update()which updates the mmap and notifies the systemcharger_task()continues, hittingprocess_charge_state(), which updates the battery flags mmap with the now-outdated AC-state that was read at the beginning of the iterationFootnotes
not very familiar with how zephyr scheduling works. this might be off the mark ↩