@@ -1016,8 +1016,17 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dai_type = SOF_SDW_DAI_TYPE_JACK,
.dailink = {SDW_UNUSED_DAI_ID, SDW_JACK_IN_DAI_ID},
},
+ {
+ .direction = {true, false},
+ .dai_name = "cs42l43-dp6",
+ .dai_type = SOF_SDW_DAI_TYPE_AMP,
+ .dailink = {SDW_AMP_OUT_DAI_ID, SDW_UNUSED_DAI_ID},
+ .init = sof_sdw_cs42l43_spk_init,
+ .rtd_init = cs42l43_spk_rtd_init,
+ .quirk = SOF_CODEC_SPKR,
+ },
},
- .dai_num = 3,
+ .dai_num = 4,
},
{
.part_id = 0xaaaa, /* generic codec mockup */
@@ -66,7 +66,7 @@ enum {
#define SOF_SDW_DAI_TYPE_AMP 1
#define SOF_SDW_DAI_TYPE_MIC 2
-#define SOF_SDW_MAX_DAI_NUM 3
+#define SOF_SDW_MAX_DAI_NUM 8
struct sof_sdw_codec_info;
@@ -162,6 +162,12 @@ int sof_sdw_maxim_init(struct snd_soc_card *card,
struct sof_sdw_codec_info *info,
bool playback);
+/* CS42L43 support */
+int sof_sdw_cs42l43_spk_init(struct snd_soc_card *card,
+ struct snd_soc_dai_link *dai_links,
+ struct sof_sdw_codec_info *info,
+ bool playback);
+
/* CS AMP support */
int sof_sdw_cs_amp_init(struct snd_soc_card *card,
struct snd_soc_dai_link *dai_links,
@@ -172,6 +178,7 @@ int sof_sdw_cs_amp_init(struct snd_soc_card *card,
int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd);
int cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd);
+int cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd);
int cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd);
int cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd);
int maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd);
@@ -30,6 +30,17 @@ static const struct snd_soc_dapm_route cs42l43_hs_map[] = {
{ "cs42l43 ADC1_IN1_N", NULL, "Headset Mic" },
};
+static const struct snd_soc_dapm_widget cs42l43_spk_widgets[] = {
+ SND_SOC_DAPM_SPK("Speaker", NULL),
+};
+
+static const struct snd_soc_dapm_route cs42l43_spk_map[] = {
+ { "Speaker", NULL, "cs42l43 AMP1_OUT_P", },
+ { "Speaker", NULL, "cs42l43 AMP1_OUT_N", },
+ { "Speaker", NULL, "cs42l43 AMP2_OUT_P", },
+ { "Speaker", NULL, "cs42l43 AMP2_OUT_N", },
+};
+
static const struct snd_soc_dapm_widget cs42l43_dmic_widgets[] = {
SND_SOC_DAPM_MIC("DMIC", NULL),
};
@@ -108,6 +119,45 @@ int cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd)
return ret;
}
+int cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd)
+{
+ struct snd_soc_card *card = rtd->card;
+ int ret;
+
+ card->components = devm_kasprintf(card->dev, GFP_KERNEL, "%s spk:cs42l43-spk",
+ card->components);
+ if (!card->components)
+ return -ENOMEM;
+
+ ret = snd_soc_dapm_new_controls(&card->dapm, cs42l43_spk_widgets,
+ ARRAY_SIZE(cs42l43_spk_widgets));
+ if (ret) {
+ dev_err(card->dev, "cs42l43 speaker widgets addition failed: %d\n", ret);
+ return ret;
+ }
+
+ ret = snd_soc_dapm_add_routes(&card->dapm, cs42l43_spk_map,
+ ARRAY_SIZE(cs42l43_spk_map));
+ if (ret)
+ dev_err(card->dev, "cs42l43 speaker map addition failed: %d\n", ret);
+
+ return ret;
+}
+
+int sof_sdw_cs42l43_spk_init(struct snd_soc_card *card,
+ struct snd_soc_dai_link *dai_links,
+ struct sof_sdw_codec_info *info,
+ bool playback)
+{
+ /* Do init on playback link only. */
+ if (!playback)
+ return 0;
+
+ info->amp_num++;
+
+ return 0;
+}
+
int cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
@@ -357,6 +357,12 @@ static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = {
.group_position = 0,
.group_id = 0,
},
+ { /* Speaker Playback Endpoint */
+ .num = 3,
+ .aggregated = 0,
+ .group_position = 0,
+ .group_id = 0,
+ },
};
static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = {
@@ -433,6 +433,12 @@ static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = {
.group_position = 0,
.group_id = 0,
},
+ { /* Speaker Playback Endpoint */
+ .num = 3,
+ .aggregated = 0,
+ .group_position = 0,
+ .group_id = 0,
+ },
};
static const struct snd_soc_acpi_adr_device cs42l43_3_adr[] = {