Skip to content

Commit

Permalink
Merge branch 'master' of github.com:awilliam/asus-switcheroo
Browse files Browse the repository at this point in the history
  • Loading branch information
awilliam committed Aug 5, 2012
2 parents 00eedb3 + ab4563b commit 4c9bd44
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
15 changes: 15 additions & 0 deletions Makefile
Expand Up @@ -9,6 +9,21 @@ default:
clean: clean:
$(MAKE) -C $(KDIR) M=$(PWD) 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-fedora:
install -m 0644 -D asus-switcheroo.ko /lib/modules/$(shell uname -r)/extra/asus-switcheroo/asus-switcheroo.ko 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 byo-switcheroo.ko /lib/modules/$(shell uname -r)/extra/asus-switcheroo/byo-switcheroo.ko
Expand Down
13 changes: 12 additions & 1 deletion asus-switcheroo.c
Expand Up @@ -306,6 +306,14 @@ static bool asus_switcheroo_dsm_detect(void)
return false; 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) static int __init asus_switcheroo_init(void)
{ {
if (!asus_switcheroo_dsm_detect()) if (!asus_switcheroo_dsm_detect())
Expand All @@ -314,7 +322,10 @@ static int __init asus_switcheroo_init(void)
vga_switcheroo_register_handler(&asus_dsm_handler); vga_switcheroo_register_handler(&asus_dsm_handler);


if (dummy_client) 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, vga_switcheroo_register_client(discrete_dev,
asus_switcheroo_set_state, NULL, asus_switcheroo_set_state, NULL,
asus_switcheroo_can_switch); asus_switcheroo_can_switch);
Expand Down
12 changes: 11 additions & 1 deletion byo-switcheroo.c
Expand Up @@ -328,6 +328,14 @@ static bool dummy_switcheroo_can_switch(struct pci_dev *pdev)
return !dummy_client_switched; 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) static int __init byo_switcheroo_init(void)
{ {
struct pci_dev *pdev = NULL; struct pci_dev *pdev = NULL;
Expand Down Expand Up @@ -365,7 +373,9 @@ static int __init byo_switcheroo_init(void)
printk(KERN_INFO "BYO-switcheroo handler registered\n"); printk(KERN_INFO "BYO-switcheroo handler registered\n");


if (dummy_client) { 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, ret = vga_switcheroo_register_client(dis_dev,
dummy_switcheroo_set_state, NULL, dummy_switcheroo_set_state, NULL,
dummy_switcheroo_can_switch); dummy_switcheroo_can_switch);
Expand Down

0 comments on commit 4c9bd44

Please sign in to comment.