summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Bidar2018-07-21 22:01:04 +0200
committerBjörn Bidar2018-07-21 22:14:02 +0200
commit39e42c44dd626aca42845aa054a2e2257fd9e5a6 (patch)
treea330eb2042a2a5c677393da0ed62e6d56b1dc39c
parent910d289c4bf580c937aefc5c4833ba66ea2dcf68 (diff)
downloadaur-39e42c44dd626aca42845aa054a2e2257fd9e5a6.tar.gz
upkg, added patch for linux 4.17
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD12
-rw-r--r--linux_4.17_vgaswitch.patch65
3 files changed, 78 insertions, 3 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 8812f44b2641..87dde2567c23 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,5 +1,5 @@
# Generated by mksrcinfo v8
-# Sat Jul 21 18:54:17 UTC 2018
+# Sat Jul 21 20:13:03 UTC 2018
pkgbase = bbswitch-pf
pkgdesc = Kernel module allowing to switch dedicated graphics card on Optimus laptops
pkgver = 0.8
@@ -12,7 +12,9 @@ pkgbase = bbswitch-pf
depends = linux-pf>=4.17
depends = linux-pf<4.18
source = git+https://github.com/Bumblebee-Project/bbswitch.git#branch=pm-rework
+ source = linux_4.17_vgaswitch.patch
md5sums = SKIP
+ md5sums = b0a672ecba5dadf7922a363a7a9960ba
pkgname = bbswitch-pf
diff --git a/PKGBUILD b/PKGBUILD
index 0f613029693d..044a27587eed 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -16,8 +16,16 @@ url="http://github.com/Bumblebee-Project/bbswitch"
license=('GPL')
depends=("linux-pf>=$_godver" "linux-pf<$_badver")
makedepends=("linux-pf-headers")
-source=(git+https://github.com/Bumblebee-Project/bbswitch.git#branch=pm-rework)
-md5sums=('SKIP')
+source=(git+https://github.com/Bumblebee-Project/bbswitch.git#branch=pm-rework
+ 'linux_4.17_vgaswitch.patch')
+md5sums=('SKIP'
+ 'b0a672ecba5dadf7922a363a7a9960ba')
+
+prepare()
+{
+ cd ${srcdir}/${_pkgname}
+ patch -p1 -i "$srcdir"/linux_4.17_vgaswitch.patch
+}
build() {
cd ${srcdir}/${_pkgname}
diff --git a/linux_4.17_vgaswitch.patch b/linux_4.17_vgaswitch.patch
new file mode 100644
index 000000000000..ad54c9159e19
--- /dev/null
+++ b/linux_4.17_vgaswitch.patch
@@ -0,0 +1,65 @@
+--- a/bbswitch.c 2018-07-21 21:51:36.039044960 +0200
++++ b/bbswitch.c 2018-07-21 21:56:29.706612678 +0200
+@@ -34,6 +34,7 @@
+ #include <asm/uaccess.h>
+ #include <linux/suspend.h>
+ #include <linux/seq_file.h>
++#include <drm/drmP.h>
+ #include <linux/pm_runtime.h>
+ #include <linux/pm_domain.h>
+ #include <linux/vga_switcheroo.h>
+@@ -288,17 +289,25 @@
+ static int bbswitch_pci_runtime_suspend(struct device *dev)
+ {
+ struct pci_dev *pdev = to_pci_dev(dev);
+-
++ struct drm_device *drm_dev = pci_get_drvdata(pdev);
++
+ pr_info("disabling discrete graphics\n");
+
+- /* Ensure that the audio driver knows not to touch us. */
+- vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_OFF);
+
++ drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
++
++
+ bbswitch_optimus_dsm();
+
+ /* Save state now that the device is still awake, makes PCI layer happy */
+ pci_save_state(pdev);
+- /* TODO if _PR3 is supported, should this be PCI_D3hot? */
++ pci_disable_device(pdev);
++ pci_ignore_hotplug(pdev);
++
++
++ /* Ensure that the audio driver knows not to touch us. */
++ drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF;
++ /* TODO if _PR3 is supported, should this be PCI_D3hot? */
+ pci_set_power_state(pdev, PCI_D3hot);
+ return 0;
+ }
+@@ -306,11 +315,22 @@
+ static int bbswitch_pci_runtime_resume(struct device *dev)
+ {
+ struct pci_dev *pdev = to_pci_dev(dev);
+-
++ struct drm_device *drm_dev = pci_get_drvdata(pdev);
++ int ret;
+ pr_debug("Finishing runtime resume.\n");
+
++ pci_restore_state(pdev);
++ ret = pci_enable_device(pdev);
++ if (ret)
++ return ret;
++
++ pci_set_master(pdev);
++
++
++ // drm_kms_helper_poll_enable(drm_dev);
+ /* Resume audio driver. */
+- vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_ON);
++ drm_dev->switch_power_state = DRM_SWITCH_POWER_ON;
++
+ return 0;
+ }
+