Skip to content

ASoC: Intel: Prevent HDMI PCM creation if iDisp codec is not present #5412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ujfalusi
Copy link
Collaborator

If the system does not have iDisp codec then mark the HDMI PCM link as
ignore.
This will 'hide' ensures that HDMI PCMs will be not 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.

The first two patch (actually only one of them) is needed to prevent NULL pointer dereference on module removal since the runtime is not created and snd_soc_remove_pcm_runtime() do not have checks for rtd == NULL.

Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very nice! This is also easy to add to other machine drivers if they need make HDMI optional. One question on the first two patches.

@bardliao
Copy link
Collaborator

SOFCI TEST

@ujfalusi ujfalusi force-pushed the peter/sof/pr/no-idisp-no-hdmi-01 branch from 241c45e to 21f022c Compare May 21, 2025 07:59
@ujfalusi
Copy link
Collaborator Author

Changes since v1:

  • commit message corrected for the last two patch

ujfalusi added 4 commits May 21, 2025 11:00
…links

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>
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>
…MI 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: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
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>
Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ujfalusi ! Looks good now and this is very welcome. I just hit this on one setup where there was a small error in UCM, and result was a flood of errors to kernel dmesg due to the dummy HDMI PCMs. It's much less confusing with this PR.

@ranj063 ranj063 merged commit 48e1714 into thesofproject:topic/sof-dev Jun 3, 2025
10 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants