ubuntu-x-swat team mailing list archive
-
ubuntu-x-swat team
-
Mailing list archive
-
Message #42762
[Bug 312756] Re: support graphics card hot switch
Hi,
After inspecting the contents of 2 MSI Megabook DSDT.dsl tables we've got, it looks like the calls to switch on/off graphics card in this
laptop model are:
^^^MXR0.MXM0._ON
^^^MXR0.MXM0._OFF
^^^MXR0.MXM0._STA
so instead of using the method below, which works in Asus UL*0V models:
status = acpi_get_handle(root_handle, "\\_SB.PCI0.P0P1.VGA._OFF",
&handle);
one would use this:
status = acpi_get_handle(root_handle, "\\_SB.PCI0.MXR0.MXM0._OFF",
&handle);
See a modified version of the module and makefile:
msi_nvidia.c
========================================================
#include <acpi/acpi.h>
#include <linux/suspend.h>
MODULE_LICENSE("GPL");
static acpi_handle root_handle;
static int kill_nvidia(void)
{
acpi_status status;
// The device handle
acpi_handle handle;
struct acpi_object_list args;
// For the return value
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
status = acpi_get_handle(root_handle, "\\_SB.PCI0.MXR0.MXM0._OFF", &handle);
if (ACPI_FAILURE(status))
{
printk("%s: cannot get ACPI handle: %s\n", __func__, acpi_format_exception(status));
return -ENOSYS;
}
args.count = 0;
args.pointer = NULL;
status = acpi_evaluate_object(handle, NULL, &args, &buffer);
if (ACPI_FAILURE(status))
{
printk("%s: _OFF method call failed: %s\n", __func__, acpi_format_exception(status));
return -ENOSYS;
}
kfree(buffer.pointer);
printk("%s: disabled the discrete graphics card\n",__func__);
return 0;
}
static int power_event(struct notifier_block *this, unsigned long event,
void *ptr)
{
switch (event) {
case PM_POST_HIBERNATION:
kill_nvidia();
return NOTIFY_DONE;
case PM_POST_SUSPEND:
case PM_HIBERNATION_PREPARE:
case PM_SUSPEND_PREPARE:
default:
return NOTIFY_DONE;
}
}
static struct notifier_block power_notifier = {
.notifier_call = power_event,
};
static int __init msi_nvidia(void)
{
int ret = register_pm_notifier(&power_notifier);
if (ret) return ret;
return kill_nvidia();
}
static void dummy(void)
{
}
module_init(msi_nvidia);
module_exit(dummy);
========================================================
Makefile
========================================================
ifneq ($(KERNELRELEASE),)
obj-m := msi_nvidia.o
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) $(EXTRA_FLAGS) modules
clean:
$(MAKE) -C $(KERNELDIR) M=$(PWD) $(EXTRA_FLAGS) clean
endif
========================================================
--
support graphics card hot switch
https://bugs.launchpad.net/bugs/312756
You received this bug notification because you are a member of Ubuntu-X,
which is subscribed to xorg-server in ubuntu.