From: Brent Lu <brent.lu@xxxxxxxxx> 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 <yung-chuan.liao@xxxxxxxxxxxxxxx> Signed-off-by: Brent Lu <brent.lu@xxxxxxxxx> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx> --- sound/soc/intel/boards/sof_sdw.c | 12 ++++------ sound/soc/intel/boards/sof_sdw_common.h | 4 ++-- sound/soc/intel/boards/sof_sdw_hdmi.c | 30 ++++--------------------- 3 files changed, 10 insertions(+), 36 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index cb5d71350f58..c5d555cc6f8e 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1542,8 +1542,6 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, return 0; } -#define IDISP_CODEC_MASK 0x4 - static int sof_card_dai_links_create(struct snd_soc_card *card) { struct device *dev = card->dev; @@ -1587,7 +1585,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) } if (mach_params->codec_mask & IDISP_CODEC_MASK) { - ctx->idisp_codec = true; + ctx->hdmi.idisp_codec = true; if (sof_sdw_quirk & SOF_SDW_TGL_HDMI) hdmi_num = SOF_TGL_HDMI_COUNT; @@ -1757,7 +1755,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) name = devm_kasprintf(dev, GFP_KERNEL, "iDisp%d", i + 1); cpu_dai_name = devm_kasprintf(dev, GFP_KERNEL, "iDisp%d Pin", i + 1); - if (ctx->idisp_codec) { + if (ctx->hdmi.idisp_codec) { codec_name = "ehdaudio0D2"; codec_dai_name = devm_kasprintf(dev, GFP_KERNEL, "intel-hdmi-hifi%d", i + 1); @@ -1769,7 +1767,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) ret = init_simple_dai_link(dev, dai_links + link_index, &be_id, name, 1, 0, // HDMI only supports playback cpu_dai_name, codec_name, codec_dai_name, - sof_sdw_hdmi_init, NULL); + i == 0 ? sof_sdw_hdmi_init : NULL, NULL); if (ret) return ret; @@ -1814,7 +1812,7 @@ static int sof_sdw_card_late_probe(struct snd_soc_card *card) } } - if (ctx->idisp_codec) + if (ctx->hdmi.idisp_codec) ret = sof_sdw_hdmi_card_late_probe(card); return ret; @@ -1893,8 +1891,6 @@ static int mc_probe(struct platform_device *pdev) if (!ctx) return -ENOMEM; - INIT_LIST_HEAD(&ctx->hdmi_pcm_list); - snd_soc_card_set_drvdata(card, ctx); dmi_check_system(sof_sdw_quirk_table); diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h index bfdeab4be1a7..e6b98523b4e7 100644 --- a/sound/soc/intel/boards/sof_sdw_common.h +++ b/sound/soc/intel/boards/sof_sdw_common.h @@ -12,6 +12,7 @@ #include <linux/bits.h> #include <linux/types.h> #include <sound/soc.h> +#include "sof_hdmi_common.h" #define MAX_NO_PROPS 2 #define MAX_HDMI_NUM 4 @@ -94,9 +95,8 @@ struct sof_sdw_codec_info { }; struct mc_private { - struct list_head hdmi_pcm_list; - bool idisp_codec; struct snd_soc_jack sdw_headset; + struct sof_hdmi_private hdmi; struct device *headset_codec_dev; /* only one headset per card */ struct device *amp_dev1, *amp_dev2; /* To store SDW Pin index for each SoundWire link */ diff --git a/sound/soc/intel/boards/sof_sdw_hdmi.c b/sound/soc/intel/boards/sof_sdw_hdmi.c index 7e07aa685573..f34fabdf9d93 100644 --- a/sound/soc/intel/boards/sof_sdw_hdmi.c +++ b/sound/soc/intel/boards/sof_sdw_hdmi.c @@ -15,47 +15,25 @@ #include "sof_sdw_common.h" #include "hda_dsp_common.h" -struct hdmi_pcm { - struct list_head head; - struct snd_soc_dai *codec_dai; - int device; -}; - int sof_sdw_hdmi_init(struct snd_soc_pcm_runtime *rtd) { struct mc_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; - - /* dai_link id is 1:1 mapped to the PCM device */ - pcm->device = rtd->dai_link->id; - pcm->codec_dai = dai; - - list_add_tail(&pcm->head, &ctx->hdmi_pcm_list); + ctx->hdmi.hdmi_comp = dai->component; return 0; } -#define NAME_SIZE 32 int sof_sdw_hdmi_card_late_probe(struct snd_soc_card *card) { struct mc_private *ctx = snd_soc_card_get_drvdata(card); - struct hdmi_pcm *pcm; - struct snd_soc_component *component = NULL; - if (!ctx->idisp_codec) + if (!ctx->hdmi.idisp_codec) return 0; - if (list_empty(&ctx->hdmi_pcm_list)) + if (!ctx->hdmi.hdmi_comp) return -EINVAL; - pcm = list_first_entry(&ctx->hdmi_pcm_list, struct hdmi_pcm, - head); - component = pcm->codec_dai->component; - - return hda_dsp_hdmi_build_controls(card, component); + return hda_dsp_hdmi_build_controls(card, ctx->hdmi.hdmi_comp); } -- 2.39.2