2 * Linux kernel module that disables the discrete graphics board
4 * Original version for Lenovo laptops by Sylvain Joyeux <sylvain.joyeux@m4x.org> Copyright (c) 2009
6 * mil2 added nVidia GeForce G210M support (for Asus UL30VT, UL50V, UL80V laptops)
7 * o8x8 added post hibernate support
9 * Marco Giorgi <blackmoon.105@gmail.com> packaged this module for debian/ubuntu
11 * Power down the nVidia card to save up to 4W of power.
17 * Name: nvidia_g210m_acpi.c
18 * Source code for nvidia_g210m_acpi switch-off kernel module
20 * Licensed under the GNU GPL
25 #include <acpi/acpi.h>
26 #include <linux/suspend.h>
28 MODULE_LICENSE("GPL");
30 static acpi_handle root_handle
;
32 static int kill_nvidia(void)
37 struct acpi_object_list args
;
38 // For the return value
39 struct acpi_buffer buffer
= { ACPI_ALLOCATE_BUFFER
, NULL
};
41 status
= acpi_get_handle(root_handle
, "\\_SB.PCI0.P0P1.VGA._OFF", &handle
);
42 if (ACPI_FAILURE(status
))
44 printk("%s: cannot get ACPI handle: %s\n", __func__
, acpi_format_exception(status
));
51 status
= acpi_evaluate_object(handle
, NULL
, &args
, &buffer
);
52 if (ACPI_FAILURE(status
))
54 printk("%s: _OFF method call failed: %s\n", __func__
, acpi_format_exception(status
));
57 kfree(buffer
.pointer
);
59 printk("%s: disabled the discrete graphics card\n", __func__
);
63 static int power_event(struct notifier_block
*this, unsigned long event
, void *ptr
)
66 case PM_POST_HIBERNATION
:
67 printk("%s: post hibernation\n",__FILE__
);
71 printk("%s: post suspend\n",__FILE__
);
80 static struct notifier_block power_notifier
= { .notifier_call
= power_event
, };
82 static int __init
nvidia_g210m_acpi(void)
84 int ret
= register_pm_notifier(&power_notifier
);
89 static void dummy(void)
93 module_init(nvidia_g210m_acpi
);