public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Untested proposal patch: Store video capabilities of BIOS globally at ACPI parse time and export it.
@ 2007-10-15 16:45 Thomas Renninger
       [not found] ` <1192466754.9847.594.camel-X8wR35IVlAxolqkO4TVVkw@public.gmane.org>
  2007-10-17 14:35 ` Thomas Renninger
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Renninger @ 2007-10-15 16:45 UTC (permalink / raw)
  To: linux-acpi; +Cc: ibm-acpi-devel, Matthew Garrett

Store video capabilities of BIOS globally at ACPI parse time and export it.

This is for vendor specific vs video driver so that they can distinguish who
should take care of video/brightness control.
The bits are chosen in a way that video can handle the ability gracefully
if all the checked functions are there...

Vendor specific modules must check on that bits and take their hands off
brightness/video control when set, as they are then served by the video
driver.

This hasn't been tested yet. It's more a proposal whether this is the way
to go...
Would be great if someone could give it a test if accepted, I will test
this also as soon as some positive feedback is popping up.

Signed-off-by: Thomas Renninger <trenn-l3A5Bk7waGM@public.gmane.org>

---
 drivers/acpi/scan.c  |   42 ++++++++++++++++++++++++++++++++++++------
 include/linux/acpi.h |    7 +++++++
 2 files changed, 43 insertions(+), 6 deletions(-)

Index: lenb/drivers/acpi/scan.c
===================================================================
--- lenb.orig/drivers/acpi/scan.c
+++ lenb/drivers/acpi/scan.c
@@ -870,6 +870,25 @@ static void acpi_device_get_busid(struct
 	}
 }
 
+u8 acpi_video_support;
+EXPORT_SYMBOL(acpi_video_support);
+
+static acpi_status
+acpi_brighntess_cap_match(acpi_handle handle, u32 level, void *context,
+			  void **return_value)
+{
+	acpi_handle h_dummy1;
+	acpi_handle h_dummy2;
+	acpi_handle h_dummy3;
+
+	if (ACPI_SUCCESS(acpi_get_handle(handle, "_BCM", &h_dummy1)) &&
+	    ACPI_SUCCESS(acpi_get_handle(handle, "_BCL", &h_dummy2)) &&
+	    ACPI_SUCCESS(acpi_get_handle(handle, "_BQC", &h_dummy3)))
+		acpi_video_support |= ACPI_VIDEO_BRIGHTNESS;
+
+	return 0;
+}
+
 static int
 acpi_video_bus_match(struct acpi_device *device)
 {
@@ -887,20 +906,31 @@ acpi_video_bus_match(struct acpi_device 
 
 	/* Does this device able to support video switching ? */
 	if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy1)) &&
-	    ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy2)))
-		return 0;
+	    ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy2))) {
+		acpi_video_support |= ACPI_VIDEO_OUTPUT_SWITCHING;
+		goto success;
+	}
 
 	/* Does this device able to retrieve a video ROM ? */
-	if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy1)))
-		return 0;
+	if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy1))) {
+		acpi_video_support |= ACPI_VIDEO_ROM_AVAILABLE;
+		goto success;
+	}
 
 	/* Does this device able to configure which video head to be POSTed ? */
 	if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy1)) &&
 	    ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy2)) &&
-	    ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3)))
-		return 0;
+	    ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3))) {
+		acpi_video_support |= ACPI_VIDEO_DEVICE_POSTING;
+		goto success;
+	}
 
 	return -ENODEV;
+
+ success:
+	acpi_walk_namespace(ACPI_TYPE_METHOD, device->handle, ACPI_UINT32_MAX,
+			    acpi_brighntess_cap_match, NULL, NULL);
+	return 0;
 }
 
 /*
Index: lenb/include/linux/acpi.h
===================================================================
--- lenb.orig/include/linux/acpi.h
+++ lenb/include/linux/acpi.h
@@ -184,6 +184,13 @@ struct acpi_pci_driver {
 int acpi_pci_register_driver(struct acpi_pci_driver *driver);
 void acpi_pci_unregister_driver(struct acpi_pci_driver *driver);
 
+/* video/brightness support */
+#define ACPI_VIDEO_OUTPUT_SWITCHING	1
+#define ACPI_VIDEO_DEVICE_POSTING	2
+#define ACPI_VIDEO_ROM_AVAILABLE	4
+#define ACPI_VIDEO_BRIGHTNESS		8
+extern u8 acpi_video_support;
+
 #endif /* CONFIG_ACPI */
 
 #ifdef CONFIG_ACPI_EC



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Untested proposal patch: Store video capabilities of BIOS globally at ACPI parse time and export it.
       [not found] ` <1192466754.9847.594.camel-X8wR35IVlAxolqkO4TVVkw@public.gmane.org>
@ 2007-10-15 16:52   ` Matthew Garrett
  0 siblings, 0 replies; 3+ messages in thread
From: Matthew Garrett @ 2007-10-15 16:52 UTC (permalink / raw)
  To: Thomas Renninger; +Cc: linux-acpi, ibm-acpi-devel

On Mon, Oct 15, 2007 at 06:45:53PM +0200, Thomas Renninger wrote:
> +	if (ACPI_SUCCESS(acpi_get_handle(handle, "_BCM", &h_dummy1)) &&
> +	    ACPI_SUCCESS(acpi_get_handle(handle, "_BCL", &h_dummy2)) &&
> +	    ACPI_SUCCESS(acpi_get_handle(handle, "_BQC", &h_dummy3)))
> +		acpi_video_support |= ACPI_VIDEO_BRIGHTNESS;

Probably want to check for _BCQ as an alternative to _BQC as well.

> +	return 0;

Why return int if you always return 0? Other than that, it looks 
reasonable (and saves us having copy and pasted code in all of the 
hardware-specific drivers)

-- 
Matthew Garrett | mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Untested proposal patch: Store video capabilities of BIOS globally at ACPI parse time and export it.
  2007-10-15 16:45 [PATCH] Untested proposal patch: Store video capabilities of BIOS globally at ACPI parse time and export it Thomas Renninger
       [not found] ` <1192466754.9847.594.camel-X8wR35IVlAxolqkO4TVVkw@public.gmane.org>
@ 2007-10-17 14:35 ` Thomas Renninger
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Renninger @ 2007-10-17 14:35 UTC (permalink / raw)
  To: linux-acpi; +Cc: ibm-acpi-devel, Matthew Garrett, Len Brown

On Mon, 2007-10-15 at 18:45 +0200, Thomas Renninger wrote:
> Store video capabilities of BIOS globally at ACPI parse time and export it.
> 
> This is for vendor specific vs video driver so that they can distinguish who
> should take care of video/brightness control.
> The bits are chosen in a way that video can handle the ability gracefully
> if all the checked functions are there...
> 
> Vendor specific modules must check on that bits and take their hands off
> brightness/video control when set, as they are then served by the video
> driver.
> 
> This hasn't been tested yet. It's more a proposal whether this is the way
> to go...
> Would be great if someone could give it a test if accepted, I will test
> this also as soon as some positive feedback is popping up.
> 
> + success:
> +	acpi_walk_namespace(ACPI_TYPE_METHOD, device->handle, ACPI_UINT32_MAX,
> +			    acpi_brighntess_cap_match, NULL, NULL);
This has been tested now and and it works fine if ACPI_TYPE_METHOD is
replaced with ACPI_TYPE_DEVICE.
Oh, Len was not in CC on the original post..:
Please tell me if you like to take it and if, whether you replace this
METHOD <-> DEVICE manually or if you like to have it reposted.

Thanks,

   Thomas


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-10-17 14:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-15 16:45 [PATCH] Untested proposal patch: Store video capabilities of BIOS globally at ACPI parse time and export it Thomas Renninger
     [not found] ` <1192466754.9847.594.camel-X8wR35IVlAxolqkO4TVVkw@public.gmane.org>
2007-10-15 16:52   ` Matthew Garrett
2007-10-17 14:35 ` Thomas Renninger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox