Unverified Commit bb48117b authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Mark Brown
Browse files

ASoC: Intel: sof_sdw: Implement add_dai_link to filter HDMI PCMs



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: default avatarPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarLiam Girdwood <liam.r.girdwood@intel.com>
Reviewed-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://patch.msgid.link/20250619084222.559-5-peter.ujfalusi@linux.intel.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 86591907
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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);