]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: cs35l56: Split SoundWire DAI into separate playback and capture
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Tue, 3 Dec 2024 10:45:33 +0000 (18:45 +0800)
committerMark Brown <broonie@kernel.org>
Tue, 3 Dec 2024 12:36:27 +0000 (12:36 +0000)
This patch splits the SoundWire capture DP into a separate DAI so that
it can be independently routed and/or aggregated. It also makes
corresponding changes to the SOF SoundWire machine driver.

The playback and capture over SoundWire are separate DPs so don't have to
route to the same place. They could also be aggregated differently - for
example the playback DP could be aggregated with a playback-only DAI on
a codec.

No production device currently uses the capture path and their topologies
do not connect it. So there is no need to change the machine driver match
table entries for these. They will simply drop the unused capture DAI.

There is one hookup used for a non-production development board that was
added by commit 05fe62842804 ("ASoC: Intel: soc-acpi-intel-mtl-match: add
acpi match table for cdb35l56-eight-c") This is the only hookup using a
topology that connects the SoundWire DP for capture, so this hookup has
been changed to include an aggregated endpoint for the capture DAI.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://patch.msgid.link/20241203104534.56719-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/cs35l56.c
sound/soc/intel/common/soc-acpi-intel-mtl-match.c
sound/soc/sdw_utils/soc_sdw_utils.c

index 757ade6373ede393496e9cbc0ee76b2c3d9d3b1f..5c099443eb7a93b47958837789ee840f396e4c87 100644 (file)
@@ -646,6 +646,12 @@ static struct snd_soc_dai_driver cs35l56_dai[] = {
                        .rates = CS35L56_RATES,
                        .formats = CS35L56_RX_FORMATS,
                },
+               .symmetric_rate = 1,
+               .ops = &cs35l56_sdw_dai_ops,
+       },
+       {
+               .name = "cs35l56-sdw1c",
+               .id = 2,
                .capture = {
                        .stream_name = "SDW1 Capture",
                        .channels_min = 1,
@@ -655,7 +661,7 @@ static struct snd_soc_dai_driver cs35l56_dai[] = {
                },
                .symmetric_rate = 1,
                .ops = &cs35l56_sdw_dai_ops,
-       }
+       },
 };
 
 static int cs35l56_write_cal(struct cs35l56_private *cs35l56)
index 0b37465b6c53fce49249fedd20728b16c505f4d2..9892efd8e9c282049a2453574de00dde04a6ece5 100644 (file)
@@ -441,6 +441,66 @@ static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = {
        }
 };
 
+static const struct snd_soc_acpi_endpoint cs35l56_l_fb_endpoints[] = {
+       { /* Speaker Playback Endpoint */
+               .num = 0,
+               .aggregated = 1,
+               .group_position = 0,
+               .group_id = 1,
+       },
+       { /* Feedback Capture Endpoint */
+               .num = 1,
+               .aggregated = 1,
+               .group_position = 0,
+               .group_id = 2,
+       },
+};
+
+static const struct snd_soc_acpi_endpoint cs35l56_r_fb_endpoints[] = {
+       { /* Speaker Playback Endpoint */
+               .num = 0,
+               .aggregated = 1,
+               .group_position = 1,
+               .group_id = 1,
+       },
+       { /* Feedback Capture Endpoint */
+               .num = 1,
+               .aggregated = 1,
+               .group_position = 1,
+               .group_id = 2,
+       },
+};
+
+static const struct snd_soc_acpi_endpoint cs35l56_2_fb_endpoints[] = {
+       { /* Speaker Playback Endpoint */
+               .num = 0,
+               .aggregated = 1,
+               .group_position = 2,
+               .group_id = 1,
+       },
+       { /* Feedback Capture Endpoint */
+               .num = 1,
+               .aggregated = 1,
+               .group_position = 2,
+               .group_id = 2,
+       },
+};
+
+static const struct snd_soc_acpi_endpoint cs35l56_3_fb_endpoints[] = {
+       { /* Speaker Playback Endpoint */
+               .num = 0,
+               .aggregated = 1,
+               .group_position = 3,
+               .group_id = 1,
+       },
+       { /* Feedback Capture Endpoint */
+               .num = 1,
+               .aggregated = 1,
+               .group_position = 3,
+               .group_id = 2,
+       },
+};
+
 static const struct snd_soc_acpi_adr_device cs35l56_1_adr[] = {
        {
                .adr = 0x00013701FA355601ull,
@@ -474,14 +534,14 @@ static const struct snd_soc_acpi_adr_device cs35l56_2_adr[] = {
 static const struct snd_soc_acpi_adr_device cs35l56_2_r_adr[] = {
        {
                .adr = 0x00023201FA355601ull,
-               .num_endpoints = 1,
-               .endpoints = &spk_r_endpoint,
+               .num_endpoints = ARRAY_SIZE(cs35l56_r_fb_endpoints),
+               .endpoints = cs35l56_r_fb_endpoints,
                .name_prefix = "AMP3"
        },
        {
                .adr = 0x00023301FA355601ull,
-               .num_endpoints = 1,
-               .endpoints = &spk_3_endpoint,
+               .num_endpoints = ARRAY_SIZE(cs35l56_3_fb_endpoints),
+               .endpoints = cs35l56_3_fb_endpoints,
                .name_prefix = "AMP4"
        }
 
@@ -490,14 +550,14 @@ static const struct snd_soc_acpi_adr_device cs35l56_2_r_adr[] = {
 static const struct snd_soc_acpi_adr_device cs35l56_3_l_adr[] = {
        {
                .adr = 0x00033001fa355601ull,
-               .num_endpoints = 1,
-               .endpoints = &spk_l_endpoint,
+               .num_endpoints = ARRAY_SIZE(cs35l56_l_fb_endpoints),
+               .endpoints = cs35l56_l_fb_endpoints,
                .name_prefix = "AMP1"
        },
        {
                .adr = 0x00033101fa355601ull,
-               .num_endpoints = 1,
-               .endpoints = &spk_2_endpoint,
+               .num_endpoints = ARRAY_SIZE(cs35l56_2_fb_endpoints),
+               .endpoints = cs35l56_2_fb_endpoints,
                .name_prefix = "AMP2"
        }
 };
index 19bd02e2cd6d67186aeb0c7a37cc62253907ae63..111e00e916c563be3c9df8e0df0be5c7031a4d86 100644 (file)
@@ -488,10 +488,10 @@ struct asoc_sdw_codec_info codec_info_list[] = {
                .part_id = 0x3556,
                .dais = {
                        {
-                               .direction = {true, true},
+                               .direction = {true, false},
                                .dai_name = "cs35l56-sdw1",
                                .dai_type = SOC_SDW_DAI_TYPE_AMP,
-                               .dailink = {SOC_SDW_AMP_OUT_DAI_ID, SOC_SDW_AMP_IN_DAI_ID},
+                               .dailink = {SOC_SDW_AMP_OUT_DAI_ID, SOC_SDW_UNUSED_DAI_ID},
                                .init = asoc_sdw_cs_amp_init,
                                .rtd_init = asoc_sdw_cs_spk_rtd_init,
                                .controls = generic_spk_controls,
@@ -499,8 +499,14 @@ struct asoc_sdw_codec_info codec_info_list[] = {
                                .widgets = generic_spk_widgets,
                                .num_widgets = ARRAY_SIZE(generic_spk_widgets),
                        },
+                       {
+                               .direction = {false, true},
+                               .dai_name = "cs35l56-sdw1c",
+                               .dai_type = SOC_SDW_DAI_TYPE_AMP,
+                               .dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_AMP_IN_DAI_ID},
+                       },
                },
-               .dai_num = 1,
+               .dai_num = 2,
        },
        {
                .part_id = 0x4242,