From fa76fcad1d7fa43725814abba503b02871eefd5a Mon Sep 17 00:00:00 2001 From: Brent Lu Date: Thu, 12 Oct 2023 15:08:17 -0400 Subject: [PATCH] ASoC: Intel: sof_da7219: use sof_hdmi_private to init HDMI Use sof_hdmi_private structure instead of a link list of sof_hdmi_pcm structure for HDMI dai link initialization since hdac-hdmi support is removed. Reviewed-by: Bard Liao Signed-off-by: Brent Lu Signed-off-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20231012190826.142619-15-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown --- sound/soc/intel/boards/sof_da7219.c | 32 ++++++++++++----------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/sound/soc/intel/boards/sof_da7219.c b/sound/soc/intel/boards/sof_da7219.c index 03131cb495d1..6eb5a6144e97 100644 --- a/sound/soc/intel/boards/sof_da7219.c +++ b/sound/soc/intel/boards/sof_da7219.c @@ -16,6 +16,7 @@ #include #include "../../codecs/da7219.h" #include "hda_dsp_common.h" +#include "sof_hdmi_common.h" #include "sof_maxim_common.h" #include "sof_ssp_common.h" @@ -24,14 +25,9 @@ #define DIALOG_CODEC_DAI "da7219-hifi" -struct hdmi_pcm { - struct list_head head; - struct snd_soc_dai *codec_dai; -}; - struct card_private { struct snd_soc_jack headset_jack; - struct list_head hdmi_pcm_list; + struct sof_hdmi_private hdmi; enum sof_ssp_codec codec_type; enum sof_ssp_codec amp_type; @@ -230,15 +226,8 @@ static int hdmi_init(struct snd_soc_pcm_runtime *rtd) { struct card_private *ctx = snd_soc_card_get_drvdata(rtd->card); struct snd_soc_dai *dai = snd_soc_rtd_to_codec(rtd, 0); - struct hdmi_pcm *pcm; - pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); - if (!pcm) - return -ENOMEM; - - pcm->codec_dai = dai; - - list_add_tail(&pcm->head, &ctx->hdmi_pcm_list); + ctx->hdmi.hdmi_comp = dai->component; return 0; } @@ -246,10 +235,14 @@ static int hdmi_init(struct snd_soc_pcm_runtime *rtd) static int card_late_probe(struct snd_soc_card *card) { struct card_private *ctx = snd_soc_card_get_drvdata(card); - struct hdmi_pcm *pcm; - pcm = list_first_entry(&ctx->hdmi_pcm_list, struct hdmi_pcm, head); - return hda_dsp_hdmi_build_controls(card, pcm->codec_dai->component); + if (!ctx->hdmi.idisp_codec) + return 0; + + if (!ctx->hdmi.hdmi_comp) + return -EINVAL; + + return hda_dsp_hdmi_build_controls(card, ctx->hdmi.hdmi_comp); } SND_SOC_DAILINK_DEF(ssp0_pin, @@ -469,6 +462,9 @@ static int audio_probe(struct platform_device *pdev) ctx->codec_type = sof_ssp_detect_codec_type(&pdev->dev); ctx->amp_type = sof_ssp_detect_amp_type(&pdev->dev); + if (mach->mach_params.codec_mask & IDISP_CODEC_MASK) + ctx->hdmi.idisp_codec = true; + if (board_quirk & SOF_DA7219_JSL_BOARD) { /* backward-compatible with existing devices */ switch (ctx->amp_type) { @@ -524,8 +520,6 @@ static int audio_probe(struct platform_device *pdev) card_da7219.dai_link = dai_links; - INIT_LIST_HEAD(&ctx->hdmi_pcm_list); - card_da7219.dev = &pdev->dev; ret = snd_soc_fixup_dai_links_platform_name(&card_da7219,