Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <quic_rjendra@quicinc.com>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20220920111517.10407-1-quic_rjendra@quicinc.com

authored by

Rajendra Nayak and committed by
Bjorn Andersson
d3997239 e55d937d

+15
+10
drivers/clk/qcom/gdsc.c
··· 368 368 if (sc->pwrsts & PWRSTS_OFF) 369 369 gdsc_clear_mem_on(sc); 370 370 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 + 371 381 ret = gdsc_toggle_logic(sc, GDSC_OFF); 372 382 if (ret) 373 383 return ret;
+5
drivers/clk/qcom/gdsc.h
··· 49 49 const u8 pwrsts; 50 50 /* Powerdomain allowable state bitfields */ 51 51 #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 + */ 52 57 #define PWRSTS_RET BIT(1) 53 58 #define PWRSTS_ON BIT(2) 54 59 #define PWRSTS_OFF_ON (PWRSTS_OFF | PWRSTS_ON)