Skip to content

Commit d82b51c

Browse files
plbossarttiwai
authored andcommitted
ALSA: HD-Audio: SKL+: force HDaudio legacy or SKL+ driver selection
For HDaudio and Skylake drivers, add module parameter "pci_binding" When pci_binding == 0 (AUTO), the PCI class/subclass info is used to select drivers based on the presence of the DSP. pci_binding == 1 (LEGACY) forces the use of the HDAudio legacy driver, even if the DSP is present. pci_binding == 2 (ASOC) forces the use of the ASOC driver. The information on the DSP presence is bypassed. The value for the module parameter needs to be identical for both drivers. This parameter is intended as a back-up solution if the automatic detection fails or when the DSP usage fails. Such cases should be reported on the alsa-devel mailing list for analysis. Signed-off-by: Pierre-Louis Bossart <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent c337104 commit d82b51c

File tree

3 files changed

+62
-18
lines changed

3 files changed

+62
-18
lines changed

include/sound/hdaudio.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ enum {
9898
HDA_DEV_ASOC,
9999
};
100100

101+
enum {
102+
SND_SKL_PCI_BIND_AUTO, /* automatic selection based on pci class */
103+
SND_SKL_PCI_BIND_LEGACY,/* bind only with legacy driver */
104+
SND_SKL_PCI_BIND_ASOC /* bind only with ASoC driver */
105+
};
106+
101107
/* direction */
102108
enum {
103109
HDA_INPUT, HDA_OUTPUT

sound/pci/hda/hda_intel.c

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ module_param_array(beep_mode, bool, NULL, 0444);
172172
MODULE_PARM_DESC(beep_mode, "Select HDA Beep registration mode "
173173
"(0=off, 1=on) (default=1).");
174174
#endif
175+
static int skl_pci_binding;
176+
module_param_named(pci_binding, skl_pci_binding, int, 0444);
177+
MODULE_PARM_DESC(pci_binding, "PCI binding (0=auto, 1=only legacy, 2=only asoc");
175178

176179
#ifdef CONFIG_PM
177180
static int param_set_xint(const char *val, const struct kernel_param *kp);
@@ -2050,9 +2053,26 @@ static int azx_probe(struct pci_dev *pci,
20502053
int err;
20512054

20522055
/* check if this driver can be used on SKL+ Intel platforms */
2053-
if ((pci_id->driver_data & AZX_DCAPS_INTEL_SHARED) &&
2054-
pci->class != 0x040300)
2055-
return -ENODEV;
2056+
if (pci_id->driver_data & AZX_DCAPS_INTEL_SHARED) {
2057+
switch (skl_pci_binding) {
2058+
case SND_SKL_PCI_BIND_AUTO:
2059+
if (pci->class != 0x040300) {
2060+
dev_info(&pci->dev, "The DSP is enabled on this platform, aborting probe\n");
2061+
return -ENODEV;
2062+
}
2063+
dev_info(&pci->dev, "No DSP detected, continuing HDaudio legacy probe\n");
2064+
break;
2065+
case SND_SKL_PCI_BIND_LEGACY:
2066+
dev_info(&pci->dev, "Module parameter forced binding with HDaudio legacy, bypassed detection logic\n");
2067+
break;
2068+
case SND_SKL_PCI_BIND_ASOC:
2069+
dev_info(&pci->dev, "Module parameter forced binding with SKL+ ASoC driver, aborting probe\n");
2070+
return -ENODEV;
2071+
default:
2072+
dev_err(&pci->dev, "invalid value for skl_pci_binding module parameter, ignored\n");
2073+
break;
2074+
}
2075+
}
20562076

20572077
if (dev >= SNDRV_CARDS)
20582078
return -ENODEV;

sound/soc/intel/skylake/skl.c

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
#if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC)
4141
#include "../../../soc/codecs/hdac_hda.h"
4242
#endif
43+
static int skl_pci_binding;
44+
module_param_named(pci_binding, skl_pci_binding, int, 0444);
45+
MODULE_PARM_DESC(pci_binding, "PCI binding (0=auto, 1=only legacy, 2=only asoc");
4346

4447
/*
4548
* initialize the PCI registers
@@ -896,21 +899,6 @@ static int skl_first_init(struct hdac_bus *bus)
896899
unsigned short gcap;
897900
int cp_streams, pb_streams, start_idx;
898901

899-
/*
900-
* detect DSP by checking class/subclass/prog-id information
901-
* class=04 subclass 03 prog-if 00: no DSP, legacy driver needs to be used
902-
* class=04 subclass 01 prog-if 00: DSP is present (and may be required e.g. for DMIC or SSP support)
903-
* class=04 subclass 03 prog-if 80: either of DSP or legacy mode can be used
904-
*/
905-
if (pci->class == 0x040300) {
906-
dev_err(bus->dev, "The DSP is not enabled on this platform, aborting probe\n");
907-
return -ENODEV;
908-
} else if (pci->class != 0x040100 && pci->class != 0x040380) {
909-
dev_err(bus->dev, "Unknown PCI class/subclass/prog-if information (0x%06x) found, aborting probe\n", pci->class);
910-
return -ENODEV;
911-
}
912-
dev_info(bus->dev, "DSP detected with PCI class/subclass/prog-if info 0x%06x\n", pci->class);
913-
914902
err = pci_request_regions(pci, "Skylake HD audio");
915903
if (err < 0)
916904
return err;
@@ -984,6 +972,36 @@ static int skl_probe(struct pci_dev *pci,
984972
struct hdac_bus *bus = NULL;
985973
int err;
986974

975+
switch (skl_pci_binding) {
976+
case SND_SKL_PCI_BIND_AUTO:
977+
/*
978+
* detect DSP by checking class/subclass/prog-id information
979+
* class=04 subclass 03 prog-if 00: no DSP, use legacy driver
980+
* class=04 subclass 01 prog-if 00: DSP is present
981+
* (and may be required e.g. for DMIC or SSP support)
982+
* class=04 subclass 03 prog-if 80: use DSP or legacy mode
983+
*/
984+
if (pci->class == 0x040300) {
985+
dev_info(&pci->dev, "The DSP is not enabled on this platform, aborting probe\n");
986+
return -ENODEV;
987+
}
988+
if (pci->class != 0x040100 && pci->class != 0x040380) {
989+
dev_err(&pci->dev, "Unknown PCI class/subclass/prog-if information (0x%06x) found, aborting probe\n", pci->class);
990+
return -ENODEV;
991+
}
992+
dev_info(&pci->dev, "DSP detected with PCI class/subclass/prog-if info 0x%06x\n", pci->class);
993+
break;
994+
case SND_SKL_PCI_BIND_LEGACY:
995+
dev_info(&pci->dev, "Module parameter forced binding with HDaudio legacy, aborting probe\n");
996+
return -ENODEV;
997+
case SND_SKL_PCI_BIND_ASOC:
998+
dev_info(&pci->dev, "Module parameter forced binding with SKL driver, bypassed detection logic\n");
999+
break;
1000+
default:
1001+
dev_err(&pci->dev, "invalid value for skl_pci_binding module parameter, ignored\n");
1002+
break;
1003+
}
1004+
9871005
/* we use ext core ops, so provide NULL for ops here */
9881006
err = skl_create(pci, NULL, &skl);
9891007
if (err < 0)

0 commit comments

Comments
 (0)