summaryrefslogtreecommitdiff
path: root/sound/soc/sdw_utils
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/sdw_utils')
-rw-r--r--sound/soc/sdw_utils/Makefile1
-rw-r--r--sound/soc/sdw_utils/soc_sdw_cs42l43.c10
-rw-r--r--sound/soc/sdw_utils/soc_sdw_cs47l47.c80
-rw-r--r--sound/soc/sdw_utils/soc_sdw_rt_dmic.c46
-rw-r--r--sound/soc/sdw_utils/soc_sdw_utils.c234
5 files changed, 353 insertions, 18 deletions
diff --git a/sound/soc/sdw_utils/Makefile b/sound/soc/sdw_utils/Makefile
index e8bd5ffb1a6a..a8d091fd374b 100644
--- a/sound/soc/sdw_utils/Makefile
+++ b/sound/soc/sdw_utils/Makefile
@@ -6,6 +6,7 @@ snd-soc-sdw-utils-y := soc_sdw_utils.o soc_sdw_dmic.o soc_sdw_rt_dmic.o \
soc_sdw_bridge_cs35l56.o \
soc_sdw_cs42l42.o soc_sdw_cs42l43.o \
soc_sdw_cs42l45.o \
+ soc_sdw_cs47l47.o \
soc_sdw_cs_amp.o \
soc_sdw_maxim.o \
soc_sdw_ti_amp.o
diff --git a/sound/soc/sdw_utils/soc_sdw_cs42l43.c b/sound/soc/sdw_utils/soc_sdw_cs42l43.c
index 2685ff4f0932..4a451b9d4f13 100644
--- a/sound/soc/sdw_utils/soc_sdw_cs42l43.c
+++ b/sound/soc/sdw_utils/soc_sdw_cs42l43.c
@@ -107,6 +107,7 @@ EXPORT_SYMBOL_NS(asoc_sdw_cs42l43_hs_rtd_init, "SND_SOC_SDW_UTILS");
int asoc_sdw_cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{
+ struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component;
struct snd_soc_card *card = rtd->card;
struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
struct asoc_sdw_mc_private *ctx = snd_soc_card_get_drvdata(card);
@@ -131,8 +132,15 @@ int asoc_sdw_cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_so
ret = snd_soc_dapm_add_routes(dapm, cs42l43_spk_map,
ARRAY_SIZE(cs42l43_spk_map));
- if (ret)
+ if (ret) {
dev_err(card->dev, "cs42l43 speaker map addition failed: %d\n", ret);
+ return ret;
+ }
+
+ ret = snd_soc_component_set_sysclk(component, CS42L43_SYSCLK, CS42L43_SYSCLK_SDW,
+ 0, SND_SOC_CLOCK_IN);
+ if (ret)
+ dev_err(card->dev, "Failed to set sysclk: %d\n", ret);
return ret;
}
diff --git a/sound/soc/sdw_utils/soc_sdw_cs47l47.c b/sound/soc/sdw_utils/soc_sdw_cs47l47.c
new file mode 100644
index 000000000000..259ecf1e0a71
--- /dev/null
+++ b/sound/soc/sdw_utils/soc_sdw_cs47l47.c
@@ -0,0 +1,80 @@
+// SPDX-License-Identifier: GPL-2.0-only
+// Based on sof_sdw_cs42l45.c
+// This file incorporates work covered by the following copyright notice:
+// Copyright (c) 2023 Intel Corporation
+// Copyright (c) 2024 Advanced Micro Devices, Inc.
+
+/*
+ * soc_sdw_cs47l47 - Helpers to handle CS47L47 from generic machine driver
+ */
+#include <linux/device.h>
+#include <linux/errno.h>
+#include <sound/jack.h>
+#include <sound/soc.h>
+#include <sound/soc-card.h>
+#include <sound/soc-component.h>
+#include <sound/soc-dai.h>
+#include <sound/soc_sdw_utils.h>
+
+static struct snd_soc_jack_pin soc_jack_pins[] = {
+ {
+ .pin = "cs47l47 OT 43 Headphone",
+ .mask = SND_JACK_HEADPHONE,
+ },
+ {
+ .pin = "cs47l47 OT 45 Headset",
+ .mask = SND_JACK_HEADPHONE,
+ },
+ {
+ .pin = "cs47l47 IT 31 Microphone",
+ .mask = SND_JACK_MICROPHONE,
+ },
+ {
+ .pin = "cs47l47 IT 33 Headset",
+ .mask = SND_JACK_MICROPHONE,
+ },
+};
+
+int asoc_sdw_cs47l47_hs_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
+{
+ struct snd_soc_card *card = rtd->card;
+ struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component;
+ struct asoc_sdw_mc_private *ctx = snd_soc_card_get_drvdata(card);
+ struct snd_soc_jack *jack = &ctx->sdw_headset;
+ int ret;
+
+ card->components = devm_kasprintf(card->dev, GFP_KERNEL, "%s hs:cs47l47",
+ card->components);
+ if (!card->components)
+ return -ENOMEM;
+
+ ret = snd_soc_card_jack_new_pins(card, "Jack", SND_JACK_MECHANICAL |
+ SND_JACK_HEADSET | SND_JACK_LINEOUT, jack,
+ soc_jack_pins, ARRAY_SIZE(soc_jack_pins));
+ if (ret) {
+ dev_err(card->dev, "Failed to create jack: %d\n", ret);
+ return ret;
+ }
+
+ ret = snd_soc_component_set_jack(component, jack, NULL);
+ if (ret) {
+ dev_err(card->dev, "Failed to register jack: %d\n", ret);
+ return ret;
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL_NS(asoc_sdw_cs47l47_hs_rtd_init, "SND_SOC_SDW_UTILS");
+
+int asoc_sdw_cs47l47_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
+{
+ struct snd_soc_card *card = rtd->card;
+
+ card->components = devm_kasprintf(card->dev, GFP_KERNEL, "%s mic:cs47l47-dmic",
+ card->components);
+ if (!card->components)
+ return -ENOMEM;
+
+ return 0;
+}
+EXPORT_SYMBOL_NS(asoc_sdw_cs47l47_dmic_rtd_init, "SND_SOC_SDW_UTILS");
diff --git a/sound/soc/sdw_utils/soc_sdw_rt_dmic.c b/sound/soc/sdw_utils/soc_sdw_rt_dmic.c
index 97be110a59b6..fed85bad9e88 100644
--- a/sound/soc/sdw_utils/soc_sdw_rt_dmic.c
+++ b/sound/soc/sdw_utils/soc_sdw_rt_dmic.c
@@ -9,15 +9,20 @@
#include <linux/device.h>
#include <linux/errno.h>
+#include <linux/soundwire/sdw.h>
+#include <linux/soundwire/sdw_type.h>
#include <sound/soc.h>
#include <sound/soc-acpi.h>
#include <sound/soc_sdw_utils.h>
+#include <sound/sdca_function.h>
int asoc_sdw_rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{
struct snd_soc_card *card = rtd->card;
struct snd_soc_component *component;
+ struct sdw_slave *sdw_peripheral = NULL;
char *mic_name;
+ int rt1320_dmic_num = 0, part_id, i;
component = dai->component;
@@ -32,9 +37,44 @@ int asoc_sdw_rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_da
if (!mic_name)
return -ENOMEM;
- card->components = devm_kasprintf(card->dev, GFP_KERNEL,
- "%s mic:%s", card->components,
- mic_name);
+ /*
+ * If there is any rt1320/rt1321 DMIC belonging to this card, try to count the `cfg-mics`
+ * to be used in card->components.
+ * Note: The rt1320 drivers register the peripheral dev to component->dev, so get the
+ * sdw_peripheral from component->dev.
+ */
+ if (is_sdw_slave(component->dev))
+ sdw_peripheral = dev_to_sdw_dev(component->dev);
+ if (sdw_peripheral &&
+ (sdw_peripheral->id.part_id == 0x1320 || sdw_peripheral->id.part_id == 0x1321)) {
+ part_id = sdw_peripheral->id.part_id;
+ /*
+ * This rtd init callback is called once, so count the rt1320/rt1321 with SDCA
+ * function SmartMic type in this card.
+ */
+ for_each_card_components(card, component) {
+ if (!is_sdw_slave(component->dev))
+ continue;
+ sdw_peripheral = dev_to_sdw_dev(component->dev);
+ if (sdw_peripheral->id.part_id != part_id)
+ continue;
+ for (i = 0; i < sdw_peripheral->sdca_data.num_functions; i++) {
+ if (sdw_peripheral->sdca_data.function[i].type ==
+ SDCA_FUNCTION_TYPE_SMART_MIC) {
+ rt1320_dmic_num++;
+ break;
+ }
+ }
+ }
+ card->components = devm_kasprintf(card->dev, GFP_KERNEL,
+ "%s mic:%s cfg-mics:%d", card->components,
+ mic_name, rt1320_dmic_num);
+ } else {
+ card->components = devm_kasprintf(card->dev, GFP_KERNEL,
+ "%s mic:%s", card->components,
+ mic_name);
+ }
+
if (!card->components)
return -ENOMEM;
diff --git a/sound/soc/sdw_utils/soc_sdw_utils.c b/sound/soc/sdw_utils/soc_sdw_utils.c
index 0e67d9f34cba..2807f536eef0 100644
--- a/sound/soc/sdw_utils/soc_sdw_utils.c
+++ b/sound/soc/sdw_utils/soc_sdw_utils.c
@@ -73,6 +73,7 @@ static const struct snd_kcontrol_new rt700_controls[] = {
struct asoc_sdw_codec_info codec_info_list[] = {
{
+ .vendor_id = 0x0102,
.part_id = 0x0000, /* TAS2783A */
.name_prefix = "tas2783",
.dais = {
@@ -92,6 +93,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 1,
},
{
+ .vendor_id = 0x025d,
.part_id = 0x700,
.name_prefix = "rt700",
.dais = {
@@ -110,6 +112,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 1,
},
{
+ .vendor_id = 0x025d,
.part_id = 0x711,
.name_prefix = "rt711",
.version_id = 3,
@@ -131,6 +134,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 1,
},
{
+ .vendor_id = 0x025d,
.part_id = 0x711,
.name_prefix = "rt711",
.version_id = 2,
@@ -152,6 +156,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 1,
},
{
+ .vendor_id = 0x025d,
.part_id = 0x712,
.name_prefix = "rt712",
.version_id = 3,
@@ -194,6 +199,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 3,
},
{
+ .vendor_id = 0x025d,
.part_id = 0x1712,
.name_prefix = "rt712-dmic",
.version_id = 3,
@@ -209,6 +215,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 1,
},
{
+ .vendor_id = 0x025d,
.part_id = 0x713,
.name_prefix = "rt713",
.version_id = 3,
@@ -237,6 +244,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 2,
},
{
+ .vendor_id = 0x025d,
.part_id = 0x1713,
.name_prefix = "rt713-dmic",
.version_id = 3,
@@ -252,6 +260,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 1,
},
{
+ .vendor_id = 0x025d,
.part_id = 0x1308,
.name_prefix = "rt1308",
.acpi_id = "10EC1308",
@@ -275,6 +284,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.ops = &soc_sdw_rt1308_i2s_ops,
},
{
+ .vendor_id = 0x025d,
.part_id = 0x1316,
.name_prefix = "rt1316",
.dais = {
@@ -296,6 +306,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 1,
},
{
+ .vendor_id = 0x025d,
.part_id = 0x1318,
.name_prefix = "rt1318",
.dais = {
@@ -317,8 +328,10 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 1,
},
{
+ .vendor_id = 0x025d,
.part_id = 0x1320,
.name_prefix = "rt1320",
+ .is_amp = true,
.dais = {
{
.direction = {true, false},
@@ -334,12 +347,24 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.widgets = generic_spk_widgets,
.num_widgets = ARRAY_SIZE(generic_spk_widgets),
},
+ {
+ .direction = {false, true},
+ .dai_name = "rt1320-aif2",
+ .component_name = "rt1320",
+ .dai_type = SOC_SDW_DAI_TYPE_MIC,
+ .dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_DMIC_DAI_ID},
+ .rtd_init = asoc_sdw_rt_dmic_rtd_init,
+ .widgets = generic_dmic_widgets,
+ .num_widgets = ARRAY_SIZE(generic_dmic_widgets),
+ },
},
- .dai_num = 1,
+ .dai_num = 2,
},
{
+ .vendor_id = 0x025d,
.part_id = 0x1321,
.name_prefix = "rt1320",
+ .is_amp = true,
.dais = {
{
.direction = {true, false},
@@ -355,10 +380,21 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.widgets = generic_spk_widgets,
.num_widgets = ARRAY_SIZE(generic_spk_widgets),
},
+ {
+ .direction = {false, true},
+ .dai_name = "rt1320-aif2",
+ .component_name = "rt1320",
+ .dai_type = SOC_SDW_DAI_TYPE_MIC,
+ .dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_DMIC_DAI_ID},
+ .rtd_init = asoc_sdw_rt_dmic_rtd_init,
+ .widgets = generic_dmic_widgets,
+ .num_widgets = ARRAY_SIZE(generic_dmic_widgets),
+ },
},
- .dai_num = 1,
+ .dai_num = 2,
},
{
+ .vendor_id = 0x025d,
.part_id = 0x714,
.name_prefix = "rt714",
.version_id = 3,
@@ -375,6 +411,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 1,
},
{
+ .vendor_id = 0x025d,
.part_id = 0x715,
.name_prefix = "rt715",
.version_id = 3,
@@ -391,6 +428,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 1,
},
{
+ .vendor_id = 0x025d,
.part_id = 0x714,
.name_prefix = "rt714",
.version_id = 2,
@@ -407,6 +445,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 1,
},
{
+ .vendor_id = 0x025d,
.part_id = 0x715,
.name_prefix = "rt715",
.version_id = 2,
@@ -423,6 +462,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 1,
},
{
+ .vendor_id = 0x025d,
.part_id = 0x721,
.name_prefix = "rt721",
.version_id = 3,
@@ -466,6 +506,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 3,
},
{
+ .vendor_id = 0x025d,
.part_id = 0x722,
.name_prefix = "rt722",
.version_id = 3,
@@ -513,6 +554,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 3,
},
{
+ .vendor_id = 0x019f,
.part_id = 0x8373,
.name_prefix = "Left",
.dais = {
@@ -533,6 +575,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 1,
},
{
+ .vendor_id = 0x019f,
.part_id = 0x8363,
.name_prefix = "Left",
.dais = {
@@ -553,6 +596,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 1,
},
{
+ .vendor_id = 0x025d,
.part_id = 0x5682,
.name_prefix = "rt5682",
.dais = {
@@ -571,6 +615,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 1,
},
{
+ .vendor_id = 0x01fa,
.part_id = 0x3556,
.name_prefix = "AMP",
.dais = {
@@ -598,6 +643,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 2,
},
{
+ .vendor_id = 0x01fa,
.part_id = 0x3557,
.name_prefix = "AMP",
.dais = {
@@ -625,6 +671,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 2,
},
{
+ .vendor_id = 0x01fa,
.part_id = 0x3563,
.name_prefix = "AMP",
.dais = {
@@ -652,6 +699,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 2,
},
{
+ .vendor_id = 0x01fa,
.part_id = 0x4242,
.name_prefix = "cs42l42",
.dais = {
@@ -670,6 +718,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 1,
},
{
+ .vendor_id = 0x01fa,
.part_id = 0x4243,
.name_prefix = "cs42l43",
.count_sidecar = asoc_sdw_bridge_cs35l56_count_sidecar,
@@ -724,12 +773,105 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 4,
},
{
+ .vendor_id = 0x01fa,
+ .part_id = 0x2A3B,
+ .name_prefix = "cs42l43",
+ .count_sidecar = asoc_sdw_bridge_cs35l56_count_sidecar,
+ .add_sidecar = asoc_sdw_bridge_cs35l56_add_sidecar,
+ .dais = {
+ {
+ .direction = {true, false},
+ .codec_name = "cs42l43-codec",
+ .dai_name = "cs42l43-dp5",
+ .dai_type = SOC_SDW_DAI_TYPE_JACK,
+ .dailink = {SOC_SDW_JACK_OUT_DAI_ID, SOC_SDW_UNUSED_DAI_ID},
+ .rtd_init = asoc_sdw_cs42l43_hs_rtd_init,
+ .controls = generic_jack_controls,
+ .num_controls = ARRAY_SIZE(generic_jack_controls),
+ .widgets = generic_jack_widgets,
+ .num_widgets = ARRAY_SIZE(generic_jack_widgets),
+ },
+ {
+ .direction = {false, true},
+ .codec_name = "cs42l43-codec",
+ .dai_name = "cs42l43-dp1",
+ .dai_type = SOC_SDW_DAI_TYPE_MIC,
+ .dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_DMIC_DAI_ID},
+ .rtd_init = asoc_sdw_cs42l43_dmic_rtd_init,
+ .widgets = generic_dmic_widgets,
+ .num_widgets = ARRAY_SIZE(generic_dmic_widgets),
+ .quirk = SOC_SDW_CODEC_MIC,
+ .quirk_exclude = true,
+ },
+ {
+ .direction = {false, true},
+ .codec_name = "cs42l43-codec",
+ .dai_name = "cs42l43-dp2",
+ .dai_type = SOC_SDW_DAI_TYPE_JACK,
+ .dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_JACK_IN_DAI_ID},
+ },
+ {
+ .direction = {true, false},
+ .codec_name = "cs42l43-codec",
+ .dai_name = "cs42l43-dp6",
+ .dai_type = SOC_SDW_DAI_TYPE_AMP,
+ .dailink = {SOC_SDW_AMP_OUT_DAI_ID, SOC_SDW_UNUSED_DAI_ID},
+ .init = asoc_sdw_cs42l43_spk_init,
+ .rtd_init = asoc_sdw_cs42l43_spk_rtd_init,
+ .controls = generic_spk_controls,
+ .num_controls = ARRAY_SIZE(generic_spk_controls),
+ .widgets = generic_spk_widgets,
+ .num_widgets = ARRAY_SIZE(generic_spk_widgets),
+ .quirk = SOC_SDW_CODEC_SPKR | SOC_SDW_SIDECAR_AMPS,
+ },
+ },
+ .dai_num = 4,
+ },
+ {
+ .vendor_id = 0x01fa,
.part_id = 0x4245,
.name_prefix = "cs42l45",
.dais = {
{
.direction = {true, false},
- .codec_name = "snd_soc_sdca.UAJ.1",
+ .codec_name = "snd_soc_sdca.UAJ",
+ .dai_name = "IT 41",
+ .dai_type = SOC_SDW_DAI_TYPE_JACK,
+ .dailink = {SOC_SDW_JACK_OUT_DAI_ID, SOC_SDW_UNUSED_DAI_ID},
+ .rtd_init = asoc_sdw_cs42l45_hs_rtd_init,
+ },
+ {
+ .direction = {false, true},
+ .codec_name = "snd_soc_sdca.SmartMic",
+ .dai_name = "OT 113",
+ .dai_type = SOC_SDW_DAI_TYPE_MIC,
+ .dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_DMIC_DAI_ID},
+ .rtd_init = asoc_sdw_cs42l45_dmic_rtd_init,
+ },
+ {
+ .direction = {false, true},
+ .codec_name = "snd_soc_sdca.UAJ",
+ .dai_name = "OT 36",
+ .dai_type = SOC_SDW_DAI_TYPE_JACK,
+ .dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_JACK_IN_DAI_ID},
+ },
+ },
+ .dai_num = 3,
+ .auxs = {
+ {
+ .codec_name = "snd_soc_sdca.HID",
+ },
+ },
+ .aux_num = 1,
+ },
+ {
+ .vendor_id = 0x01fa,
+ .part_id = 0x4249,
+ .name_prefix = "cs42l45", /* Use same user-space as cs42l45 */
+ .dais = {
+ {
+ .direction = {true, false},
+ .codec_name = "snd_soc_sdca.UAJ",
.dai_name = "IT 41",
.dai_type = SOC_SDW_DAI_TYPE_JACK,
.dailink = {SOC_SDW_JACK_OUT_DAI_ID, SOC_SDW_UNUSED_DAI_ID},
@@ -737,7 +879,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
},
{
.direction = {false, true},
- .codec_name = "snd_soc_sdca.SmartMic.0",
+ .codec_name = "snd_soc_sdca.SmartMic",
.dai_name = "OT 113",
.dai_type = SOC_SDW_DAI_TYPE_MIC,
.dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_DMIC_DAI_ID},
@@ -745,7 +887,44 @@ struct asoc_sdw_codec_info codec_info_list[] = {
},
{
.direction = {false, true},
- .codec_name = "snd_soc_sdca.UAJ.1",
+ .codec_name = "snd_soc_sdca.UAJ",
+ .dai_name = "OT 36",
+ .dai_type = SOC_SDW_DAI_TYPE_JACK,
+ .dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_JACK_IN_DAI_ID},
+ },
+ },
+ .dai_num = 3,
+ .auxs = {
+ {
+ .codec_name = "snd_soc_sdca.HID",
+ },
+ },
+ .aux_num = 1,
+ },
+ {
+ .vendor_id = 0x01fa,
+ .part_id = 0x4747,
+ .name_prefix = "cs47l47",
+ .dais = {
+ {
+ .direction = {true, false},
+ .codec_name = "snd_soc_sdca.UAJ",
+ .dai_name = "IT 41",
+ .dai_type = SOC_SDW_DAI_TYPE_JACK,
+ .dailink = {SOC_SDW_JACK_OUT_DAI_ID, SOC_SDW_UNUSED_DAI_ID},
+ .rtd_init = asoc_sdw_cs47l47_hs_rtd_init,
+ },
+ {
+ .direction = {false, true},
+ .codec_name = "snd_soc_sdca.SmartMic",
+ .dai_name = "OT 113",
+ .dai_type = SOC_SDW_DAI_TYPE_MIC,
+ .dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_DMIC_DAI_ID},
+ .rtd_init = asoc_sdw_cs47l47_dmic_rtd_init,
+ },
+ {
+ .direction = {false, true},
+ .codec_name = "snd_soc_sdca.UAJ",
.dai_name = "OT 36",
.dai_type = SOC_SDW_DAI_TYPE_JACK,
.dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_JACK_IN_DAI_ID},
@@ -754,12 +933,13 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 3,
.auxs = {
{
- .codec_name = "snd_soc_sdca.HID.2",
+ .codec_name = "snd_soc_sdca.HID",
},
},
.aux_num = 1,
},
{
+ .vendor_id = 0x0105,
.part_id = 0xaaaa, /* generic codec mockup */
.name_prefix = "sdw_mockup_mmulti-function",
.version_id = 0,
@@ -786,6 +966,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 3,
},
{
+ .vendor_id = 0x0105,
.part_id = 0xaa55, /* headset codec mockup */
.name_prefix = "sdw_mockup_headset0",
.version_id = 0,
@@ -800,6 +981,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 1,
},
{
+ .vendor_id = 0x0105,
.part_id = 0x55aa, /* amplifier mockup */
.name_prefix = "sdw_mockup_amp1",
.version_id = 0,
@@ -814,6 +996,7 @@ struct asoc_sdw_codec_info codec_info_list[] = {
.dai_num = 1,
},
{
+ .vendor_id = 0x0105,
.part_id = 0x5555,
.name_prefix = "sdw_mockup_mic0",
.version_id = 0,
@@ -838,9 +1021,10 @@ EXPORT_SYMBOL_NS(asoc_sdw_get_codec_info_list_count, "SND_SOC_SDW_UTILS");
struct asoc_sdw_codec_info *asoc_sdw_find_codec_info_part(const u64 adr)
{
- unsigned int part_id, sdw_version;
+ unsigned int vendor_id, part_id, sdw_version;
int i;
+ vendor_id = SDW_MFG_ID(adr);
part_id = SDW_PART_ID(adr);
sdw_version = SDW_VERSION(adr);
for (i = 0; i < ARRAY_SIZE(codec_info_list); i++)
@@ -849,6 +1033,7 @@ struct asoc_sdw_codec_info *asoc_sdw_find_codec_info_part(const u64 adr)
* version_id is not specified in the codec info.
*/
if (part_id == codec_info_list[i].part_id &&
+ vendor_id == codec_info_list[i].vendor_id &&
(!codec_info_list[i].version_id ||
sdw_version == codec_info_list[i].version_id))
return &codec_info_list[i];
@@ -863,6 +1048,7 @@ static struct asoc_sdw_codec_info *asoc_sdw_find_codec_info_sdw_id(const struct
for (i = 0; i < ARRAY_SIZE(codec_info_list); i++)
if (id->part_id == codec_info_list[i].part_id &&
+ id->mfg_id == codec_info_list[i].vendor_id &&
(!codec_info_list[i].version_id ||
id->sdw_version == codec_info_list[i].version_id))
return &codec_info_list[i];
@@ -967,8 +1153,8 @@ int asoc_sdw_rtd_init(struct snd_soc_pcm_runtime *rtd)
ret = snd_soc_add_card_controls(card, codec_info->dais[dai_index].controls,
codec_info->dais[dai_index].num_controls);
if (ret) {
- dev_err(card->dev, "%#x controls addition failed: %d\n",
- codec_info->part_id, ret);
+ dev_err(card->dev, "%#x-%#x controls addition failed: %d\n",
+ codec_info->vendor_id, codec_info->part_id, ret);
return ret;
}
}
@@ -977,8 +1163,8 @@ int asoc_sdw_rtd_init(struct snd_soc_pcm_runtime *rtd)
codec_info->dais[dai_index].widgets,
codec_info->dais[dai_index].num_widgets);
if (ret) {
- dev_err(card->dev, "%#x widgets addition failed: %d\n",
- codec_info->part_id, ret);
+ dev_err(card->dev, "%#x-%#x widgets addition failed: %d\n",
+ codec_info->vendor_id, codec_info->part_id, ret);
return ret;
}
}
@@ -1215,8 +1401,18 @@ const char *asoc_sdw_get_codec_name(struct device *dev,
const struct snd_soc_acpi_link_adr *adr_link,
int adr_index)
{
- if (dai_info->codec_name)
- return devm_kstrdup(dev, dai_info->codec_name, GFP_KERNEL);
+ if (dai_info->codec_name) {
+ struct snd_soc_component *component;
+
+ component = snd_soc_lookup_component_by_name(dai_info->codec_name);
+ if (component) {
+ dev_dbg(dev, "%s found component %s for codec_name %s\n",
+ __func__, component->name, dai_info->codec_name);
+ return devm_kstrdup(dev, component->name, GFP_KERNEL);
+ } else {
+ return devm_kstrdup(dev, dai_info->codec_name, GFP_KERNEL);
+ }
+ }
return _asoc_sdw_get_codec_name(dev, adr_link, adr_index);
}
@@ -1528,7 +1724,17 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card,
return -EINVAL;
for (j = 0; j < codec_info->aux_num; j++) {
- soc_aux->dlc.name = codec_info->auxs[j].codec_name;
+ struct snd_soc_component *component;
+
+ component = snd_soc_lookup_component_by_name(codec_info->auxs[j].codec_name);
+ if (component) {
+ dev_dbg(dev, "%s found component %s for aux name %s\n",
+ __func__, component->name,
+ codec_info->auxs[j].codec_name);
+ soc_aux->dlc.name = component->name;
+ } else {
+ soc_aux->dlc.name = codec_info->auxs[j].codec_name;
+ }
soc_aux++;
}