ASoC: Intel: sof_sdw: allow HDaudio/HDMI disable
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Mon, 6 Jun 2022 20:46:22 +0000 (15:46 -0500)
committerMark Brown <broonie@kernel.org>
Mon, 6 Jun 2022 21:00:08 +0000 (22:00 +0100)
For tests, it's rather common to disable the HDaudio links and codecs
in the build. Since we already get a codec_mask parameter indicating
that there are no codecs detected, it's straightforward to skip the
HDMI dailink creation and create a card.

Note that when disabling HDMI, a modified topology without HDMI
pipelines needs to be provided as well.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220606204622.144424-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/boards/Kconfig
sound/soc/intel/boards/sof_sdw.c

index f3873b5..4b4c1e1 100644 (file)
@@ -660,7 +660,6 @@ config SND_SOC_INTEL_SOUNDWIRE_SOF_MACH
        depends on MFD_INTEL_LPSS || COMPILE_TEST
        depends on SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES || COMPILE_TEST
        depends on SOUNDWIRE
-       depends on SND_HDA_CODEC_HDMI && SND_SOC_SOF_HDA_AUDIO_CODEC
        select SND_SOC_MAX98373_I2C
        select SND_SOC_MAX98373_SDW
        select SND_SOC_RT700_SDW
index 1f00679..f871daa 100644 (file)
@@ -1127,10 +1127,14 @@ static int sof_card_dai_links_create(struct device *dev,
        for (i = 0; i < ARRAY_SIZE(codec_info_list); i++)
                codec_info_list[i].amp_num = 0;
 
-       if (sof_sdw_quirk & SOF_SDW_TGL_HDMI)
-               hdmi_num = SOF_TGL_HDMI_COUNT;
-       else
-               hdmi_num = SOF_PRE_TGL_HDMI_COUNT;
+       if (mach_params->codec_mask & IDISP_CODEC_MASK) {
+               ctx->idisp_codec = true;
+
+               if (sof_sdw_quirk & SOF_SDW_TGL_HDMI)
+                       hdmi_num = SOF_TGL_HDMI_COUNT;
+               else
+                       hdmi_num = SOF_PRE_TGL_HDMI_COUNT;
+       }
 
        ssp_mask = SOF_SSP_GET_PORT(sof_sdw_quirk);
        /*
@@ -1150,9 +1154,6 @@ static int sof_card_dai_links_create(struct device *dev,
                return ret;
        }
 
-       if (mach_params->codec_mask & IDISP_CODEC_MASK)
-               ctx->idisp_codec = true;
-
        /* enable dmic01 & dmic16k */
        dmic_num = (sof_sdw_quirk & SOF_SDW_PCH_DMIC || mach_params->dmic_num) ? 2 : 0;
        comp_num += dmic_num;
@@ -1375,7 +1376,9 @@ HDMI:
 
 static int sof_sdw_card_late_probe(struct snd_soc_card *card)
 {
-       int i, ret;
+       struct mc_private *ctx = snd_soc_card_get_drvdata(card);
+       int ret = 0;
+       int i;
 
        for (i = 0; i < ARRAY_SIZE(codec_info_list); i++) {
                if (!codec_info_list[i].late_probe)
@@ -1386,7 +1389,10 @@ static int sof_sdw_card_late_probe(struct snd_soc_card *card)
                        return ret;
        }
 
-       return sof_sdw_hdmi_card_late_probe(card);
+       if (ctx->idisp_codec)
+               ret = sof_sdw_hdmi_card_late_probe(card);
+
+       return ret;
 }
 
 /* SoC card */