Add TDM audio on StarFive JH7110
Subsystems (6)
Walker Chen
maintainerPATCH 2/3 ASoC: starfive: Add JH7110 TDM driver
In reply to Walker ChenAdd tdm driver support for the StarFive JH7110 SoC.
--- MAINTAINERS | 6 + sound/soc/Kconfig | 1 + sound/soc/Makefile | 1 + sound/soc/starfive/Kconfig | 15 + sound/soc/starfive/Makefile | 2 + sound/soc/starfive/jh7110_tdm.c | 579 ++++++++++++++++++++++++++++++++ sound/soc/starfive/jh7110_tdm.h | 155 +++++++++ 7 files changed, 759 insertions(+) create mode 100644 sound/soc/starfive/Kconfig create mode 100644 sound/soc/starfive/Makefile create mode 100644 sound/soc/starfive/jh7110_tdm.c create mode 100644 sound/soc/starfive/jh7110_tdm.h
MAINTAINERS +6 -0
@@ -19952,6 +19952,12 @@ F: Documentation/devicetree/bindings/power/starfive* F: drivers/soc/starfive/jh71xx_pmu.c F: include/dt-bindings/power/starfive,jh7110-pmu.h +STARFIVE JH7110 TDM DRIVERS +M: Walker Chen <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/sound/starfive,jh7110-tdm.yaml +F: sound/soc/starfive/jh7110-tdm.* + STARFIVE SOC DRIVERS M: Conor Dooley <[email protected]> S: Maintained
sound/soc/Kconfig +1 -0
@@ -91,6 +91,7 @@ source "sound/soc/sh/Kconfig" source "sound/soc/sof/Kconfig" source "sound/soc/spear/Kconfig" source "sound/soc/sprd/Kconfig" +source "sound/soc/starfive/Kconfig" source "sound/soc/sti/Kconfig" source "sound/soc/stm/Kconfig" source "sound/soc/sunxi/Kconfig"
sound/soc/Makefile +1 -0
@@ -59,6 +59,7 @@ obj-$(CONFIG_SND_SOC) += sh/ obj-$(CONFIG_SND_SOC) += sof/ obj-$(CONFIG_SND_SOC) += spear/ obj-$(CONFIG_SND_SOC) += sprd/ +obj-$(CONFIG_SND_SOC) += starfive/ obj-$(CONFIG_SND_SOC) += sti/ obj-$(CONFIG_SND_SOC) += stm/ obj-$(CONFIG_SND_SOC) += sunxi/
sound/soc/starfive/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-only +config SND_SOC_STARFIVE + tristate "Audio support for StarFive SoC" + depends on COMPILE_TEST || SOC_STARFIVE + help + Say Y or M if you want to add support for codecs attached to + the Starfive SoCs' Audio interfaces. You will also need to + select the audio interfaces to support below. + +config SND_SOC_JH7110_TDM + tristate "JH7110 TDM device driver" + depends on HAVE_CLK && SND_SOC_STARFIVE + select SND_SOC_GENERIC_DMAENGINE_PCM + help + Say Y or M if you want to add support for StarFive TDM driver.
sound/soc/starfive/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +# StarFive Platform Support +obj-$(CONFIG_SND_SOC_JH7110_TDM) += jh7110_tdm.o
sound/soc/starfive/jh7110_tdm.c new file +579 -0
579 lines not on this page · raw message
sound/soc/starfive/jh7110_tdm.h new file +155 -0
155 lines not on this page · raw message
Signature · 1 line
2.17.1
Walker Chen
maintainercover Add TDM audio on StarFive JH7110
This patchset adds TDM audio driver for the StarFive JH7110 SoC. The first patch adds device tree binding for TDM module. The second patch adds tdm driver support for JH7110 SoC. The last patch adds device node of tdm and sound card to JH7110 dts.
The series has been tested on the VisionFive 2 boards which equip with JH7110 SoC and works normally.
The last patch should be applied after the following patchset:
https://lore.kernel.org/all/[email protected]/
Walker Chen (3):
dt-bindings: sound: Add TDM for StarFive JH7110
ASoC: starfive: Add JH7110 TDM driver
riscv: dts: starfive: add tdm node and sound card
.../bindings/sound/starfive,jh7110-tdm.yaml | 95 +++ MAINTAINERS | 6 + .../jh7110-starfive-visionfive-2.dtsi | 87 +++ arch/riscv/boot/dts/starfive/jh7110.dtsi | 34 + sound/soc/Kconfig | 1 + sound/soc/Makefile | 1 + sound/soc/starfive/Kconfig | 15 + sound/soc/starfive/Makefile | 2 + sound/soc/starfive/jh7110_tdm.c | 579 ++++++++++++++++++ sound/soc/starfive/jh7110_tdm.h | 155 +++++ 10 files changed, 975 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/starfive,jh7110-tdm.yaml create mode 100644 sound/soc/starfive/Kconfig create mode 100644 sound/soc/starfive/Makefile create mode 100644 sound/soc/starfive/jh7110_tdm.c create mode 100644 sound/soc/starfive/jh7110_tdm.h
base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6
prerequisite-patch-id: c3a6b87df79b338fc97766406d010fedb79ab428
prerequisite-patch-id: b49509523cf7c098f684647bdc4fdaece48b61bc
prerequisite-patch-id: 46cc850aa0e9e03ccf5ed23d8458babfca3d71af
prerequisite-patch-id: a6975e61ee5803fbd74b1c21ab925fd81c3c0eab
prerequisite-patch-id: ac150a8c622e858e088df8121093d448df49c245
prerequisite-patch-id: 044263ef2fb9f1e5a586edbf85d5f67814a28430
prerequisite-patch-id: 89f049f951e5acf75aab92541992f816fd0acc0d
prerequisite-patch-id: 9f3dbc9073eee89134e68977e941e457593c2757
prerequisite-patch-id: 8600b156a235be2b3db53be3f834e7a370e2cfb9
prerequisite-patch-id: 1b2d0982b18da060c82134f05bf3ce16425bac8d
prerequisite-patch-id: 090ba4b78d47bc19204916e76fdbc70021785388
prerequisite-patch-id: a5d9e0f7d4f8163f566678894cf693015119f2d9
prerequisite-patch-id: 4c12d958e3a3d629d86dddb1e4f099d8909393e0
prerequisite-patch-id: bb939c0c7c26b08addfccd890f9d3974b6eaec53
prerequisite-patch-id: 8f5c66dfb14403424044192f6fa05b347ad356a7
prerequisite-patch-id: fd93763b95469912bde9bdfa4cd827c8d5dba9c6
prerequisite-patch-id: 6987950c2eb4b3773b2df8f7934eff434244aeab
prerequisite-patch-id: 258ea5f9b8bf41b6981345dcc81795f25865d38f
prerequisite-patch-id: 8b6f2c9660c0ac0ee4e73e4c21aca8e6b75e81b9
prerequisite-patch-id: dbb0c0151b8bdf093e6ce79fd2fe3f60791a6e0b
prerequisite-patch-id: e7773c977a7b37692e9792b21cc4f17fa58f9215
prerequisite-patch-id: d57e95d31686772abc4c4d5aa1cadc344dc293cd
prerequisite-patch-id: 9f911969d0a550648493952c99096d26e05d4d83
prerequisite-patch-id: 2ddada18ab6ea5cd1da14212aaf59632f5203d40
prerequisite-patch-id: 398744c61913c76a35754de867c4f820ca7a8d99
prerequisite-patch-id: be3d7a6a13098884ec26cd5e543cc95c39045e35
prerequisite-patch-id: b3ce7955a80d90d992b7d1bca3409f465810b2bb
prerequisite-patch-id: db2f66860cc5b2fd2f71747c4428287b6e3153fb
prerequisite-patch-id: 9da71dcd3af4c68da9d855b43aab6927103e7525
prerequisite-patch-id: 2d9e4f185631549094b6136cf8717a507b68c5bb
prerequisite-patch-id: bb8e071ed43998874b9d98292c0dcdeedc0760ca
prerequisite-patch-id: cd0b464336aabfbfad96c1a3595c0f9ce9401638
prerequisite-patch-id: 24eab3d30274700c2be4727bece743c76d2618bd
prerequisite-patch-id: 584c256c9acb52ee2773d0c81c3f4977fc18155a
prerequisite-patch-id: 2bc43b375b470f7e8bbe937b78678ba3856e3b8f
prerequisite-patch-id: 32deea16304859842af5c2151bc41d91cf6dfc9b
prerequisite-patch-id: d85dbedbb3b36bbd6806f4eb84a2129c8f8963aa
prerequisite-patch-id: c0bdbdd3db98f7ebae0661dd331edac2c84c70f8
prerequisite-patch-id: 6abf359fa445f4104432ddee27044dfbfb128417
Signature · 1 line
2.17.1
Walker Chen
maintainerPATCH 1/3 dt-bindings: sound: Add TDM for StarFive JH7110
Add bindings to describe the TDM driver for the StarFive JH7110 SoC.
--- .../bindings/sound/starfive,jh7110-tdm.yaml | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/starfive,jh7110-tdm.yaml
Documentation/devicetree/bindings/sound/starfive,jh7110-tdm.yaml new file +95 -0
@@ -0,0 +1,95 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/starfive,jh7110-tdm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: StarFive JH7110 TDM Controller + +description: | + The TDM Controller is a Time Division Multiplexed audio interface + integrated in StarFive JH7110 SoC, allowing up to 8 channels of + audio over a serial interface. The TDM controller can operate both + in master and slave mode. + +maintainers: + - Walker Chen <[email protected]> + +properties: + compatible: + enum: + - starfive,jh7110-tdm + + reg: + maxItems: 1 + + clocks: + items: + - description: TDM AHB Clock + - description: TDM APB Clock + - description: TDM Internal Clock + - description: TDM Clock + - description: Inner MCLK + - description: TDM External Clock + + clock-names: + items: + - const: tdm_ahb + - const: tdm_apb + - const: tdm_internal + - const: tdm + - const: mclk_inner + - const: tdm_ext + + resets: + items: + - description: tdm ahb reset line + - description: tdm apb reset line + - description: tdm core reset line + + dmas: + items: + - description: RX DMA Channel + - description: TX DMA Channel + + dma-names: + items: + - const: rx + - const: tx + + "#sound-dai-cells": + const: 0 + +required: + - compatible + - reg + - clocks + - clock-names + - resets + - dmas + - dma-names + - "#sound-dai-cells" + +additionalProperties: false + +examples: + - | + tdm: tdm@10090000 { + compatible = "starfive,jh7110-tdm"; + reg = <0x10090000 0x1000>; + clocks = <&syscrg 184>, + <&syscrg 185>, + <&syscrg 186>, + <&syscrg 187>, + <&syscrg 17>, + <&tdm_ext>; + clock-names = "tdm_ahb", "tdm_apb", + "tdm_internal", "tdm", + "mclk_inner", "tdm_ext"; + resets = <&syscrg 105>, + <&syscrg 107>, + <&syscrg 106>; + dmas = <&dma 20>, <&dma 21>; + dma-names = "rx","tx"; + #sound-dai-cells = <0>; + };
Signature · 1 line
2.17.1
Walker Chen
maintainerPATCH 3/3 riscv: dts: starfive: add tdm node and sound card
In reply to Walker ChenAdd the tdm controller node and sound card for the StarFive JH7110 SoC.
--- .../jh7110-starfive-visionfive-2.dtsi | 87 +++++++++++++++++++ arch/riscv/boot/dts/starfive/jh7110.dtsi | 34 ++++++++ 2 files changed, 121 insertions(+)
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +87 -0
@@ -62,6 +62,10 @@ clock-frequency = <297000000>; }; +&wm8960_mclk { + clock-frequency = <24576000>; +}; + &i2srx_bclk_ext { clock-frequency = <12288000>; };
@@ -102,6 +106,14 @@ pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins>; status = "okay"; + + wm8960: codec@1a { + compatible = "wlf,wm8960"; + reg = <0x1a>; + #sound-dai-cells = <0>; + + wlf,shared-lrclk; + }; }; &i2c2 {
@@ -214,6 +226,40 @@ slew-rate = <0>; }; }; + + tdm0_pins: tdm0-pins { + tdm0-pins-tx { + pinmux = <GPIOMUX(44, GPOUT_SYS_TDM_TXD, + GPOEN_ENABLE, + GPI_NONE)>; + bias-pull-up; + drive-strength = <2>; + input-disable; + input-schmitt-disable; + slew-rate = <0>; + }; + + tdm0-pins-rx { + pinmux = <GPIOMUX(61, GPOUT_HIGH, + GPOEN_DISABLE, + GPI_SYS_TDM_RXD)>; + input-enable; + }; + + tdm0-pins-sync { + pinmux = <GPIOMUX(63, GPOUT_HIGH, + GPOEN_DISABLE, + GPI_SYS_TDM_SYNC)>; + input-enable; + }; + + tdm0-pins-pcmclk { + pinmux = <GPIOMUX(38, GPOUT_HIGH, + GPOEN_DISABLE, + GPI_SYS_TDM_CLK)>; + input-enable; + }; + }; }; &uart0 {
@@ -221,3 +267,44 @@ pinctrl-0 = <&uart0_pins>; status = "okay"; }; + +&tdm { + pinctrl-names = "default"; + pinctrl-0 = <&tdm0_pins>; + status = "okay"; +}; + +&sound0 { + simple-audio-card,dai-link@0 { + reg = <0>; + status = "okay"; + format = "dsp_a"; + bitclock-master = <&dailink_master>; + frame-master = <&dailink_master>; + + widgets = + "Microphone", "Mic Jack", + "Line", "Line In", + "Line", "Line Out", + "Speaker", "Speaker", + "Headphone", "Headphone Jack"; + routing = + "Headphone Jack", "HP_L", + "Headphone Jack", "HP_R", + "Speaker", "SPK_LP", + "Speaker", "SPK_LN", + "LINPUT1", "Mic Jack", + "LINPUT3", "Mic Jack", + "RINPUT1", "Mic Jack", + "RINPUT2", "Mic Jack"; + cpu { + sound-dai = <&tdm>; + }; + + dailink_master:codec { + sound-dai = <&wm8960>; + clocks = <&wm8960_mclk>; + clock-names = "mclk"; + }; + }; +};
arch/riscv/boot/dts/starfive/jh7110.dtsi +34 -0
@@ -210,6 +210,12 @@ #clock-cells = <0>; }; + wm8960_mclk: wm8960_mclk { + compatible = "fixed-clock"; + clock-output-names = "wm8960_mclk"; + #clock-cells = <0>; + }; + i2srx_bclk_ext: i2srx-bclk-ext-clock { compatible = "fixed-clock"; clock-output-names = "i2srx_bclk_ext";
@@ -375,6 +381,27 @@ status = "disabled"; }; + tdm: tdm@10090000 { + compatible = "starfive,jh7110-tdm"; + reg = <0x0 0x10090000 0x0 0x1000>; + clocks = <&syscrg JH7110_SYSCLK_TDM_AHB>, + <&syscrg JH7110_SYSCLK_TDM_APB>, + <&syscrg JH7110_SYSCLK_TDM_INTERNAL>, + <&syscrg JH7110_SYSCLK_TDM_TDM>, + <&syscrg JH7110_SYSCLK_MCLK_INNER>, + <&tdm_ext>; + clock-names = "tdm_ahb", "tdm_apb", + "tdm_internal", "tdm", + "mclk_inner", "tdm_ext"; + resets = <&syscrg JH7110_SYSRST_TDM_AHB>, + <&syscrg JH7110_SYSRST_TDM_APB>, + <&syscrg JH7110_SYSRST_TDM_CORE>; + dmas = <&dma 20>, <&dma 21>; + dma-names = "rx","tx"; + #sound-dai-cells = <0>; + status = "disabled"; + }; + stgcrg: clock-controller@10230000 { compatible = "starfive,jh7110-stgcrg"; reg = <0x0 0x10230000 0x0 0x10000>;
@@ -601,5 +628,12 @@ #reset-cells = <1>; power-domains = <&pwrc JH7110_PD_VOUT>; }; + + sound0: snd-card0 { + compatible = "simple-audio-card"; + simple-audio-card,name = "Starfive-TDM-Sound-Card"; + #address-cells = <1>; + #size-cells = <0>; + }; }; };
Signature · 1 line
2.17.1
Re: [PATCH v1 1/3] dt-bindings: sound: Add TDM for StarFive JH7110
In reply to Walker ChenQuoted 21 lines · Walker Chen
Add bindings to describe the TDM driver for the StarFive JH7110 SoC.
Signed-off-by Walker Chen <[email protected]>--- .../bindings/sound/starfive,jh7110-tdm.yaml | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/starfive,jh7110-tdm.yamlDocumentation/devicetree/bindings/sound/starfive,jh7110-tdm.yaml new file +7
-0@@ -0,0 +1,95 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/starfive,jh7110-tdm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: StarFive JH7110 TDM Controller
Documentation/devicetree/bindings/sound/starfive,jh7110-tdm.yaml line 17
Quoted 10 lines
Documentation/devicetree/bindings/sound/starfive,jh7110-tdm.yaml new file +10
-0+ +description: | + The TDM Controller is a Time Division Multiplexed audio interface + integrated in StarFive JH7110 SoC, allowing up to 8 channels of + audio over a serial interface. The TDM controller can operate both + in master and slave mode. + +maintainers: + - Walker Chen <[email protected]> +
Missing allOf: with $ref to dai-common.
Quoted 7 lines
Documentation/devicetree/bindings/sound/starfive,jh7110-tdm.yaml new file +7
-0+properties: + compatible: + enum: + - starfive,jh7110-tdm + + reg: + maxItems: 1
(...)
Quoted 5 lines
Documentation/devicetree/bindings/sound/starfive,jh7110-tdm.yaml new file +5
-0+required: + - compatible + - reg + - clocks + - clock-names
Documentation/devicetree/bindings/sound/starfive,jh7110-tdm.yaml line 77
Quoted 10 lines
Documentation/devicetree/bindings/sound/starfive,jh7110-tdm.yaml new file +10
-0+ - resets + - dmas + - dma-names + - "#sound-dai-cells" + +additionalProperties: false + +examples: + - | + tdm: tdm@10090000 {
Drop tdm label, not used.
Best regards,
Krzysztof
Re: [PATCH v1 3/3] riscv: dts: starfive: add tdm node and sound card
In reply to Walker ChenQuoted 84 lines · Walker Chen
Add the tdm controller node and sound card for the StarFive JH7110 SoC.
Signed-off-by Walker Chen <[email protected]>--- .../jh7110-starfive-visionfive-2.dtsi | 87 +++++++++++++++++++ arch/riscv/boot/dts/starfive/jh7110.dtsi | 34 ++++++++ 2 files changed, 121 insertions(+)arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +47
-0@@ -62,6 +62,10 @@ clock-frequency = <297000000>; }; +&wm8960_mclk { + clock-frequency = <24576000>; +}; + &i2srx_bclk_ext { clock-frequency = <12288000>; };@@ -102,6 +106,14 @@ pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins>; status = "okay"; + + wm8960: codec@1a { + compatible = "wlf,wm8960"; + reg = <0x1a>; + #sound-dai-cells = <0>; + + wlf,shared-lrclk; + }; }; &i2c2 {@@ -214,6 +226,40 @@ slew-rate = <0>; }; }; + + tdm0_pins: tdm0-pins { + tdm0-pins-tx { + pinmux = <GPIOMUX(44, GPOUT_SYS_TDM_TXD, + GPOEN_ENABLE, + GPI_NONE)>; + bias-pull-up; + drive-strength = <2>; + input-disable; + input-schmitt-disable; + slew-rate = <0>; + }; + + tdm0-pins-rx { + pinmux = <GPIOMUX(61, GPOUT_HIGH, + GPOEN_DISABLE, + GPI_SYS_TDM_RXD)>; + input-enable; + }; + + tdm0-pins-sync { + pinmux = <GPIOMUX(63, GPOUT_HIGH, + GPOEN_DISABLE, + GPI_SYS_TDM_SYNC)>; + input-enable; + }; + + tdm0-pins-pcmclk { + pinmux = <GPIOMUX(38, GPOUT_HIGH, + GPOEN_DISABLE, + GPI_SYS_TDM_CLK)>; + input-enable; + }; + }; }; &uart0 {@@ -221,3 +267,44 @@ pinctrl-0 = <&uart0_pins>; status = "okay"; }; +
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi line 280
Quoted 10 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +10
-0+&tdm { + pinctrl-names = "default"; + pinctrl-0 = <&tdm0_pins>; + status = "okay"; +}; + +&sound0 { + simple-audio-card,dai-link@0 { + reg = <0>; + status = "okay";
Why? Drop.
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi line 285
Quoted 5 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +5
-0+ format = "dsp_a"; + bitclock-master = <&dailink_master>; + frame-master = <&dailink_master>; + + widgets =
Drop line break.
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi line 291
Quoted 6 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +6
-0+ "Microphone", "Mic Jack", + "Line", "Line In", + "Line", "Line Out", + "Speaker", "Speaker", + "Headphone", "Headphone Jack"; + routing =
Drop unnecessary line break.
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi line 304
Quoted 13 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +13
-0+ "Headphone Jack", "HP_L", + "Headphone Jack", "HP_R", + "Speaker", "SPK_LP", + "Speaker", "SPK_LN", + "LINPUT1", "Mic Jack", + "LINPUT3", "Mic Jack", + "RINPUT1", "Mic Jack", + "RINPUT2", "Mic Jack"; + cpu { + sound-dai = <&tdm>; + }; + + dailink_master:codec {
Missing space after label:.
Quoted 11 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +6
-0+ sound-dai = <&wm8960>; + clocks = <&wm8960_mclk>; + clock-names = "mclk"; + }; + }; +};arch/riscv/boot/dts/starfive/jh7110.dtsi +0
-0
arch/riscv/boot/dts/starfive/jh7110.dtsi line 213
Quoted 4 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi +1
-0@@ -210,6 +210,12 @@ #clock-cells = <0>; }; + wm8960_mclk: wm8960_mclk {
No underscores in node names. Use consistent naming - do you see here any nodes named "mclk"?
Anyway this is some fake clock. Real clock should come out from wm8960.
Quoted 37 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi +26
-0+ compatible = "fixed-clock"; + clock-output-names = "wm8960_mclk"; + #clock-cells = <0>; + }; + i2srx_bclk_ext: i2srx-bclk-ext-clock { compatible = "fixed-clock"; clock-output-names = "i2srx_bclk_ext";@@ -375,6 +381,27 @@ status = "disabled"; }; + tdm: tdm@10090000 { + compatible = "starfive,jh7110-tdm"; + reg = <0x0 0x10090000 0x0 0x1000>; + clocks = <&syscrg JH7110_SYSCLK_TDM_AHB>, + <&syscrg JH7110_SYSCLK_TDM_APB>, + <&syscrg JH7110_SYSCLK_TDM_INTERNAL>, + <&syscrg JH7110_SYSCLK_TDM_TDM>, + <&syscrg JH7110_SYSCLK_MCLK_INNER>, + <&tdm_ext>; + clock-names = "tdm_ahb", "tdm_apb", + "tdm_internal", "tdm", + "mclk_inner", "tdm_ext"; + resets = <&syscrg JH7110_SYSRST_TDM_AHB>, + <&syscrg JH7110_SYSRST_TDM_APB>, + <&syscrg JH7110_SYSRST_TDM_CORE>; + dmas = <&dma 20>, <&dma 21>; + dma-names = "rx","tx"; + #sound-dai-cells = <0>; + status = "disabled"; + }; + stgcrg: clock-controller@10230000 { compatible = "starfive,jh7110-stgcrg"; reg = <0x0 0x10230000 0x0 0x10000>;
arch/riscv/boot/dts/starfive/jh7110.dtsi line 632
Quoted 5 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi +2
-0@@ -601,5 +628,12 @@ #reset-cells = <1>; power-domains = <&pwrc JH7110_PD_VOUT>; }; + + sound0: snd-card0 {
1. Why card0?
2. Where is this node located? In MMIO bus? Run some basic checks on your DTS before submitting upstream.dtbs_check
dtbs W=1
3. Why this is even in the DTSI? This really looks wrong.
arch/riscv/boot/dts/starfive/jh7110.dtsi line 636
Quoted 4 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi +4
-0+ compatible = "simple-audio-card"; + simple-audio-card,name = "Starfive-TDM-Sound-Card"; + #address-cells = <1>; + #size-cells = <0>;
Best regards,
Krzysztof
Re: [PATCH v1 3/3] riscv: dts: starfive: add tdm node and sound card
Quoted 52 lines · Krzysztof Kozlowski
Quoted 39 lines · Walker Chen
Add the tdm controller node and sound card for the StarFive JH7110 SoC.
arch/riscv/boot/dts/starfive/jh7110.dtsi +26
-0+ compatible = "fixed-clock"; + clock-output-names = "wm8960_mclk"; + #clock-cells = <0>; + }; + i2srx_bclk_ext: i2srx-bclk-ext-clock { compatible = "fixed-clock"; clock-output-names = "i2srx_bclk_ext";@@ -375,6 +381,27 @@ status = "disabled"; }; + tdm: tdm@10090000 { + compatible = "starfive,jh7110-tdm"; + reg = <0x0 0x10090000 0x0 0x1000>; + clocks = <&syscrg JH7110_SYSCLK_TDM_AHB>, + <&syscrg JH7110_SYSCLK_TDM_APB>, + <&syscrg JH7110_SYSCLK_TDM_INTERNAL>, + <&syscrg JH7110_SYSCLK_TDM_TDM>, + <&syscrg JH7110_SYSCLK_MCLK_INNER>, + <&tdm_ext>; + clock-names = "tdm_ahb", "tdm_apb", + "tdm_internal", "tdm", + "mclk_inner", "tdm_ext"; + resets = <&syscrg JH7110_SYSRST_TDM_AHB>, + <&syscrg JH7110_SYSRST_TDM_APB>, + <&syscrg JH7110_SYSRST_TDM_CORE>; + dmas = <&dma 20>, <&dma 21>; + dma-names = "rx","tx"; + #sound-dai-cells = <0>; + status = "disabled"; + }; + stgcrg: clock-controller@10230000 { compatible = "starfive,jh7110-stgcrg"; reg = <0x0 0x10230000 0x0 0x10000>;arch/riscv/boot/dts/starfive/jh7110.dtsi line 632
Quoted 5 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi +2
-0@@ -601,5 +628,12 @@ #reset-cells = <1>; power-domains = <&pwrc JH7110_PD_VOUT>; }; + + sound0: snd-card0 {1. Why card0?
2. Where is this node located? In MMIO bus? Run some basic checks on your DTS before submitting upstream.dtbs_check
dtbs W=1
Quoted 1 line
3. Why this is even in the DTSI? This really looks wrong.
Excuse me for not following here, but Walker, could you point me at where in the schematic for the VisionFive 2 that this wm8960 actually is?
I know ~nothing about audio, but good old Google tells me that this is a dedicated codec chip and I was looking at [1] and could not easily find it on the schematic.
Thanks,
Conor.
1 https://doc-en.rvspace.org/VisionFive2/PDF/SCH_RV002_V1.2A_20221216.pdf
Re: [PATCH v1 3/3] riscv: dts: starfive: add tdm node and sound card
In reply to Krzysztof KozlowskiQuoted 52 lines · Krzysztof Kozlowski
Quoted 39 lines · Walker Chen
Add the tdm controller node and sound card for the StarFive JH7110 SoC.
arch/riscv/boot/dts/starfive/jh7110.dtsi +26
-0+ compatible = "fixed-clock"; + clock-output-names = "wm8960_mclk"; + #clock-cells = <0>; + }; + i2srx_bclk_ext: i2srx-bclk-ext-clock { compatible = "fixed-clock"; clock-output-names = "i2srx_bclk_ext";@@ -375,6 +381,27 @@ status = "disabled"; }; + tdm: tdm@10090000 { + compatible = "starfive,jh7110-tdm"; + reg = <0x0 0x10090000 0x0 0x1000>; + clocks = <&syscrg JH7110_SYSCLK_TDM_AHB>, + <&syscrg JH7110_SYSCLK_TDM_APB>, + <&syscrg JH7110_SYSCLK_TDM_INTERNAL>, + <&syscrg JH7110_SYSCLK_TDM_TDM>, + <&syscrg JH7110_SYSCLK_MCLK_INNER>, + <&tdm_ext>; + clock-names = "tdm_ahb", "tdm_apb", + "tdm_internal", "tdm", + "mclk_inner", "tdm_ext"; + resets = <&syscrg JH7110_SYSRST_TDM_AHB>, + <&syscrg JH7110_SYSRST_TDM_APB>, + <&syscrg JH7110_SYSRST_TDM_CORE>; + dmas = <&dma 20>, <&dma 21>; + dma-names = "rx","tx"; + #sound-dai-cells = <0>; + status = "disabled"; + }; + stgcrg: clock-controller@10230000 { compatible = "starfive,jh7110-stgcrg"; reg = <0x0 0x10230000 0x0 0x10000>;arch/riscv/boot/dts/starfive/jh7110.dtsi line 632
Quoted 5 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi +2
-0@@ -601,5 +628,12 @@ #reset-cells = <1>; power-domains = <&pwrc JH7110_PD_VOUT>; }; + + sound0: snd-card0 {1. Why card0?
2. Where is this node located? In MMIO bus? Run some basic checks on your DTS before submitting upstream.dtbs_check
dtbs W=1
Quoted 1 line
3. Why this is even in the DTSI? This really looks wrong.
Excuse me for not following here, but Walker, could you point me at where in the schematic for the VisionFive 2 that this wm8960 actually is?
I know ~nothing about audio, but good old Google tells me that this is a dedicated codec chip and I was looking at [1] and could not easily find it on the schematic.
Thanks,
Conor.
1 https://doc-en.rvspace.org/VisionFive2/PDF/SCH_RV002_V1.2A_20221216.pdf
Walker Chen
maintainerRe: [PATCH v1 3/3] riscv: dts: starfive: add tdm node and sound card
In reply to Conor DooleyQuoted 62 lines · Conor Dooley
Quoted 52 lines · Krzysztof Kozlowski
Quoted 39 lines · Walker Chen
Add the tdm controller node and sound card for the StarFive JH7110 SoC.
arch/riscv/boot/dts/starfive/jh7110.dtsi +26
-0+ compatible = "fixed-clock"; + clock-output-names = "wm8960_mclk"; + #clock-cells = <0>; + }; + i2srx_bclk_ext: i2srx-bclk-ext-clock { compatible = "fixed-clock"; clock-output-names = "i2srx_bclk_ext";@@ -375,6 +381,27 @@ status = "disabled"; }; + tdm: tdm@10090000 { + compatible = "starfive,jh7110-tdm"; + reg = <0x0 0x10090000 0x0 0x1000>; + clocks = <&syscrg JH7110_SYSCLK_TDM_AHB>, + <&syscrg JH7110_SYSCLK_TDM_APB>, + <&syscrg JH7110_SYSCLK_TDM_INTERNAL>, + <&syscrg JH7110_SYSCLK_TDM_TDM>, + <&syscrg JH7110_SYSCLK_MCLK_INNER>, + <&tdm_ext>; + clock-names = "tdm_ahb", "tdm_apb", + "tdm_internal", "tdm", + "mclk_inner", "tdm_ext"; + resets = <&syscrg JH7110_SYSRST_TDM_AHB>, + <&syscrg JH7110_SYSRST_TDM_APB>, + <&syscrg JH7110_SYSRST_TDM_CORE>; + dmas = <&dma 20>, <&dma 21>; + dma-names = "rx","tx"; + #sound-dai-cells = <0>; + status = "disabled"; + }; + stgcrg: clock-controller@10230000 { compatible = "starfive,jh7110-stgcrg"; reg = <0x0 0x10230000 0x0 0x10000>;arch/riscv/boot/dts/starfive/jh7110.dtsi line 632
Quoted 5 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi +2
-0@@ -601,5 +628,12 @@ #reset-cells = <1>; power-domains = <&pwrc JH7110_PD_VOUT>; }; + + sound0: snd-card0 {1. Why card0?
2. Where is this node located? In MMIO bus? Run some basic checks on your DTS before submitting upstream.dtbs_check
dtbs W=1Quoted 1 line
3. Why this is even in the DTSI? This really looks wrong.
Excuse me for not following here, but Walker, could you point me at where in the schematic for the VisionFive 2 that this wm8960 actually is?
I know ~nothing about audio, but good old Google tells me that this is a dedicated codec chip and I was looking at [1] and could not easily find it on the schematic.
Quoted 4 lines
Thanks,
Conor.1 https://doc-en.rvspace.org/VisionFive2/PDF/SCH_RV002_V1.2A_20221216.pdf
Hi Conor,
The TDM need work together with external codec WM8960 by plugging the raspberry pie
audio board into the 40-pin, which is found in sheet 21 of the schematic. Because the 40-pin of VisionFive2 is fully compatible with the pins of Raspberry pie audio board.
For more information of the audio board, you can take a look at the following webpage:
https://wiki.seeedstudio.com/ReSpeaker_2_Mics_Pi_HAT/
The schematic of audio board:
https://files.seeedstudio.com/wiki/MIC_HATv1.0_for_raspberrypi/src/ReSpeaker%202-Mics%20Pi%20HAT_SCH.pdf
Best regards,
Walker
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Conor Dooley
maintainerRe: [PATCH v1 3/3] riscv: dts: starfive: add tdm node and sound card
Quoted 15 lines · Walker Chen
Quoted 8 lines · Conor Dooley
Excuse me for not following here, but Walker, could you point me at where in the schematic for the VisionFive 2 that this wm8960 actually is?
I know ~nothing about audio, but good old Google tells me that this is a dedicated codec chip and I was looking at [1] and could not easily find it on the schematic.1 https://doc-en.rvspace.org/VisionFive2/PDF/SCH_RV002_V1.2A_20221216.pdf
The TDM need work together with external codec WM8960 by plugging the raspberry pie
audio board into the 40-pin, which is found in sheet 21 of the schematic. Because the 40-pin of VisionFive2 is fully compatible with the pins of Raspberry pie audio board.
Quoted 5 lines
For more information of the audio board, you can take a look at the following webpage:
https://wiki.seeedstudio.com/ReSpeaker_2_Mics_Pi_HAT/The schematic of audio board:
https://files.seeedstudio.com/wiki/MIC_HATv1.0_for_raspberrypi/src/ReSpeaker%202-Mics%20Pi%20HAT_SCH.pdf
Ahh, I feared that this was the case. If it's not on the board, then it shouldn't be in the dts (and certainly nothing should be in jh7110.dtsi!).
I suppose this should be a dt-overlay, but I don't know anything about the upstream infrastructure for those. Nor do I know what is permitted in terms of overlays.
Thanks,
Conor.
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Walker Chen
maintainerRe: [PATCH v1 1/3] dt-bindings: sound: Add TDM for StarFive JH7110
In reply to Krzysztof KozlowskiQuoted 26 lines · Krzysztof Kozlowski
Quoted 25 lines · Walker Chen
Add bindings to describe the TDM driver for the StarFive JH7110 SoC.
Signed-off-by Walker Chen <[email protected]>--- .../bindings/sound/starfive,jh7110-tdm.yaml | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/starfive,jh7110-tdm.yamlDocumentation/devicetree/bindings/sound/starfive,jh7110-tdm.yaml new file +11
-0@@ -0,0 +1,95 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/starfive,jh7110-tdm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: StarFive JH7110 TDM Controller + +description: | + The TDM Controller is a Time Division Multiplexed audio interface + integrated in StarFive JH7110 SoC, allowing up to 8 channels of
Quoted 8 lines
Documentation/devicetree/bindings/sound/starfive,jh7110-tdm.yaml line 17
Quoted 6 lines
Documentation/devicetree/bindings/sound/starfive,jh7110-tdm.yaml new file +6
-0+ audio over a serial interface. The TDM controller can operate both + in master and slave mode. + +maintainers: + - Walker Chen <[email protected]> +Missing allOf: with $ref to dai-common.
Indeed missing allOf, thank you for kind reminding.
Quoted 20 lines
Quoted 8 lines
Documentation/devicetree/bindings/sound/starfive,jh7110-tdm.yaml new file +7
-0+properties: + compatible: + enum: + - starfive,jh7110-tdm + + reg: + maxItems: 1(...)
Quoted 9 lines
Documentation/devicetree/bindings/sound/starfive,jh7110-tdm.yaml new file +9
-0+required: + - compatible + - reg + - clocks + - clock-names + - resets + - dmas + - dma-names + - "#sound-dai-cells"
Quoted 8 lines
Documentation/devicetree/bindings/sound/starfive,jh7110-tdm.yaml line 77
Quoted 6 lines
Documentation/devicetree/bindings/sound/starfive,jh7110-tdm.yaml new file +6
-0+ +additionalProperties: false + +examples: + - | + tdm: tdm@10090000 {Drop tdm label, not used.
Ok, will drop it.
Best regards,
Walker
Walker Chen
maintainerRe: [PATCH v1 3/3] riscv: dts: starfive: add tdm node and sound card
In reply to Krzysztof KozlowskiQuoted 89 lines · Krzysztof Kozlowski
Quoted 88 lines · Walker Chen
Add the tdm controller node and sound card for the StarFive JH7110 SoC.
Signed-off-by Walker Chen <[email protected]>--- .../jh7110-starfive-visionfive-2.dtsi | 87 +++++++++++++++++++ arch/riscv/boot/dts/starfive/jh7110.dtsi | 34 ++++++++ 2 files changed, 121 insertions(+)arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +51
-0@@ -62,6 +62,10 @@ clock-frequency = <297000000>; }; +&wm8960_mclk { + clock-frequency = <24576000>; +}; + &i2srx_bclk_ext { clock-frequency = <12288000>; };@@ -102,6 +106,14 @@ pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins>; status = "okay"; + + wm8960: codec@1a { + compatible = "wlf,wm8960"; + reg = <0x1a>; + #sound-dai-cells = <0>; + + wlf,shared-lrclk; + }; }; &i2c2 {@@ -214,6 +226,40 @@ slew-rate = <0>; }; }; + + tdm0_pins: tdm0-pins { + tdm0-pins-tx { + pinmux = <GPIOMUX(44, GPOUT_SYS_TDM_TXD, + GPOEN_ENABLE, + GPI_NONE)>; + bias-pull-up; + drive-strength = <2>; + input-disable; + input-schmitt-disable; + slew-rate = <0>; + }; + + tdm0-pins-rx { + pinmux = <GPIOMUX(61, GPOUT_HIGH, + GPOEN_DISABLE, + GPI_SYS_TDM_RXD)>; + input-enable; + }; + + tdm0-pins-sync { + pinmux = <GPIOMUX(63, GPOUT_HIGH, + GPOEN_DISABLE, + GPI_SYS_TDM_SYNC)>; + input-enable; + }; + + tdm0-pins-pcmclk { + pinmux = <GPIOMUX(38, GPOUT_HIGH, + GPOEN_DISABLE, + GPI_SYS_TDM_CLK)>; + input-enable; + }; + }; }; &uart0 {@@ -221,3 +267,44 @@ pinctrl-0 = <&uart0_pins>; status = "okay"; }; + +&tdm { + pinctrl-names = "default"; + pinctrl-0 = <&tdm0_pins>; + status = "okay";
Quoted 8 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi line 280
Quoted 6 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +6
-0+}; + +&sound0 { + simple-audio-card,dai-link@0 { + reg = <0>; + status = "okay";Why? Drop.
Will drop it.
Quoted 8 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi line 285
Quoted 6 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +5
-0+ format = "dsp_a"; + bitclock-master = <&dailink_master>; + frame-master = <&dailink_master>; + + widgets =Drop line break.
OK, will drop it.
Quoted 9 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi line 291
Quoted 7 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +6
-0+ "Microphone", "Mic Jack", + "Line", "Line In", + "Line", "Line Out", + "Speaker", "Speaker", + "Headphone", "Headphone Jack"; + routing =Drop unnecessary line break.
OK, will drop it.
Quoted 16 lines
Quoted 4 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +3
-0+ "Headphone Jack", "HP_L", + "Headphone Jack", "HP_R", + "Speaker", "SPK_LP",arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi line 304
Quoted 10 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +10
-0+ "Speaker", "SPK_LN", + "LINPUT1", "Mic Jack", + "LINPUT3", "Mic Jack", + "RINPUT1", "Mic Jack", + "RINPUT2", "Mic Jack"; + cpu { + sound-dai = <&tdm>; + }; + + dailink_master:codec {Missing space after label:.
Will be fixed.
Quoted 15 lines
Quoted 15 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +6
-0+ sound-dai = <&wm8960>; + clocks = <&wm8960_mclk>; + clock-names = "mclk"; + }; + }; +};arch/riscv/boot/dts/starfive/jh7110.dtsi +0
-0@@ -210,6 +210,12 @@ #clock-cells = <0>; };
Quoted 6 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi line 213
Quoted 1 line
arch/riscv/boot/dts/starfive/jh7110.dtsi +1
-0+ wm8960_mclk: wm8960_mclk {No underscores in node names. Use consistent naming - do you see here any nodes named "mclk"?
Anyway this is some fake clock. Real clock should come out from wm8960.
Thank you for pointing out this, it will be fixed.
Quoted 37 lines
Quoted 37 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi +26
-0+ compatible = "fixed-clock"; + clock-output-names = "wm8960_mclk"; + #clock-cells = <0>; + }; + i2srx_bclk_ext: i2srx-bclk-ext-clock { compatible = "fixed-clock"; clock-output-names = "i2srx_bclk_ext";@@ -375,6 +381,27 @@ status = "disabled"; }; + tdm: tdm@10090000 { + compatible = "starfive,jh7110-tdm"; + reg = <0x0 0x10090000 0x0 0x1000>; + clocks = <&syscrg JH7110_SYSCLK_TDM_AHB>, + <&syscrg JH7110_SYSCLK_TDM_APB>, + <&syscrg JH7110_SYSCLK_TDM_INTERNAL>, + <&syscrg JH7110_SYSCLK_TDM_TDM>, + <&syscrg JH7110_SYSCLK_MCLK_INNER>, + <&tdm_ext>; + clock-names = "tdm_ahb", "tdm_apb", + "tdm_internal", "tdm", + "mclk_inner", "tdm_ext"; + resets = <&syscrg JH7110_SYSRST_TDM_AHB>, + <&syscrg JH7110_SYSRST_TDM_APB>, + <&syscrg JH7110_SYSRST_TDM_CORE>; + dmas = <&dma 20>, <&dma 21>; + dma-names = "rx","tx"; + #sound-dai-cells = <0>; + status = "disabled"; + }; + stgcrg: clock-controller@10230000 { compatible = "starfive,jh7110-stgcrg"; reg = <0x0 0x10230000 0x0 0x10000>;
Quoted 8 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi line 632
Quoted 6 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi +2
-0@@ -601,5 +628,12 @@ #reset-cells = <1>; power-domains = <&pwrc JH7110_PD_VOUT>; }; + + sound0: snd-card0 {1. Why card0?
There are several audio interfaces in JH7110 SoC, each as an independent sound card. TDM is for snd-card0, latter i2s will be for snd-card1, spdif will be for snd-card2, etc.
Quoted 6 lines
2. Where is this node located? In MMIO bus? Run some basic checks on your DTS before submitting upstream.
dtbs_check
dtbs W=13. Why this is even in the DTSI? This really looks wrong.
It seems that the sound node should be located in DTS file more appropriately.
Best regards,
Walker