Skip to content

Commit ffe9232

Browse files
Taniya Dasgregkh
authored andcommitted
clk: qcom: gdsc: Set retain_ff before moving to HW CTRL
[ Upstream commit 25708f7 ] 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> [ Changed error path ] Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b01a706 commit ffe9232

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

drivers/clk/qcom/gdsc.c

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

276+
if (sc->flags & RETAIN_FF_ENABLE)
277+
gdsc_retain_ff_on(sc);
278+
276279
/* Turn on HW trigger mode if supported */
277280
if (sc->flags & HW_CTRL) {
278281
ret = gdsc_hwctrl(sc, true);
@@ -289,9 +292,6 @@ static int gdsc_enable(struct generic_pm_domain *domain)
289292
udelay(1);
290293
}
291294

292-
if (sc->flags & RETAIN_FF_ENABLE)
293-
gdsc_retain_ff_on(sc);
294-
295295
return 0;
296296
}
297297

@@ -392,20 +392,21 @@ static int gdsc_init(struct gdsc *sc)
392392
return ret;
393393
}
394394

395-
/* Turn on HW trigger mode if supported */
396-
if (sc->flags & HW_CTRL) {
397-
ret = gdsc_hwctrl(sc, true);
398-
if (ret < 0)
399-
return ret;
400-
}
401-
402395
/*
403396
* Make sure the retain bit is set if the GDSC is already on,
404397
* otherwise we end up turning off the GDSC and destroying all
405398
* the register contents that we thought we were saving.
406399
*/
407400
if (sc->flags & RETAIN_FF_ENABLE)
408401
gdsc_retain_ff_on(sc);
402+
403+
/* Turn on HW trigger mode if supported */
404+
if (sc->flags & HW_CTRL) {
405+
ret = gdsc_hwctrl(sc, true);
406+
if (ret < 0)
407+
return ret;
408+
}
409+
409410
} else if (sc->flags & ALWAYS_ON) {
410411
/* If ALWAYS_ON GDSCs are not ON, turn them ON */
411412
gdsc_enable(&sc->pd);

0 commit comments

Comments
 (0)