mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/2] scsi: ufs-mediatek: fix va09 regulator lifecycle
@ 2026-11-19  7:16 Xiangwu Lai
  2026-11-19  7:16 ` [PATCH v3 1/2] scsi: ufs-mediatek: use devm_regulator_get() for the va09 regulator Xiangwu Lai
  2026-11-19  7:16 ` [PATCH v3 2/2] scsi: ufs-mediatek: restore the M-PHY power state when va09 disable fails Xiangwu Lai
  0 siblings, 2 replies; 4+ messages in thread
From: Xiangwu Lai @ 2026-11-19  7:16 UTC (permalink / raw)
  To: peter.wang, chaotian.jing
  Cc: chu.stanley, alim.akhtar, bvanassche, stanley.chu, sashiko-bot,
	linux-scsi, linux-mediatek, linux-kernel, Xiangwu Lai

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@cmss.chinamobile.com/

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-19  8:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19  7:16 [PATCH v3 0/2] scsi: ufs-mediatek: fix va09 regulator lifecycle Xiangwu Lai
2026-11-19  7:16 ` [PATCH v3 1/2] scsi: ufs-mediatek: use devm_regulator_get() for the va09 regulator Xiangwu Lai
2026-11-19  7:16 ` [PATCH v3 2/2] scsi: ufs-mediatek: restore the M-PHY power state when va09 disable fails Xiangwu Lai
2026-11-19  8:36   ` Peter Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®