|
|
|
@ -31,12 +31,10 @@
|
|
|
|
|
#include <linux/pci.h>
|
|
|
|
|
#include <linux/acpi.h>
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
|
#include <linux/uaccess.h>
|
|
|
|
|
#include <asm/uaccess.h>
|
|
|
|
|
#include <linux/suspend.h>
|
|
|
|
|
#include <linux/seq_file.h>
|
|
|
|
|
#include <linux/pm_runtime.h>
|
|
|
|
|
#include <linux/proc_fs.h>
|
|
|
|
|
#include <linux/version.h>
|
|
|
|
|
|
|
|
|
|
#define BBSWITCH_VERSION "0.8"
|
|
|
|
|
|
|
|
|
@ -287,7 +285,7 @@ static void bbswitch_on(void) {
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
pr_info("enabling discrete graphics\n");
|
|
|
|
|
//pci_bridge_secondary_bus_reset(dis_dev);
|
|
|
|
|
|
|
|
|
|
if (bbswitch_acpi_on())
|
|
|
|
|
pr_warn("The discrete card could not be enabled by a _DSM call\n");
|
|
|
|
|
|
|
|
|
@ -377,15 +375,6 @@ static int bbswitch_pm_handler(struct notifier_block *nbp,
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
|
|
|
|
|
static struct proc_ops bbswitch_fops = {
|
|
|
|
|
.proc_open = bbswitch_proc_open,
|
|
|
|
|
.proc_read = seq_read,
|
|
|
|
|
.proc_write = bbswitch_proc_write,
|
|
|
|
|
.proc_lseek = seq_lseek,
|
|
|
|
|
.proc_release= single_release
|
|
|
|
|
};
|
|
|
|
|
#else
|
|
|
|
|
static struct file_operations bbswitch_fops = {
|
|
|
|
|
.open = bbswitch_proc_open,
|
|
|
|
|
.read = seq_read,
|
|
|
|
@ -393,7 +382,6 @@ static struct file_operations bbswitch_fops = {
|
|
|
|
|
.llseek = seq_lseek,
|
|
|
|
|
.release= single_release
|
|
|
|
|
};
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static struct notifier_block nb = {
|
|
|
|
|
.notifier_call = &bbswitch_pm_handler
|
|
|
|
@ -430,13 +418,12 @@ static int __init bbswitch_init(void) {
|
|
|
|
|
|
|
|
|
|
acpi_get_name(handle, ACPI_FULL_PATHNAME, &buf);
|
|
|
|
|
|
|
|
|
|
if (pdev->vendor == PCI_VENDOR_ID_ATI) {
|
|
|
|
|
if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
|
|
|
|
|
igd_handle = handle;
|
|
|
|
|
pr_info("Found integrated VGA device %s: %s\n",
|
|
|
|
|
dev_name(&pdev->dev), (char *)buf.pointer);
|
|
|
|
|
} else {
|
|
|
|
|
dis_dev = pdev;
|
|
|
|
|
pci_d3cold_enable(pdev);
|
|
|
|
|
dis_handle = handle;
|
|
|
|
|
pr_info("Found discrete VGA device %s: %s\n",
|
|
|
|
|
dev_name(&pdev->dev), (char *)buf.pointer);
|
|
|
|
|