type-c-service/tps6699x: Fix EPR capable flag not being set - #941
type-c-service/tps6699x: Fix EPR capable flag not being set#941RobertZ2011 wants to merge 3 commits into
Conversation
This flag was not being set properly.
There was a problem hiding this comment.
Pull request overview
This PR fixes PortStatus.epr not being populated when using the TPS6699x Type‑C/PD controller driver, by extracting the EPR-capable bit from the partner’s first received Source PDO (the 5V fixed SPR PDO). It also updates the PortStatus field documentation to describe epr as “port partner is EPR capable”. The intent is to make the EPR capability visible to higher layers that consume PortStatus.
Changes:
- Parse the first received Source PDO as a fixed PDO and use its flags to populate
dual_power,unconstrained_power, and the newly-seteprfield. - Update
PortStatus.eprdoc comment to reflect “port partner is EPR capable”.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
type-c-service/src/driver/tps6699x.rs |
Sets PortStatus.epr (and refactors related flag extraction) based on the first received fixed Source PDO. |
embedded-service/src/type_c/controller.rs |
Updates the documentation describing what PortStatus.epr represents. |
| port_status.dual_power = fixed_source_pdo.dual_role_power; | ||
| port_status.unconstrained_power = fixed_source_pdo.unconstrained_power; | ||
| port_status.epr = fixed_source_pdo.epr_capable; |
There was a problem hiding this comment.
Use an exhaustive pattern to not forget fields by accident.
let Pdo { a, b, c } = pdo; // note: no `..`. Use `field: _` to intentionally discard one.There was a problem hiding this comment.
Done, I've also added dual_data and usb_comms_capable to PortStatus to support more functionality for downstream users. The other ignored fields are either irrelevant (current/voltage is already pulled from the PDO), or doesn't strike me as particularly useful.
There was a problem hiding this comment.
What about putting the whole PDO in?
asasine
left a comment
There was a problem hiding this comment.
The whole PDO would avoid ambiguity with what each field refers to, and would save us from needing to revisit this again for yet-another-field.
This flag was not being set properly. Also add two more useful fields to
PortStatus.