Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: tlv320aic32x4: Add multi endpoint support

Support multiple endpoints on TLV320AIC32x4 codec port when
used in of_graph context.

This patch allows to share the codec port between two CPU DAIs.

Example:

Custom STM32MP157C board uses TLV320AIC32x4 audio codec. This codec
is connected to two serial audio interfaces, which are configured
either as rx or tx.

>From AsoC point of view the topolgy is the following:
// 2 CPU DAIs (SAI2A/B), 1 Codec (TLV320AIC32x4)
Playback: CPU-A-DAI(slave) -> (master)CODEC-DAI/port0
Record: CPU-B-DAI(slave) <- (master)CODEC-DAI/port0

In the DT two endpoints have to be associated to the codec port:
tlv320aic32x4_port: port {
tlv320aic32x4_tx_endpoint: endpoint@0 {
remote-endpoint = <&sai2a_endpoint>;
};
tlv320aic32x4_rx_endpoint: endpoint@1 {
remote-endpoint = <&sai2b_endpoint>;
};
};

However, when the audio graph card parses the codec nodes, it expects
to find DAI interface indexes matching the endpoints indexes.

The current patch forces the use of DAI id 0 for both endpoints,
which allows to share the codec DAI between the two CPU DAIs
for playback and capture streams respectively.

Signed-off-by: Marek Vasut <marex@denx.de>
Link: https://patch.msgid.link/20240830231007.205707-1-marex@denx.de
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Marek Vasut and committed by
Mark Brown
568dc2fa fcca6d05

+9
+9
sound/soc/codecs/tlv320aic32x4.c
··· 1073 1073 return 0; 1074 1074 } 1075 1075 1076 + static int aic32x4_of_xlate_dai_id(struct snd_soc_component *component, 1077 + struct device_node *endpoint) 1078 + { 1079 + /* return dai id 0, whatever the endpoint index */ 1080 + return 0; 1081 + } 1082 + 1076 1083 static const struct snd_soc_component_driver soc_component_dev_aic32x4 = { 1077 1084 .probe = aic32x4_component_probe, 1078 1085 .set_bias_level = aic32x4_set_bias_level, ··· 1089 1082 .num_dapm_widgets = ARRAY_SIZE(aic32x4_dapm_widgets), 1090 1083 .dapm_routes = aic32x4_dapm_routes, 1091 1084 .num_dapm_routes = ARRAY_SIZE(aic32x4_dapm_routes), 1085 + .of_xlate_dai_id = aic32x4_of_xlate_dai_id, 1092 1086 .suspend_bias_off = 1, 1093 1087 .idle_bias_on = 1, 1094 1088 .use_pmdown_time = 1, ··· 1211 1203 .num_dapm_widgets = ARRAY_SIZE(aic32x4_tas2505_dapm_widgets), 1212 1204 .dapm_routes = aic32x4_tas2505_dapm_routes, 1213 1205 .num_dapm_routes = ARRAY_SIZE(aic32x4_tas2505_dapm_routes), 1206 + .of_xlate_dai_id = aic32x4_of_xlate_dai_id, 1214 1207 .suspend_bias_off = 1, 1215 1208 .idle_bias_on = 1, 1216 1209 .use_pmdown_time = 1,