7 Commits
v0.6 ... v0.7

Author SHA1 Message Date
c7dbd6babb Update to version 0.7, update NEWS 2013-05-28 19:49:26 +02:00
2822d1630c README: mention kmod, workaround for T410 (Fixes GH-58) 2013-05-28 19:40:57 +02:00
c665a74def Fix WARNING on Linux 3.9 (Closes GH-55)
Patch by amonakov. This stops the following error:

    bbswitch: disabling discrete graphics
    ------------[ cut here ]------------
    WARNING: at drivers/pci/pci.c:1393 pci_disable_device+0x84/0x90()
    Hardware name: B7130
    [44B blob data]
    Modules linked in:
     bbswitch(O+) ip_set_hash_ip xt_set ip_set nfnetlink ipt_REJECT xt_recent xt_tcpudp xt_owner nf_conntrack_ipv6 nf_defrag
    Pid: 2653, comm: modprobe Tainted: G           O 3.9.1-1-custom #1
    Call Trace:
     [<ffffffff8103fe60>] warn_slowpath_common+0x70/0xa0
     [<ffffffff8103fedc>] warn_slowpath_fmt+0x4c/0x50
     [<ffffffff8130712c>] ? pci_bus_write_config_word+0x1c/0x20
     [<ffffffff8130d794>] pci_disable_device+0x84/0x90
     [<ffffffffa05b21f6>] bbswitch_off+0xa6/0x1d0 [bbswitch]
     [<ffffffffa0104248>] bbswitch_init+0x248/0x1000 [bbswitch]
     [<ffffffffa0104000>] ? 0xffffffffa0103fff
     [<ffffffff810002da>] do_one_initcall+0x10a/0x160
     [<ffffffff810a8720>] load_module+0x1d40/0x24a0
     [<ffffffff810a4410>] ? store_uevent+0x40/0x40
     [<ffffffff810a8fce>] sys_finit_module+0x7e/0x80
     [<ffffffff815afcc6>] system_call_fastpath+0x1a/0x1f
    ---[ end trace 1b312a60aa1b0ed6 ]---
    pci 0000:01:00.0: Refused to change power state, currently in D0
2013-05-10 19:18:34 +02:00
e21cdd7b3f Update REAMDE.md
Closes GH-28
2013-04-26 19:12:42 +02:00
f982a09546 Print path to DSM method on execution failure 2013-04-02 17:44:30 +02:00
3e50c7b118 Do not check for nvidia DSM on igd handle
Just in case the integrated video ACPI handle cannot be found. This is a safety
net for those who try bbswitch on an incompatible machine. I do not know any of
such machinees, but it looks good.
2013-04-02 17:40:38 +02:00
91814c63f1 Add copyright header (GH-50) 2013-03-22 10:24:06 +01:00
3 changed files with 52 additions and 6 deletions

6
NEWS
View File

@ -1,3 +1,9 @@
Version 0.7 - 28 May 2013
* Fixes a scary WARNING on Linux 3.9.
* Improved debug information when an ACPI method cannot be executed.
* Added copyright information, update my name.
Version 0.6 - 19 March 2013 Version 0.6 - 19 March 2013
* Add workaround for Linux 3.8 regression (not present in earlier or latter * Add workaround for Linux 3.8 regression (not present in earlier or latter

View File

@ -22,6 +22,16 @@ detect the correct handle preceding _DSM and has some built-in safeguards:
disabled again if that was the case before suspending. Hibernation should disabled again if that was the case before suspending. Hibernation should
work, but it not tested. work, but it not tested.
Precautionary measure :
- On some machines, turning off the card is permanent and the card does not
reappear on subsequents reboots, which can result into the screen staying
black all the time, including the BIOS screen.
If it occurs, first try to shutdown, unplug power cord, remove battery, wait
30s, then put everything back in and boot. If it's not solved, then the
solution is to reset the BIOS to factory settings. Before executing bbswitch
for the first time, it is therefore recommended to take note of the full key
sequence in the BIOS to do a reset.
Build Build
----- -----
@ -94,8 +104,9 @@ same behavior as:
If not explictly set, the default behavior is not to change the power state of If not explictly set, the default behavior is not to change the power state of
the discrete video card which equals to `load_state=-1 unload_state=-1`. the discrete video card which equals to `load_state=-1 unload_state=-1`.
The Lenovo T410s laptop needs the module option `skip_optimus_dsm=1`, otherwise The Lenovo T410 and Lenovo T410s laptops need the module option
it will detect the wrong methods which result in the card not being disabled. `skip_optimus_dsm=1`, otherwise it will detect the wrong methods which result in
the card not being disabled.
### Disable card on boot ### Disable card on boot
@ -106,10 +117,26 @@ get disabled on boot:
bbswitch load_state=0 bbswitch load_state=0
Users of `kmod` should create `/etc/modprobe.d/bbswitch.conf` containing
`options bbswitch load_state=0` to set the default options. To load the module,
systemd users should create `/etc/modules-load.d/bbswitch.conf` containing
`bbswitch`.
You have to update your initial ramdisk (initrd) for the changes propagate to You have to update your initial ramdisk (initrd) for the changes propagate to
the boot process. On Debian and Ubuntu, this can performed by running the boot process. On Debian and Ubuntu, this can performed by running
`update-initramfs -u` as root. `update-initramfs -u` as root.
### Enable card on shutdown
Some machines do not like the card being disabled at shutdown.
Add the next initscript (`/etc/init/bbswitch.conf`) :
description "Save power by disabling nvidia on Optimus"
author "Lekensteyn <lekensteyn@gmail.com>"
start on runlevel [2345]
stop on runlevel [016]
pre-start exec /sbin/modprobe bbswitch load_state=0 unload_state=1
pre-stop exec /sbin/rmmod bbswitch
Reporting bugs Reporting bugs
-------------- --------------

View File

@ -10,6 +10,9 @@
* # cat /proc/acpi/bbswitch * # cat /proc/acpi/bbswitch
*/ */
/* /*
* Copyright (C) 2011-2013 Bumblebee Project
* Author: Peter Wu <lekensteyn@gmail.com>
*
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
@ -33,11 +36,11 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#define BBSWITCH_VERSION "0.6" #define BBSWITCH_VERSION "0.7"
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Toggle the discrete graphics card"); MODULE_DESCRIPTION("Toggle the discrete graphics card");
MODULE_AUTHOR("Peter Lekensteyn <lekensteyn@gmail.com>"); MODULE_AUTHOR("Peter Wu <lekensteyn@gmail.com>");
MODULE_VERSION(BBSWITCH_VERSION); MODULE_VERSION(BBSWITCH_VERSION);
enum { enum {
@ -129,10 +132,14 @@ static int acpi_call_dsm(acpi_handle handle, const char muid[16], int revid,
err = acpi_evaluate_object(handle, "_DSM", &input, &output); err = acpi_evaluate_object(handle, "_DSM", &input, &output);
if (err) { if (err) {
struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };
char muid_str[5 * 16]; char muid_str[5 * 16];
char args_str[5 * 4]; char args_str[5 * 4];
pr_warn("failed to evaluate _DSM {%s} 0x%X 0x%X {%s}: %s\n", acpi_get_name(handle, ACPI_FULL_PATHNAME, &buf);
pr_warn("failed to evaluate %s._DSM {%s} 0x%X 0x%X {%s}: %s\n",
(char *)buf.pointer,
buffer_to_string(muid, 16, muid_str), revid, func, buffer_to_string(muid, 16, muid_str), revid, func,
buffer_to_string(args, 4, args_str), acpi_format_exception(err)); buffer_to_string(args, 4, args_str), acpi_format_exception(err));
return err; return err;
@ -431,7 +438,7 @@ static int __init bbswitch_init(void) {
/* At least two Acer machines are known to use the intel ACPI handle /* At least two Acer machines are known to use the intel ACPI handle
* with the legacy nvidia DSM */ * with the legacy nvidia DSM */
dis_handle = igd_handle; dis_handle = igd_handle;
if (has_dsm_func(acpi_nvidia_dsm_muid, 0x102, 0x3)) { if (dis_handle && has_dsm_func(acpi_nvidia_dsm_muid, 0x102, 0x3)) {
dsm_type = DSM_TYPE_NVIDIA; dsm_type = DSM_TYPE_NVIDIA;
pr_info("detected a nVidia _DSM function on the" pr_info("detected a nVidia _DSM function on the"
" integrated video card\n"); " integrated video card\n");
@ -449,6 +456,12 @@ static int __init bbswitch_init(void) {
dis_dev_get(); dis_dev_get();
if (!is_card_disabled()) {
/* We think the card is enabled, so ensure the kernel does as well */
if (pci_enable_device(dis_dev))
pr_warn("failed to enable %s\n", dev_name(&dis_dev->dev));
}
if (load_state == CARD_ON) if (load_state == CARD_ON)
bbswitch_on(); bbswitch_on();
else if (load_state == CARD_OFF) else if (load_state == CARD_OFF)