Skip to content

Commit 54e49a3

Browse files
committed
ASoC: fsl-asoc-card: add S/PDIF controller support
Merge series from Elinor Montmasson <[email protected]>: This is a series of patches aiming to make the machine driver `fsl-asoc-card` compatible with S/PDIF controllers on imx boards. The main goal is to allow the use of S/PDIF controllers with ASRC modules. The `imx-spdif` machine driver already has specific support for S/PDIF controllers but doesn't support using an ASRC with it. However, the `fsl-asoc-card` machine driver has the necessary code to create a sound card which can use an ASRC module. It is then possible to extend the support for S/PDIF audio cards by merging the `imx-spdif` driver into `fsl-asoc-card`. The first three patches adapt the `fsl-asoc-card` driver to support multiple codec use cases. The driver can get 2 codec phandles from the device tree, and codec-related variables are doubled. `for_each_codecs` macros are also used when possible to ease adding other multi-codec use cases in the future. It makes possible to use the two S/PDIF dummy codec drivers `spdif_receiver` and `spdif_transmitter` instead of `snd-soc-dummy`, which was used in `imx-spdif`. The fourth patch merges the S/PDIF support from `imx-spdif` to `fsl-asoc-card`. `fsl-asoc-card` offers the same functionalities as `imx-spdif` did, but this merge also extends the S/PDIF support with the possibility of using an ASRC. Compatible "fsl,imx-audio-spdif" is kept, but `fsl-asoc-card` uses different DT properties compared to `imx-spdif`: * The "spdif-controller" property from `imx-spdif` is named "audio-cpu" in `fsl-asoc-card`. * `fsl-asoc-card` uses codecs explicitly declared in DT with "audio-codec". With an S/PDIF, codec drivers `spdif_transmitter` and `spdif_receiver` should be used. Driver `imx-spdif` used instead the dummy codec and a pair of boolean properties, "spdif-in" and "spdif-out". Backward compatibility is therefore implemented in `fsl-asoc-card`. However, it is recommended to use the new properties when needed. Especially, declaring and using S/PDIF transmitter and/or receiver nodes is better than using the dummy codec. The last three patches update the device tree bindings of `fsl-asoc-card` and update all in-tree device trees to use the `fsl-asoc-card` properties. Note that as the old properties are still supported: * previous versions of in-tree device trees are still supported. * out-of-tree device trees are still supported. This series of patches was successfully built for arm64 and x86 on top of the latest "for-next" branch of the ASoC git tree on the 26th of June 2024. These modifications have also been tested on an i.MX8MN evaluation board with a linux kernel RT v6.1.26-rt8.
2 parents 0c6c651 + 4359caa commit 54e49a3

File tree

8 files changed

+306
-313
lines changed

8 files changed

+306
-313
lines changed

Documentation/devicetree/bindings/sound/fsl,imx-audio-spdif.yaml

Lines changed: 0 additions & 66 deletions
This file was deleted.

Documentation/devicetree/bindings/sound/fsl-asoc-card.yaml

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ properties:
6565
- fsl,imx-audio-sgtl5000
6666
- fsl,imx-audio-wm8960
6767
- fsl,imx-audio-wm8962
68+
- items:
69+
- enum:
70+
- fsl,imx-sabreauto-spdif
71+
- fsl,imx6sx-sdb-spdif
72+
- const: fsl,imx-audio-spdif
6873
- items:
6974
- enum:
7075
- fsl,imx-audio-ac97
@@ -81,6 +86,7 @@ properties:
8186
- fsl,imx-audio-wm8960
8287
- fsl,imx-audio-wm8962
8388
- fsl,imx-audio-wm8958
89+
- fsl,imx-audio-spdif
8490

8591
model:
8692
$ref: /schemas/types.yaml#/definitions/string
@@ -93,8 +99,15 @@ properties:
9399
need to add ASRC support via DPCM.
94100

95101
audio-codec:
96-
$ref: /schemas/types.yaml#/definitions/phandle
97-
description: The phandle of an audio codec
102+
$ref: /schemas/types.yaml#/definitions/phandle-array
103+
description: |
104+
The phandle of an audio codec.
105+
With "fsl,imx-audio-spdif", either SPDIF audio codec spdif_transmitter,
106+
spdif_receiver or both.
107+
minItems: 1
108+
maxItems: 2
109+
items:
110+
maxItems: 1
98111

99112
audio-cpu:
100113
$ref: /schemas/types.yaml#/definitions/phandle
@@ -150,8 +163,10 @@ properties:
150163
description: dai-link uses bit clock inversion.
151164

152165
mclk-id:
153-
$ref: /schemas/types.yaml#/definitions/uint32
154-
description: main clock id, specific for each card configuration.
166+
$ref: /schemas/types.yaml#/definitions/uint32-array
167+
description: Main clock id for each codec, specific for each card configuration.
168+
minItems: 1
169+
maxItems: 2
155170

156171
mux-int-port:
157172
$ref: /schemas/types.yaml#/definitions/uint32
@@ -167,6 +182,27 @@ properties:
167182
$ref: /schemas/types.yaml#/definitions/phandle
168183
description: The phandle of an CPU DAI controller
169184

185+
spdif-controller:
186+
$ref: /schemas/types.yaml#/definitions/phandle
187+
deprecated: true
188+
description: The phandle of an S/PDIF CPU DAI controller.
189+
190+
spdif-out:
191+
type: boolean
192+
deprecated: true
193+
description: |
194+
If present, the transmitting function of S/PDIF will be enabled,
195+
indicating there's a physical S/PDIF out connector or jack on the
196+
board or it's connecting to some other IP block, such as an HDMI
197+
encoder or display-controller.
198+
199+
spdif-in:
200+
type: boolean
201+
deprecated: true
202+
description: |
203+
If present, the receiving function of S/PDIF will be enabled,
204+
indicating there is a physical S/PDIF in connector/jack on the board.
205+
170206
required:
171207
- compatible
172208
- model
@@ -195,3 +231,12 @@ examples:
195231
"AIN2L", "Line In Jack",
196232
"AIN2R", "Line In Jack";
197233
};
234+
235+
- |
236+
sound-spdif-asrc {
237+
compatible = "fsl,imx-audio-spdif";
238+
model = "spdif-asrc-audio";
239+
audio-cpu = <&spdif>;
240+
audio-asrc = <&easrc>;
241+
audio-codec = <&spdifdit>, <&spdifdir>;
242+
};

arch/arm/configs/imx_v6_v7_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,6 @@ CONFIG_SND_IMX_SOC=y
311311
CONFIG_SND_SOC_EUKREA_TLV320=y
312312
CONFIG_SND_SOC_IMX_ES8328=y
313313
CONFIG_SND_SOC_IMX_SGTL5000=y
314-
CONFIG_SND_SOC_IMX_SPDIF=y
315314
CONFIG_SND_SOC_FSL_ASOC_CARD=y
316315
CONFIG_SND_SOC_AC97_CODEC=y
317316
CONFIG_SND_SOC_CS42XX8_I2C=y

arch/arm64/configs/defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,6 @@ CONFIG_SND_SOC_FSL_MICFIL=m
940940
CONFIG_SND_SOC_FSL_EASRC=m
941941
CONFIG_SND_IMX_SOC=m
942942
CONFIG_SND_SOC_IMX_SGTL5000=m
943-
CONFIG_SND_SOC_IMX_SPDIF=m
944943
CONFIG_SND_SOC_FSL_ASOC_CARD=m
945944
CONFIG_SND_SOC_IMX_AUDMIX=m
946945
CONFIG_SND_SOC_MT8183=m

sound/soc/fsl/Kconfig

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -303,15 +303,6 @@ config SND_SOC_IMX_SGTL5000
303303
SND_SOC_FSL_ASOC_CARD and SND_SOC_SGTL5000 to use the newer
304304
driver.
305305

306-
config SND_SOC_IMX_SPDIF
307-
tristate "SoC Audio support for i.MX boards with S/PDIF"
308-
select SND_SOC_IMX_PCM_DMA
309-
select SND_SOC_FSL_SPDIF
310-
help
311-
SoC Audio support for i.MX boards with S/PDIF
312-
Say Y if you want to add support for SoC audio on an i.MX board with
313-
a S/DPDIF.
314-
315306
config SND_SOC_FSL_ASOC_CARD
316307
tristate "Generic ASoC Sound Card with ASRC support"
317308
depends on OF && I2C
@@ -323,6 +314,7 @@ config SND_SOC_FSL_ASOC_CARD
323314
select SND_SOC_FSL_ESAI
324315
select SND_SOC_FSL_SAI
325316
select SND_SOC_FSL_SSI
317+
select SND_SOC_FSL_SPDIF
326318
select SND_SOC_TLV320AIC31XX
327319
select SND_SOC_WM8994
328320
select MFD_WM8994

sound/soc/fsl/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ obj-$(CONFIG_SND_SOC_IMX_PCM_RPMSG) += imx-pcm-rpmsg.o
6767
snd-soc-eukrea-tlv320-y := eukrea-tlv320.o
6868
snd-soc-imx-es8328-y := imx-es8328.o
6969
snd-soc-imx-sgtl5000-y := imx-sgtl5000.o
70-
snd-soc-imx-spdif-y := imx-spdif.o
7170
snd-soc-imx-audmix-y := imx-audmix.o
7271
snd-soc-imx-hdmi-y := imx-hdmi.o
7372
snd-soc-imx-rpmsg-y := imx-rpmsg.o
@@ -76,7 +75,6 @@ snd-soc-imx-card-y := imx-card.o
7675
obj-$(CONFIG_SND_SOC_EUKREA_TLV320) += snd-soc-eukrea-tlv320.o
7776
obj-$(CONFIG_SND_SOC_IMX_ES8328) += snd-soc-imx-es8328.o
7877
obj-$(CONFIG_SND_SOC_IMX_SGTL5000) += snd-soc-imx-sgtl5000.o
79-
obj-$(CONFIG_SND_SOC_IMX_SPDIF) += snd-soc-imx-spdif.o
8078
obj-$(CONFIG_SND_SOC_IMX_AUDMIX) += snd-soc-imx-audmix.o
8179
obj-$(CONFIG_SND_SOC_IMX_HDMI) += snd-soc-imx-hdmi.o
8280
obj-$(CONFIG_SND_SOC_IMX_RPMSG) += snd-soc-imx-rpmsg.o

0 commit comments

Comments
 (0)