aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2016-03-29 09:03:06 -0400
committerTakashi Iwai <tiwai@suse.de>2016-04-04 05:46:17 -0400
commitbfa5fb14fb9e698ae2d9429a82ef0ab67a17df37 (patch)
tree65d4398338ca2c40b51fa75f6fbd69ebe59eedbc
parent9735a22799b9214d17d3c231fe377fc852f042e9 (diff)
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: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/hda/hdac_i915.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c
index fb96aead8257..54babe1c0b16 100644
--- a/sound/hda/hdac_i915.c
+++ b/sound/hda/hdac_i915.c
@@ -267,6 +267,18 @@ int snd_hdac_i915_register_notifier(const struct i915_audio_component_audio_ops
267} 267}
268EXPORT_SYMBOL_GPL(snd_hdac_i915_register_notifier); 268EXPORT_SYMBOL_GPL(snd_hdac_i915_register_notifier);
269 269
270/* check whether intel graphics is present */
271static bool i915_gfx_present(void)
272{
273 static struct pci_device_id ids[] = {
274 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_ANY_ID),
275 .class = PCI_BASE_CLASS_DISPLAY << 16,
276 .class_mask = 0xff << 16 },
277 {}
278 };
279 return pci_dev_present(ids);
280}
281
270/** 282/**
271 * snd_hdac_i915_init - Initialize i915 audio component 283 * snd_hdac_i915_init - Initialize i915 audio component
272 * @bus: HDA core bus 284 * @bus: HDA core bus
@@ -286,6 +298,9 @@ int snd_hdac_i915_init(struct hdac_bus *bus)
286 struct i915_audio_component *acomp; 298 struct i915_audio_component *acomp;
287 int ret; 299 int ret;
288 300
301 if (!i915_gfx_present())
302 return -ENODEV;
303
289 acomp = kzalloc(sizeof(*acomp), GFP_KERNEL); 304 acomp = kzalloc(sizeof(*acomp), GFP_KERNEL);
290 if (!acomp) 305 if (!acomp)
291 return -ENOMEM; 306 return -ENOMEM;