diff --git a/sound/soc/intel/boards/Kconfig b/sound/soc/intel/boards/Kconfig index f472f603ab750e..2717874d65da2a 100644 --- a/sound/soc/intel/boards/Kconfig +++ b/sound/soc/intel/boards/Kconfig @@ -505,6 +505,7 @@ config SND_SOC_INTEL_SOF_CS42L42_MACH (MFD_INTEL_LPSS || COMPILE_TEST)) select SND_SOC_CS42L42 select SND_SOC_MAX98357A + select SND_SOC_MAX98396 select SND_SOC_DMIC select SND_SOC_HDAC_HDMI select SND_SOC_INTEL_HDA_DSP_COMMON diff --git a/sound/soc/intel/boards/sof_cs42l42.c b/sound/soc/intel/boards/sof_cs42l42.c index e6695e77d59438..6f087ca0bdedc7 100644 --- a/sound/soc/intel/boards/sof_cs42l42.c +++ b/sound/soc/intel/boards/sof_cs42l42.c @@ -48,6 +48,7 @@ (((quirk) << SOF_CS42L42_SSP_BT_SHIFT) & SOF_CS42L42_SSP_BT_MASK) #define SOF_MAX98357A_SPEAKER_AMP_PRESENT BIT(29) #define SOF_MAX98360A_SPEAKER_AMP_PRESENT BIT(30) +#define SOF_MAX98396_SPEAKER_AMP_PRESENT BIT(31) enum { LINK_NONE = 0, @@ -222,11 +223,15 @@ static int sof_card_late_probe(struct snd_soc_card *card) static const struct snd_kcontrol_new sof_controls[] = { SOC_DAPM_PIN_SWITCH("Headphone Jack"), SOC_DAPM_PIN_SWITCH("Headset Mic"), + SOC_DAPM_PIN_SWITCH("Left Spk"), + SOC_DAPM_PIN_SWITCH("Right Spk"), }; static const struct snd_soc_dapm_widget sof_widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), + SND_SOC_DAPM_SPK("Left Spk", NULL), + SND_SOC_DAPM_SPK("Right Spk", NULL), }; static const struct snd_soc_dapm_widget dmic_widgets[] = { @@ -320,6 +325,8 @@ static int create_spk_amp_dai_links(struct device *dev, max_98357a_dai_link(&links[*id]); } else if (sof_cs42l42_quirk & SOF_MAX98360A_SPEAKER_AMP_PRESENT) { max_98360a_dai_link(&links[*id]); + } else if (sof_cs42l42_quirk & SOF_MAX98396_SPEAKER_AMP_PRESENT) { + max_98396_dai_link(&links[*id]); } else { dev_err(dev, "no amp defined\n"); ret = -EINVAL; @@ -651,6 +658,9 @@ static int sof_audio_probe(struct platform_device *pdev) if (sof_cs42l42_quirk & SOF_SPEAKER_AMP_PRESENT) sof_audio_card_cs42l42.num_links++; + if (sof_cs42l42_quirk & SOF_MAX98396_SPEAKER_AMP_PRESENT) + sof_max98396_codec_conf(&sof_audio_card_cs42l42); + if (sof_cs42l42_quirk & SOF_BT_OFFLOAD_PRESENT) sof_audio_card_cs42l42.num_links++; @@ -707,6 +717,17 @@ static const struct platform_device_id board_ids[] = { SOF_CS42L42_SSP_BT(2) | SOF_CS42L42_DAILINK(LINK_HP, LINK_DMIC, LINK_HDMI, LINK_SPK, LINK_BT)), }, + { + .name = "adl_mx98396_cs4242", + .driver_data = (kernel_ulong_t)(SOF_CS42L42_SSP_CODEC(0) | + SOF_SPEAKER_AMP_PRESENT | + SOF_MAX98396_SPEAKER_AMP_PRESENT | + SOF_CS42L42_SSP_AMP(1) | + SOF_CS42L42_NUM_HDMIDEV(4) | + SOF_BT_OFFLOAD_PRESENT | + SOF_CS42L42_SSP_BT(2) | + SOF_CS42L42_DAILINK(LINK_HP, LINK_DMIC, LINK_HDMI, LINK_SPK, LINK_BT)), + }, { } }; MODULE_DEVICE_TABLE(platform, board_ids); diff --git a/sound/soc/intel/boards/sof_maxim_common.c b/sound/soc/intel/boards/sof_maxim_common.c index 112e89951da08b..a705394c7b811a 100644 --- a/sound/soc/intel/boards/sof_maxim_common.c +++ b/sound/soc/intel/boards/sof_maxim_common.c @@ -51,11 +51,13 @@ static int max_98373_hw_params(struct snd_pcm_substream *substream, int j; for_each_rtd_codec_dais(rtd, j, codec_dai) { - if (!strcmp(codec_dai->component->name, MAX_98373_DEV0_NAME)) { + if (!strcmp(codec_dai->component->name, MAX_98373_DEV0_NAME) || + !strcmp(codec_dai->component->name, MAX_98396_DEV0_NAME)) { /* DEV0 tdm slot configuration */ snd_soc_dai_set_tdm_slot(codec_dai, 0x03, 3, 8, 32); } - if (!strcmp(codec_dai->component->name, MAX_98373_DEV1_NAME)) { + if (!strcmp(codec_dai->component->name, MAX_98373_DEV1_NAME) || + !strcmp(codec_dai->component->name, MAX_98396_DEV1_NAME)) { /* DEV1 tdm slot configuration */ snd_soc_dai_set_tdm_slot(codec_dai, 0x0C, 3, 8, 32); } @@ -313,6 +315,51 @@ void max_98390_set_codec_conf(struct snd_soc_card *card, int ch) } EXPORT_SYMBOL_NS(max_98390_set_codec_conf, SND_SOC_INTEL_SOF_MAXIM_COMMON); +/* + * Maxim MAX98396 + */ +static struct snd_soc_codec_conf max_98396_codec_conf[] = { + { + .dlc = COMP_CODEC_CONF(MAX_98396_DEV0_NAME), + .name_prefix = "Right", + }, + { + .dlc = COMP_CODEC_CONF(MAX_98396_DEV1_NAME), + .name_prefix = "Left", + }, +}; + +static struct snd_soc_dai_link_component max_98396_components[] = { + { /* For Right */ + .name = MAX_98396_DEV0_NAME, + .dai_name = MAX_98396_CODEC_DAI, + }, + { /* For Left */ + .name = MAX_98396_DEV1_NAME, + .dai_name = MAX_98396_CODEC_DAI, + }, +}; + +static const struct snd_soc_ops max_98396_ops = { + .hw_params = max_98373_hw_params, +}; + +void max_98396_dai_link(struct snd_soc_dai_link *link) +{ + link->codecs = max_98396_components; + link->num_codecs = ARRAY_SIZE(max_98396_components); + link->init = max_98373_spk_codec_init; + link->ops = &max_98396_ops; +} +EXPORT_SYMBOL_NS(max_98396_dai_link, SND_SOC_INTEL_SOF_MAXIM_COMMON); + +void sof_max98396_codec_conf(struct snd_soc_card *card) +{ + card->codec_conf = max_98396_codec_conf; + card->num_configs = ARRAY_SIZE(max_98396_codec_conf); +} +EXPORT_SYMBOL_NS(sof_max98396_codec_conf, SND_SOC_INTEL_SOF_MAXIM_COMMON); + /* * Maxim MAX98357A/MAX98360A */ diff --git a/sound/soc/intel/boards/sof_maxim_common.h b/sound/soc/intel/boards/sof_maxim_common.h index 7a8c53049e4d56..c94a10faa8f8a1 100644 --- a/sound/soc/intel/boards/sof_maxim_common.h +++ b/sound/soc/intel/boards/sof_maxim_common.h @@ -40,6 +40,16 @@ extern const struct snd_soc_ops max_98390_ops; void max_98390_set_codec_conf(struct snd_soc_card *card, int ch); int max_98390_spk_codec_init(struct snd_soc_pcm_runtime *rtd); +/* + * Maxim MAX98396 + */ +#define MAX_98396_CODEC_DAI "max98396-aif1" +#define MAX_98396_DEV0_NAME "i2c-ADS8396-00" +#define MAX_98396_DEV1_NAME "i2c-ADS8396-01" + +void max_98396_dai_link(struct snd_soc_dai_link *link); +void sof_max98396_codec_conf(struct snd_soc_card *card); + /* * Maxim MAX98357A/MAX98360A */ diff --git a/sound/soc/intel/common/soc-acpi-intel-adl-match.c b/sound/soc/intel/common/soc-acpi-intel-adl-match.c index bcd66e0094b4bc..26abc1266c68e4 100644 --- a/sound/soc/intel/common/soc-acpi-intel-adl-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-adl-match.c @@ -482,6 +482,11 @@ static const struct snd_soc_acpi_codecs adl_max98390_amp = { .codecs = {"MX98390"} }; +static const struct snd_soc_acpi_codecs adl_max98396_amp = { + .num_codecs = 1, + .codecs = {"ADS8396"} +}; + static const struct snd_soc_acpi_codecs adl_lt6911_hdmi = { .num_codecs = 1, .codecs = {"INTC10B0"} @@ -580,6 +585,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = { .quirk_data = &adl_max98360a_amp, .sof_tplg_filename = "sof-adl-max98360a-cs42l42.tplg", }, + { + .id = "10134242", + .drv_name = "adl_mx98396_cs4242", + .machine_quirk = snd_soc_acpi_codec_list, + .quirk_data = &adl_max98396_amp, + .sof_tplg_filename = "sof-adl-max98396-cs42l42.tplg", + }, { .comp_ids = &essx_83x6, .drv_name = "adl_es83x6_c1_h02",