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
|
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 |
3a1bdcc to
1186be0
Compare
|
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. |
2 similar comments
|
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. |
|
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. |
hd3ss3220_regulator_control() enables the VBUS regulator when @on is true and disables it when @on is false. However, its error message uses the opposite operation name, so an enable failure is reported as a disable failure and vice versa. Print the operation that was actually attempted. Reporting the opposite regulator operation on failures can mislead debugging of VBUS problems. Fixes: 27fbc19 ("usb: typec: hd3ss3220: Enable VBUS based on role state") Cc: stable@vger.kernel.org Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Xu Rao <raoxu@uniontech.com> Link: https://patch.msgid.link/7A42A287B2B588D0+20260812094632.348581-1-raoxu@uniontech.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
regulator_is_enabled() reports the aggregate regulator state, not whether this consumer holds an enable reference. If another consumer enables VBUS first, the driver can skip its own regulator_enable() call and later attempt to drop a reference it never acquired, triggering an unbalanced regulator disable warning. Track successful enable and disable calls locally. Keep the state unchanged when an operation fails so a later role or ID notification retries the operation while this consumer keeps balanced references. Fixes: b3f9d6e ("usb: typec: hd3ss3220: Check if regulator needs to be switched") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/linux-usb/20260819152027.90994-1-kunjinkao.jp@gmail.com/ Signed-off-by: Chang Wu <kunjinkao.jp@gmail.com>
1186be0 to
12aa1d7
Compare
|
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. |
The HD3SS3220 driver uses regulator_is_enabled() to determine whether VBUS
needs to be enabled or disabled. However, regulator_is_enabled() reports the
aggregate regulator state and does not indicate 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 so that regulator enable and disable
references remain balanced for this consumer. Update the state only after a
successful regulator operation.
This PR contains two commits:
Already merged in the Linux USB subsystem.
Submitted upstream at:
https://lore.kernel.org/linux-usb/20260819152027.90994-1-kunjinkao.jp@gmail.com/
Fixes: b3f9d6e ("usb: typec: hd3ss3220: Check if regulator needs to be switched")
Testing:
I am an external contributor and do not have access to Qualcomm's internal
CR system. Maintainer guidance on the appropriate CR association would be
appreciated.