Permalink
Browse files

Merge branch 'master' of github.com:awilliam/asus-switcheroo

  • Loading branch information...
2 parents 00eedb3 + ab4563b commit 4c9bd446c25612b24bbbe2f9f6d07c4aae73c6af @awilliam committed Aug 5, 2012
Showing with 38 additions and 2 deletions.
  1. +15 −0 Makefile
  2. +12 −1 asus-switcheroo.c
  3. +11 −1 byo-switcheroo.c
View
@@ -9,6 +9,21 @@ default:
clean:
$(MAKE) -C $(KDIR) M=$(PWD) clean
+install-slackware:
+ install -m 0644 -D asus-switcheroo.ko /lib/modules/$(shell uname -r)/extra/asus-switcheroo/asus-switcheroo.ko
+ install -m 0644 -D byo-switcheroo.ko /lib/modules/$(shell uname -r)/extra/asus-switcheroo byo-switcheroo.ko
+ install -m 0644 -D i915-jprobe.ko /lib/modules/$(shell uname -r)/extra/asus-switcheroo/i915-jprobe.ko
+ install -m 0644 -D nouveau-jprobe.ko /lib/modules/$(shell uname -r)/extra/asus-switcheroo/nouveau-jprobe.ko
+ depmod -a
+ install -m 0755 asus-switcheroo-pm /etc/pm/sleep.d/75-asus-switcheroo-pm
+ install -m 0644 asus-switcheroo.conf-modprobe.d /etc/modprobe.d/50-asus-switcheroo.conf
+
+uninstall-slackware:
+ rm -rf /lib/modules/$(shell uname -r)extra/asus-switcheroo
+ depmod -a
+ rm -f /etc/pm/sleep.d/75-asus-switcheroo-pm
+ rm -f /etc/modprobe.d/50-asus-switcheroo.conf
+
install-fedora:
install -m 0644 -D asus-switcheroo.ko /lib/modules/$(shell uname -r)/extra/asus-switcheroo/asus-switcheroo.ko
install -m 0644 -D byo-switcheroo.ko /lib/modules/$(shell uname -r)/extra/asus-switcheroo/byo-switcheroo.ko
View
@@ -306,6 +306,14 @@ static bool asus_switcheroo_dsm_detect(void)
return false;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
+struct vga_switcheroo_client_ops asus_switcheroo_ops = {
+ .set_gpu_state = asus_switcheroo_set_state,
+ .reprobe = NULL,
+ .can_switch = asus_switcheroo_can_switch,
+};
+#endif
+
static int __init asus_switcheroo_init(void)
{
if (!asus_switcheroo_dsm_detect())
@@ -314,7 +322,10 @@ static int __init asus_switcheroo_init(void)
vga_switcheroo_register_handler(&asus_dsm_handler);
if (dummy_client)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
+ vga_switcheroo_register_client(discrete_dev,
+ &asus_switcheroo_ops);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
vga_switcheroo_register_client(discrete_dev,
asus_switcheroo_set_state, NULL,
asus_switcheroo_can_switch);
View
@@ -328,6 +328,14 @@ static bool dummy_switcheroo_can_switch(struct pci_dev *pdev)
return !dummy_client_switched;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
+struct vga_switcheroo_client_ops byo_switcheroo_ops = {
+ .set_gpu_state = dummy_switcheroo_set_state,
+ .reprobe = NULL,
+ .can_switch = dummy_switcheroo_can_switch,
+};
+#endif
+
static int __init byo_switcheroo_init(void)
{
struct pci_dev *pdev = NULL;
@@ -365,7 +373,9 @@ static int __init byo_switcheroo_init(void)
printk(KERN_INFO "BYO-switcheroo handler registered\n");
if (dummy_client) {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
+ vga_switcheroo_register_client(dis_dev, &byo_switcheroo_ops);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
ret = vga_switcheroo_register_client(dis_dev,
dummy_switcheroo_set_state, NULL,
dummy_switcheroo_can_switch);

0 comments on commit 4c9bd44

Please sign in to comment.