* [PATCH 0/4] ASoC: core/topology/Intel:
@ 2025-06-19 8:42 Peter Ujfalusi
2025-06-19 8:42 ` [PATCH 1/4] ASoC: topology: Do not call snd_soc_remove_pcm_runtime() for ignored links Peter Ujfalusi
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Peter Ujfalusi @ 2025-06-19 8:42 UTC (permalink / raw)
To: lgirdwood, broonie
Cc: linux-sound, kai.vehmanen, ranjani.sridharan, yung-chuan.liao,
pierre-louis.bossart
Hi,
There are devices where the iDisp HDA codec for HDMI is disconnected
and it is not present on the HDA bus.
This usually happens on systems with dGPU, but not limited to them.
How SOF tried to deal with this is to drop in a dummy codec in place of
the iDisp to allow the topology to be loaded, but these PCM devices are
unusable, they fail when user tries to use them.
PA/PW is probing the PCM devices on probe and that causes the kernel log
to fill up with errors, which is harmless but disturbing.
This series will use the filter function to prevent the creation of the
HDMI PCM devices in the first place (like HDA legacy stack will not
present HDMI devices if the codec is not visible).
The topology still loads, we still use dummy codec to satisfy it, but
there will be no dummy PCM devices created.
The first two patch handles the same issue that was discovered by the
ignored link: a NULL dereference.
I'm not sure if both is needed, but I felt that fixing it in one place
and leaving the other open might not be future proof.
If I would to pick one, I would likely go with the patch for the
soc-core.
Regards,
Peter
---
Peter Ujfalusi (4):
ASoC: topology: Do not call snd_soc_remove_pcm_runtime() for ignored
links
ASoC: core: Check for rtd == NULL in snd_soc_remove_pcm_runtime()
ASoC: Intel: skl_hda_dsp_generic: Implement add_dai_link to filter
HDMI PCMs
ASoC: Intel: sof_sdw: Implement add_dai_link to filter HDMI PCMs
sound/soc/intel/boards/skl_hda_dsp_generic.c | 13 +++++++++++++
sound/soc/intel/boards/sof_sdw.c | 14 ++++++++++++++
sound/soc/soc-core.c | 3 +++
sound/soc/soc-topology.c | 7 +++++--
4 files changed, 35 insertions(+), 2 deletions(-)
--
2.49.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] ASoC: topology: Do not call snd_soc_remove_pcm_runtime() for ignored links
2025-06-19 8:42 [PATCH 0/4] ASoC: core/topology/Intel: Peter Ujfalusi
@ 2025-06-19 8:42 ` Peter Ujfalusi
2025-06-19 8:42 ` [PATCH 2/4] ASoC: core: Check for rtd == NULL in snd_soc_remove_pcm_runtime() Peter Ujfalusi
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Peter Ujfalusi @ 2025-06-19 8:42 UTC (permalink / raw)
To: lgirdwood, broonie
Cc: linux-sound, kai.vehmanen, ranjani.sridharan, yung-chuan.liao,
pierre-louis.bossart
If a link has been ignored then it is not even added.
The snd_soc_get_pcm_runtime() will return NULL as the runtime will does
not exist.
We can just skip this step to avoid performing a lookup to do nothing.
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>
---
sound/soc/soc-topology.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 7b0b8531bb32..44b60324eaa2 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -429,8 +429,11 @@ static void soc_tplg_remove_link(struct snd_soc_component *comp,
dobj->unload(comp, dobj);
list_del(&dobj->list);
- snd_soc_remove_pcm_runtime(comp->card,
- snd_soc_get_pcm_runtime(comp->card, link));
+
+ /* Ignored links do not need to be removed, they are not added */
+ if (!link->ignore)
+ snd_soc_remove_pcm_runtime(comp->card,
+ snd_soc_get_pcm_runtime(comp->card, link));
}
/* unload dai link */
--
2.49.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] ASoC: core: Check for rtd == NULL in snd_soc_remove_pcm_runtime()
2025-06-19 8:42 [PATCH 0/4] ASoC: core/topology/Intel: Peter Ujfalusi
2025-06-19 8:42 ` [PATCH 1/4] ASoC: topology: Do not call snd_soc_remove_pcm_runtime() for ignored links Peter Ujfalusi
@ 2025-06-19 8:42 ` Peter Ujfalusi
2025-06-19 8:42 ` [PATCH 3/4] ASoC: Intel: skl_hda_dsp_generic: Implement add_dai_link to filter HDMI PCMs Peter Ujfalusi
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Peter Ujfalusi @ 2025-06-19 8:42 UTC (permalink / raw)
To: lgirdwood, broonie
Cc: linux-sound, kai.vehmanen, ranjani.sridharan, yung-chuan.liao,
pierre-louis.bossart
snd_soc_remove_pcm_runtime() might be called with rtd == NULL which will
leads to null pointer dereference.
This was reproduced with topology loading and marking a link as ignore
due to missing hardware component on the system.
On module removal the soc_tplg_remove_link() would call
snd_soc_remove_pcm_runtime() with rtd == NULL since the link was ignored,
no runtime was created.
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>
---
sound/soc/soc-core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index cfafdabcdc88..1ffabac1fb6b 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1139,6 +1139,9 @@ static int snd_soc_compensate_channel_connection_map(struct snd_soc_card *card,
void snd_soc_remove_pcm_runtime(struct snd_soc_card *card,
struct snd_soc_pcm_runtime *rtd)
{
+ if (!rtd)
+ return;
+
lockdep_assert_held(&client_mutex);
/*
--
2.49.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] ASoC: Intel: skl_hda_dsp_generic: Implement add_dai_link to filter HDMI PCMs
2025-06-19 8:42 [PATCH 0/4] ASoC: core/topology/Intel: Peter Ujfalusi
2025-06-19 8:42 ` [PATCH 1/4] ASoC: topology: Do not call snd_soc_remove_pcm_runtime() for ignored links Peter Ujfalusi
2025-06-19 8:42 ` [PATCH 2/4] ASoC: core: Check for rtd == NULL in snd_soc_remove_pcm_runtime() Peter Ujfalusi
@ 2025-06-19 8:42 ` Peter Ujfalusi
2025-06-19 8:42 ` [PATCH 4/4] ASoC: Intel: sof_sdw: " Peter Ujfalusi
2025-06-20 11:32 ` [PATCH 0/4] ASoC: core/topology/Intel: Mark Brown
4 siblings, 0 replies; 6+ messages in thread
From: Peter Ujfalusi @ 2025-06-19 8:42 UTC (permalink / raw)
To: lgirdwood, broonie
Cc: linux-sound, kai.vehmanen, ranjani.sridharan, yung-chuan.liao,
pierre-louis.bossart
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>
---
sound/soc/intel/boards/skl_hda_dsp_generic.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/sound/soc/intel/boards/skl_hda_dsp_generic.c b/sound/soc/intel/boards/skl_hda_dsp_generic.c
index 0554c7e2cb34..519218385fdf 100644
--- a/sound/soc/intel/boards/skl_hda_dsp_generic.c
+++ b/sound/soc/intel/boards/skl_hda_dsp_generic.c
@@ -85,6 +85,18 @@ skl_hda_get_board_quirk(struct snd_soc_acpi_mach_params *mach_params)
return board_quirk;
}
+static int skl_hda_add_dai_link(struct snd_soc_card *card,
+ struct snd_soc_dai_link *link)
+{
+ struct sof_card_private *ctx = snd_soc_card_get_drvdata(card);
+
+ /* Ignore the HDMI PCM link if iDisp is not present */
+ if (strstr(link->stream_name, "HDMI") && !ctx->hdmi.idisp_codec)
+ link->ignore = true;
+
+ return 0;
+}
+
static int skl_hda_audio_probe(struct platform_device *pdev)
{
struct snd_soc_acpi_mach *mach = pdev->dev.platform_data;
@@ -101,6 +113,7 @@ static int skl_hda_audio_probe(struct platform_device *pdev)
card->owner = THIS_MODULE;
card->fully_routed = true;
card->late_probe = skl_hda_card_late_probe;
+ card->add_dai_link = skl_hda_add_dai_link;
dev_dbg(&pdev->dev, "board_quirk = %lx\n", board_quirk);
--
2.49.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] ASoC: Intel: sof_sdw: Implement add_dai_link to filter HDMI PCMs
2025-06-19 8:42 [PATCH 0/4] ASoC: core/topology/Intel: Peter Ujfalusi
` (2 preceding siblings ...)
2025-06-19 8:42 ` [PATCH 3/4] ASoC: Intel: skl_hda_dsp_generic: Implement add_dai_link to filter HDMI PCMs Peter Ujfalusi
@ 2025-06-19 8:42 ` Peter Ujfalusi
2025-06-20 11:32 ` [PATCH 0/4] ASoC: core/topology/Intel: Mark Brown
4 siblings, 0 replies; 6+ messages in thread
From: Peter Ujfalusi @ 2025-06-19 8:42 UTC (permalink / raw)
To: lgirdwood, broonie
Cc: linux-sound, kai.vehmanen, ranjani.sridharan, yung-chuan.liao,
pierre-louis.bossart
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>
---
sound/soc/intel/boards/sof_sdw.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c
index 81a914bd7ec2..05d13bacf88a 100644
--- a/sound/soc/intel/boards/sof_sdw.c
+++ b/sound/soc/intel/boards/sof_sdw.c
@@ -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);
--
2.49.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] ASoC: core/topology/Intel:
2025-06-19 8:42 [PATCH 0/4] ASoC: core/topology/Intel: Peter Ujfalusi
` (3 preceding siblings ...)
2025-06-19 8:42 ` [PATCH 4/4] ASoC: Intel: sof_sdw: " Peter Ujfalusi
@ 2025-06-20 11:32 ` Mark Brown
4 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2025-06-20 11:32 UTC (permalink / raw)
To: lgirdwood, Peter Ujfalusi
Cc: linux-sound, kai.vehmanen, ranjani.sridharan, yung-chuan.liao,
pierre-louis.bossart
On Thu, 19 Jun 2025 11:42:18 +0300, Peter Ujfalusi wrote:
> There are devices where the iDisp HDA codec for HDMI is disconnected
> and it is not present on the HDA bus.
> This usually happens on systems with dGPU, but not limited to them.
>
> How SOF tried to deal with this is to drop in a dummy codec in place of
> the iDisp to allow the topology to be loaded, but these PCM devices are
> unusable, they fail when user tries to use them.
> PA/PW is probing the PCM devices on probe and that causes the kernel log
> to fill up with errors, which is harmless but disturbing.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/4] ASoC: topology: Do not call snd_soc_remove_pcm_runtime() for ignored links
commit: cbf4e0fac347b78f1bcd29350b78184665ad487d
[2/4] ASoC: core: Check for rtd == NULL in snd_soc_remove_pcm_runtime()
commit: 2d91cb261cac6d885954b8f5da28b5c176c18131
[3/4] ASoC: Intel: skl_hda_dsp_generic: Implement add_dai_link to filter HDMI PCMs
commit: 86591907527effbfd99c038ffc06ca30bb4f6b64
[4/4] ASoC: Intel: sof_sdw: Implement add_dai_link to filter HDMI PCMs
commit: bb48117b79ebc39485f7306d09dc602981fe540f
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-06-20 11:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-19 8:42 [PATCH 0/4] ASoC: core/topology/Intel: Peter Ujfalusi
2025-06-19 8:42 ` [PATCH 1/4] ASoC: topology: Do not call snd_soc_remove_pcm_runtime() for ignored links Peter Ujfalusi
2025-06-19 8:42 ` [PATCH 2/4] ASoC: core: Check for rtd == NULL in snd_soc_remove_pcm_runtime() Peter Ujfalusi
2025-06-19 8:42 ` [PATCH 3/4] ASoC: Intel: skl_hda_dsp_generic: Implement add_dai_link to filter HDMI PCMs Peter Ujfalusi
2025-06-19 8:42 ` [PATCH 4/4] ASoC: Intel: sof_sdw: " Peter Ujfalusi
2025-06-20 11:32 ` [PATCH 0/4] ASoC: core/topology/Intel: Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox