Skip to content

Disable sink path during voltage transition#899

Open
tullom wants to merge 2 commits into
OpenDevicePartnership:mainfrom
tullom:port-sink-disable-changes-to-main
Open

Disable sink path during voltage transition#899
tullom wants to merge 2 commits into
OpenDevicePartnership:mainfrom
tullom:port-sink-disable-changes-to-main

Conversation

@tullom

@tullom tullom commented Jun 18, 2026

Copy link
Copy Markdown
Contributor
  • 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

Resolves #874 and is a port of #861

- 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
@tullom tullom self-assigned this Jun 18, 2026
@tullom tullom requested a review from a team as a code owner June 18, 2026 20:40
Copilot AI review requested due to automatic review settings June 18, 2026 20:40
@tullom tullom requested review from a team as code owners June 18, 2026 20:40
@tullom tullom added the enhancement New feature or request label Jun 18, 2026
@tullom tullom requested review from asasine and gjpmsft June 18, 2026 20:40
@tullom tullom added this to ODP v0.2 Jun 18, 2026
@github-project-automation github-project-automation Bot moved this to In progress in ODP v0.2 Jun 18, 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 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 ConsumerDisconnected events to include ConsumerDisconnect flags (renegotiation vs switching) 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.

Comment thread type-c-service/src/controller/max_sink_voltage.rs Outdated
Comment thread type-c-service/src/controller/max_sink_voltage.rs Outdated
- 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

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 13 out of 13 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

type-C: Port sink disable changes to main

3 participants