[PATCH v2 0/2] scsi: ufs-mediatek: fix va09 regulator lifecycle
From: Xiangwu Lai
Date: Tue Nov 17 2026 - 22:20:34 EST
This is v2 of the va09 regulator reference fix. Two issues surfaced
while reviewing the devm conversion (many thanks to the Sashiko AI
review of v1):
- the devm release alone would trip
WARN_ON(regulator->enable_count) in _regulator_put() on unbind,
because ufs_mtk_init() powers the M-PHY (and thus va09) on and
nothing powers it off again on the way out;
- the M-PHY power-off path can leave host->mphy_powered_on set when
regulator_disable() fails, so the next power-on bails out early
and never restores the PHY (pre-existing).
Patch 1 keeps the devm conversion and adds an .exit callback which
balances the enable count before the devm release, in the same spirit
as the .exit callbacks of ufs-exynos and ufs-qcom. Patch 2 fixes
the pre-existing state desync.
Changes in v2:
- 1/2: additionally add an .exit callback powering the M-PHY off so
the va09 enable count is balanced before devm releases the
regulator. Without it, _regulator_put() would warn on every
driver unbind (Sashiko AI review, [Medium]).
- 2/2: new patch fixing the mphy state desync when va09 disable
fails (Sashiko AI review, [High], pre-existing).
Link: https://lore.kernel.org/r/20261118014234.424-1-laixiangwu@xxxxxxxxxxxxxxxxxxxx
Xiangwu Lai (2):
scsi: ufs-mediatek: use devm_regulator_get() for the va09 regulator
scsi: ufs-mediatek: keep mphy state in sync when va09 disable fails
drivers/ufs/host/ufs-mediatek.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
--
2.50.1.windows.1