From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-185.mta0.migadu.com (out-185.mta0.migadu.com [91.218.175.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BE813D3486 for ; Tue, 23 Jun 2026 11:10:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.185 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782213058; cv=none; b=faoiR8buoIiW7Hawq7mz6zjFxEuQq6JSqybTpw0OxXpN6nMRX54glRHA6MZKTWHSO77R6Z0A6LPAWYwAXC2NttakJtF3DdOfqvbgcvxUYlXJR9TgmY+W1sclpWzk1nK2Iwk5ZJYOQ/m0f1ICkpTwzL13tdn78k0cNx6UHCu4GKU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782213058; c=relaxed/simple; bh=ZUm4KkPPLsAjnKKl40pQCQvmtFDX7DyxwcQ7kmg3q/E=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=B2lcz091q02Saj120qvjVXHPcagHsn+2udXgrYCtqEHzwhvGMC8a2iBISBWNfc0xI/BcqXoBG80tEJmZcZTlXU0J/Ouj/ZDCLW4JybheyB6mK0JuvSgFdAJRpQsq9V3kw55XUo8OiIkTFGtIgT3zOx73BVrmCVgWH2b9PtynYnM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=cknow-tech.com; spf=pass smtp.mailfrom=cknow-tech.com; dkim=pass (2048-bit key) header.d=cknow-tech.com header.i=@cknow-tech.com header.b=Bvn3yQ8T; arc=none smtp.client-ip=91.218.175.185 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=cknow-tech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cknow-tech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cknow-tech.com header.i=@cknow-tech.com header.b="Bvn3yQ8T" Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cknow-tech.com; s=key1; t=1782213053; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k4NUULsbD4Wr6wdY5daDLj8cImrhH+2QVswARzXf4Zs=; b=Bvn3yQ8TmLGKyw5o+A2ByipnhrRbTy4NK+Kh9x//FBQlE2+gxQ+tyapgaF4UWjlQEe7bwe mfgtxetRw+VljLm3/DuIXkMEDxiIQv+hK99VFD/MwDz2lvcJIY4RtTKbRL/RnbtZKDrezd fNSTqbzrZnI3iABN6X3TScvs6FoNRqoAXEeftPGdBxqFH1MFJyhkdmldBgapDw7tRUNmmM UKxnFuwYkoRTJirMmEDU7qIMzjayGg4OAufkp2bSujEhrWj/u/XzFFIUIWErchfXURwR7V gahekD/4Sr1CPRzhMB022kvUpUG/8BK5o9uJkNX0KW0llsK78j5m5Hd4GKnMzg== Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 23 Jun 2026 13:10:49 +0200 Message-Id: Cc: "Nicolas Frattaroli" , , , , , , "Ricardo Pardini" Subject: Re: [PATCH v4 5/5] clk: rockchip: rk3588: add GATE_GRF clocks for I2S MCLK output to IO X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Diederik de Haas" To: "Daniele Briguglio" , "Michael Turquette" , "Stephen Boyd" , "Rob Herring" , "Krzysztof Kozlowski" , "Conor Dooley" , "Heiko Stuebner" References: <20260419-rk3588-mclk-gate-grf-v4-0-513a42dd1dcc@superkali.me> <20260419-rk3588-mclk-gate-grf-v4-5-513a42dd1dcc@superkali.me> In-Reply-To: <20260419-rk3588-mclk-gate-grf-v4-5-513a42dd1dcc@superkali.me> X-Migadu-Flow: FLOW_OUT [Resending it against v4 which wasn't present in my INBOX, but was the version accepted and used in my kernel] On Tue Jun 23, 2026 at 1:08 PM CEST, Daniele Briguglio wrote: > The I2S MCLK outputs on RK3588 are gated by bits in the SYS_GRF > register SOC_CON6 (offset 0x318). These gates control whether the > internal CRU MCLK signals reach the external IO pins connected to > audio codecs. > > The kernel should explicitly manage these gates so that audio > functionality does not depend on bootloader register state. This is > analogous to what was done for RK3576 SAI MCLK outputs [1]. > > Register the SYS_GRF as an auxiliary GRF with grf_type_sys using > rockchip_clk_add_grf(), and add GATE_GRF entries for all four I2S > MCLK output gates: > > - I2S0_8CH_MCLKOUT_TO_IO (bit 0) > - I2S1_8CH_MCLKOUT_TO_IO (bit 1) > - I2S2_2CH_MCLKOUT_TO_IO (bit 2) > - I2S3_2CH_MCLKOUT_TO_IO (bit 7) > > Board DTS files that need MCLK on an IO pin can reference these > clocks, e.g.: > > clocks =3D <&cru I2S0_8CH_MCLKOUT_TO_IO>; > > Tested on the Youyeetoo YY3588 (RK3588) with an ES8388 codec on I2S0. Doesn't this break audio on a lot of RK3588 based boards? I have a kernel with this patch set and since then analog audio on my NanoP= C-T6 LTS and my WIP NanoPC-T6 Plus stopped working. Until I did s/I2S0_8CH_MCLKOUT/I2S0_8CH_MCLKOUT_TO_IO/ in my dts[i] files. And I wouldn't be surprised if the same thing applies to other RK3588 based boards? The same dtb file with a 7.1 kernel, without this patch set, works. Cheers, Diederik > [1] https://lore.kernel.org/r/20250305-rk3576-sai-v1-2-64e6cf863e9a@colla= bora.com/ > > Tested-by: Ricardo Pardini > Signed-off-by: Daniele Briguglio > --- > drivers/clk/rockchip/clk-rk3588.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/drivers/clk/rockchip/clk-rk3588.c b/drivers/clk/rockchip/clk= -rk3588.c > index 1694223f4f84..2ba9976654cf 100644 > --- a/drivers/clk/rockchip/clk-rk3588.c > +++ b/drivers/clk/rockchip/clk-rk3588.c > @@ -5,11 +5,13 @@ > */ > =20 > #include > +#include > #include > #include > #include > #include > #include > +#include > #include "clk.h" > =20 > #define RK3588_GRF_SOC_STATUS0 0x600 > @@ -892,6 +894,8 @@ static struct rockchip_clk_branch rk3588_early_clk_br= anches[] __initdata =3D { > RK3588_CLKGATE_CON(8), 0, GFLAGS), > MUX(I2S2_2CH_MCLKOUT, "i2s2_2ch_mclkout", i2s2_2ch_mclkout_p, CLK_SET_R= ATE_PARENT, > RK3588_CLKSEL_CON(30), 2, 1, MFLAGS), > + GATE_GRF(I2S2_2CH_MCLKOUT_TO_IO, "i2s2_2ch_mclkout_to_io", "i2s2_2ch_mc= lkout", > + 0, RK3588_SYSGRF_SOC_CON6, 2, GFLAGS, grf_type_sys), > =20 > COMPOSITE(CLK_I2S3_2CH_SRC, "clk_i2s3_2ch_src", gpll_aupll_p, 0, > RK3588_CLKSEL_CON(30), 8, 1, MFLAGS, 3, 5, DFLAGS, > @@ -907,6 +911,8 @@ static struct rockchip_clk_branch rk3588_early_clk_br= anches[] __initdata =3D { > RK3588_CLKGATE_CON(8), 4, GFLAGS), > MUX(I2S3_2CH_MCLKOUT, "i2s3_2ch_mclkout", i2s3_2ch_mclkout_p, CLK_SET_R= ATE_PARENT, > RK3588_CLKSEL_CON(32), 2, 1, MFLAGS), > + GATE_GRF(I2S3_2CH_MCLKOUT_TO_IO, "i2s3_2ch_mclkout_to_io", "i2s3_2ch_mc= lkout", > + 0, RK3588_SYSGRF_SOC_CON6, 7, GFLAGS, grf_type_sys), > GATE(PCLK_ACDCDIG, "pclk_acdcdig", "pclk_audio_root", 0, > RK3588_CLKGATE_CON(7), 11, GFLAGS), > GATE(HCLK_I2S0_8CH, "hclk_i2s0_8ch", "hclk_audio_root", 0, > @@ -935,6 +941,8 @@ static struct rockchip_clk_branch rk3588_early_clk_br= anches[] __initdata =3D { > RK3588_CLKGATE_CON(7), 10, GFLAGS), > MUX(I2S0_8CH_MCLKOUT, "i2s0_8ch_mclkout", i2s0_8ch_mclkout_p, CLK_SET_R= ATE_PARENT, > RK3588_CLKSEL_CON(28), 2, 2, MFLAGS), > + GATE_GRF(I2S0_8CH_MCLKOUT_TO_IO, "i2s0_8ch_mclkout_to_io", "i2s0_8ch_mc= lkout", > + 0, RK3588_SYSGRF_SOC_CON6, 0, GFLAGS, grf_type_sys), > =20 > GATE(HCLK_PDM1, "hclk_pdm1", "hclk_audio_root", 0, > RK3588_CLKGATE_CON(9), 6, GFLAGS), > @@ -2220,6 +2228,8 @@ static struct rockchip_clk_branch rk3588_early_clk_= branches[] __initdata =3D { > RK3588_PMU_CLKGATE_CON(2), 13, GFLAGS), > MUX(I2S1_8CH_MCLKOUT, "i2s1_8ch_mclkout", i2s1_8ch_mclkout_p, CLK_SET_R= ATE_PARENT, > RK3588_PMU_CLKSEL_CON(9), 2, 2, MFLAGS), > + GATE_GRF(I2S1_8CH_MCLKOUT_TO_IO, "i2s1_8ch_mclkout_to_io", "i2s1_8ch_mc= lkout", > + 0, RK3588_SYSGRF_SOC_CON6, 1, GFLAGS, grf_type_sys), > GATE(PCLK_PMU1, "pclk_pmu1", "pclk_pmu0_root", CLK_IS_CRITICAL, > RK3588_PMU_CLKGATE_CON(1), 0, GFLAGS), > GATE(CLK_DDR_FAIL_SAFE, "clk_ddr_fail_safe", "clk_pmu0", CLK_IGNORE_UNU= SED, > @@ -2439,6 +2449,7 @@ static struct rockchip_clk_branch rk3588_clk_branch= es[] =3D { > static void __init rk3588_clk_early_init(struct device_node *np) > { > struct rockchip_clk_provider *ctx; > + struct regmap *sys_grf; > unsigned long clk_nr_clks, max_clk_id1, max_clk_id2; > void __iomem *reg_base; > =20 > @@ -2479,6 +2490,11 @@ static void __init rk3588_clk_early_init(struct de= vice_node *np) > &rk3588_cpub1clk_data, rk3588_cpub1clk_rates, > ARRAY_SIZE(rk3588_cpub1clk_rates)); > =20 > + /* Register SYS_GRF for I2S MCLK output to IO gate clocks */ > + sys_grf =3D syscon_regmap_lookup_by_compatible("rockchip,rk3588-sys-grf= "); > + if (!IS_ERR(sys_grf)) > + rockchip_clk_add_grf(ctx, sys_grf, grf_type_sys); > + > rockchip_clk_register_branches(ctx, rk3588_early_clk_branches, > ARRAY_SIZE(rk3588_early_clk_branches)); > =20