-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
power: Handle signals in separate functions #386
Conversation
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Signed-off-by: Tim Crawford <tcrawford@system76.com>
|
||
void power_event(void) { | ||
const bool ac_new = power_handle_acin_n(); | ||
gpio_set(&AC_PRESENT, !ac_new); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it need to be set on every cycle, or can it be set only when ACIN#
changes?
// Read power switch state | ||
const bool ps_new = power_handle_pwr_sw_n(); | ||
// Send power signal to PCH | ||
gpio_set(&PWR_BTN_N, ps_new); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it need to be set on every cycle, or can it be set only when PWR_SW#
changes?
Break up
power_event
into functions for handling each signal.This reduces complexity of the
power_event
function itself and brings it down to <100 LoC.