Disable sink path during voltage transition#899
Open
tullom wants to merge 2 commits into
Open
Conversation
- Disable the sink path before a max sink voltage change when a consumer is connected and the limit is changing or being removed, to avoid overcurrent/overvoltage during renegotiation. - Add a ConsumerDisconnect flags argument to the power policy consumer disconnected event: renegotiation when the consumer is recontracting, switching when moving to a different PSU. - Add tests for the sink disable logic and the new flags. Assisted-by: GitHub Copilot:claude-opus-4.8
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves Type-C power renegotiation safety by disabling the sink path before max sink voltage transitions while a consumer is connected, and enhances power-policy consumer disconnect signaling by adding explicit disconnect-reason flags.
Changes:
- Disable the sink path before applying a max sink voltage change/removal when a consumer is connected (to reduce overcurrent/overvoltage risk during renegotiation).
- Extend
ConsumerDisconnectedevents to includeConsumerDisconnectflags (renegotiationvsswitching) across the power-policy interface and service. - Add/extend tests for the new sink-disable behavior and the new disconnect flags, plus a Type-C controller mock for max sink voltage.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| type-c-service/tests/power.rs | Adds a regression test ensuring sink path is disabled before max sink voltage renegotiation when appropriate. |
| type-c-service/src/service/power.rs | Updates power-policy event handling to accept the new ConsumerDisconnected payload shape. |
| type-c-service/src/controller/max_sink_voltage.rs | Implements sink-path disable logic around max sink voltage updates when a consumer is connected. |
| type-c-interface-mocks/src/controller/mod.rs | Extends the controller mock to support max sink voltage calls/results. |
| type-c-interface-mocks/src/controller/max_sink_voltage.rs | Adds a mock implementation of the max sink voltage controller trait. |
| power-policy-service/tests/consumer.rs | Adds tests validating switching and renegotiation disconnect flags. |
| power-policy-service/tests/common/mod.rs | Adds assertion helper to validate disconnect flags in emitted events. |
| power-policy-service/tests/common/mock.rs | Adds mock helper to simulate a consumer renegotiating capability. |
| power-policy-service/src/service/consumer.rs | Emits ConsumerDisconnected with explicit flags based on renegotiation vs PSU switching. |
| power-policy-interface/src/service/event.rs | Updates service event types to carry ConsumerDisconnect flags. |
| power-policy-interface/src/capability.rs | Introduces the ConsumerDisconnect bitflags type and unit tests. |
RobertZ2011
approved these changes
Jun 18, 2026
RobertZ2011
requested changes
Jun 18, 2026
- Move the port out of the consumer state and send a Disconnected event with the renegotiation flag so the power policy broadcasts ConsumerDisconnected and reconnects once the new contract is negotiated. - Thread the ConsumerDisconnect flag through the PSU Disconnected event and the disconnect handling. - Verify the broadcast in TestSinkDisableOnVoltageChange. Assisted-by: GitHub Copilot:claude-opus-4.8
RobertZ2011
approved these changes
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Assisted-by: GitHub Copilot:claude-opus-4.8
Resolves #874 and is a port of #861