]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: Intel: sof_sdw: Implement add_dai_link to filter HDMI PCMs
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Thu, 19 Jun 2025 08:42:22 +0000 (11:42 +0300)
committerMark Brown <broonie@kernel.org>
Thu, 19 Jun 2025 12:19:16 +0000 (13:19 +0100)
If the system does not have iDisp codec then mark the HDMI PCM link as
ignore.
This ensures that HDMI PCMs will not be created when there is no iDisp
codec available.

When iDisp codec is not present and the HDMI PCMs were created they were
not operational, all operations would fail on them.

With this patch it is possible to load the topology with HDMI links, but
gives the ability to ignore them and thus prevent the creation of the
nonworking PCM devices.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://patch.msgid.link/20250619084222.559-5-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/boards/sof_sdw.c

index 81a914bd7ec21cad4f81e09b23f653782d90d045..05d13bacf88a193f1f7b6358d3687c0cf7e704ec 100644 (file)
@@ -1295,6 +1295,19 @@ static int sof_sdw_card_late_probe(struct snd_soc_card *card)
        return ret;
 }
 
+static int sof_sdw_add_dai_link(struct snd_soc_card *card,
+                               struct snd_soc_dai_link *link)
+{
+       struct asoc_sdw_mc_private *ctx = snd_soc_card_get_drvdata(card);
+       struct intel_mc_ctx *intel_ctx = (struct intel_mc_ctx *)ctx->private;
+
+       /* Ignore the HDMI PCM link if iDisp is not present */
+       if (strstr(link->stream_name, "HDMI") && !intel_ctx->hdmi.idisp_codec)
+               link->ignore = true;
+
+       return 0;
+}
+
 static int mc_probe(struct platform_device *pdev)
 {
        struct snd_soc_acpi_mach *mach = dev_get_platdata(&pdev->dev);
@@ -1321,6 +1334,7 @@ static int mc_probe(struct platform_device *pdev)
        card->name = "soundwire";
        card->owner = THIS_MODULE;
        card->late_probe = sof_sdw_card_late_probe;
+       card->add_dai_link = sof_sdw_add_dai_link;
 
        snd_soc_card_set_drvdata(card, ctx);