diff --git a/sound/soc/intel/boards/Kconfig b/sound/soc/intel/boards/Kconfig index 9e427f00deac57..d40e910abd2422 100644 --- a/sound/soc/intel/boards/Kconfig +++ b/sound/soc/intel/boards/Kconfig @@ -516,6 +516,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_INTEL_HDA_DSP_COMMON select SND_SOC_INTEL_SOF_BOARD_HELPERS diff --git a/sound/soc/intel/boards/sof_cs42l42.c b/sound/soc/intel/boards/sof_cs42l42.c index 30e78c20ce6e36..c003f7a3c10d6c 100644 --- a/sound/soc/intel/boards/sof_cs42l42.c +++ b/sound/soc/intel/boards/sof_cs42l42.c @@ -217,6 +217,10 @@ static int create_spk_amp_dai_links(struct device *dev, case CODEC_MAX98360A: max_98360a_dai_link(&links[*id]); break; + case CODEC_MAX98396: + max_98396_dai_link(&links[*id]); + break; + default: dev_err(dev, "invalid amp type %d\n", amp_type); return -EINVAL; @@ -466,6 +470,19 @@ static int sof_audio_probe(struct platform_device *pdev) sof_audio_card_cs42l42.dai_link = dai_links; + /* update codec_conf */ + switch (ctx->amp_type) { + case CODEC_MAX98396: + max_98396_set_codec_conf(&sof_audio_card_cs42l42); + break; + case CODEC_NONE: + /* no codec conf required */ + break; + default: + dev_err(&pdev->dev, "invalid amp type %d\n", ctx->amp_type); + return -EINVAL; + } + sof_audio_card_cs42l42.dev = &pdev->dev; /* set platform name for each dailink */ @@ -502,6 +519,16 @@ 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_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 3c00afc328050f..f9231218c630fb 100644 --- a/sound/soc/intel/boards/sof_maxim_common.c +++ b/sound/soc/intel/boards/sof_maxim_common.c @@ -64,11 +64,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); } @@ -343,6 +345,52 @@ void max_98390_set_codec_conf(struct device *dev, struct snd_soc_card *card) } 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", + }, +}; + +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, + .trigger = max_98373_trigger, +}; + +void max_98396_dai_link(struct snd_soc_dai_link *link) +{ + link->codecs = max_98396_components; + link->num_codecs = get_num_codecs(MAX_98396_ACPI_HID); + 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(max_98396_set_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 fe0212fbad8eab..13be87dc691224 100644 --- a/sound/soc/intel/boards/sof_maxim_common.h +++ b/sound/soc/intel/boards/sof_maxim_common.h @@ -40,6 +40,16 @@ int max_98373_trigger(struct snd_pcm_substream *substream, int cmd); void max_98390_dai_link(struct device *dev, struct snd_soc_dai_link *link); void max_98390_set_codec_conf(struct device *dev, struct snd_soc_card *card); +/* + * Maxim MAX98396 + */ +#define MAX_98396_CODEC_DAI "max98396-aif1" +#define MAX_98396_DEV0_NAME "i2c-" MAX_98396_ACPI_HID ":00" +#define MAX_98396_DEV1_NAME "i2c-" MAX_98396_ACPI_HID ":01" + +void max_98396_dai_link(struct snd_soc_dai_link *link); +void max_98396_set_codec_conf(struct snd_soc_card *card); + /* * Maxim MAX98357A/MAX98360A */ diff --git a/sound/soc/intel/boards/sof_ssp_common.c b/sound/soc/intel/boards/sof_ssp_common.c index 96072790e9c0f9..f4fbe250c44c87 100644 --- a/sound/soc/intel/boards/sof_ssp_common.c +++ b/sound/soc/intel/boards/sof_ssp_common.c @@ -52,6 +52,7 @@ static const struct codec_map amps[] = { CODEC_MAP_ENTRY("MAX98360A", MAX_98360A_ACPI_HID, CODEC_MAX98360A), CODEC_MAP_ENTRY("MAX98373", MAX_98373_ACPI_HID, CODEC_MAX98373), CODEC_MAP_ENTRY("MAX98390", MAX_98390_ACPI_HID, CODEC_MAX98390), + CODEC_MAP_ENTRY("ADS8396", MAX_98396_ACPI_HID, CODEC_MAX98396), /* Nuvoton */ CODEC_MAP_ENTRY("NAU8318", NAU8318_ACPI_HID, CODEC_NAU8318), diff --git a/sound/soc/intel/boards/sof_ssp_common.h b/sound/soc/intel/boards/sof_ssp_common.h index 6d827103479b5d..fb9e230dfcdd20 100644 --- a/sound/soc/intel/boards/sof_ssp_common.h +++ b/sound/soc/intel/boards/sof_ssp_common.h @@ -22,6 +22,7 @@ #define MAX_98360A_ACPI_HID "MX98360A" #define MAX_98373_ACPI_HID "MX98373" #define MAX_98390_ACPI_HID "MX98390" +#define MAX_98396_ACPI_HID "ADS8396" /* Nuvoton */ #define NAU8318_ACPI_HID "NVTN2012" @@ -63,6 +64,7 @@ enum sof_ssp_codec { CODEC_RT1015P, CODEC_RT1019P, CODEC_RT1308, + CODEC_MAX98396, }; enum sof_ssp_codec sof_ssp_detect_codec_type(struct device *dev); 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 6e712ad954c849..5efb40691289b9 100644 --- a/sound/soc/intel/common/soc-acpi-intel-adl-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-adl-match.c @@ -497,6 +497,11 @@ static struct snd_soc_acpi_codecs adl_rt5650_amp = { .codecs = {"10EC5650"} }; +static const struct snd_soc_acpi_codecs adl_max98396_amp = { + .num_codecs = 1, + .codecs = {"ADS8396"} +}; + struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = { { .comp_ids = &adl_rt5682_rt5682s_hp, @@ -592,6 +597,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",