VGA_Switcheroo Is Getting Modernized With Device Link Support
Open-source contributor Lukas Wunner sent out a set of patches this Sunday to "modernize" VGA_Switcheroo by using a Device Link for its HDA controller support. Device links were added to Linux 4.10 as a way of representing dependencies between devices in the driver core, besides just parent/child relationships in the device hierarchy. Device links can be used for representing "siblings" and simply drivers that first depend upon the presence of another driver. Using device links ensures correct suspend/resume and shutdown ordering and the driver presence on the supplier.
Lukas is using device links with VGA_Switcheroo for enforcing a runtime power management dependent on an HDA controller to the GPU it's integrated into and by making use of this newer kernel API allows dropping some obsolete code that in the process also fixes "a bunch of bugs."
This might also yield a small power savings if a discrete GPU is being used but not its HDA controller, since now that audio controller can be run-time suspended to a D3hot stage.
This patch work also takes VGA_Switcheroo closer to being able to support run-time power management on MUX'ed laptops like the MacBook Pro.
More details on this patch series here. We'll see if this code is baked enough to get into Linux 4.17.