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:
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;
}
}
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) BUFFER, NULL };
{
acpi_status status;
// The device handle
acpi_handle handle;
struct acpi_object_list args;
// For the return value
struct acpi_buffer buffer = { ACPI_ALLOCATE_
status = acpi_get_ handle( root_handle, "\\_SB. PCI0.MXR0. MXM0._OFF" , &handle); status) ) exception( status) );
if (ACPI_FAILURE(
{
printk("%s: cannot get ACPI handle: %s\n", __func__, acpi_format_
return -ENOSYS;
}
args.count = 0;
args.pointer = NULL;
status = acpi_evaluate_ object( handle, NULL, &args, &buffer); status) ) exception( status) ); buffer. pointer) ;
if (ACPI_FAILURE(
{
printk("%s: _OFF method call failed: %s\n", __func__, acpi_format_
return -ENOSYS;
}
kfree(
printk("%s: disabled the discrete graphics card\n",__func__);
return 0;
}
static int power_event(struct notifier_block *this, unsigned long event,
void *ptr) HIBERNATION:
kill_ nvidia( );
return NOTIFY_DONE; PREPARE:
return NOTIFY_DONE;
{
switch (event) {
case PM_POST_
case PM_POST_SUSPEND:
case PM_HIBERNATION_
case PM_SUSPEND_PREPARE:
default:
}
}
static struct notifier_block power_notifier = {
.notifier_ call = power_event,
};
static int __init msi_nvidia(void) pm_notifier( &power_ notifier) ;
{
int ret = register_
if (ret) return ret;
return kill_nvidia();
}
static void dummy(void)
{
}
module_ init(msi_ nvidia) ; ======= ======= ======= ======= ======= ======= =======
module_exit(dummy);
=======
Makefile ======= ======= ======= ======= ======= ======= ======= $(shell uname -r)/build
=======
ifneq ($(KERNELRELEASE),)
obj-m := msi_nvidia.o
else
KERNELDIR ?= /lib/modules/
PWD := $(shell pwd)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) $(EXTRA_FLAGS) modules
clean:
$(MAKE) -C $(KERNELDIR) M=$(PWD) $(EXTRA_FLAGS) clean
endif ======= ======= ======= ======= ======= ======= =======
=======