usb: typec: hd3ss3220: Fix VBUS regulator reference handling - #965
Closed
Chang Wu (kunjinkao-os) wants to merge 2 commits into
Closed
usb: typec: hd3ss3220: Fix VBUS regulator reference handling#965Chang Wu (kunjinkao-os) wants to merge 2 commits into
Chang Wu (kunjinkao-os) wants to merge 2 commits into
Conversation
The error message currently reports the inverse operation because the enable/disable names are selected backwards. Report the operation that was actually attempted. Signed-off-by: Chang Wu <kunjinkao.jp@gmail.com>
regulator_is_enabled() may report enabled when another consumer holds the enable reference, so it cannot be used to determine whether this consumer called regulator_enable(). If another consumer enables VBUS first, hd3ss3220 can skip its own enable. A later disable then attempts to drop a reference it never acquired, causing an unbalanced regulator disable. Track successful enable and disable calls locally. Do not update the state when a regulator operation fails, so repeated role and ID notifications remain balanced. Fixes: b3f9d6e ("usb: typec: hd3ss3220: Check if regulator needs to be switched") Signed-off-by: Chang Wu <kunjinkao.jp@gmail.com>
Chang Wu (kunjinkao-os)
force-pushed
the
dev
branch
from
August 17, 2026 13:26
7fd12da to
7f0394c
Compare
Contributor
|
PR's should not be raised on main branch closing it |
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.
The HD3SS3220 driver uses regulator_is_enabled() to determine whether
VBUS needs to be enabled or disabled. However, this reports the
aggregate regulator state and cannot determine whether this consumer holds an enable reference.
If another consumer enables VBUS first, the driver may skip its own
regulator_enable() call and later issue an unbalanced regulator_disable() call.
Track the VBUS enable state locally for this consumer and update the state only after successful regulator operations. This keeps the regulator enable/disable references balanced across role and ID notifications.
Also fix the VBUS regulator error message to report the operation that was actually attempted.
Fixes: b3f9d6e ("usb: typec: hd3ss3220: Check if regulator needs to be switched")
Testing: