return 0;
 }
 
-#define IDISP_CODEC_MASK       0x4
-
 static int sof_card_dai_links_create(struct snd_soc_card *card)
 {
        struct device *dev = card->dev;
        }
 
        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;
                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);
                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;
 
                }
        }
 
-       if (ctx->idisp_codec)
+       if (ctx->hdmi.idisp_codec)
                ret = sof_sdw_hdmi_card_late_probe(card);
 
        return ret;
        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);
 
 #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
 };
 
 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 */
 
 #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);
 }