Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e0313a70c3 | ||
|
fd987219fc | ||
|
219c34f5a9 | ||
|
8ff86a7eff | ||
|
c38a3e084d | ||
|
ddbd243638 | ||
|
07b110df46 | ||
|
b0fdcfd847 | ||
|
9dd227019a | ||
|
322c9625c2 |
19
bbswitch.c
19
bbswitch.c
@ -31,10 +31,12 @@
|
|||||||
#include <linux/pci.h>
|
#include <linux/pci.h>
|
||||||
#include <linux/acpi.h>
|
#include <linux/acpi.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <asm/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
#include <linux/suspend.h>
|
#include <linux/suspend.h>
|
||||||
#include <linux/seq_file.h>
|
#include <linux/seq_file.h>
|
||||||
#include <linux/pm_runtime.h>
|
#include <linux/pm_runtime.h>
|
||||||
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/version.h>
|
||||||
|
|
||||||
#define BBSWITCH_VERSION "0.8"
|
#define BBSWITCH_VERSION "0.8"
|
||||||
|
|
||||||
@ -285,7 +287,7 @@ static void bbswitch_on(void) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
pr_info("enabling discrete graphics\n");
|
pr_info("enabling discrete graphics\n");
|
||||||
|
//pci_bridge_secondary_bus_reset(dis_dev);
|
||||||
if (bbswitch_acpi_on())
|
if (bbswitch_acpi_on())
|
||||||
pr_warn("The discrete card could not be enabled by a _DSM call\n");
|
pr_warn("The discrete card could not be enabled by a _DSM call\n");
|
||||||
|
|
||||||
@ -375,6 +377,15 @@ static int bbswitch_pm_handler(struct notifier_block *nbp,
|
|||||||
return 0;
|
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 = {
|
static struct file_operations bbswitch_fops = {
|
||||||
.open = bbswitch_proc_open,
|
.open = bbswitch_proc_open,
|
||||||
.read = seq_read,
|
.read = seq_read,
|
||||||
@ -382,6 +393,7 @@ static struct file_operations bbswitch_fops = {
|
|||||||
.llseek = seq_lseek,
|
.llseek = seq_lseek,
|
||||||
.release= single_release
|
.release= single_release
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
static struct notifier_block nb = {
|
static struct notifier_block nb = {
|
||||||
.notifier_call = &bbswitch_pm_handler
|
.notifier_call = &bbswitch_pm_handler
|
||||||
@ -418,12 +430,13 @@ static int __init bbswitch_init(void) {
|
|||||||
|
|
||||||
acpi_get_name(handle, ACPI_FULL_PATHNAME, &buf);
|
acpi_get_name(handle, ACPI_FULL_PATHNAME, &buf);
|
||||||
|
|
||||||
if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
|
if (pdev->vendor == PCI_VENDOR_ID_ATI) {
|
||||||
igd_handle = handle;
|
igd_handle = handle;
|
||||||
pr_info("Found integrated VGA device %s: %s\n",
|
pr_info("Found integrated VGA device %s: %s\n",
|
||||||
dev_name(&pdev->dev), (char *)buf.pointer);
|
dev_name(&pdev->dev), (char *)buf.pointer);
|
||||||
} else {
|
} else {
|
||||||
dis_dev = pdev;
|
dis_dev = pdev;
|
||||||
|
pci_d3cold_enable(pdev);
|
||||||
dis_handle = handle;
|
dis_handle = handle;
|
||||||
pr_info("Found discrete VGA device %s: %s\n",
|
pr_info("Found discrete VGA device %s: %s\n",
|
||||||
dev_name(&pdev->dev), (char *)buf.pointer);
|
dev_name(&pdev->dev), (char *)buf.pointer);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user