ASoC: ti: Add support for audio on J721e EVM
Subsystems (4)
v3 cover ASoC: ti: Add support for audio on J721e EVM
Hi,
Changes since v2:
- DT binding:
- use proper (?) patch subject for the binding docuemtn patch
- drop pll4 and pll15 from DT - driver should check the rate via clk_get_parent. If it is not available (as it is not currently) then use the match_data provided rates.
- add simple explanation for the clocking setup
- Use descriptive names for clocks: cpb/ivi-mcasp-auxclk and cpb/ivi-codec-scki
- dt_binding_check shows no errors/warnings
- ASoC machine driver:
- Try to read the PLL4/15 rate with clk API (parent of the two clock divider) if it is not available then use the match_data provided numbers.
- Support for single PLL setup
Changes since v1:
- Fixed DT binding documentation errors
- Rebased on ASoC head and updated the driver to compile and work
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
ASoC: dt-bindings: 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 | 95 ++ .../sound/ti,j721e-cpb-ivi-audio.yaml | 150 +++ sound/soc/ti/Kconfig | 8 + sound/soc/ti/Makefile | 2 + sound/soc/ti/davinci-mcasp.c | 3 + sound/soc/ti/j721e-evm.c | 887 ++++++++++++++++++ 6 files changed, 1145 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
Signature · 4 lines
Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
PATCH v3 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.
--- sound/soc/ti/davinci-mcasp.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/ti/davinci-mcasp.c +3 -0
@@ -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,
Signature · 4 lines
Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
PATCH v3 2/3 ASoC: dt-bindings: Add documentation for TI j721e EVM (CPB and IVI)
In reply to Peter UjfalusiThe 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.
--- .../bindings/sound/ti,j721e-cpb-audio.yaml | 95 +++++++++++ .../sound/ti,j721e-cpb-ivi-audio.yaml | 150 ++++++++++++++++++ 2 files changed, 245 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
Documentation/devicetree/bindings/sound/ti,j721e-cpb-audio.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/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. + + Clocking setup for 48KHz family: + PLL4 ---> PLL4_HSDIV0 ---> MCASP10_AUXCLK ---> McASP10.auxclk + |-> PLL4_HSDIV2 ---> AUDIO_REFCLK2 ---> pcm3168a.SCKI + + Clocking setup for 44.1KHz family: + PLL15 ---> PLL15_HSDIV0 ---> MCASP10_AUXCLK ---> McASP10.auxclk + |-> PLL15_HSDIV2 ---> AUDIO_REFCLK2 ---> pcm3168a.SCKI + +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 McASP used on CPB + 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: AUXCLK clock for McASP used by CPB audio + - description: Parent for CPB_McASP auxclk (for 48KHz) + - description: Parent for CPB_McASP auxclk (for 44.1KHz) + - description: SCKI clock for the pcm3168a codec on CPB + - description: Parent for CPB_SCKI clock (for 48KHz) + - description: Parent for CPB_SCKI clock (for 44.1KHz) + + clock-names: + items: + - const: cpb-mcasp-auxclk + - const: cpb-mcasp-auxclk-48000 + - const: cpb-mcasp-auxclk-44100 + - const: cpb-codec-scki + - const: cpb-codec-scki-48000 + - const: cpb-codec-scki-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 = <&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 = "cpb-mcasp-auxclk", + "cpb-mcasp-auxclk-48000", "cpb-mcasp-auxclk-44100", + "cpb-codec-scki", + "cpb-codec-scki-48000", "cpb-codec-scki-44100"; + };
Documentation/devicetree/bindings/sound/ti,j721e-cpb-ivi-audio.yaml new file +150 -0
150 lines not on this page · raw message
Signature · 4 lines
Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
PATCH v3 3/3 ASoC: ti: Add custom machine driver for j721e EVM (CPB and IVI)
In reply to Peter UjfalusiThe audio support on the board is using pcm3168a codec connected to McASP10 serializers in parallel setup.
The pcm3168a SCKI clock is coming via the 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.
Generic card can not be used for the board as we need to switch between clock paths for different sampling rate families and also need to change the slot_width between 16 and 24 bit audio.
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. It is extending the audio support on the CPB.
Due to the fact that the same PLL4/15 is used by both domains (CPB/IVI) there are cross restriction on sampling rates.
The IVI side is represented as multicodec setup.
PCMs available on a plain CPB (no IVI addon):
hw:0,0 - cpb playback (8 channels)
hw:0,1 - cpb capture (6 channels)
When the IVI addon is present, additional two PCMs will be present:
hw:0,2 - ivi multicodec playback (16 channels)
hw:0,3 - ivi multicodec capture (12 channels)
--- sound/soc/ti/Kconfig | 8 + sound/soc/ti/Makefile | 2 + sound/soc/ti/j721e-evm.c | 887 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 897 insertions(+) create mode 100644 sound/soc/ti/j721e-evm.c
sound/soc/ti/Kconfig +8 -0
@@ -219,5 +219,13 @@ config SND_SOC_DM365_VOICE_CODEC_MODULE The is an internal symbol needed to ensure that the codec and MFD driver can be built as loadable modules if necessary. +config SND_SOC_J721E_EVM + tristate "SoC Audio support for j721e EVM" + depends on ARCH_K3_J721E_SOC || COMPILE_TEST + select SND_SOC_PCM3168A_I2C + select SND_SOC_DAVINCI_MCASP + help + Say Y if you want to add support for SoC audio on j721e Common + Processor Board and Infotainment expansion board. endmenu
sound/soc/ti/Makefile +2 -0
@@ -34,6 +34,7 @@ snd-soc-omap-abe-twl6040-objs := omap-abe-twl6040.o snd-soc-ams-delta-objs := ams-delta.o snd-soc-omap-hdmi-objs := omap-hdmi.o snd-soc-osk5912-objs := osk5912.o +snd-soc-j721e-evm-objs := j721e-evm.o obj-$(CONFIG_SND_SOC_DAVINCI_EVM) += snd-soc-davinci-evm.o obj-$(CONFIG_SND_SOC_NOKIA_N810) += snd-soc-n810.o
@@ -44,3 +45,4 @@ obj-$(CONFIG_SND_SOC_OMAP_ABE_TWL6040) += snd-soc-omap-abe-twl6040.o obj-$(CONFIG_SND_SOC_OMAP_AMS_DELTA) += snd-soc-ams-delta.o obj-$(CONFIG_SND_SOC_OMAP_HDMI) += snd-soc-omap-hdmi.o obj-$(CONFIG_SND_SOC_OMAP_OSK5912) += snd-soc-osk5912.o +obj-$(CONFIG_SND_SOC_J721E_EVM) += snd-soc-j721e-evm.o
sound/soc/ti/j721e-evm.c new file +887 -0
887 lines not on this page · raw message
Signature · 4 lines
Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Re: [PATCH v3 3/3] ASoC: ti: Add custom machine driver for j721e EVM (CPB and IVI)
Quoted 43 lines · Peter Ujfalusi
The audio support on the board is using pcm3168a codec connected to McASP10 serializers in parallel setup.
The pcm3168a SCKI clock is coming via the j721eAUDIO_REFCLK2pin. In order to support 48KHz and 44.1KHz family of sampling rates the parent clock forAUDIO_REFCLK2needs 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.Generic card can not be used for the board as we need to switch between clock paths for different sampling rate families and also need to change the
slot_widthbetween 16 and 24 bit audio.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_REFCLK0pin. It is extending the audio support on the CPB.Due to the fact that the same PLL4/15 is used by both domains (CPB/IVI) there are cross restriction on sampling rates.
The IVI side is represented as multicodec setup.
PCMs available on a plain CPB (no IVI addon):
hw:0,0 - cpb playback (8 channels)
hw:0,1 - cpb capture (6 channels)When the IVI addon is present, additional two PCMs will be present:
hw:0,2 - ivi multicodec playback (16 channels)
hw:0,3 - ivi multicodec capture (12 channels)Signed-off-by Peter Ujfalusi <[email protected]>--- sound/soc/ti/Kconfig | 8 + sound/soc/ti/Makefile | 2 + sound/soc/ti/j721e-evm.c | 887 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 897 insertions(+) create mode 100644 sound/soc/ti/j721e-evm.csound/soc/ti/j721e-evm.c new file +0
-0
...
sound/soc/ti/j721e-evm.c line 461
Quoted 12 lines
sound/soc/ti/j721e-evm.c new file +12
-0+static int j721e_get_clocks (struct device *dev, +struct j721e_audio_clocks *clocks,char *prefix) +{ +struct clk *parent; +char *clk_name; +int ret; + + clocks->target =devm_clk_get (dev, prefix); +if (IS_ERR (clocks->target)) { + ret =PTR_ERR (clocks->target); +if (ret != -EPROBE_DEFER ) + dev_err(dev, "failed to acquire %s': %d\n",
Looks like I have extra "'" in the prints...
Quoted 4 lines
sound/soc/ti/j721e-evm.c new file +4
-0+ prefix, ret); +return ret; + } +
sound/soc/ti/j721e-evm.c line 475
Quoted 10 lines
sound/soc/ti/j721e-evm.c new file +10
-0+ clk_name =kasprintf (GFP_KERNEL ,"%s-48000" , prefix); +if (clk_name) { + parent =devm_clk_get (dev, clk_name); +kfree (clk_name); +if (IS_ERR (parent)) { + ret =PTR_ERR (parent); +if (ret != -EPROBE_DEFER ) +dev_err (dev,"failed to acquire %s': %d\n" , + prefix, ret); +return ret;
It should be like this to really not fail with single PLL (from DT), but it is not documented and supported officially.
if (ret == -EPROBE_DEFER)
return ret;
dev_dbg(dev, "no 48KHz parent for %s: %d\n", prefix, ret); parent = NULL;
Quoted 6 lines
sound/soc/ti/j721e-evm.c new file +6
-0+ } + clocks->parent[J721E_CLK_PARENT_48000 ] = parent; + }else { +return -ENOMEM ; + } +
sound/soc/ti/j721e-evm.c line 491
Quoted 10 lines
sound/soc/ti/j721e-evm.c new file +10
-0+ clk_name =kasprintf (GFP_KERNEL ,"%s-44100" , prefix); +if (clk_name) { + parent =devm_clk_get (dev, clk_name); +kfree (clk_name); +if (IS_ERR (parent)) { + ret =PTR_ERR (parent); +if (ret != -EPROBE_DEFER ) +dev_err (dev,"failed to acquire %s': %d\n" , + prefix, ret); +return ret;
and here
sound/soc/ti/j721e-evm.c line 496
Quoted 5 lines
sound/soc/ti/j721e-evm.c new file +5
-0+ } + clocks->parent[J721E_CLK_PARENT_44100 ] = parent; + }else { +return -ENOMEM ; + }
then:
if (!clocks->parent[J721E_CLK_PARENT_44100] &&
!clocks->parent[J721E_CLK_PARENT_48000]) {
dev_err(dev, "At least on parent clock is needed for %s\n",
prefix);
return -EINVAL;
}sound/soc/ti/j721e-evm.c line 298
Quoted 3 lines
sound/soc/ti/j721e-evm.c new file +3
-0+ +return 0 ; +}
- Péter
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Mark Brown
maintainerRe: [PATCH v3 3/3] ASoC: ti: Add custom machine driver for j721e EVM (CPB and IVI)
Quoted 6 lines · Peter Ujfalusi
sound/soc/ti/j721e-evm.c line 461
Quoted 4 lines
sound/soc/ti/j721e-evm.c new file +4
-0+if (IS_ERR (clocks->target)) { + ret =PTR_ERR (clocks->target); +if (ret != -EPROBE_DEFER ) + dev_err(dev, "failed to acquire %s': %d\n",Looks like I have extra "'" in the prints...
Apart from the issues you pointed out yourself this all looks reasonable to me.
Re: [PATCH v3 3/3] ASoC: ti: Add custom machine driver for j721e EVM (CPB and IVI)
Quoted 11 lines · Mark Brown
Quoted 6 lines · Peter Ujfalusi
sound/soc/ti/j721e-evm.c line 461
Quoted 4 lines
sound/soc/ti/j721e-evm.c new file +4
-0+if (IS_ERR (clocks->target)) { + ret =PTR_ERR (clocks->target); +if (ret != -EPROBE_DEFER ) + dev_err(dev, "failed to acquire %s': %d\n",Looks like I have extra "'" in the prints...
Apart from the issues you pointed out yourself this all looks reasonable to me.
Thanks Mark,
I'll wait for Rob on the binding doc side before I send the updated v4.
- Péter
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki