Skip to content
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

[lotus-zephyr] Bug in power slider mode management #34

Open
DHowett opened this issue Aug 1, 2023 · 0 comments
Open

[lotus-zephyr] Bug in power slider mode management #34

DHowett opened this issue Aug 1, 2023 · 0 comments

Comments

@DHowett
Copy link
Contributor

DHowett commented Aug 1, 2023

I think the code here is wrong as of 42ec4cc.

if (force_no_adapter || (!extpower_is_present()) || (active_mpower < 55000)) {
active_mpower = 0;
if (mode > EC_DC_BATTERY_SAVER)
mode = mode << 4;
}

mode = mode << 4 will produce out-of-range values for the AC modes: EC_AC_BEST_PERFORMANCE will become 256 (16 << 4), EC_AC_BALANCED (32) will become 512, etc.

Reading the condition, it looks like we want to treat low-power AC (AC < 55W) as the same as DC.
I would expect that to downgrade EC_AC_BEST_PERFORMANCE to EC_**DC**_BEST_PERFORMANCE (as an example).

If that's the case, I suspect mode >> 4 is what you want. That reduces EC_AC_BEST_PERFORMANCE to 1 (16 >> 4)... which happens to match the value for EC_DC_BEST_...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant