Remove unnecessary parameters unconstrained_power from Func cmp_consumer_capability#636
Merged
asasine merged 2 commits intoOpenDevicePartnership:mainfrom Dec 15, 2025
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the unconstrained_power flag from the consumer capability comparison logic in the power policy service. According to the description, the unconstrained_power flag was causing the low power source to always be selected over USB-C, regardless of connection order, because this barrel jack charger source always reports unconstrained_power=1 while USB-C reports 0. The team determined that comparing power capability and current connection status is sufficient for selecting the best consumer.
Key Changes
- Removed
unconstrained_power()from the tuple comparison incmp_consumer_capability(), simplifying the logic to compare only power capability and current connection status - The
unconstrained_powerflag is still tracked and used elsewhere in the codebase for state monitoring and notifications
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
RobertZ2011
approved these changes
Dec 15, 2025
asasine
approved these changes
Dec 15, 2025
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.
In current ODP code cmp_consumer_capability(), when two power sources have the same power capability, it will compare their
unconstrained_powernext.Currently, the unconstrained power of USBC power is always false, so if the unconstrained power of another lower-power source is always true, it will always select this lower-power source regardless of whether it's inserted first or last. It is enough to use power capability and current power flag to choose best consumer.