aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Wunner <lukas@wunner.de>2016-05-31 05:13:27 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2016-05-31 07:16:22 -0400
commita345918d6ee69076fea098cd317385937402c85b (patch)
treefce528fcbe8ddc57360b47b6d62e01c197494d51
parentb00e5334ab1bb2e41187fb964a1a2304871fb4ff (diff)
vga_switcheroo: Support deferred probing of audio clients
Daniel Vetter pointed out that vga_switcheroo_client_probe_defer() could be needed by audio clients as well. To avoid mistakes when someone adds conditions for these in the future, constrain the single existing condition to VGA clients by checking for PCI_BASE_CLASS_DISPLAY. This encompasses both PCI_CLASS_DISPLAY_VGA as well as PCI_CLASS_DISPLAY_3D, which is used by some Nvidia Optimus GPUs. Any future checks for audio clients should then be constrained to PCI_BASE_CLASS_MULTIMEDIA. v6: Spun out from commit introducing vga_switcheroo_client_probe_defer() to keep it a pure refactoring change. (Emil Velikov, Jani Nikula) Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Emil Velikov <emil.l.velikov@gmail.com> Cc: Jani Nikula <jani.nikula@linux.intel.com> Signed-off-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/358d58490eb9dda5f270d844b0dce511a2a20828.1464685538.git.lukas@wunner.de
-rw-r--r--drivers/gpu/vga/vga_switcheroo.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index d349bf91dd11..2df216b39cc5 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -331,7 +331,8 @@ EXPORT_SYMBOL(vga_switcheroo_register_client);
331 * @id: client identifier 331 * @id: client identifier
332 * 332 *
333 * Register audio client (audio device on a GPU). The power state of the 333 * Register audio client (audio device on a GPU). The power state of the
334 * client is assumed to be ON. 334 * client is assumed to be ON. Beforehand, vga_switcheroo_client_probe_defer()
335 * shall be called to ensure that all prerequisites are met.
335 * 336 *
336 * Return: 0 on success, -ENOMEM on memory allocation error. 337 * Return: 0 on success, -ENOMEM on memory allocation error.
337 */ 338 */
@@ -390,13 +391,15 @@ find_active_client(struct list_head *head)
390 */ 391 */
391bool vga_switcheroo_client_probe_defer(struct pci_dev *pdev) 392bool vga_switcheroo_client_probe_defer(struct pci_dev *pdev)
392{ 393{
393 /* 394 if ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) {
394 * apple-gmux is needed on pre-retina MacBook Pro 395 /*
395 * to probe the panel if pdev is the inactive GPU. 396 * apple-gmux is needed on pre-retina MacBook Pro
396 */ 397 * to probe the panel if pdev is the inactive GPU.
397 if (apple_gmux_present() && pdev != vga_default_device() && 398 */
398 !vgasr_priv.handler_flags) 399 if (apple_gmux_present() && pdev != vga_default_device() &&
399 return true; 400 !vgasr_priv.handler_flags)
401 return true;
402 }
400 403
401 return false; 404 return false;
402} 405}