Skip to content

Commit d399723

Browse files
Rajendra Nayakandersson
authored andcommitted
clk: qcom: gdsc: Fix the handling of PWRSTS_RET support
GDSCs cannot be transitioned into a Retention state in SW. When either the RETAIN_MEM bit, or both the RETAIN_MEM and RETAIN_PERIPH bits are set, and the GDSC is left ON, the HW takes care of retaining the memory/logic for the domain when the parent domain transitions to power collapse/power off state. On some platforms where the parent domains lowest power state itself is Retention, just leaving the GDSC in ON (without any RETAIN_MEM/RETAIN_PERIPH bits being set) will also transition it to Retention. The existing logic handling the PWRSTS_RET seems to set the RETAIN_MEM/RETAIN_PERIPH bits if the cxcs offsets are specified but then explicitly turns the GDSC OFF as part of _gdsc_disable(). Fix that by leaving the GDSC in ON state. Signed-off-by: Rajendra Nayak <[email protected]> Cc: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Bjorn Andersson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent e55d937 commit d399723

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

drivers/clk/qcom/gdsc.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,16 @@ static int _gdsc_disable(struct gdsc *sc)
368368
if (sc->pwrsts & PWRSTS_OFF)
369369
gdsc_clear_mem_on(sc);
370370

371+
/*
372+
* If the GDSC supports only a Retention state, apart from ON,
373+
* leave it in ON state.
374+
* There is no SW control to transition the GDSC into
375+
* Retention state. This happens in HW when the parent
376+
* domain goes down to a Low power state
377+
*/
378+
if (sc->pwrsts == PWRSTS_RET_ON)
379+
return 0;
380+
371381
ret = gdsc_toggle_logic(sc, GDSC_OFF);
372382
if (ret)
373383
return ret;

drivers/clk/qcom/gdsc.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ struct gdsc {
4949
const u8 pwrsts;
5050
/* Powerdomain allowable state bitfields */
5151
#define PWRSTS_OFF BIT(0)
52+
/*
53+
* There is no SW control to transition a GDSC into
54+
* PWRSTS_RET. This happens in HW when the parent
55+
* domain goes down to a low power state
56+
*/
5257
#define PWRSTS_RET BIT(1)
5358
#define PWRSTS_ON BIT(2)
5459
#define PWRSTS_OFF_ON (PWRSTS_OFF | PWRSTS_ON)

0 commit comments

Comments
 (0)