2020-03-19 09:28:57

by Peter Ujfalusi

[permalink] [raw]
Subject: [PATCH 0/3] ASoC: ti: Add support for audio on J721e EVM

Hi,

This series adds support for the analog audio setup on the j721e EVM.
The audio setup of the EVM is:
Common Processor Board (CPB): McASP10 <-> pcm3168a
Infotainment Expansion Board (IVI): McASP0 <-> 2x pcm3168a

Both CPB and IVI wired in parallel serializer setup.

The first patch adds the stream_name for McASP driver as it is needed in
multicodec (and would be needed in DPCM) setup for proper DAPM handling.

The second patch adds two DT schema, one for the cpb and one for the cpb+ivi
card.

Regards,
Peter
---
Peter Ujfalusi (3):
ASoC: ti: davinci-mcasp: Specify stream_name for playback/capture
bindings: sound: Add documentation for TI j721e EVM (CPB and IVI)
ASoC: ti: Add custom machine driver for j721e EVM (CPB and IVI)

.../bindings/sound/ti,j721e-cpb-audio.yaml | 93 ++
.../sound/ti,j721e-cpb-ivi-audio.yaml | 145 +++
sound/soc/ti/Kconfig | 8 +
sound/soc/ti/Makefile | 2 +
sound/soc/ti/davinci-mcasp.c | 3 +
sound/soc/ti/j721e-evm.c | 864 ++++++++++++++++++
6 files changed, 1115 insertions(+)
create mode 100644 Documentation/devicetree/bindings/sound/ti,j721e-cpb-audio.yaml
create mode 100644 Documentation/devicetree/bindings/sound/ti,j721e-cpb-ivi-audio.yaml
create mode 100644 sound/soc/ti/j721e-evm.c

--
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


2020-03-19 09:30:17

by Peter Ujfalusi

[permalink] [raw]
Subject: [PATCH 2/3] bindings: sound: Add documentation for TI j721e EVM (CPB and IVI)

The audio support on the Common Processor Board board is using
pcm3168a codec connected to McASP10 serializers in parallel setup.

The Infotainment board plugs into the Common Processor Board, the support
of the extension board is extending the CPB audio support by adding
the two codecs on the expansion board.

The audio support on the Infotainment Expansion Board consists of McASP0
connected to two pcm3168a codecs with dedicated set of serializers to each.
The SCKI for pcm3168a is sourced from j721e AUDIO_REFCLK0 pin.

Signed-off-by: Peter Ujfalusi <[email protected]>
---
.../bindings/sound/ti,j721e-cpb-audio.yaml | 93 +++++++++++
.../sound/ti,j721e-cpb-ivi-audio.yaml | 145 ++++++++++++++++++
2 files changed, 238 insertions(+)
create mode 100644 Documentation/devicetree/bindings/sound/ti,j721e-cpb-audio.yaml
create mode 100644 Documentation/devicetree/bindings/sound/ti,j721e-cpb-ivi-audio.yaml

diff --git a/Documentation/devicetree/bindings/sound/ti,j721e-cpb-audio.yaml b/Documentation/devicetree/bindings/sound/ti,j721e-cpb-audio.yaml
new file mode 100644
index 000000000000..0355ffc2b01b
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/ti,j721e-cpb-audio.yaml
@@ -0,0 +1,93 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/ti,j721e-cpb-audio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments J721e Common Processor Board Audio Support
+
+maintainers:
+ - Peter Ujfalusi <[email protected]>
+
+description: |
+ The audio support on the board is using pcm3168a codec connected to McASP10
+ serializers in parallel setup.
+ The pcm3168a SCKI clock is sourced from j721e AUDIO_REFCLK2 pin.
+ In order to support 48KHz and 44.1KHz family of sampling rates the parent
+ clock for AUDIO_REFCLK2 needs to be changed between PLL4 (for 48KHz) and
+ PLL15 (for 44.1KHz). The same PLLs are used for McASP10's AUXCLK clock via
+ different HSDIVIDER.
+
+properties:
+ compatible:
+ items:
+ - const: ti,j721e-cpb-audio
+
+ model:
+ $ref: /schemas/types.yaml#/definitions/string
+ description: User specified audio sound card name
+
+ ti,cpb-mcasp:
+ description: phandle to McASP10
+ allOf:
+ - $ref: /schemas/types.yaml#/definitions/phandle
+
+ ti,cpb-codec:
+ description: phandle to the pcm3168a codec used on the CPB
+ allOf:
+ - $ref: /schemas/types.yaml#/definitions/phandle
+
+ clocks:
+ items:
+ - description: PLL4 clock
+ - description: PLL15 clock
+ - description: McASP10 auxclk clock
+ - description: PLL4_HSDIV0 parent for McASP10 auxclk (for 48KHz)
+ - description: PLL15_HSDIV0 parent for McASP10 auxclk (for 44.1KHz)
+ - description: AUDIO_REFCLK2 clock
+ - description: PLL4_HSDIV2 parent for AUDIO_REFCLK2 clock (for 48KHz)
+ - description: PLL15_HSDIV2 parent for AUDIO_REFCLK2 clock (for 44.1KHz)
+
+ clock-names:
+ items:
+ - const: pll4
+ - const: pll15
+ - const: cpb-mcasp
+ - const: cpb-mcasp-48000
+ - const: cpb-mcasp-44100
+ - const: audio-refclk2
+ - const: audio-refclk2-48000
+ - const: audio-refclk2-44100
+
+required:
+ - compatible
+ - model
+ - ti,cpb-mcasp
+ - ti,cpb-codec
+ - clocks
+ - clock-names
+
+additionalProperties: false
+
+examples:
+ - |+
+ sound {
+ compatible = "ti,j721e-cpb-audio";
+ model = "j721e-cpb";
+
+ status = "okay";
+
+ ti,cpb-mcasp = <&mcasp10>;
+ ti,cpb-codec = <&pcm3168a_1>;
+
+ clocks = <&pll4>, <&pll15>,
+ <&k3_clks 184 1>,
+ <&k3_clks 184 2>, <&k3_clks 184 4>,
+ <&k3_clks 157 371>,
+ <&k3_clks 157 400>, <&k3_clks 157 401>;
+ clock-names = "pll4", "pll15",
+ "cpb-mcasp",
+ "cpb-mcasp-48000", "cpb-mcasp-44100",
+ "audio-refclk2",
+ "audio-refclk2-48000", "audio-refclk2-44100";
+ };
diff --git a/Documentation/devicetree/bindings/sound/ti,j721e-cpb-ivi-audio.yaml b/Documentation/devicetree/bindings/sound/ti,j721e-cpb-ivi-audio.yaml
new file mode 100644
index 000000000000..d02c66926418
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/ti,j721e-cpb-ivi-audio.yaml
@@ -0,0 +1,145 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/ti,j721e-cpb-audio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments J721e Common Processor Board Audio Support
+
+maintainers:
+ - Peter Ujfalusi <[email protected]>
+
+description: |
+ The Infotainment board plugs into the Common Processor Board, the support of the
+ extension board is extending the CPB audio support, decribed in:
+ sound/ti,j721e-cpb-audio.txt
+
+ The audio support on the Infotainment Expansion Board consists of McASP0
+ connected to two pcm3168a codecs with dedicated set of serializers to each.
+ The SCKI for pcm3168a is sourced from j721e AUDIO_REFCLK0 pin.
+
+ In order to support 48KHz and 44.1KHz family of sampling rates the parent clock
+ for AUDIO_REFCLK0 needs to be changed between PLL4 (for 48KHz) and PLL15 (for
+ 44.1KHz). The same PLLs are used for McASP0's AUXCLK clock via different
+ HSDIVIDER.
+
+ Note: the same PLL4 and PLL15 is used by the audio support on the CPB!
+
+allOf:
+ - $ref: "ti,j721e-cpb-audio.yaml#"
+
+properties:
+ compatible:
+ items:
+ - const: ti,j721e-cpb-ivi-audio
+
+ model:
+ $ref: /schemas/types.yaml#/definitions/string
+ description: User specified audio sound card name
+
+ ti,cpb-mcasp:
+ description: phandle to McASP10
+ allOf:
+ - $ref: /schemas/types.yaml#/definitions/phandle
+
+ ti,cpb-codec:
+ description: phandle to the pcm3168a codec used on the CPB
+ allOf:
+ - $ref: /schemas/types.yaml#/definitions/phandle
+
+ ti,ivi-mcasp:
+ description: phandle to McASP9
+ allOf:
+ - $ref: /schemas/types.yaml#/definitions/phandle
+
+ ti,ivi-codec-a:
+ description: phandle to the pcm3168a-A codec on the expansion board
+ allOf:
+ - $ref: /schemas/types.yaml#/definitions/phandle
+
+ ti,ivi-codec-b:
+ description: phandle to the pcm3168a-B codec on the expansion board
+ allOf:
+ - $ref: /schemas/types.yaml#/definitions/phandle
+
+ clocks:
+ items:
+ - description: PLL4 clock
+ - description: PLL15 clock
+ - description: McASP10 auxclk clock
+ - description: PLL4_HSDIV0 parent for McASP10 auxclk (for 48KHz)
+ - description: PLL15_HSDIV0 parent for McASP10 auxclk (for 44.1KHz)
+ - description: AUDIO_REFCLK2 clock
+ - description: PLL4_HSDIV2 parent for AUDIO_REFCLK2 clock (for 48KHz)
+ - description: PLL15_HSDIV2 parent for AUDIO_REFCLK2 clock (for 44.1KHz)
+ - description: McASP0 auxclk clock
+ - description: PLL4_HSDIV0 parent for McASP0 auxclk (for 48KHz)
+ - description: PLL15_HSDIV0 parent for McASP0 auxclk (for 44.1KHz)
+ - description: AUDIO_REFCLK0 clock
+ - description: PLL4_HSDIV2 parent for AUDIO_REFCLK0 clock (for 48KHz)
+ - description: PLL15_HSDIV2 parent for AUDIO_REFCLK0 clock (for 44.1KHz)
+
+ clock-names:
+ items:
+ - const: pll4
+ - const: pll15
+ - const: cpb-mcasp
+ - const: cpb-mcasp-48000
+ - const: cpb-mcasp-44100
+ - const: audio-refclk2
+ - const: audio-refclk2-48000
+ - const: audio-refclk2-44100
+ - const: ivi-mcasp
+ - const: ivi-mcasp-48000
+ - const: ivi-mcasp-44100
+ - const: audio-refclk0
+ - const: audio-refclk0-48000
+ - const: audio-refclk0-44100
+
+required:
+ - compatible
+ - model
+ - ti,cpb-mcasp
+ - ti,cpb-codec
+ - ti,ivi-mcasp
+ - ti,ivi-codec-a
+ - ti,ivi-codec-b
+ - clocks
+ - clock-names
+
+additionalProperties: false
+
+examples:
+ - |+
+ sound0: sound@0 {
+ compatible = "ti,j721e-cpb-ivi-audio";
+ model = "j721e-cpb-ivi
+
+ status = "okay";
+
+ ti,cpb-mcasp = <&mcasp10>;
+ ti,cpb-codec = <&pcm3168a_1>;
+
+ ti,ivi-mcasp = <&mcasp0>;
+ ti,ivi-codec-a = <&pcm3168a_a>;
+ ti,ivi-codec-b = <&pcm3168a_b>;
+
+ clocks = <&pll4>, <&pll15>,
+ <&k3_clks 184 1>,
+ <&k3_clks 184 2>, <&k3_clks 184 4>,
+ <&k3_clks 157 371>,
+ <&k3_clks 157 400>, <&k3_clks 157 401>,
+ <&k3_clks 174 1>,
+ <&k3_clks 174 2>, <&k3_clks 174 4>,
+ <&k3_clks 157 301>,
+ <&k3_clks 157 330>, <&k3_clks 157 331>;
+ clock-names = "pll4", "pll15",
+ "cpb-mcasp",
+ "cpb-mcasp-48000", "cpb-mcasp-44100",
+ "audio-refclk2",
+ "audio-refclk2-48000", "audio-refclk2-44100",
+ "ivi-mcasp",
+ "ivi-mcasp-48000", "ivi-mcasp-44100",
+ "audio-refclk0",
+ "audio-refclk0-48000", "audio-refclk0-44100";
+ };
--
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

2020-03-19 09:30:27

by Peter Ujfalusi

[permalink] [raw]
Subject: [PATCH 1/3] ASoC: ti: davinci-mcasp: Specify stream_name for playback/capture

In order to dai stream widgets to be created the stream_name must be set.

Signed-off-by: Peter Ujfalusi <[email protected]>
---
sound/soc/ti/davinci-mcasp.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
index 734ffe925c4d..9cccf6b7a8a2 100644
--- a/sound/soc/ti/davinci-mcasp.c
+++ b/sound/soc/ti/davinci-mcasp.c
@@ -1623,12 +1623,14 @@ static struct snd_soc_dai_driver davinci_mcasp_dai[] = {
.name = "davinci-mcasp.0",
.probe = davinci_mcasp_dai_probe,
.playback = {
+ .stream_name = "IIS Playback",
.channels_min = 1,
.channels_max = 32 * 16,
.rates = DAVINCI_MCASP_RATES,
.formats = DAVINCI_MCASP_PCM_FMTS,
},
.capture = {
+ .stream_name = "IIS Capture",
.channels_min = 1,
.channels_max = 32 * 16,
.rates = DAVINCI_MCASP_RATES,
@@ -1642,6 +1644,7 @@ static struct snd_soc_dai_driver davinci_mcasp_dai[] = {
.name = "davinci-mcasp.1",
.probe = davinci_mcasp_dai_probe,
.playback = {
+ .stream_name = "DIT Playback",
.channels_min = 1,
.channels_max = 384,
.rates = DAVINCI_MCASP_RATES,
--
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

2020-03-20 00:22:59

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 2/3] bindings: sound: Add documentation for TI j721e EVM (CPB and IVI)

On Thu, 19 Mar 2020 11:28:14 +0200, Peter Ujfalusi wrote:
> The audio support on the Common Processor Board board is using
> pcm3168a codec connected to McASP10 serializers in parallel setup.
>
> The Infotainment board plugs into the Common Processor Board, the support
> of the extension board is extending the CPB audio support by adding
> the two codecs on the expansion board.
>
> The audio support on the Infotainment Expansion Board consists of McASP0
> connected to two pcm3168a codecs with dedicated set of serializers to each.
> The SCKI for pcm3168a is sourced from j721e AUDIO_REFCLK0 pin.
>
> Signed-off-by: Peter Ujfalusi <[email protected]>
> ---
> .../bindings/sound/ti,j721e-cpb-audio.yaml | 93 +++++++++++
> .../sound/ti,j721e-cpb-ivi-audio.yaml | 145 ++++++++++++++++++
> 2 files changed, 238 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/sound/ti,j721e-cpb-audio.yaml
> create mode 100644 Documentation/devicetree/bindings/sound/ti,j721e-cpb-ivi-audio.yaml
>

My bot found errors running 'make dt_binding_check' on your patch:

Documentation/devicetree/bindings/sound/ti,j721e-cpb-ivi-audio.yaml: $id: relative path/filename doesn't match actual path or filename
expected: http://devicetree.org/schemas/sound/ti,j721e-cpb-ivi-audio.yaml#
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/sound/ti,j721e-cpb-audio.yaml: duplicate '$id' value 'http://devicetree.org/schemas/sound/ti,j721e-cpb-audio.yaml#'
Error: Documentation/devicetree/bindings/sound/ti,j721e-cpb-ivi-audio.example.dts:21.23-24 syntax error
FATAL ERROR: Unable to parse input tree
scripts/Makefile.lib:311: recipe for target 'Documentation/devicetree/bindings/sound/ti,j721e-cpb-ivi-audio.example.dt.yaml' failed
make[1]: *** [Documentation/devicetree/bindings/sound/ti,j721e-cpb-ivi-audio.example.dt.yaml] Error 1
make[1]: *** Waiting for unfinished jobs....
Makefile:1262: recipe for target 'dt_binding_check' failed
make: *** [dt_binding_check] Error 2

See https://patchwork.ozlabs.org/patch/1258054

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure dt-schema is up to date:

pip3 install git+https://github.com/devicetree-org/dt-schema.git@master --upgrade

Please check and re-submit.

2020-03-20 09:33:56

by Peter Ujfalusi

[permalink] [raw]
Subject: Re: [PATCH 2/3] bindings: sound: Add documentation for TI j721e EVM (CPB and IVI)

Rob,

On 20/03/2020 2.21, Rob Herring wrote:
> On Thu, 19 Mar 2020 11:28:14 +0200, Peter Ujfalusi wrote:
>> The audio support on the Common Processor Board board is using
>> pcm3168a codec connected to McASP10 serializers in parallel setup.
>>
>> The Infotainment board plugs into the Common Processor Board, the support
>> of the extension board is extending the CPB audio support by adding
>> the two codecs on the expansion board.
>>
>> The audio support on the Infotainment Expansion Board consists of McASP0
>> connected to two pcm3168a codecs with dedicated set of serializers to each.
>> The SCKI for pcm3168a is sourced from j721e AUDIO_REFCLK0 pin.
>>
>> Signed-off-by: Peter Ujfalusi <[email protected]>
>> ---
>> .../bindings/sound/ti,j721e-cpb-audio.yaml | 93 +++++++++++
>> .../sound/ti,j721e-cpb-ivi-audio.yaml | 145 ++++++++++++++++++
>> 2 files changed, 238 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/sound/ti,j721e-cpb-audio.yaml
>> create mode 100644 Documentation/devicetree/bindings/sound/ti,j721e-cpb-ivi-audio.yaml
>>
>
> My bot found errors running 'make dt_binding_check' on your patch:
>
> Documentation/devicetree/bindings/sound/ti,j721e-cpb-ivi-audio.yaml: $id: relative path/filename doesn't match actual path or filename
> expected: http://devicetree.org/schemas/sound/ti,j721e-cpb-ivi-audio.yaml#
> /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/sound/ti,j721e-cpb-audio.yaml: duplicate '$id' value 'http://devicetree.org/schemas/sound/ti,j721e-cpb-audio.yaml#'
> Error: Documentation/devicetree/bindings/sound/ti,j721e-cpb-ivi-audio.example.dts:21.23-24 syntax error
> FATAL ERROR: Unable to parse input tree
> scripts/Makefile.lib:311: recipe for target 'Documentation/devicetree/bindings/sound/ti,j721e-cpb-ivi-audio.example.dt.yaml' failed
> make[1]: *** [Documentation/devicetree/bindings/sound/ti,j721e-cpb-ivi-audio.example.dt.yaml] Error 1
> make[1]: *** Waiting for unfinished jobs....
> Makefile:1262: recipe for target 'dt_binding_check' failed
> make: *** [dt_binding_check] Error 2

I made copy-paste error (two) when creating the cpb-ivi yaml and forgot
to re-run the dt_binding_check

Fixed up and verified that the build is clean now.

> See https://patchwork.ozlabs.org/patch/1258054
>
> If you already ran 'make dt_binding_check' and didn't see the above
> error(s), then make sure dt-schema is up to date:
>
> pip3 install git+https://github.com/devicetree-org/dt-schema.git@master --upgrade
>
> Please check and re-submit.
>

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki