|
|
@ -19,7 +19,7 @@
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
MODULE_DESCRIPTION("Toggle the discrete graphics card");
|
|
|
|
MODULE_DESCRIPTION("Toggle the discrete graphics card");
|
|
|
|
MODULE_AUTHOR("Peter Lekensteyn <lekensteyn@gmail.com>");
|
|
|
|
MODULE_AUTHOR("Peter Lekensteyn <lekensteyn@gmail.com>");
|
|
|
|
MODULE_VERSION("0.3");
|
|
|
|
MODULE_VERSION("0.4");
|
|
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
enum {
|
|
|
|
CARD_UNCHANGED = -1,
|
|
|
|
CARD_UNCHANGED = -1,
|
|
|
@ -329,15 +329,22 @@ static int __init bbswitch_init(void) {
|
|
|
|
struct proc_dir_entry *acpi_entry;
|
|
|
|
struct proc_dir_entry *acpi_entry;
|
|
|
|
struct pci_dev *pdev = NULL;
|
|
|
|
struct pci_dev *pdev = NULL;
|
|
|
|
acpi_handle igd_handle = NULL;
|
|
|
|
acpi_handle igd_handle = NULL;
|
|
|
|
int class = PCI_CLASS_DISPLAY_VGA << 8;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while ((pdev = pci_get_class(class, pdev)) != NULL) {
|
|
|
|
while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) {
|
|
|
|
struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };
|
|
|
|
struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };
|
|
|
|
acpi_handle handle;
|
|
|
|
acpi_handle handle;
|
|
|
|
|
|
|
|
int pci_class = pdev->class >> 8;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pci_class != PCI_CLASS_DISPLAY_VGA &&
|
|
|
|
|
|
|
|
pci_class != PCI_CLASS_DISPLAY_3D)
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
handle = DEVICE_ACPI_HANDLE(&pdev->dev);
|
|
|
|
handle = DEVICE_ACPI_HANDLE(&pdev->dev);
|
|
|
|
if (!handle)
|
|
|
|
if (!handle) {
|
|
|
|
|
|
|
|
printk(KERN_WARNING "bbswitch: cannot find ACPI handle for VGA"
|
|
|
|
|
|
|
|
" device %s\n", dev_name(&pdev->dev));
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
acpi_get_name(handle, ACPI_FULL_PATHNAME, &buf);
|
|
|
|
acpi_get_name(handle, ACPI_FULL_PATHNAME, &buf);
|
|
|
|
|
|
|
|
|
|
|
|