Skip to content

Commit c9db8a3

Browse files
kv2019itiwai
authored andcommitted
ALSA: hda/i915 - skip acomp init if no matching display
In systems with only a discrete i915 GPU, the acomp init will always timeout for the PCH HDA controller instance. Avoid the timeout by checking the PCI device hierarchy whether any display class PCI device can be found on the system, and at the same level as the HDA PCI device. If found, proceed with the acomp init, which will wait until i915 probe is complete and component binding can proceed. If no matching display device is found, the audio component bind can be safely skipped. The bind timeout will still be hit if the display is present in the system, but i915 driver does not bind to it by configuration choice or probe error. In this case the 60sec timeout will be hit. Signed-off-by: Kai Vehmanen <[email protected]> Acked-by: Lucas De Marchi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent bc55cfd commit c9db8a3

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

sound/hda/hdac_i915.c

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,25 @@ static int i915_component_master_match(struct device *dev, int subcomponent,
116116
return 0;
117117
}
118118

119-
/* check whether intel graphics is present */
120-
static bool i915_gfx_present(void)
119+
/* check whether Intel graphics is present and reachable */
120+
static int i915_gfx_present(struct pci_dev *hdac_pci)
121121
{
122-
static const struct pci_device_id ids[] = {
123-
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_ANY_ID),
124-
.class = PCI_BASE_CLASS_DISPLAY << 16,
125-
.class_mask = 0xff << 16 },
126-
{}
127-
};
128-
return pci_dev_present(ids);
122+
unsigned int class = PCI_BASE_CLASS_DISPLAY << 16;
123+
struct pci_dev *display_dev = NULL;
124+
bool match = false;
125+
126+
do {
127+
display_dev = pci_get_class(class, display_dev);
128+
129+
if (display_dev && display_dev->vendor == PCI_VENDOR_ID_INTEL &&
130+
connectivity_check(display_dev, hdac_pci))
131+
match = true;
132+
133+
pci_dev_put(display_dev);
134+
135+
} while (!match && display_dev);
136+
137+
return match;
129138
}
130139

131140
/**
@@ -145,7 +154,7 @@ int snd_hdac_i915_init(struct hdac_bus *bus)
145154
struct drm_audio_component *acomp;
146155
int err;
147156

148-
if (!i915_gfx_present())
157+
if (!i915_gfx_present(to_pci_dev(bus->dev)))
149158
return -ENODEV;
150159

151160
err = snd_hdac_acomp_init(bus, NULL,

0 commit comments

Comments
 (0)