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

Avoid resetting charge_max_level during CHG_LIMIT_GET_LIMIT #7

Merged
merged 4 commits into from May 26, 2023

Conversation

DHowett
Copy link
Contributor

@DHowett DHowett commented Jan 23, 2022

Reading into charging_maximum_level overwrites CHG_LIMIT_OVERRIDE;
GET_LIMIT should not change global state.

Fixes #6.

@@ -363,8 +363,9 @@ static enum ec_status cmd_charging_limit_control(struct host_cmd_handler_args *a
charging_maximum_level = charging_maximum_level | CHG_LIMIT_OVERRIDE;

if (p->modes & CHG_LIMIT_GET_LIMIT) {
system_get_bbram(SYSTEM_BBRAM_IDX_CHG_MAX, &charging_maximum_level);
r->max_percentage = charging_maximum_level;
uint8_t max = 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw I think the code style here is to declare all variables at the beginning of the function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair. I was iffy on whether I wanted to introduce a temporary anyway, given that ec_response_chg_limit_control::max_percentage is itself a uint8_t. I switched over to reading directly into it.

This may cause a compat problem if the response from this command ever changes, but the correct way to handle that would be with a new command version anyway . . . 😄

Thanks!

@github-actions
Copy link

github-actions bot commented Jun 14, 2022

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@DHowett
Copy link
Contributor Author

DHowett commented Jun 14, 2022

I have read the CLA Document and I hereby sign the CLA

kiram9 added a commit that referenced this pull request Jun 14, 2022
@DHowett
Copy link
Contributor Author

DHowett commented Jun 14, 2022

I'm not certain about the "labeler" failure:

Error: HttpError: Resource not accessible by integration
Error: Resource not accessible by integration

@kiram9 kiram9 changed the base branch from hx20 to hx20-hx30 January 5, 2023 00:09
@DHowett
Copy link
Contributor Author

DHowett commented Jan 5, 2023

Moved this over to baseboard/fwk. Thanks again for doing all the baseboard stuff, folks 😄

@DHowett DHowett changed the title Do not reset charge_max_level during CHG_LIMIT_GET_LIMIT Avoid resetting charge_max_level during CHG_LIMIT_GET_LIMIT Jan 5, 2023
@kiram9 kiram9 merged commit 72748b7 into FrameworkComputer:hx20-hx30 May 26, 2023
@github-actions github-actions bot locked and limited conversation to collaborators May 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

hx20: CHG_LIMIT_GET_LIMIT disables charge override
3 participants