All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/5] clk: rockchip: rk3588: add I2S MCLK output gate clocks
@ 2026-04-19 11:43 Daniele Briguglio
  2026-04-19 11:43 ` [PATCH v4 1/5] dt-bindings: clock: rockchip,rk3588-cru: add I2S MCLK output to IO clock IDs Daniele Briguglio
                   ` (5 more replies)
  0 siblings, 6 replies; 26+ messages in thread
From: Daniele Briguglio @ 2026-04-19 11:43 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Heiko Stuebner
  Cc: Nicolas Frattaroli, linux-clk, devicetree, linux-arm-kernel,
	linux-rockchip, linux-kernel, Daniele Briguglio,
	Krzysztof Kozlowski, Ricardo Pardini

On RK3588, the four I2S master clock (MCLK) outputs to external IO
pins are gated by bits in SYS_GRF SOC_CON6 (offset 0x0318). These
are set-to-disable gates with hiword mask semantics.

The TRM documents the reset value of these bits as 0 (gate open),
but in practice the Rockchip firmware (BL31) may set them during
early boot, preventing the MCLK signal from reaching external audio
codecs. The kernel should manage these gates explicitly so that
audio functionality does not depend on bootloader register state.

This series adds GATE_GRF clock entries for all four I2S MCLK output
gates, following the same approach used for the RK3576 SAI MCLK
output gates [1]. Board DTS files that need MCLK on an IO pin can
reference these clocks (e.g. clocks = <&cru I2S0_8CH_MCLKOUT_TO_IO>),
ensuring the output gate is opened when the clock is enabled.

Patch 1 adds the four clock ID bindings.
Patch 2 removes the grf_type_sys exclusion from the aux_grf_table
        lookup, which prevented SYS_GRF-based GATE_GRF entries from
        being resolved on RK3588 (where ctx->grf points to PHP_GRF).
Patch 3 introduces rockchip_clk_add_grf(), a helper to register
        auxiliary GRFs, so SoC drivers don't open-code the aux_grf
        allocation and hashtable insertion.
Patch 4 adds the RK3588_SYSGRF_SOC_CON6 register define.
Patch 5 adds the four GATE_GRF clock entries and registers the
        SYS_GRF via the new helper.

clk-rk3576.c currently open-codes the same GRF registration pattern
twice and is an obvious candidate for conversion to the new helper,
but that refactor is left as a separate follow-up to keep this
series focused.

Tested on a Youyeetoo YY3588 (RK3588) board with an ES8388 audio
codec connected to I2S0, and independently on a Mekotronics R58X-Pro
(ES8388) by Ricardo Pardini.

[1] https://lore.kernel.org/r/20250305-rk3576-sai-v1-2-64e6cf863e9a@collabora.com/

Changes in v4:
- Introduced rockchip_clk_add_grf() helper and used it in clk-rk3588.c
  instead of open-coding the aux_grf registration (Heiko)
- Dropped Reviewed-by from patch 5 since the code was refactored

Changes in v3:
- Added separate patch for RK3588_SYSGRF_SOC_CON6 register define
  in rk3588_grf.h, replacing magic 0x0318 (Nicolas)
- Dropped Reported-by/Closes tags from the driver patch (Nicolas)
- Added Tested-by from Ricardo Pardini (Mekotronics R58X-Pro)

Changes in v2:
- Patch 1: shortened commit message (Krzysztof)
- Driver patch: added missing #include <linux/slab.h> for kzalloc_obj
  (kernel test robot)

Signed-off-by: Daniele Briguglio <hello@superkali.me>
---
Daniele Briguglio (5):
      dt-bindings: clock: rockchip,rk3588-cru: add I2S MCLK output to IO clock IDs
      clk: rockchip: allow grf_type_sys lookup in aux_grf_table
      clk: rockchip: add helper to register auxiliary GRFs
      soc: rockchip: rk3588: add SYS_GRF SOC_CON6 register offset
      clk: rockchip: rk3588: add GATE_GRF clocks for I2S MCLK output to IO

 drivers/clk/rockchip/clk-rk3588.c               | 16 ++++++++++++++++
 drivers/clk/rockchip/clk.c                      | 25 +++++++++++++++++++++----
 drivers/clk/rockchip/clk.h                      |  3 +++
 include/dt-bindings/clock/rockchip,rk3588-cru.h |  4 ++++
 include/soc/rockchip/rk3588_grf.h               |  2 ++
 5 files changed, 46 insertions(+), 4 deletions(-)
---
base-commit: b84a0ebe421ca56995ff78b66307667b62b3a900
change-id: 20260316-rk3588-mclk-gate-grf-c4b180438fc0

Best regards,
--  
Daniele Briguglio <hello@superkali.me>


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2026-06-23 17:42 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-19 11:43 [PATCH v4 0/5] clk: rockchip: rk3588: add I2S MCLK output gate clocks Daniele Briguglio
2026-04-19 11:43 ` [PATCH v4 1/5] dt-bindings: clock: rockchip,rk3588-cru: add I2S MCLK output to IO clock IDs Daniele Briguglio
2026-04-19 11:43 ` [PATCH v4 2/5] clk: rockchip: allow grf_type_sys lookup in aux_grf_table Daniele Briguglio
2026-04-19 11:43 ` [PATCH v4 3/5] clk: rockchip: add helper to register auxiliary GRFs Daniele Briguglio
2026-04-19 11:43 ` [PATCH v4 4/5] soc: rockchip: rk3588: add SYS_GRF SOC_CON6 register offset Daniele Briguglio
2026-04-19 11:43 ` [PATCH v4 5/5] clk: rockchip: rk3588: add GATE_GRF clocks for I2S MCLK output to IO Daniele Briguglio
2026-06-23 11:10   ` Diederik de Haas
2026-06-23 11:10     ` Diederik de Haas
2026-06-23 12:05     ` Heiko Stübner
2026-06-23 12:05       ` Heiko Stübner
2026-06-23 12:33       ` Daniele Briguglio
2026-06-23 12:33         ` Daniele Briguglio
2026-06-23 13:05         ` Diederik de Haas
2026-06-23 13:05           ` Diederik de Haas
2026-06-23 13:08           ` Diederik de Haas
2026-06-23 13:08             ` Diederik de Haas
2026-06-23 13:23           ` Daniele Briguglio
2026-06-23 13:23             ` Daniele Briguglio
2026-06-23 13:45             ` Diederik de Haas
2026-06-23 13:45               ` Diederik de Haas
2026-06-23 14:09               ` Daniele Briguglio
2026-06-23 14:09                 ` Daniele Briguglio
2026-06-23 17:42                 ` Diederik de Haas
2026-06-23 17:42                   ` Diederik de Haas
2026-04-27 12:23 ` [PATCH v4 0/5] clk: rockchip: rk3588: add I2S MCLK output gate clocks Heiko Stuebner
2026-04-27 12:23   ` Heiko Stuebner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.