Commit bfa5fb14 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Bind with i915 only when Intel graphics is present

On Skylake and onwards, the HD-audio controller driver needs to bind
with i915 for having the control of power well audio domain before
actually probing the codec.  This leads to the load of i915 driver
from the audio driver side.  But, there are systems that have no Intel
graphics but Nvidia or AMD GPU, although they still use HD-audio bus
for the onboard audio codecs.  On these, loading the i915 driver is
nothing but a useless memory and CPU consumption.

A simple way to avoid it is just to look for the Intel graphics PCI
entry beforehand, and try to bind with i915 only when such an entry is
found.  Currently, it assumes the PCI display class.  If another class
appears, this needs to be extended (although it's very unlikely).
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 9735a227
...@@ -267,6 +267,18 @@ int snd_hdac_i915_register_notifier(const struct i915_audio_component_audio_ops ...@@ -267,6 +267,18 @@ int snd_hdac_i915_register_notifier(const struct i915_audio_component_audio_ops
} }
EXPORT_SYMBOL_GPL(snd_hdac_i915_register_notifier); EXPORT_SYMBOL_GPL(snd_hdac_i915_register_notifier);
/* check whether intel graphics is present */
static bool i915_gfx_present(void)
{
static struct pci_device_id ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_ANY_ID),
.class = PCI_BASE_CLASS_DISPLAY << 16,
.class_mask = 0xff << 16 },
{}
};
return pci_dev_present(ids);
}
/** /**
* snd_hdac_i915_init - Initialize i915 audio component * snd_hdac_i915_init - Initialize i915 audio component
* @bus: HDA core bus * @bus: HDA core bus
...@@ -286,6 +298,9 @@ int snd_hdac_i915_init(struct hdac_bus *bus) ...@@ -286,6 +298,9 @@ int snd_hdac_i915_init(struct hdac_bus *bus)
struct i915_audio_component *acomp; struct i915_audio_component *acomp;
int ret; int ret;
if (!i915_gfx_present())
return -ENODEV;
acomp = kzalloc(sizeof(*acomp), GFP_KERNEL); acomp = kzalloc(sizeof(*acomp), GFP_KERNEL);
if (!acomp) if (!acomp)
return -ENOMEM; return -ENOMEM;
......
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