usb: typec: hd3ss3220: Fix VBUS regulator reference handling - #972
usb: typec: hd3ss3220: Fix VBUS regulator reference handling#972Chang 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>
|
Merge Check Failed: No CR Numbers Found Error: No Change Request numbers were found. Please add Change Request numbers to your pull request description in the format CRs-Fixed: 12345 or link GitHub issues that are associated with Change Requests. |
1 similar comment
|
Merge Check Failed: No CR Numbers Found Error: No Change Request numbers were found. Please add Change Request numbers to your pull request description in the format CRs-Fixed: 12345 or link GitHub issues that are associated with Change Requests. |
|
Dmitry Baryshkov (@lumag) yijiyang jingyiwang42 The VBUS regulator warning was observed in the log attached to #472, but it is This PR only fixes the independent Could you please advise the appropriate CR to reference for this fix, or the |
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: