[PATCH 0/2] ALSA/ASoC: hdmi/hdac_hda: Conditionally register dais

Peter Ujfalusi
2023-11-27T13:02:39Z

Hi,

Each instance of the hdac_hda registers DAIs to be used for analog and HDMI
audio.
When the system have more than one HDA codec - like most devices then the kernel
log will include the following warning prints:

snd_hda_codec_realtek ehdaudio0D0: ASoC: sink widget AIF1TX overwritten
snd_hda_codec_realtek ehdaudio0D0: ASoC: source widget AIF1RX overwritten
skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget hifi3 overwritten
skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget hifi2 overwritten
skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget hifi1 overwritten
skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget Codec Output Pin1 overwritten
skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget Codec Input Pin1 overwritten
skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget Analog Codec Playback overwritten
skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget Digital Codec Playback overwritten
skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget Alt Analog Codec Playback overwritten
skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget Analog Codec Capture overwritten
skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget Digital Codec Capture overwritten
skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget Alt Analog Codec Capture overwritten

These are printed when the second instance of the hdac_hda is probing since it
is re-registering the DAIs with the same name.
Using some clever way of prefixing might solve the issue but that would need non
backwards compatible changes to topology files.

Pragmatically the hdac_hda instance fro the normal codec should not register
DAIs for HDMI and the hdac_hda instance for the HDMI should not register DAIs
for the analog codec - for example on a SDW device where we have HDA-HDMI and
sdw codecs.

To keep the hdac_hda vendor neutral (altrough it is only used on Intel platforms
afaik) add a helper function to answer the question: is this codec HDMI?
Use the new helper to decide which sets of DAIs to register for the probing
hdac_hda instance.

Regards,
Peter
---
Peter Ujfalusi (2):
ALSA: hda/hdmi: Add helper function to check if a device is HDMI codec
ASoC: hdac_hda: Conditionally register dais for HDMI and Analog

include/sound/hdaudio.h | 10 ++++++++++
sound/pci/hda/patch_hdmi.c | 13 +++++++++++++
sound/soc/codecs/hdac_hda.c | 22 +++++++++++++++++++---
3 files changed, 42 insertions(+), 3 deletions(-)

--
2.43.0