From: Thomas Renninger <trenn@suse.de>
To: ak@linux.intel.com
Cc: mjg59@srcf.ucam.org, jwoithe@physics.adelaide.edu.au,
hmh@hmh.eng.br, rui.zhang@intel.com, corentincj@iksaif.net,
linux-acpi@vger.kernel.org, dannybaumann@web.de,
marcus@better.se, corsac@debian.org, mzxreary@0pointer.de,
carlos@strangeworlds.co.uk, malattia@linux.it,
Thomas Renninger <trenn@suse.de>Thomas Renninger <trenn@suse.de>
Subject: [PATCH 01/11] ACPI: video: Ignore devices that aren't present in hardware
Date: Wed, 16 Jul 2008 12:52:23 +0200 [thread overview]
Message-ID: <1216205553-8486-2-git-send-email-trenn@suse.de> (raw)
In-Reply-To: <1216205553-8486-1-git-send-email-trenn@suse.de>
This is a reimplemention of commit
0119509c4fbc9adcef1472817fda295334612976
from Matthew Garrett <mjg59@srcf.ucam.org>
This patch got removed because of a regression: ThinkPads with a
Intel graphics card and an Integrated Graphics Device BIOS implementation
stopped working.
In fact, they only worked because the ACPI device of the discrete, the
wrong one, got used (via int10). So ACPI functions were poking on the wrong
hardware used which is a sever bug.
The next patch provides support for above ThinkPads to be able to
switch brightness via the legacy thinkpad_acpi driver and automatically
detect when to use it.
Original commit message from Matthew Garrett:
Vendors often ship machines with a choice of integrated or discrete
graphics, and use the same DSDT for both. As a result, the ACPI video
module will locate devices that may not exist on this specific platform.
Attempt to determine whether the device exists or not, and abort the
device creation if it doesn't.
http://bugzilla.kernel.org/show_bug.cgi?id=9614
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Thomas Renninger <trenn@stravinsky.suse.de>
---
drivers/acpi/glue.c | 40 ++++++++++++++++++++++++++++++++++++++++
drivers/acpi/video.c | 7 ++++++-
include/acpi/acpi_bus.h | 2 ++
3 files changed, 48 insertions(+), 1 deletions(-)
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index 9b227d4..a76ef8f 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -140,6 +140,46 @@ struct device *acpi_get_physical_device(acpi_handle handle)
EXPORT_SYMBOL(acpi_get_physical_device);
+/* ToDo: When a PCI bridge is found, return the PCI device behind the bridge
+ * This should work in general, but did not on a Lenovo T61 for the
+ * graphics card. But this must be fixed when the PCI device is
+ * bound and the kernel device struct is attached to the acpi device
+ * Note: A success call will increase reference count by one
+ * Do call put_device(dev) on the returned device then
+ */
+struct device *acpi_get_physical_pci_device(acpi_handle handle)
+{
+ struct device *dev;
+ long device_id;
+ acpi_status status;
+
+ status =
+ acpi_evaluate_integer(handle, "_ADR", NULL, &device_id);
+
+ if (ACPI_FAILURE(status))
+ return NULL;
+
+ /* We need to attempt to determine whether the _ADR refers to a
+ PCI device or not. There's no terribly good way to do this,
+ so the best we can hope for is to assume that there'll never
+ be a device in the host bridge */
+ if (device_id >= 0x10000) {
+ /* It looks like a PCI device. Does it exist? */
+ dev = acpi_get_physical_device(handle);
+ } else {
+ /* It doesn't look like a PCI device. Does its parent
+ exist? */
+ acpi_handle phandle;
+ if (acpi_get_parent(handle, &phandle))
+ return NULL;
+ dev = acpi_get_physical_device(phandle);
+ }
+ if (!dev)
+ return NULL;
+ return dev;
+}
+EXPORT_SYMBOL(acpi_get_physical_pci_device);
+
static int acpi_bind_one(struct device *dev, acpi_handle handle)
{
struct acpi_device *acpi_dev;
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 0da8f55..767d9b9 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -833,11 +833,16 @@ static void acpi_video_bus_find_cap(struct acpi_video_bus *video)
static int acpi_video_bus_check(struct acpi_video_bus *video)
{
acpi_status status = -ENOENT;
-
+ struct device *dev;
if (!video)
return -EINVAL;
+ dev = acpi_get_physical_pci_device(video->device->handle);
+ if (!dev)
+ return -ENODEV;
+ put_device(dev);
+
/* Since there is no HID, CID and so on for VGA driver, we have
* to check well known required nodes.
*/
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index db90a74..d4243a4 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -370,6 +370,8 @@ struct acpi_bus_type {
int register_acpi_bus_type(struct acpi_bus_type *);
int unregister_acpi_bus_type(struct acpi_bus_type *);
struct device *acpi_get_physical_device(acpi_handle);
+struct device *acpi_get_physical_pci_device(acpi_handle);
+
/* helper */
acpi_handle acpi_get_child(acpi_handle, acpi_integer);
acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
--
1.5.4.5
next prev parent reply other threads:[~2008-07-16 10:52 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-16 10:52 Check for ACPI backlight support otherwise use vendor ACPI drivers - version 2 Thomas Renninger
2008-07-16 10:52 ` Thomas Renninger [this message]
2008-07-16 10:52 ` [PATCH 02/11] Check for ACPI backlight support otherwise use vendor ACPI drivers Thomas Renninger
2008-07-16 11:16 ` Matthew Garrett
2008-07-16 13:01 ` Sergio Monteiro Basto
2008-07-17 13:52 ` Thomas Renninger
2008-07-18 3:18 ` Sergio Monteiro Basto
2008-07-18 2:54 ` Thomas Renninger
2008-07-18 3:52 ` Sergio Monteiro Basto
2008-07-17 6:33 ` Zhao Yakui
2008-08-01 1:27 ` Zhang Rui
2008-07-16 10:52 ` [PATCH 03/11] Acer-WMI: fingers off backlight if video.ko is serving this functionality Thomas Renninger
2008-07-16 17:42 ` Carlos Corbacho
2008-07-16 10:52 ` [PATCH 04/11] asus-acpi: " Thomas Renninger
2008-07-16 10:52 ` [PATCH 05/11] eeepc-laptop: " Thomas Renninger
2008-07-16 10:52 ` [PATCH 06/11] fujitsu-laptop: " Thomas Renninger
2008-07-16 23:11 ` Jonathan Woithe
2008-07-18 0:04 ` Jonathan Woithe
2008-07-16 10:52 ` [PATCH 07/11] fujitsu-laptop: Fix section mismatch Thomas Renninger
2008-07-16 10:52 ` [PATCH 08/11] msi-laptop: fingers off backlight if video.ko is serving this functionality Thomas Renninger
2008-07-16 10:52 ` [PATCH 09/11] sony-laptop: " Thomas Renninger
2008-07-16 10:52 ` [PATCH 10/11] thinkpad_acpi: " Thomas Renninger
2008-07-16 11:20 ` Matthew Garrett
2008-07-16 11:36 ` Thomas Renninger
2008-07-16 12:40 ` Henrique de Moraes Holschuh
2008-07-16 12:47 ` Matthew Garrett
2008-07-16 13:38 ` Henrique de Moraes Holschuh
2008-07-16 15:27 ` Thomas Renninger
2008-07-16 15:29 ` Matthew Garrett
2008-07-16 15:49 ` Yves-Alexis Perez
2008-07-17 9:10 ` Andi Kleen
2008-07-17 10:46 ` Matthew Garrett
2008-07-17 11:18 ` Yves-Alexis Perez
2008-07-17 11:25 ` Matthew Garrett
2008-07-16 10:52 ` [PATCH 11/11] compal: " Thomas Renninger
[not found] ` <20080716105931.GC1701@corsac.net>
2008-07-16 11:16 ` Check for ACPI backlight support otherwise use vendor ACPI drivers - version 2 Thomas Renninger
2008-07-19 6:01 ` Yves-Alexis Perez
2008-07-30 6:29 ` Yves-Alexis Perez
2008-07-30 9:06 ` Thomas Renninger
2008-07-31 0:35 ` Jonathan Woithe
2008-07-31 2:28 ` Zhang Rui
2008-07-31 2:51 ` Check for ACPI backlight support otherwise use vendor ACPI Jonathan Woithe
2008-07-31 5:22 ` Zhang Rui
2008-07-31 15:32 ` Check for ACPI backlight support otherwise use vendor ACPI drivers - version 2 nokos
2008-07-31 23:00 ` Check for ACPI backlight support otherwise use vendor ACPI Jonathan Woithe
2008-08-01 1:28 ` Check for ACPI backlight support otherwise use vendor ACPIdrivers - version 2 Zhang Rui
2008-08-01 8:25 ` nokos
2008-08-01 9:29 ` nokos
-- strict thread matches above, loose matches on Subject: below --
2008-07-17 17:32 Check for ACPI backlight support otherwise use vendor ACPI drivers - version 3 Thomas Renninger
2008-07-17 17:32 ` [PATCH 01/11] ACPI: video: Ignore devices that aren't present in hardware Thomas Renninger
2008-07-18 7:48 ` Zhang Rui
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1216205553-8486-2-git-send-email-trenn@suse.de \
--to=trenn@suse.de \
--cc=ak@linux.intel.com \
--cc=carlos@strangeworlds.co.uk \
--cc=corentincj@iksaif.net \
--cc=corsac@debian.org \
--cc=dannybaumann@web.de \
--cc=hmh@hmh.eng.br \
--cc=jwoithe@physics.adelaide.edu.au \
--cc=linux-acpi@vger.kernel.org \
--cc=malattia@linux.it \
--cc=marcus@better.se \
--cc=mjg59@srcf.ucam.org \
--cc=mzxreary@0pointer.de \
--cc=rui.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox