[PATCH v7 3/9] phy: rockchip-samsung-dcphy: Unwind power-on on PLL lock failure

From: Jason Yang

Date: Wed Nov 18 2026 - 00:56:04 EST


samsung_mipi_dphy_power_on() returns on a PLL lock timeout with PLL_EN
set and m_phy_rst still asserted, and the PHY core does not call
power_off after a failed power_on.

Today the APB reset at the start of the next power_on cleans this up.

A later change moves that reset to runtime resume, so the leftover
PLL_EN would stay set, and regmap_update_bits() would not even write
it again.

Unwind the power-on before returning the error.

Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
Closes: https://lore.kernel.org/linux-phy/sashiko-outbox-174059@xxxxxxxxxx/
Signed-off-by: Jason Yang <jason98166@xxxxxxxxx>
Reviewed-by: Michael Riesch <michael.riesch@xxxxxxxxxxxxx>
Tested-by: Quentin Schulz <quentin.schulz@xxxxxxxxx> # RK3588 Tiger CSI1 2-lane IMX219, CSI0 2-lane OV5675+DSI
---
drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c b/drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c
index 7382043e1f31..ce1bc62497c5 100644
--- a/drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c
+++ b/drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c
@@ -1343,8 +1343,11 @@ static int samsung_mipi_dphy_power_on(struct samsung_mipi_dcphy *samsung)
samsung_mipi_dphy_clk_lane_timing_init(samsung);
samsung_mipi_dphy_data_lane_timing_init(samsung);
ret = samsung_mipi_dcphy_pll_enable(samsung);
- if (ret < 0)
+ if (ret < 0) {
+ samsung_mipi_dcphy_pll_disable(samsung);
+ reset_control_deassert(samsung->m_phy_rst);
return ret;
+ }

samsung_mipi_dphy_lane_enable(samsung);


--
2.43.0