Re: [PATCH 1/2] clk: qcom: gdsc: add LEGACY_FOOTSWITCH support for MSM8x60

From: Linus Walleij

Date: Wed Jun 10 2026 - 16:26:42 EST


On Tue, Jun 2, 2026 at 7:08 AM Herman van Hazendonk
<github.com@xxxxxxxxxx> wrote:

> The MSM8x60 family (MSM8260, MSM8660, APQ8060) ships an older
> footswitch (FS / "GFS") block that pre-dates the GDSC programming
> model the existing driver was designed around. Adding GDSC entries
> for that family's MMCC power domains needs the driver to understand
> the legacy register layout:
>
> - the CLAMP, ENABLE and RETENTION bits live in the main GDSCR
> register rather than in a separate clamp_io_ctrl;
> - there is no power-status bit, so software cannot poll for the
> transition completing and has to gate progress on a fixed
> udelay() after toggling ENABLE;
> - ENABLE is positive-logic (set to power up, clear to collapse)
> rather than the modern inverted SW_COLLAPSE semantics;
> - none of the modern wait-time / HW-trigger / SW-override fields
> are present, so gdsc_init() must skip the wait-config
> programming block entirely.
>
> Introduce a LEGACY_FOOTSWITCH flag and the matching code paths in
> gdsc_check_status(), gdsc_update_collapse_bit(), gdsc_enable(),
> gdsc_disable() and gdsc_init(). The enable / disable sequences
> mirror what the downstream vendor footswitch driver did on these
> SoCs:
>
> enable: assert resets -> set ENABLE -> 2us settle ->
> deassert resets -> clear CLAMP -> 5us settle
> disable: assert resets -> set CLAMP -> clear ENABLE
>
> If the ENABLE write fails after asserting resets, deassert them
> again before returning so the hardware block is not left stuck
> in reset for the remainder of the system's lifetime.
>
> In gdsc_init(), clear the RETENTION bit (BIT 9) before jumping to
> the common state-sync block. The vendor MSM8x60 footswitch driver
> does the same one-shot clear at probe for every footswitch; without
> it the reset-default value is unspecified per board and a stuck-set
> retention bit would leave the rail draining power while looking
> collapsed in software.
>
> This patch only adds the infrastructure; the MSM8x60 MMCC driver
> that consumes it lands in a follow-up series.
>
> Signed-off-by: Herman van Hazendonk <github.com@xxxxxxxxxx>

This looks good to me:
Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>

Maybe Dmitry has a point that there is too much commenting
going on, but I don't mind much, so work either way with
me.

Yours,
Linus Walleij