Skip to content

Commit 79ac4c1

Browse files
plbossarttiwai
authored andcommitted
ALSA: hda: intel-dsp-config: harden I2C/I2S codec detection
The SOF driver is selected whenever specific I2C/I2S HIDs are reported as 'present' in the ACPI DSDT. In some cases, an HID is reported but the hardware does not actually rely on I2C/I2S. This false positive leads to an invalid selection of the SOF driver and as a result an invalid topology is loaded. This patch hardens the detection with a check that the NHLT table is consistent with the report of an I2S-based codec in DSDT. This table should expose at least one SSP endpoint configured for an I2S-codec connection. Tested on Huawei Matebook D14 (NBLB-WAX9N) using an HDaudio codec with an invalid ES8336 ACPI HID reported: [ 7.858249] snd_hda_intel 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040380 [ 7.858312] snd_hda_intel 0000:00:1f.3: snd_intel_dsp_find_config: no valid SSP found for HID ESSX8336, skipped Reported-by: Mauro Carvalho Chehab <[email protected]> Tested-by: Mauro Carvalho Chehab <[email protected]> Closes: thesofproject#4934 Signed-off-by: Pierre-Louis Bossart <[email protected]> Reviewed-by: Bard Liao <[email protected]> Reviewed-by: Péter Ujfalusi <[email protected]> Message-ID: <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent 2d5af3a commit 79ac4c1

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

sound/hda/intel-dsp-config.c

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,9 +557,32 @@ static const struct config_entry *snd_intel_dsp_find_config
557557
if (table->codec_hid) {
558558
int i;
559559

560-
for (i = 0; i < table->codec_hid->num_codecs; i++)
561-
if (acpi_dev_present(table->codec_hid->codecs[i], NULL, -1))
560+
for (i = 0; i < table->codec_hid->num_codecs; i++) {
561+
struct nhlt_acpi_table *nhlt;
562+
bool ssp_found = false;
563+
564+
if (!acpi_dev_present(table->codec_hid->codecs[i], NULL, -1))
565+
continue;
566+
567+
nhlt = intel_nhlt_init(&pci->dev);
568+
if (!nhlt) {
569+
dev_warn(&pci->dev, "%s: NHLT table not found, skipped HID %s\n",
570+
__func__, table->codec_hid->codecs[i]);
571+
continue;
572+
}
573+
574+
if (intel_nhlt_has_endpoint_type(nhlt, NHLT_LINK_SSP) &&
575+
intel_nhlt_ssp_endpoint_mask(nhlt, NHLT_DEVICE_I2S))
576+
ssp_found = true;
577+
578+
intel_nhlt_free(nhlt);
579+
580+
if (ssp_found)
562581
break;
582+
583+
dev_warn(&pci->dev, "%s: no valid SSP found for HID %s, skipped\n",
584+
__func__, table->codec_hid->codecs[i]);
585+
}
563586
if (i == table->codec_hid->num_codecs)
564587
continue;
565588
}

0 commit comments

Comments
 (0)