Enable rk3066a HDMI sound
Subsystems (6)
v4 cover Enable rk3066a HDMI sound
First fix some legacy things in clk-rk3188.c that was never updated, because probably nobody used rk3066a I2S before in the mainline kernel. Update the rk3066a HDMI documents with a #sound-dai-cells property. Include the code for sound in the HDMI driver.
Add a simple-sound-card compatible node to rk3066a.dtsi, because I2S0 and HDMI TX are connected internally.
And as last enable rk3066a HDMI sound in the rk3066a-mk808.dts file.
Johan Jonker (6):
clk: rockchip: add CLK_SET_RATE_PARENT to sclk for rk3066a i2s and
uart clocks
clk: rockchip: fix i2s gate bits on rk3066 and rk3188
dt-bindings: display: add #sound-dai-cells property to rockchip rk3066
hdmi
ARM: dts: rockchip: rk3066a: add #sound-dai-cells to hdmi node
ARM: dts: rockchip: add hdmi-sound node to rk3066a.dtsi
ARM: dts: rockchip: enable hdmi_sound and i2s0 for rk3066a-mk808
Zheng Yang (1):
drm: rockchip: add sound support to rk3066 hdmi driver
.../display/rockchip/rockchip,rk3066-hdmi.yaml | 4 + arch/arm/boot/dts/rk3066a-mk808.dts | 8 + arch/arm/boot/dts/rk3066a.dtsi | 17 ++ drivers/clk/rockchip/clk-rk3188.c | 35 +-- drivers/gpu/drm/rockchip/Kconfig | 2 + drivers/gpu/drm/rockchip/rk3066_hdmi.c | 272 ++++++++++++++++++++- 6 files changed, 320 insertions(+), 18 deletions(-)
--
2.11.0
PATCH v4 1/7 clk: rockchip: add CLK_SET_RATE_PARENT to sclk for rk3066a i2s and uart clocks
Add CLK_SET_RATE_PARENT to sclk for rk3066a i2s and uart clocks, so that the parent COMPOSITE_FRACMUX and COMPOSITE_NOMUX also update.
--- drivers/clk/rockchip/clk-rk3188.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/clk/rockchip/clk-rk3188.c +14 -14
@@ -255,19 +255,19 @@ static struct rockchip_clk_branch common_spdif_fracmux __initdata = RK2928_CLKSEL_CON(5), 8, 2, MFLAGS);static struct rockchip_clk_branch common_uart0_fracmux__initdata = -MUX (SCLK_UART0 ,"sclk_uart0" , mux_sclk_uart0_p,0 , +MUX (SCLK_UART0 ,"sclk_uart0" , mux_sclk_uart0_p,CLK_SET_RATE_PARENT ,RK2928_CLKSEL_CON (13 ),8 ,2 ,MFLAGS );static struct rockchip_clk_branch common_uart1_fracmux__initdata = -MUX (SCLK_UART1 ,"sclk_uart1" , mux_sclk_uart1_p,0 , +MUX (SCLK_UART1 ,"sclk_uart1" , mux_sclk_uart1_p,CLK_SET_RATE_PARENT ,RK2928_CLKSEL_CON (14 ),8 ,2 ,MFLAGS );static struct rockchip_clk_branch common_uart2_fracmux__initdata = -MUX (SCLK_UART2 ,"sclk_uart2" , mux_sclk_uart2_p,0 , +MUX (SCLK_UART2 ,"sclk_uart2" , mux_sclk_uart2_p,CLK_SET_RATE_PARENT ,RK2928_CLKSEL_CON (15 ),8 ,2 ,MFLAGS );static struct rockchip_clk_branch common_uart3_fracmux__initdata = -MUX (SCLK_UART3 ,"sclk_uart3" , mux_sclk_uart3_p,0 , +MUX (SCLK_UART3 ,"sclk_uart3" , mux_sclk_uart3_p,CLK_SET_RATE_PARENT ,RK2928_CLKSEL_CON (16 ),8 ,2 ,MFLAGS );static struct rockchip_clk_branch common_clk_branches[]__initdata = {
@@ -408,28 +408,28 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = {COMPOSITE_NOMUX (0 ,"uart0_pre" ,"uart_src" ,0 ,RK2928_CLKSEL_CON (13 ),0 ,7 ,DFLAGS ,RK2928_CLKGATE_CON (1 ),8 ,GFLAGS ), -COMPOSITE_FRACMUX (0 ,"uart0_frac" ,"uart0_pre" ,0 , +COMPOSITE_FRACMUX (0 ,"uart0_frac" ,"uart0_pre" ,CLK_SET_RATE_PARENT ,RK2928_CLKSEL_CON (17 ),0 ,RK2928_CLKGATE_CON (1 ),9 ,GFLAGS , &common_uart0_fracmux),COMPOSITE_NOMUX (0 ,"uart1_pre" ,"uart_src" ,0 ,RK2928_CLKSEL_CON (14 ),0 ,7 ,DFLAGS ,RK2928_CLKGATE_CON (1 ),10 ,GFLAGS ), -COMPOSITE_FRACMUX (0 ,"uart1_frac" ,"uart1_pre" ,0 , +COMPOSITE_FRACMUX (0 ,"uart1_frac" ,"uart1_pre" ,CLK_SET_RATE_PARENT ,RK2928_CLKSEL_CON (18 ),0 ,RK2928_CLKGATE_CON (1 ),11 ,GFLAGS , &common_uart1_fracmux),COMPOSITE_NOMUX (0 ,"uart2_pre" ,"uart_src" ,0 ,RK2928_CLKSEL_CON (15 ),0 ,7 ,DFLAGS ,RK2928_CLKGATE_CON (1 ),12 ,GFLAGS ), -COMPOSITE_FRACMUX (0 ,"uart2_frac" ,"uart2_pre" ,0 , +COMPOSITE_FRACMUX (0 ,"uart2_frac" ,"uart2_pre" ,CLK_SET_RATE_PARENT ,RK2928_CLKSEL_CON (19 ),0 ,RK2928_CLKGATE_CON (1 ),13 ,GFLAGS , &common_uart2_fracmux),COMPOSITE_NOMUX (0 ,"uart3_pre" ,"uart_src" ,0 ,RK2928_CLKSEL_CON (16 ),0 ,7 ,DFLAGS ,RK2928_CLKGATE_CON (1 ),14 ,GFLAGS ), -COMPOSITE_FRACMUX (0 ,"uart3_frac" ,"uart3_pre" ,0 , +COMPOSITE_FRACMUX (0 ,"uart3_frac" ,"uart3_pre" ,CLK_SET_RATE_PARENT ,RK2928_CLKSEL_CON (20 ),0 ,RK2928_CLKGATE_CON (1 ),15 ,GFLAGS , &common_uart3_fracmux),
@@ -543,15 +543,15 @@ static struct clk_div_table div_aclk_cpu_t[] = { };static struct rockchip_clk_branch rk3066a_i2s0_fracmux__initdata = -MUX (SCLK_I2S0 ,"sclk_i2s0" , mux_sclk_i2s0_p,0 , +MUX (SCLK_I2S0 ,"sclk_i2s0" , mux_sclk_i2s0_p,CLK_SET_RATE_PARENT ,RK2928_CLKSEL_CON (2 ),8 ,2 ,MFLAGS );static struct rockchip_clk_branch rk3066a_i2s1_fracmux__initdata = -MUX (SCLK_I2S1 ,"sclk_i2s1" , mux_sclk_i2s1_p,0 , +MUX (SCLK_I2S1 ,"sclk_i2s1" , mux_sclk_i2s1_p,CLK_SET_RATE_PARENT ,RK2928_CLKSEL_CON (3 ),8 ,2 ,MFLAGS );static struct rockchip_clk_branch rk3066a_i2s2_fracmux__initdata = -MUX (SCLK_I2S2 ,"sclk_i2s2" , mux_sclk_i2s2_p,0 , +MUX (SCLK_I2S2 ,"sclk_i2s2" , mux_sclk_i2s2_p,CLK_SET_RATE_PARENT ,RK2928_CLKSEL_CON (4 ),8 ,2 ,MFLAGS );static struct rockchip_clk_branch rk3066a_clk_branches[]__initdata = {
@@ -615,21 +615,21 @@ static struct rockchip_clk_branch rk3066a_clk_branches[] __initdata = {COMPOSITE_NOMUX (0 ,"i2s0_pre" ,"i2s_src" ,0 ,RK2928_CLKSEL_CON (2 ),0 ,7 ,DFLAGS ,RK2928_CLKGATE_CON (0 ),7 ,GFLAGS ), -COMPOSITE_FRACMUX (0 ,"i2s0_frac" ,"i2s0_pre" ,0 , +COMPOSITE_FRACMUX (0 ,"i2s0_frac" ,"i2s0_pre" ,CLK_SET_RATE_PARENT ,RK2928_CLKSEL_CON (6 ),0 ,RK2928_CLKGATE_CON (0 ),8 ,GFLAGS , &rk3066a_i2s0_fracmux),COMPOSITE_NOMUX (0 ,"i2s1_pre" ,"i2s_src" ,0 ,RK2928_CLKSEL_CON (3 ),0 ,7 ,DFLAGS ,RK2928_CLKGATE_CON (0 ),9 ,GFLAGS ), -COMPOSITE_FRACMUX (0 ,"i2s1_frac" ,"i2s1_pre" ,0 , +COMPOSITE_FRACMUX (0 ,"i2s1_frac" ,"i2s1_pre" ,CLK_SET_RATE_PARENT ,RK2928_CLKSEL_CON (7 ),0 ,RK2928_CLKGATE_CON (0 ),10 ,GFLAGS , &rk3066a_i2s1_fracmux),COMPOSITE_NOMUX (0 ,"i2s2_pre" ,"i2s_src" ,0 ,RK2928_CLKSEL_CON (4 ),0 ,7 ,DFLAGS ,RK2928_CLKGATE_CON (0 ),11 ,GFLAGS ), -COMPOSITE_FRACMUX (0 ,"i2s2_frac" ,"i2s2_pre" ,0 , +COMPOSITE_FRACMUX (0 ,"i2s2_frac" ,"i2s2_pre" ,CLK_SET_RATE_PARENT ,RK2928_CLKSEL_CON (8 ),0 ,RK2928_CLKGATE_CON (0 ),12 ,GFLAGS , &rk3066a_i2s2_fracmux),
Signature · 1 line
2.11.0
PATCH v4 2/7 clk: rockchip: fix i2s gate bits on rk3066 and rk3188
In reply to Johan JonkerThe Rockchip PX2/RK3066 uses these bits in CRU_CLKGATE7_CON:
hclk_i2s_8ch_gate_en bit 4 (dtsi: i2s0)hclk_i2s0_2ch_gate_en bit 2 (dtsi: i2s1)hclk_i2s1_2ch_gate_en bit 3 (dtsi: i2s2)
The Rockchip PX3/RK3188 uses this bit in CRU_CLKGATE7_CON:
hclk_i2s_2ch_gate_en bit 2 (dtsi: i2s0)
The bits got somehow mixed up in the clk-rk3188.c file. The labels in the dtsi files are not suppose to change. The sclk and hclk names should match for "trace_event=clk_disable,clk_enable",
so remove GATE HCLK_I2S0 from the common clock tree and fix the bits in the rk3066 and rk3188 clock tree.
--- drivers/clk/rockchip/clk-rk3188.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/clk/rockchip/clk-rk3188.c +4 -3
@@ -449,7 +449,6 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = {/* hclk_cpu gates */ GATE (HCLK_ROM ,"hclk_rom" ,"hclk_cpu" ,0 ,RK2928_CLKGATE_CON (5 ),6 ,GFLAGS ), -GATE (HCLK_I2S0 ,"hclk_i2s0" ,"hclk_cpu" ,0 ,RK2928_CLKGATE_CON (7 ),2 ,GFLAGS ),GATE (HCLK_SPDIF ,"hclk_spdif" ,"hclk_cpu" ,0 ,RK2928_CLKGATE_CON (7 ),1 ,GFLAGS ), GATE(0, "hclk_cpubus", "hclk_cpu", 0, RK2928_CLKGATE_CON(4), 8, GFLAGS),/* hclk_ahb2apb is part of a clk branch */
@@ -634,8 +633,9 @@ static struct rockchip_clk_branch rk3066a_clk_branches[] __initdata = { RK2928_CLKGATE_CON(0), 12, GFLAGS, &rk3066a_i2s2_fracmux), -GATE (HCLK_I2S1 ,"hclk_i2s1" ,"hclk_cpu" ,0 ,RK2928_CLKGATE_CON (7 ),3 ,GFLAGS ), -GATE (HCLK_I2S2 ,"hclk_i2s2" ,"hclk_cpu" ,0 ,RK2928_CLKGATE_CON (7 ),4 ,GFLAGS ), +GATE (HCLK_I2S0 ,"hclk_i2s0" ,"hclk_cpu" ,0 ,RK2928_CLKGATE_CON (7 ),4 ,GFLAGS ), +GATE (HCLK_I2S1 ,"hclk_i2s1" ,"hclk_cpu" ,0 ,RK2928_CLKGATE_CON (7 ),2 ,GFLAGS ), +GATE (HCLK_I2S2 ,"hclk_i2s2" ,"hclk_cpu" ,0 ,RK2928_CLKGATE_CON (7 ),3 ,GFLAGS ),GATE (HCLK_CIF1 ,"hclk_cif1" ,"hclk_cpu" ,0 ,RK2928_CLKGATE_CON (6 ),6 ,GFLAGS ), GATE(HCLK_HDMI, "hclk_hdmi", "hclk_cpu", 0, RK2928_CLKGATE_CON(4), 14, GFLAGS),
@@ -728,6 +728,7 @@ static struct rockchip_clk_branch rk3188_clk_branches[] __initdata = { RK2928_CLKGATE_CON(0), 10, GFLAGS, &rk3188_i2s0_fracmux), +GATE (HCLK_I2S0 ,"hclk_i2s0" ,"hclk_cpu" ,0 ,RK2928_CLKGATE_CON (7 ),2 ,GFLAGS ),GATE (0 ,"hclk_imem0" ,"hclk_cpu" ,0 ,RK2928_CLKGATE_CON (4 ),14 ,GFLAGS ), GATE(0, "hclk_imem1", "hclk_cpu", 0, RK2928_CLKGATE_CON(4), 15, GFLAGS),
Signature · 1 line
2.11.0
PATCH v4 3/7 dt-bindings: display: add #sound-dai-cells property to rockchip rk3066 hdmi
In reply to Johan Jonker'#sound-dai-cells' is required to properly interpret the list of DAI specified in the 'sound-dai' property. Add it to rockchip,rk3066-hdmi.yaml to document that the rk3066 HDMI TX also can be used to transmit some audio.
--- .../devicetree/bindings/display/rockchip/rockchip,rk3066-hdmi.yaml | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/display/rockchip/rockchip,rk3066-hdmi.yaml +4 -0
@@ -42,6 +42,9 @@ properties: description: This soc uses GRF regs to switch the HDMI TX input between vop0 and vop1. + "#sound-dai-cells": + const: 0 + ports: type: object
@@ -101,6 +104,7 @@ examples: pinctrl-names = "default"; power-domains = <&power RK3066_PD_VIO>; rockchip,grf = <&grf>; + #sound-dai-cells = <0>; ports { #address-cells = <1>;
Signature · 1 line
2.11.0
PATCH v4 4/7 drm: rockchip: add sound support to rk3066 hdmi driver
In reply to Johan JonkerFrom: Zheng Yang <[email protected]>
Add sound support to the rk3066 HDMI driver.
The I2S input of the HDMI TX allows transmission of DVD-Audio and decoded Dolby Digital
to A/V Receivers and high-end displays.
The interface supports 2 to 8 channels audio up to 192 kHz. The HDMI TX supports variable word length of
16bits to 32bits for I2S audio inputs.(This driver 24bit max) There are three I2S input modes supported.(This driver HDMI_I2S only) On RK3066/PX2 the HDMI TX audio source is connected to I2S_8CH.
--- drivers/gpu/drm/rockchip/Kconfig | 2 + drivers/gpu/drm/rockchip/rk3066_hdmi.c | 272 ++++++++++++++++++++++++++++++++- 2 files changed, 273 insertions(+), 1 deletion(-)
drivers/gpu/drm/rockchip/Kconfig +2 -0
@@ -11,6 +11,8 @@ config DRM_ROCKCHIP select DRM_DW_MIPI_DSI if ROCKCHIP_DW_MIPI_DSI select DRM_RGB if ROCKCHIP_RGB select SND_SOC_HDMI_CODEC if ROCKCHIP_CDN_DP && SND_SOC + select SND_SOC_HDMI_CODEC if ROCKCHIP_RK3066_HDMI && SND_SOC + select SND_SOC_ROCKCHIP_I2S if ROCKCHIP_RK3066_HDMI && SND_SOC help Choose this option if you have a Rockchip soc chipset. This driver provides kernel mode setting and buffer
drivers/gpu/drm/rockchip/rk3066_hdmi.c +271 -1
340 lines not on this page · raw message
Signature · 1 line
2.11.0
kernel test robot
build botRe: [PATCH v4 4/7] drm: rockchip: add sound support to rk3066 hdmi driver
Thank you for the patch! Perhaps something to improve:
Hi Johan,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on rockchip/for-next]
[also build test WARNING on robh/for-next asoc/for-next sound/for-next v5.10-rc4 next-20201117] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Johan-Jonker/Enable-rk3066a-HDMI-sound/20201118-034916 base: https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git for-next config: nios2-allyesconfig (attached as .config) compiler: nios2-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/4fd170243d9bc7618270dff969e138b05db0f945
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Johan-Jonker/Enable-rk3066a-HDMI-sound/20201118-034916 git checkout 4fd170243d9bc7618270dff969e138b05db0f945
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nios2
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
drivers/gpu/drm/rockchip/rk3066_hdmi.c: In function 'rk3066_hdmi_config_aai':
>> drivers/gpu/drm/rockchip/rk3066_hdmi.c:227:31: warning: variable 'faudio' set but not used [-Wunused-but-set-variable]
227 | struct hdmi_audio_infoframe *faudio;
| ^~~~~~vim +/faudio +227 drivers/gpu/drm/rockchip/rk3066_hdmi.c
223
224 static int rk3066_hdmi_config_aai(struct rk3066_hdmi *hdmi,
225 struct audio_info *audio)
226 {
> 227 struct hdmi_audio_infoframe *faudio;
228 union hdmi_infoframe frame;
229 int rc;
230
231 rc = hdmi_audio_infoframe_init(&frame.audio);
232 faudio = (struct hdmi_audio_infoframe *)&frame;
233
234 return rk3066_hdmi_upload_frame(hdmi, rc, &frame,
235 HDMI_INFOFRAME_AAI, 0, 0, 0);
236 }
237
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
PATCH v4 5/7 ARM: dts: rockchip: rk3066a: add #sound-dai-cells to hdmi node
In reply to Johan Jonker'#sound-dai-cells' is required to properly interpret the list of DAI specified in the 'sound-dai' property, so add them to the 'hdmi' node for 'rk3066a.dtsi'.
--- arch/arm/boot/dts/rk3066a.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/rk3066a.dtsi +1 -0
@@ -124,6 +124,7 @@ pinctrl-0 = <&hdmii2c_xfer>, <&hdmi_hpd>; power-domains = <&power RK3066_PD_VIO>; rockchip,grf = <&grf>; + #sound-dai-cells = <0>; status = "disabled"; ports {
Signature · 1 line
2.11.0
PATCH v4 6/7 ARM: dts: rockchip: add hdmi-sound node to rk3066a.dtsi
In reply to Johan JonkerAdd hdmi-sound node to rk3066a.dtsi, so that it
can be reused by boards with HDMI support.
--- arch/arm/boot/dts/rk3066a.dtsi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/arm/boot/dts/rk3066a.dtsi +16 -0
@@ -49,6 +49,22 @@ ports = <&vop0_out>, <&vop1_out>; }; + hdmi_sound: hdmi-sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "HDMI"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + status = "disabled"; + + simple-audio-card,codec { + sound-dai = <&hdmi>; + }; + + simple-audio-card,cpu { + sound-dai = <&i2s0>; + }; + }; + sram: sram@10080000 { compatible = "mmio-sram"; reg = <0x10080000 0x10000>;
Signature · 1 line
2.11.0
PATCH v4 7/7 ARM: dts: rockchip: enable hdmi_sound and i2s0 for rk3066a-mk808
In reply to Johan JonkerMake some noise with mk808. Enable the hdmi_sound node and add i2s0 as sound source for hdmi.
--- arch/arm/boot/dts/rk3066a-mk808.dts | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/rk3066a-mk808.dts +8 -0
@@ -116,6 +116,14 @@ }; }; +&hdmi_sound { + status = "okay"; +}; + +&i2s0 { + status = "okay"; +}; + &mmc0 { bus-width = <4>; cap-mmc-highspeed;
Signature · 1 line
2.11.0