diff options
author | Björn Bidar | 2018-07-21 22:01:04 +0200 |
---|---|---|
committer | Björn Bidar | 2018-07-21 22:14:02 +0200 |
commit | 39e42c44dd626aca42845aa054a2e2257fd9e5a6 (patch) | |
tree | a330eb2042a2a5c677393da0ed62e6d56b1dc39c | |
parent | 910d289c4bf580c937aefc5c4833ba66ea2dcf68 (diff) | |
download | aur-39e42c44dd626aca42845aa054a2e2257fd9e5a6.tar.gz |
upkg, added patch for linux 4.17
-rw-r--r-- | .SRCINFO | 4 | ||||
-rw-r--r-- | PKGBUILD | 12 | ||||
-rw-r--r-- | linux_4.17_vgaswitch.patch | 65 |
3 files changed, 78 insertions, 3 deletions
@@ -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 @@ -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; + } + |