|
|
@ -328,6 +328,7 @@ static struct file_operations bbswitch_fops = {
|
|
|
|
static int __init bbswitch_init(void) {
|
|
|
|
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;
|
|
|
|
int class = PCI_CLASS_DISPLAY_VGA << 8;
|
|
|
|
int class = PCI_CLASS_DISPLAY_VGA << 8;
|
|
|
|
|
|
|
|
|
|
|
|
while ((pdev = pci_get_class(class, pdev)) != NULL) {
|
|
|
|
while ((pdev = pci_get_class(class, pdev)) != NULL) {
|
|
|
@ -338,10 +339,15 @@ static int __init bbswitch_init(void) {
|
|
|
|
if (!handle)
|
|
|
|
if (!handle)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
if (pdev->vendor != PCI_VENDOR_ID_INTEL) {
|
|
|
|
acpi_get_name(handle, ACPI_FULL_PATHNAME, &buf);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
|
|
|
|
|
|
|
|
igd_handle = handle;
|
|
|
|
|
|
|
|
printk(KERN_INFO "bbswitch: Found integrated VGA device %s: %s\n",
|
|
|
|
|
|
|
|
dev_name(&pdev->dev), (char *)buf.pointer);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
dis_dev = pdev;
|
|
|
|
dis_dev = pdev;
|
|
|
|
dis_handle = handle;
|
|
|
|
dis_handle = handle;
|
|
|
|
acpi_get_name(handle, ACPI_FULL_PATHNAME, &buf);
|
|
|
|
|
|
|
|
printk(KERN_INFO "bbswitch: Found discrete VGA device %s: %s\n",
|
|
|
|
printk(KERN_INFO "bbswitch: Found discrete VGA device %s: %s\n",
|
|
|
|
dev_name(&pdev->dev), (char *)buf.pointer);
|
|
|
|
dev_name(&pdev->dev), (char *)buf.pointer);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -359,10 +365,19 @@ static int __init bbswitch_init(void) {
|
|
|
|
} else if (has_dsm_func(acpi_nvidia_dsm_muid, 0x102, 0x3)) {
|
|
|
|
} else if (has_dsm_func(acpi_nvidia_dsm_muid, 0x102, 0x3)) {
|
|
|
|
dsm_type = DSM_TYPE_NVIDIA;
|
|
|
|
dsm_type = DSM_TYPE_NVIDIA;
|
|
|
|
printk(KERN_INFO "bbswitch: detected a nVidia _DSM function\n");
|
|
|
|
printk(KERN_INFO "bbswitch: detected a nVidia _DSM function\n");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
/* At least two Acer machines are known to use the intel ACPI handle
|
|
|
|
|
|
|
|
* with the legacy nvidia DSM */
|
|
|
|
|
|
|
|
dis_handle = igd_handle;
|
|
|
|
|
|
|
|
if (has_dsm_func(acpi_nvidia_dsm_muid, 0x102, 0x3)) {
|
|
|
|
|
|
|
|
dsm_type = DSM_TYPE_NVIDIA;
|
|
|
|
|
|
|
|
printk(KERN_INFO "bbswitch: detected a nVidia _DSM function on the"
|
|
|
|
|
|
|
|
" integrated video card\n");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
printk(KERN_ERR "bbswitch: No suitable _DSM call found.\n");
|
|
|
|
printk(KERN_ERR "bbswitch: No suitable _DSM call found.\n");
|
|
|
|
return -ENODEV;
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
acpi_entry = proc_create("bbswitch", 0660, acpi_root_dir, &bbswitch_fops);
|
|
|
|
acpi_entry = proc_create("bbswitch", 0660, acpi_root_dir, &bbswitch_fops);
|
|
|
|
if (acpi_entry == NULL) {
|
|
|
|
if (acpi_entry == NULL) {
|
|
|
|