type-c-service/controller: Create customization trait#918
Open
RobertZ2011 wants to merge 1 commit into
Open
Conversation
RobertZ2011
force-pushed
the
type-c-customization
branch
2 times, most recently
from
July 20, 2026 16:45
1245fab to
be8b004
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces an OEM customization hook for the Type-C controller Port by adding a Customization trait and making Port generic over a customization implementation (defaulting to DefaultCustomization). The main behavioral change is that consumer power capability flags (notably unconstrained power) are now derived via the customization layer rather than directly from controller config. As part of this, the previous controller::config::Config content is removed and an explicit Port::with_customization(...) constructor is added for injecting non-default customization.
Changes:
- Add
controller::customizationmodule definingCustomization,DefaultCustomization, andUnconstrainedSink. - Make
controller::Portgeneric over aCustomizationimplementation (defaulted) and thread it through controller trait impls. - Route consumer capability updates through
Customization::update_consumer_capability(...)during sink contract processing.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| type-c-service/src/controller/mod.rs | Adds customization module, extends Port with a Customization type param + field, and introduces with_customization constructor. |
| type-c-service/src/controller/customization.rs | New customization trait + default implementation and migrated unconstrained-sink behavior. |
| type-c-service/src/controller/config.rs | Removes prior config fields; Config becomes an empty placeholder type. |
| type-c-service/src/controller/power.rs | Uses customization hook to update ConsumerPowerCapability during new consumer contract handling. |
| type-c-service/src/controller/pd.rs | Updates Port impl blocks to include the new Customization generic parameter. |
| type-c-service/src/controller/type_c.rs | Updates StateMachine impl to include the new Customization generic parameter. |
| type-c-service/src/controller/retimer.rs | Updates Retimer impl to include the new Customization generic parameter. |
| type-c-service/src/controller/ucsi.rs | Updates Lpm impl to include the new Customization generic parameter. |
| type-c-service/src/controller/max_sink_voltage.rs | Updates MaxSinkVoltage impl to include the new Customization generic parameter. |
| type-c-service/src/controller/electrical_disconnect.rs | Updates ElectricalDisconnect impl to include the new Customization generic parameter. |
RobertZ2011
force-pushed
the
type-c-customization
branch
from
July 20, 2026 17:42
be8b004 to
98e7014
Compare
RobertZ2011
marked this pull request as ready for review
July 20, 2026 18:06
RobertZ2011
requested review from
asasine,
felipebalbi,
gjpmsft,
jerrysxie,
kurtjd,
tullom and
williampMSFT
July 20, 2026 18:06
RobertZ2011
force-pushed
the
type-c-customization
branch
from
July 20, 2026 23:17
98e7014 to
4f0d399
Compare
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.
No description provided.