GOOD NEWS EVERYONE

I found a tiny code on the net written by Sylvain on opensuse forums. It's a kernel module that uses ACPI functionality to completely turn off the ATI card! It's just awesome.

So here're the steps to a lot more energy efficient laptop:

1. Save the following as lenovo_acpi.c:
Code:
/* Linux kernel module that disables the discrete graphics board for Lenovo
 * U330. Other lenovo laptops could work, but I don't know.
 *
 * Copyright (c) 2009: Sylvain Joyeux <sylvain.joyeux@m4x.org>
 */
#include <acpi/acpi.h>

MODULE_LICENSE("GPL");

static acpi_handle root_handle;

static int __init kill_ati(void)
{
    int i;
    acpi_status status;
    // The device handle
    acpi_handle handle;
    // The package elements
    union acpi_object package_elements[3];
    // The arguments to ATPX
    union acpi_object atpx_arg_elements[2];
    struct acpi_object_list atpx_arg;
    // For the return value of ATPX
    struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };

    status = acpi_get_handle(root_handle, "\\_SB_.PCI0.OVGA.ATPX", &handle);
    if (ACPI_FAILURE(status))
    {
        status = acpi_get_handle(root_handle, "\\_SB_.PCI0.OVGA.XTPX", &handle);
        if (ACPI_FAILURE(status))
        {
            printk("lenovo_acpi: cannot get ACPI handle: %s\n", acpi_format_exception(status));
            return -ENOSYS;
        }
        printk("lenovo_acpi: in discrete graphics mode\n");
        return 0;
    }

    for (i = 0; i < 3; ++i)
    {
        package_elements[i].type = ACPI_TYPE_INTEGER;
        package_elements[i].integer.value = 0;
    }

    atpx_arg.count = 2;
    atpx_arg.pointer = &atpx_arg_elements[0];

    atpx_arg_elements[0].type = ACPI_TYPE_INTEGER;
    atpx_arg_elements[0].integer.value = 2;

    atpx_arg_elements[1].type = ACPI_TYPE_PACKAGE;
    atpx_arg_elements[1].package.count = 3;
    atpx_arg_elements[1].package.elements = &package_elements[0];
    
    status = acpi_evaluate_object(handle, NULL, &atpx_arg, &buffer);
    if (ACPI_FAILURE(status))
    {
        printk("lenovo_acpi: ATPX method call failed: %s\n", acpi_format_exception(status));
        return -ENOSYS;
    }
    kfree(buffer.pointer);

    printk("lenovo_acpi: disabled the discrete graphics card\n");
    return 0;
}

static void dummy(void)
{
}

module_init(kill_ati);
module_exit(dummy);
2. Save the following as Makefile:

Code:
ifneq ($(KERNELRELEASE),)
  obj-m := lenovo_acpi.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
3. In the same folder, run the following shell commands:

Code:
make
sudo cp lenovo_acpi.ko /lib/modules/`uname -r`/kernel/
sudo depmod
echo lenovo_acpi | sudo tee -a /etc/modules > /dev/null
4. Restart and choose "Switchable" graphics in the BIOS

Next time your linux boots, it should shut down the ATI card. Easiest way to check is to look at the battery life estimate.

All the credit goes to Sylvain for his fabulous hack - I just copied it here, so don't thank me.

NOTE: You need to compile this for each new kernel you install - I know too little to make it work with all kernels (see dkms)

Reference: http://forum.suse.co.in/index.php?t=...8e9e12541a85d3