Commit 36a38c53 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda: Fix discovery of i915 graphics PCI device

It's been reported that the recent fix for skipping the
component-binding with D-GPU caused a regression on some systems; it
resulted in the completely missing component binding with i915 GPU.

The problem was the use of pci_get_class() function.  It matches with
the full PCI class bits, while we want to match only partially the PCI
base class bits.  So, when a system has an i915 graphics device with
the PCI class 0380, it won't hit because we're looking for only the
PCI class 0300.

This patch fixes i915_gfx_present() to look up each PCI device and
match with PCI base class explicitly instead of pci_get_class().

Fixes: c9db8a30 ("ALSA: hda/i915 - skip acomp init if no matching display")
Reviewed-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Tested-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Cc: <stable@vger.kernel.org>
Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1200611
Link: https://lore.kernel.org/r/87bkunztec.wl-tiwai@suse.de
Link: https://lore.kernel.org/r/20220621120044.11573-1-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent c7807b27
...@@ -119,21 +119,18 @@ static int i915_component_master_match(struct device *dev, int subcomponent, ...@@ -119,21 +119,18 @@ static int i915_component_master_match(struct device *dev, int subcomponent,
/* check whether Intel graphics is present and reachable */ /* check whether Intel graphics is present and reachable */
static int i915_gfx_present(struct pci_dev *hdac_pci) static int i915_gfx_present(struct pci_dev *hdac_pci)
{ {
unsigned int class = PCI_BASE_CLASS_DISPLAY << 16;
struct pci_dev *display_dev = NULL; struct pci_dev *display_dev = NULL;
bool match = false;
do { for_each_pci_dev(display_dev) {
display_dev = pci_get_class(class, display_dev); if (display_dev->vendor == PCI_VENDOR_ID_INTEL &&
(display_dev->class >> 16) == PCI_BASE_CLASS_DISPLAY &&
if (display_dev && display_dev->vendor == PCI_VENDOR_ID_INTEL &&
connectivity_check(display_dev, hdac_pci)) { connectivity_check(display_dev, hdac_pci)) {
pci_dev_put(display_dev); pci_dev_put(display_dev);
match = true; return true;
} }
} while (!match && display_dev); }
return match; return false;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment