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
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.
The Linux kernel is licensed under GPLv2. As GPLv3 and GPLv2 are incompatible in
some way, just license bbswitch as GPL 2.0 or (at your choice) any latter
version. Note: I wrote all code of bbswith.c, so I am entitled to change the
license and do not need permission from other authors (as there are not any).
Request made by Ludwig Nussel.
Just in case the integrated video ACPI handle cannot be found. This is a safety
net for those who try bbswitch on an incompatible machine. I do not know any of
such machinees, but it looks good.
Since the following commit, the device would not turn off because the power
state is unknown. Until a fix is released in Linux (or until I know what
better to do), I just assume the power state D0.
commit ddc150f7a33ae0c9cb16eaac3641abc00f56316f
Author: Lv Zheng <lv.zheng@intel.com>
Date: Fri Nov 16 02:46:28 2012 +0100
ACPI / PM: Add check preventing transitioning to non-D0 state from D3.
No power transitioning from D3 state up to a non-D0 state is allowed
so make acpi_device_set_power() fail and complain if such a transition
is attempted.
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
clean: do not try to wipe /usr/src/linux-...
load: rmmod and insmod do not have to be in /sbin (for example, /usr/bin
on Arch Linux). Assume that the user has a sane PATH.
This should finally support machines like the Lenovo Y570. WMMX methods should
be more reliable than direct DSM probing so let's try that before calling DSM
directly.