Skip to content

Commit c337104

Browse files
plbossarttiwai
authored andcommitted
ALSA: HD-Audio: SKL+: abort probe if DSP is present and Skylake driver selected
Now that the SST/Skylake driver supports per platform selectors, we can add logic to automatically select the right driver. If the Skylake driver is selected for a specific platform, and the DSP is detected at run-time based on the PCI class/subclass/prog-if information, the legacy HDaudio driver aborts the probe. This will result in a single driver probing and remove the need for modprobe blacklists. Follow-up patches will add a module parameter to bypass the logic if this automatic detection fails, or if the Skylake driver is unable to actually support the platform (firmware authentication, missing topology file, hardware issue, etc). The same mechanism will be used to conflicts generated by the same PCI ID being registered by both legacy HDAuudio and SOF drivers for Intel platforms. In other words SOF will not require changes to the HDaudio legacy. Signed-off-by: Pierre-Louis Bossart <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent 18d43c9 commit c337104

File tree

4 files changed

+96
-8
lines changed

4 files changed

+96
-8
lines changed

sound/pci/hda/Kconfig

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,68 @@ config SND_HDA_POWER_SAVE_DEFAULT
226226
The default time-out value in seconds for HD-audio automatic
227227
power-save mode. 0 means to disable the power-save mode.
228228

229+
if SND_HDA_INTEL
230+
231+
# The options below should not be enabled by distributions or
232+
# users. They are selected by Intel/Skylake or SOF drivers when they
233+
# register for a PCI ID which is also handled by the HDAudio legacy
234+
# driver. When this option is selected and the DSP is detected based on
235+
# the PCI class/subclass/prog-if, the probe of the HDAudio legacy
236+
# aborts. This mechanism removes the need for distributions to use
237+
# blacklists. It can be bypassed with module parameters should the
238+
# Intel/Skylake or SOF drivers fail to handle a specific platform.
239+
240+
config SND_HDA_INTEL_DSP_DETECTION_SKL
241+
bool
242+
help
243+
This option is selected by SOF or SST drivers, not users or distros.
244+
It enables DSP detection based on PCI class information for
245+
Skylake machines.
246+
247+
config SND_HDA_INTEL_DSP_DETECTION_APL
248+
bool
249+
help
250+
This option is selected by SOF or SST drivers, not users or distros.
251+
It enables DSP detection based on PCI class information for
252+
Broxton/ApolloLake machines
253+
254+
config SND_HDA_INTEL_DSP_DETECTION_KBL
255+
bool
256+
help
257+
This option is selected by SOF or SST drivers, not users or distros.
258+
It enables DSP detection based on PCI class information for
259+
KabyLake machines
260+
261+
config SND_HDA_INTEL_DSP_DETECTION_GLK
262+
bool
263+
help
264+
This option is selected by SOF or SST drivers, not users or distros.
265+
It enables DSP detection based on PCI class information for
266+
GeminiLake machines
267+
268+
config SND_HDA_INTEL_DSP_DETECTION_CNL
269+
bool
270+
help
271+
This option is selected by SOF or SST drivers, not users or distros.
272+
It enables DSP detection based on PCI class information for
273+
CannonLake machines
274+
275+
config SND_HDA_INTEL_DSP_DETECTION_CFL
276+
bool
277+
help
278+
This option is selected by SOF or SST drivers, not users or distros.
279+
It enables DSP detection based on PCI class information for
280+
CoffeeLake machines
281+
282+
config SND_HDA_INTEL_DSP_DETECTION_ICL
283+
bool
284+
help
285+
This option is selected by SOF or SST drivers, not users or distros.
286+
It enables DSP detection based on PCI class information for
287+
IceLake machines
288+
289+
endif ## SND_HDA_INTEL
290+
229291
endif
230292

231293
endmenu

sound/pci/hda/hda_controller.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#else
3838
#define AZX_DCAPS_I915_COMPONENT 0 /* NOP */
3939
#endif
40-
/* 14 unused */
40+
#define AZX_DCAPS_INTEL_SHARED (1 << 14) /* shared with ASoC */
4141
#define AZX_DCAPS_CTX_WORKAROUND (1 << 15) /* X-Fi workaround */
4242
#define AZX_DCAPS_POSFIX_LPIB (1 << 16) /* Use LPIB as default */
4343
/* 17 unused */

sound/pci/hda/hda_intel.c

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ enum {
357357
AZX_DCAPS_NO_64BIT |\
358358
AZX_DCAPS_4K_BDLE_BOUNDARY | AZX_DCAPS_SNOOP_OFF)
359359

360+
#define AZX_DCAPS_INTEL_DSP_DETECTION(conf) (IS_ENABLED(CONFIG_SND_HDA_INTEL_DSP_DETECTION_##conf) ? AZX_DCAPS_INTEL_SHARED : 0)
360361
/*
361362
* vga_switcheroo support
362363
*/
@@ -2048,6 +2049,11 @@ static int azx_probe(struct pci_dev *pci,
20482049
bool schedule_probe;
20492050
int err;
20502051

2052+
/* 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+
20512057
if (dev >= SNDRV_CARDS)
20522058
return -ENODEV;
20532059
if (!enable[dev]) {
@@ -2354,34 +2360,48 @@ static const struct pci_device_id azx_ids[] = {
23542360
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE },
23552361
/* Sunrise Point-LP */
23562362
{ PCI_DEVICE(0x8086, 0x9d70),
2357-
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE },
2363+
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE |
2364+
AZX_DCAPS_INTEL_DSP_DETECTION(SKL)
2365+
},
23582366
/* Kabylake */
23592367
{ PCI_DEVICE(0x8086, 0xa171),
23602368
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE },
23612369
/* Kabylake-LP */
23622370
{ PCI_DEVICE(0x8086, 0x9d71),
2363-
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE },
2371+
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE |
2372+
AZX_DCAPS_INTEL_DSP_DETECTION(KBL)
2373+
},
23642374
/* Kabylake-H */
23652375
{ PCI_DEVICE(0x8086, 0xa2f0),
23662376
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE },
23672377
/* Coffelake */
23682378
{ PCI_DEVICE(0x8086, 0xa348),
2369-
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
2379+
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE |
2380+
AZX_DCAPS_INTEL_DSP_DETECTION(CFL)
2381+
},
23702382
/* Cannonlake */
23712383
{ PCI_DEVICE(0x8086, 0x9dc8),
2372-
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
2384+
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE |
2385+
AZX_DCAPS_INTEL_DSP_DETECTION(CNL)
2386+
},
23732387
/* Icelake */
23742388
{ PCI_DEVICE(0x8086, 0x34c8),
2375-
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
2389+
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE |
2390+
AZX_DCAPS_INTEL_DSP_DETECTION(ICL)
2391+
},
23762392
/* Broxton-P(Apollolake) */
23772393
{ PCI_DEVICE(0x8086, 0x5a98),
2378-
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON },
2394+
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON |
2395+
AZX_DCAPS_INTEL_DSP_DETECTION(APL)
2396+
},
23792397
/* Broxton-T */
23802398
{ PCI_DEVICE(0x8086, 0x1a98),
23812399
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON },
23822400
/* Gemini-Lake */
23832401
{ PCI_DEVICE(0x8086, 0x3198),
2384-
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON },
2402+
.driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON |
2403+
AZX_DCAPS_INTEL_DSP_DETECTION(GLK)
2404+
},
23852405
/* Haswell */
23862406
{ PCI_DEVICE(0x8086, 0x0a0c),
23872407
.driver_data = AZX_DRIVER_HDMI | AZX_DCAPS_INTEL_HASWELL },

sound/soc/intel/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ config SND_SOC_INTEL_SKYLAKE_COMMON
188188
select SND_SOC_TOPOLOGY
189189
select SND_SOC_INTEL_SST
190190
select SND_SOC_HDAC_HDA if SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC
191+
select SND_HDA_INTEL_DSP_DETECTION_SKL if SND_SOC_INTEL_SKL
192+
select SND_HDA_INTEL_DSP_DETECTION_APL if SND_SOC_INTEL_APL
193+
select SND_HDA_INTEL_DSP_DETECTION_KBL if SND_SOC_INTEL_KBL
194+
select SND_HDA_INTEL_DSP_DETECTION_GLK if SND_SOC_INTEL_GLK
195+
select SND_HDA_INTEL_DSP_DETECTION_CNL if SND_SOC_INTEL_CNL
196+
select SND_HDA_INTEL_DSP_DETECTION_CFL if SND_SOC_INTEL_CFL
191197
select SND_SOC_ACPI_INTEL_MATCH
192198
help
193199
If you have a Intel Skylake/Broxton/ApolloLake/KabyLake/

0 commit comments

Comments
 (0)