Compare commits

...

36 Commits

Author SHA1 Message Date
Peter Wu
7862f115de Merge branch 'master' into hack-lenovo 2013-12-05 11:10:16 +01:00
Peter Wu
251a7fbec4 acpi-handle-hack: Linux 3.13 compatibility
Just in case this hack is needed in the future.
2013-12-05 00:16:18 +01:00
Peter Wu
81e1e7ee4d acpi-handle-hack: Support Acer Aspire V5-573PG
Reported y Christian Buchner[1].

 [1]: https://github.com/Bumblebee-Project/Bumblebee/issues/460#issuecomment-23658424
2013-09-02 15:02:55 +02:00
Peter Wu
18c3892778 acpi-handle-hack: compatibility with Linux 3.8+ 2013-09-02 15:00:39 +02:00
Peter Wu
560eea85ce acpi-handle-hack: add Acer V5-573G
\_SB.PCI0.RP05.PXSX should become \_SB.PCI0.RP05.PEGP, see
https://github.com/Bumblebee-Project/Bumblebee/issues/460
2013-09-02 12:15:19 +02:00
Peter Wu
4feced8a87 README: update information about the patch and bug. 2013-03-29 22:50:28 +01:00
Peter Wu
8f98977ad8 Add Lenovo IdeaPad Z500
Reported in an e-mail by Yroslav.
2013-03-29 22:50:28 +01:00
Peter Wu
be80d89a51 Merge pull request #44 from tiftof/u510
Support Lenovo IdeaPad U510
2013-02-17 13:14:25 -08:00
Christophe Oosterlynck
1b9e7e6af9 Support Lenove IdeaPad U510 2013-02-17 21:46:49 +01:00
Bruno Pagani
db6eaf14de And yet another one.
https://bugs.launchpad.net/lpbugreporter/+bug/1102572
2013-01-25 21:39:40 +01:00
Peter Wu
a5d7192767 Add another TOSHIBA Satellite P870 (PSPLBA-02300S) (GH-40) 2013-01-22 16:45:03 +01:00
Peter Wu
bac9a9ac27 Merge branch 'develop' into hack-lenovo 2013-01-22 16:44:42 +01:00
Peter Wu
a516f95781 README.md: bump version, simplify instructions 2012-12-04 19:53:28 +01:00
Peter Wu
d349fc3547 dkms/acpi-handle-hack.conf: Bump version to 0.0.2 2012-11-28 22:05:54 +01:00
Peter Wu
ac2969eea2 Bump to 0.0.2 because of bugfixes 2012-11-10 12:18:14 +01:00
Peter Wu
94765f1952 Improve error checking, do not leak memory
A reference to pci_dev was always kept on failure (which is rare, but it could
happen if the bug is fixed or BIOS is updated). The handle name was also always
leaked, this is now corrected too.
2012-11-10 12:17:46 +01:00
Peter Wu
5d170444eb acpi-handle-hack: convert printk to pr_*; fix error message 2012-10-28 15:08:57 +01:00
Peter Wu
2d00d70ec7 Merge branch 'master' into hack-lenovo 2012-10-28 15:05:04 +01:00
Peter Wu
f5a4f5f364 Merge pull request #34 from dauxer/hack-lenovo
Add Lenovo G780
2012-09-22 12:34:26 -07:00
dauxer
aaa0bd3be8 Add Lenovo G780 2012-09-22 20:04:27 +02:00
Peter Wu
232ee2dc11 acpi-handle-hack: Add Lenovo UdeaPad Y570 "PIQY0" (Closes GH-26) 2012-08-15 15:22:25 +02:00
Peter Wu
82648190aa Detect 3D controllers as gfx device too
Necessary for Lenovo G580 for example.
2012-08-15 14:35:40 +02:00
Peter Wu
f4128e5b40 acpi-handle-hack: Add Lenovo G580
Reported at Bumblebee-Project/Bumblebee#230, it seems to be the same
issue.
2012-08-15 12:54:31 +02:00
Peter Wu
13392b5125 Merge branch 'develop' into hack-lenovo 2012-08-15 12:51:20 +02:00
Peter
6a1de878c3 Merge pull request #24 from TheSiege/hack-lenovo
Support hack for Lenovo IdeaPad Y480
2012-06-24 00:48:25 -07:00
anagromataf
e5456d1e0e hack for Y480 2012-06-23 14:49:30 -07:00
Peter
1e54d10115 Merge pull request #22 from koniiiik/hack-lenovo
Support hack for Lenovo IdeaPad Y580
2012-06-19 01:33:56 -07:00
Michal Petrucha
6864cf40a4 Added Ideapad Y580 to the list of devices requiring the hack. 2012-06-19 01:19:11 +02:00
Lekensteyn
411db223bb Update README.md with Toshiba SATELLITE P870 2012-06-03 16:19:03 +02:00
Lekensteyn
50970d8cf1 Add Toshiba SATELLITE P870 (PSPLBE-01V00HFR)
This machine is also affected as reported on
https://github.com/Bumblebee-Project/Bumblebee/issues/173
2012-06-03 15:42:26 +02:00
Lekensteyn
ec42e5b7ad Add LENOVO IDEAPAD Y570 "PIQY0" 2012-03-01 23:41:56 +01:00
Lekensteyn
a0fdcedf27 README.md: copy to dkms.conf instead of acpi-handle-hack.conf 2012-02-03 23:37:39 +01:00
Lekensteyn
205c7ccddc Update README with test machine and post-install instructions 2012-02-03 16:08:55 +01:00
Lekensteyn
95712ab77f Update README and add adkms for Lenovo hack 2012-02-03 15:38:56 +01:00
Lekensteyn
b47ba4b087 Fix detection of machine by appending spaces 2012-02-02 23:22:16 +01:00
Lekensteyn
3668be9736 Add Lenovo IdeaPad Y470/Y570 hack
Warning: this is a very ugly hack, I do not know whether it works or not. It may
be unstable and does very unusual things.
2012-02-02 22:23:13 +01:00
3 changed files with 180 additions and 0 deletions

View File

@ -59,6 +59,45 @@ To uninstall it, run:
# make -f Makefile.dkms uninstall
Lenovo IdeaPad Y470/Y570 and Toshiba SATELLITE P870
---------------------------------------------------
[This kernel bug](https://bugzilla.kernel.org/show_bug.cgi?id=42696) is fixed in
Linux 3.9-rc1 and Linux 3.8.5 which obsoletes this hack. Linux 3.7 is
incompatible with this hack (and already EOL'd, so a backport fix won't be made
available).
In kernel version 3.6 and older, you need to apply an ugly hack on these laptops
to make bbswitch and the
driver (both nouveau and nvidia) work. For now I have decided not to put the
hack in the bbswitch module since it is a very ugly hack that is comparable to
writing a maximum allowable speed of 130 km/h on a traffic sign for a road
where 120 km/h is allowed just because the radar gun does not work properly.
The module has been tested on a Lenovo IdeaPad Y570 running an up-to-date
version of Ubuntu 11.10 Oneiric (64-bit) with Bumblebee 3.0 (3.0-1~oneiricppa2)
installed using the nvidia driver.
To make use of it, use the `hack-lenovo` branch. An example using DKMS:
$ git clone git://github.com/Bumblebee-Project/bbswitch.git -b hack-lenovo
$ cd bbswitch
$ mkdir /usr/src/acpi-handle-hack-0.0.2
# cp Makefile acpi-handle-hack.c /usr/src/acpi-handle-hack-0.0.2
# cp dkms/acpi-handle-hack.conf /usr/src/acpi-handle-hack-0.0.2/dkms.conf
# dkms install -m acpi-handle-hack -v 0.0.2
If everything goes well, you now need to get the hack loaded on boot. On
Ubuntu and Debian, this can be done with:
echo acpi-handle-hack | sudo tee -a /etc/modules
sudo update-initramfs -u
For other systems, adopt the instructions from the *Disable card on boot*
section below. Please do not copy these instructions to blogs/forums/whatever
without warning that the method is a hack (you can refer to the metaphore above)
and that it may crash the machine if incorrectly applied. To apply these
changes, you have to reboot (technically, unloading nvidia/nouveau, bbswitch and
stopping bumblebeed, `modprobe acpi-handle-hack` and starting bumblebeed should
work as well, but saying reboot is shorter)
Usage
-----

134
acpi-handle-hack.c Normal file
View File

@ -0,0 +1,134 @@
/**
* Very ugly hack to work around a wrongly detected ACPI handle, see
* https://bugzilla.kernel.org/show_bug.cgi?id=42696
* https://bugzilla.kernel.org/show_bug.cgi?id=60829
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/acpi.h>
#include <linux/dmi.h>
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Dirty ACPI handle hack for Lenovo IdeaPad Y[45]70");
MODULE_AUTHOR("Peter Lekensteyn <lekensteyn@gmail.com>");
MODULE_VERSION("0.0.2");
static struct pci_dev *dis_dev;
static acpi_handle orig_handle;
/**
* Returns true if the system needs an ACPI handle hack
*/
static bool __init need_acpi_handle_hack(void) {
return dmi_match(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Y470 ")
|| dmi_match(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Y480")
|| dmi_match(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Y570 ")
|| dmi_match(DMI_PRODUCT_VERSION, "LENOVO IDEAPAD Y570 ") /* sys-product-name: PIQY0 */
|| dmi_match(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Y580")
|| dmi_match(DMI_PRODUCT_VERSION, "Lenovo IdeaPad U510")
|| dmi_match(DMI_PRODUCT_VERSION, "PSPLBE-01V00HFR") /* TOSHIBA SATELLITE P870 */
|| dmi_match(DMI_PRODUCT_VERSION, "PSPLBA-02300S") /* TOSHIBA Satellite P870 */
|| dmi_match(DMI_PRODUCT_VERSION, "PSPLFE-00E009FR") /* TOSHIBA Satellite P870 */
|| dmi_match(DMI_PRODUCT_VERSION, "Lenovo G580")
|| dmi_match(DMI_PRODUCT_VERSION, "Lenovo G780")
|| dmi_match(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Z500")
|| (dmi_match(DMI_SYS_VENDOR, "LENOVO") && dmi_match(DMI_PRODUCT_NAME, "PIQY0")) /* Lenovo IdeaPad Y570 */
|| dmi_match(DMI_PRODUCT_NAME, "Aspire V5-573G")
|| dmi_match(DMI_PRODUCT_NAME, "Aspire V5-573PG")
;
}
static struct pci_dev __init *get_discrete_device(void) {
struct pci_dev *pdev = NULL;
while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) {
int pci_class = pdev->class >> 8;
if (pci_class != PCI_CLASS_DISPLAY_VGA &&
pci_class != PCI_CLASS_DISPLAY_3D)
continue;
if (pdev->vendor != PCI_VENDOR_ID_INTEL) {
return pdev;
}
}
return NULL;
}
/**
* Very ugly hack to set the ACPI handle, do not use this as exemplary code!
*/
static void dev_set_acpi_handle(struct pci_dev *pdev, acpi_handle handle) {
#ifdef ACPI_HANDLE_SET
ACPI_HANDLE_SET(&pdev->dev, handle);
#else
/* for Linux 3.7 and earlier */
pdev->dev.archdata.acpi_handle = handle;
#endif
}
static int __init hack_apply(void) {
acpi_handle tmp_handle, new_handle;
struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };
if (!need_acpi_handle_hack()) {
pr_err("Machine does not need ACPI handle hack\n");
return -ENODEV;
}
dis_dev = get_discrete_device();
if (!dis_dev) {
pr_err("No discrete video card found\n");
return -ENODEV;
}
#ifdef ACPI_HANDLE
/* since Linux 3.8 */
orig_handle = ACPI_HANDLE(&dis_dev->dev);
#else
/* removed since Linux 3.13 */
orig_handle = DEVICE_ACPI_HANDLE(&dis_dev->dev);
#endif
if (!orig_handle) {
pr_err("No ACPI handle found for discrete video card\n");
goto free_dev;
}
if (ACPI_FAILURE(acpi_get_name(orig_handle, ACPI_SINGLE_NAME, &buf))) {
pr_err("Could not acquire name for discrete video card\n");
goto free_dev;
}
if (strcmp((char *)buf.pointer, "PEGP") == 0) {
pr_err("Handle has already been changed to PEGP\n");
goto free_name;
}
/* \_SB.PCI0.PEG0.VGA_ -> \_SB.PCI0.PEG0.PEGP */
if (ACPI_FAILURE(acpi_get_parent(orig_handle, &tmp_handle))) {
pr_err("No parent device found for %s\n", (char *)buf.pointer);
goto free_name;
}
if (ACPI_FAILURE(acpi_get_handle(tmp_handle, "PEGP", &new_handle))) {
pr_err("No PEGP handle found on %s\n", (char *)buf.pointer);
goto free_name;
}
pr_info("Setting new ACPI handle for discrete video card\n");
dev_set_acpi_handle(dis_dev, new_handle);
kfree(buf.pointer);
pci_dev_put(dis_dev);
return 0;
free_name:
kfree(buf.pointer);
free_dev:
pci_dev_put(dis_dev);
return -ENODEV;
}
static void __exit hack_undo(void) {
if (orig_handle) {
pr_info("Restoring original ACPI handle for discrete"
" video card\n");
dev_set_acpi_handle(dis_dev, orig_handle);
}
}
module_init(hack_apply);
module_exit(hack_undo);

View File

@ -0,0 +1,7 @@
PACKAGE_NAME="acpi-handle-hack"
PACKAGE_VERSION="0.0.2"
MAKE[0]="make KVERSION=$kernelver modname=acpi-handle-hack"
CLEAN="make clean"
BUILT_MODULE_NAME[0]="acpi-handle-hack"
DEST_MODULE_LOCATION[0]="/kernel/drivers/acpi"
AUTOINSTALL="yes"