Skip to content

power-policy-service: Introduce DisconnectReason enum - #940

Open
RobertZ2011 wants to merge 1 commit into
OpenDevicePartnership:stable-v0.1.yfrom
RobertZ2011:set-renegotiate-same-psu
Open

power-policy-service: Introduce DisconnectReason enum#940
RobertZ2011 wants to merge 1 commit into
OpenDevicePartnership:stable-v0.1.yfrom
RobertZ2011:set-renegotiate-same-psu

Conversation

@RobertZ2011

@RobertZ2011 RobertZ2011 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Combine existing disconnect reasons into this enum and distinguishbetween renegotiation types. Also rename ConsumerDisconnect to Disconnect since this type is already used for provider disconnect flags as well.

@RobertZ2011 RobertZ2011 self-assigned this Aug 7, 2026
@RobertZ2011
RobertZ2011 requested a lite review from Copilot August 7, 2026 16:09
@RobertZ2011
RobertZ2011 force-pushed the set-renegotiate-same-psu branch from 3a65d39 to 88e9c85 Compare August 7, 2026 16:09
@RobertZ2011 RobertZ2011 added the type-c Related to the type-c service or drivers. label Aug 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts power-policy behavior to distinguish a consumer “renegotiation” from a true PSU switch when the best consumer remains the same device but its requested capability changes. In support of more accurate Type-C/PD status reporting, it also tightens parsing of the first received source PDO (expecting a fixed PDO) and propagates additional source-side flags into PortStatus, including EPR capability. Finally, it updates the PortStatus::epr field documentation to reflect the intended meaning.

Changes:

  • Treat “same device” consumer transitions as renegotiations (flagged via ConsumerDisconnect::renegotiation) instead of switching.
  • Extract the first RX source PDO as Fixed and use its fields to populate dual_power, unconstrained_power, and epr in Type-C port status.
  • Update the PortStatus::epr doc comment to describe EPR capability.

Reviewed changes

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

File Description
type-c-service/src/driver/tps6699x.rs Reads RX source caps and uses the first fixed PDO to populate additional PortStatus power flags, including EPR capability.
power-policy-service/src/consumer.rs Differentiates renegotiation vs switching when the best consumer remains the same device.
embedded-service/src/type_c/controller.rs Updates the PortStatus::epr field documentation to match its intended meaning.

@RobertZ2011
RobertZ2011 force-pushed the set-renegotiate-same-psu branch from 88e9c85 to efb5653 Compare August 7, 2026 17:42
@RobertZ2011
RobertZ2011 requested a lite review from Copilot August 7, 2026 17:44
Combine existing disconnect reasons into this enum and distinguish
between renegotiation types. Also rename `ConsumerDisconnect` to
`Disconnect` since this type is already used for provider disconnect
flags as well.
@RobertZ2011
RobertZ2011 force-pushed the set-renegotiate-same-psu branch from efb5653 to c915506 Compare August 7, 2026 17:45
@RobertZ2011 RobertZ2011 added the BREAKING CHANGE Marks breaking changes label Aug 7, 2026
@RobertZ2011 RobertZ2011 changed the title Set renegotiate same psu power-policy-service: Introduce DisconnectReason enum Aug 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

Suppressed comments (1)

embedded-service/src/power/policy/flags.rs:167

  • Doc comment for InvalidDisconnectReason refers to PsuType, but this error is for DisconnectReason conversion failures. This looks like a copy/paste mistake and can mislead readers.
/// Conversion error for [`PsuType`]

@RobertZ2011
RobertZ2011 marked this pull request as ready for review August 7, 2026 20:38
@RobertZ2011
RobertZ2011 requested review from a team as code owners August 7, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BREAKING CHANGE Marks breaking changes type-c Related to the type-c service or drivers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants