Skip to content

Commit a0575b4

Browse files
ujfalusibroonie
authored andcommitted
ASoC: hdac_hda: Conditionally register dais for HDMI and Analog
The current driver is registering the same dais for each hdev found in the system which results duplicated widgets to be registered and the kernel log contains similar 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 To avoid such issue, split the dai array into HDMI and non HDMI array and register them conditionally: for HDMI hdev only register the dais needed for HDMI for non HDMI hdev do not register the HDMI dais. Depends-on: 3d1dc8b ("ASoC: Intel: skl_hda_dsp_generic: Drop HDMI routes when HDMI is not available") Link: thesofproject#4509 Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Link: https://lore.kernel.org/r/20231128123914.3986-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent a2f35ed commit a0575b4

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

sound/soc/codecs/hdac_hda.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ static struct snd_soc_dai_driver hdac_hda_dais[] = {
132132
.sig_bits = 24,
133133
},
134134
},
135+
};
136+
137+
static struct snd_soc_dai_driver hdac_hda_hdmi_dais[] = {
135138
{
136139
.id = HDAC_HDMI_0_DAI_ID,
137140
.name = "intel-hdmi-hifi1",
@@ -607,8 +610,16 @@ static const struct snd_soc_component_driver hdac_hda_codec = {
607610
.endianness = 1,
608611
};
609612

613+
static const struct snd_soc_component_driver hdac_hda_hdmi_codec = {
614+
.probe = hdac_hda_codec_probe,
615+
.remove = hdac_hda_codec_remove,
616+
.idle_bias_on = false,
617+
.endianness = 1,
618+
};
619+
610620
static int hdac_hda_dev_probe(struct hdac_device *hdev)
611621
{
622+
struct hdac_hda_priv *hda_pvt = dev_get_drvdata(&hdev->dev);
612623
struct hdac_ext_link *hlink;
613624
int ret;
614625

@@ -621,9 +632,15 @@ static int hdac_hda_dev_probe(struct hdac_device *hdev)
621632
snd_hdac_ext_bus_link_get(hdev->bus, hlink);
622633

623634
/* ASoC specific initialization */
624-
ret = devm_snd_soc_register_component(&hdev->dev,
625-
&hdac_hda_codec, hdac_hda_dais,
626-
ARRAY_SIZE(hdac_hda_dais));
635+
if (hda_pvt->need_display_power)
636+
ret = devm_snd_soc_register_component(&hdev->dev,
637+
&hdac_hda_hdmi_codec, hdac_hda_hdmi_dais,
638+
ARRAY_SIZE(hdac_hda_hdmi_dais));
639+
else
640+
ret = devm_snd_soc_register_component(&hdev->dev,
641+
&hdac_hda_codec, hdac_hda_dais,
642+
ARRAY_SIZE(hdac_hda_dais));
643+
627644
if (ret < 0) {
628645
dev_err(&hdev->dev, "failed to register HDA codec %d\n", ret);
629646
return ret;

0 commit comments

Comments
 (0)