Skip to contentSkip to conversation

Untested proposal patch: Store video capabilities of BIOS globally at ACPI parse time and export it.

PATCH In review Thomas Renninger 3 participants 3 messages Oct 15, 2007 – Oct 17, 2007 1 message not in the archive ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Untested proposal patch: Store video capabilities of BIOS globally at ACPI parse time and export it.

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.

---
 drivers/acpi/scan.c  |   42 ++++++++++++++++++++++++++++++++++++------
 include/linux/acpi.h |    7 +++++++
 2 files changed, 43 insertions(+), 6 deletions(-)
drivers/acpi/scan.c +36 -6
Index: 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;
 }
 
 /*
include/linux/acpi.h +7 -0
Index: 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/

A message that is not in the archive (sent off-list or not yet received): 1192466754.9847.594.camel-X8wR35IVlAxolqkO4TVVkw@public.gmane.org

#2 lore raw

drivers/acpi/scan.c static void acpi_device_get_busid(struct · line 887

Quoted 4 lines · Thomas Renninger
drivers/acpi/scan.c +4 -0
+	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.

Review

Quoted 1 line
(quoted diff) +1 -0
+	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)

Signature · 7 lines
Matthew Garrett | [email protected]

-------------------------------------------------------------------------
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/
#3 lore raw
In reply to Thomas Renninger
Quoted 17 lines · Thomas Renninger

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:

drivers/acpi/scan.c acpi_video_bus_match(struct acpi_device · line 932

Quoted 2 lines
drivers/acpi/scan.c +2 -0
+	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