Commit Graph
5 Commits
Author SHA1 Message Date
Peter Wu e0c68599be Start handling audio devices via vga_switcheroo
This is an attempt to notify the audio driver (snd-hda-intel) that the
graphics card is being disabled to prevent access to a sleeping device.

TODO:
 - System suspend/resume is not really working properly with this.

Addresses https://github.com/Bumblebee-Project/bbswitch/issues/18
2016-06-06 02:54:55 +02:00
Peter Wu 5c7b3f53f2 Initial conversion to a PCI device using runtime PM
bbswitch will now bind a driver to the PCI device, this should remove
races that can occur when a PCI device is removed after bbswitch is
loaded.

Fixes:
 - Fixed a crash on some laptops that trigger a hotplug (a problem
   since Linux 3.12,
   https://github.com/Bumblebee-Project/bbswitch/issues/100)
 - As a driver is bound, you cannot "accidentally" load nouveau/nvidia
   anymore and confuse the power state.

Removed pci_set_master, there is no need for access to the PCI BARs.
pci_enable_device is removed too as the memory regions are not needed.

TODO:
 - Remove unload_state, it is a no-op.
 - Update load_state doc (assume ON by default).
 - System suspend/resume probably needs special treatment to ensure that
   the device is off again.
2016-06-06 02:50:06 +02:00
Peter Wu ca16c538fd Remove suspend/resume notifier
About to move to a PCI driver model where the device does not have to
be resumed, let's remove this code.
2016-06-06 02:24:56 +02:00
Peter Wu cca9882b46 Use cached dev_name
dis_dev might become invalid when the PCI device is removed from the
bus. There are more users, but this should be a start.
2016-06-06 02:22:00 +02:00
Peter Wu 2ccf2d7e31 Define ACPI_HANDLE macro for older versions
ACPI_HANDLE was added in Linux 3.8,
DEVICE_ACPI_HANDLE is gone in Linux 3.13. Move the definition a bit
higher, maybe we can reuse it later.
2016-06-06 02:20:29 +02:00