Skip to content

Commit 25708f7

Browse files
Taniya Dasandersson
authored andcommitted
clk: qcom: gdsc: Set retain_ff before moving to HW CTRL
Enable the retain_ff_enable bit of GDSCR only if the GDSC is already ON. Once the GDSCR moves to HW control, SW no longer can determine the state of the GDSCR and setting the retain_ff bit could destroy all the register contents we intended to save. Therefore, move the retain_ff configuration before switching the GDSC to HW trigger mode. Cc: stable@vger.kernel.org Fixes: 1737229 ("clk: qcom: gdsc: Add support to enable retention of GSDCR") Signed-off-by: Taniya Das <quic_tdas@quicinc.com> Reviewed-by: Imran Shaik <quic_imrashai@quicinc.com> Tested-by: Imran Shaik <quic_imrashai@quicinc.com> # on QCS8300 Link: https://lore.kernel.org/r/20250214-gdsc_fixes-v1-1-73e56d68a80f@quicinc.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
1 parent 8b75c29 commit 25708f7

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

drivers/clk/qcom/gdsc.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,9 @@ static int gdsc_enable(struct generic_pm_domain *domain)
292292
*/
293293
udelay(1);
294294

295+
if (sc->flags & RETAIN_FF_ENABLE)
296+
gdsc_retain_ff_on(sc);
297+
295298
/* Turn on HW trigger mode if supported */
296299
if (sc->flags & HW_CTRL) {
297300
ret = gdsc_hwctrl(sc, true);
@@ -308,9 +311,6 @@ static int gdsc_enable(struct generic_pm_domain *domain)
308311
udelay(1);
309312
}
310313

311-
if (sc->flags & RETAIN_FF_ENABLE)
312-
gdsc_retain_ff_on(sc);
313-
314314
return 0;
315315
}
316316

@@ -457,20 +457,21 @@ static int gdsc_init(struct gdsc *sc)
457457
goto err_disable_supply;
458458
}
459459

460-
/* Turn on HW trigger mode if supported */
461-
if (sc->flags & HW_CTRL) {
462-
ret = gdsc_hwctrl(sc, true);
463-
if (ret < 0)
464-
goto err_disable_supply;
465-
}
466-
467460
/*
468461
* Make sure the retain bit is set if the GDSC is already on,
469462
* otherwise we end up turning off the GDSC and destroying all
470463
* the register contents that we thought we were saving.
471464
*/
472465
if (sc->flags & RETAIN_FF_ENABLE)
473466
gdsc_retain_ff_on(sc);
467+
468+
/* Turn on HW trigger mode if supported */
469+
if (sc->flags & HW_CTRL) {
470+
ret = gdsc_hwctrl(sc, true);
471+
if (ret < 0)
472+
goto err_disable_supply;
473+
}
474+
474475
} else if (sc->flags & ALWAYS_ON) {
475476
/* If ALWAYS_ON GDSCs are not ON, turn them ON */
476477
gdsc_enable(&sc->pd);

0 commit comments

Comments
 (0)