[PATCH v3 0/2] scsi: ufs-mediatek: fix va09 regulator lifecycle
From: Xiangwu Lai
Date: Thu Nov 19 2026 - 02:16:29 EST
Two fixes for the va09 regulator handling of the Mediatek UFS variant
driver.
Patch 1 converts the va09 acquisition to devm_regulator_get() and adds
an .exit callback that powers the M-PHY off, so the enable count is
balanced when devm releases the regulator.
Patch 2 fixes the state desynchronization of the power-off error path:
when regulator_disable() fails, the M-PHY is left physically off while
mphy_powered_on stays set, and the next power-on never retries.
Both issues were found by manual code inspection of the va09 error
paths; neither has been observed on real hardware, and no MTK UFS
hardware was available for testing. The affected paths only trigger
when a va09 regulator operation fails, which does not happen on a
working system.
Changes in v3:
- patch 2: restore the M-PHY power state when regulator_disable()
fails (phy_power_on() plus the va09 SMC call) instead of forcing
mphy_powered_on to false, as suggested by Peter Wang. This also
keeps the va09 enable count balanced and leaves the suspend error
recovery running with the M-PHY powered, resolving both findings of
the Sashiko AI review of v2.
- patch 1: no functional change, the Reviewed-by tag received for v2
is kept.
Link: https://lore.kernel.org/r/20261118032015.974-1-laixiangwu@xxxxxxxxxxxxxxxxxxxx/
Xiangwu Lai (2):
scsi: ufs-mediatek: use devm_regulator_get() for the va09 regulator
scsi: ufs-mediatek: restore the M-PHY power state when va09 disable
fails
drivers/ufs/host/ufs-mediatek.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
--
2.50.1.windows.1