Skip to contentSkip to conversation

backlight and output sysfs support for acpi video driver

PATCH In review Yu Luming 2 participants 2 messages Nov 2, 2006

Subsystems (2)
lore
Share & tools
lore

Yu Luming

author
#0 lore raw

PATCH 3/6 backlight and output sysfs support for acpi video driver

backlight and output sysfs support for acpi video driver

signed-off-by [email protected]

[patch 3/6] backlight and output sysfs support for acpi video driver --

 acpi/Kconfig   |    2
 acpi/video.c   |  257 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
 video/Kconfig  |    9 +
 video/Makefile |    1
 4 files changed, 253 insertions(+), 16 deletions(-)
drivers/acpi/Kconfig +1 -1
index 0f9d4be..a7671f7 100644
@@ -106,7 +106,7 @@ config ACPI_BUTTON
 
 config ACPI_VIDEO
 	tristate "Video"
-	depends on X86
+	depends on X86 && (BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL)
 	help
 	  This driver implement the ACPI Extensions For Display Adapters
 	  for integrated graphics devices on motherboard, as specified in
drivers/acpi/video.c +242 -15

406 lines not on this page · raw message

drivers/video/Kconfig +9 -0
index 7a43020..effcb23 100644
@@ -1644,5 +1644,14 @@ if SYSFS
 	source "drivers/video/backlight/Kconfig"
 endif
 
+
+config VIDEO_OUTPUT_CONTROL
+	tristate "Video Output Switcher control"
+	depends on SYSFS
+	---help---
+	  The output sysfs class driver is to provide video output abstract
+	  layer that can be used to hook platform specific driver methods
+	  to enable/disable display output device through common sysfs
+	  interface.	  
 endmenu
 
drivers/video/Makefile +1 -0
index a6980e9..0f82eed 100644
@@ -108,3 +108,4 @@ obj-$(CONFIG_FB_OF)               += off
 
 # the test framebuffer is last
 obj-$(CONFIG_FB_VIRTUAL)          += vfb.o
+obj-$(CONFIG_VIDEO_OUTPUT_CONTROL) += output.o
#1 lore raw

Hi!

Quoted 1 line

backlight and output sysfs support for acpi video driver

Yes, using generic interfaces is always nice...

drivers/acpi/video.c acpi_video_bus_DOS(struct acpi_video_bus · line 544

Quoted 10 lines
drivers/acpi/video.c +6 -0
@@ -482,6 +536,134 @@ acpi_video_bus_DOS(struct acpi_video_bus
 	return status;
 }
 
+
+/*
+ * copy & paste some code for acpi_pci_data, acpi_pci_data_handler,acpi_pci_data
+ * from pci_bind.c
+ * To-do: write a new API: acpi_pci_get.
+ */

This comment only(?) serves to confuse me...

drivers/acpi/video.c acpi_video_bus_DOS(struct acpi_video_bus · line 580

Quoted 4 lines
drivers/acpi/video.c +4 -0
+	pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
+	if (!pathname)
+		return -ENOMEM;
+	memset(pathname, 0, ACPI_PATHNAME_MAX);

kzalloc()? (More than once in this file).

Quoted 19 lines
drivers/acpi/video.c +19 -0
+	buffer.length = ACPI_PATHNAME_MAX;
+	buffer.pointer = pathname;
+
+	data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
+	if (!data) {
+		kfree(pathname);
+		return NULL;
+	}
+	memset(data, 0, sizeof(struct acpi_pci_data));
+
+	acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
+	printk(KERN_INFO PREFIX "finding PCI device [%s]...\n", pathname);
+
+	/*
+	 * Segment & Bus
+	 * -------------
+	 * These are obtained via the parent device's ACPI-PCI context.
+	 */
+go_up:

drivers/acpi/video.c acpi_video_bus_DOS(struct acpi_video_bus · line 609

Quoted 10 lines
drivers/acpi/video.c +10 -0
+	status = acpi_get_data(device->parent->handle, acpi_pci_data_handler,
+			       (void **)&pdata);
+	if (ACPI_FAILURE(status) || !pdata || !pdata->bus) {
+		struct acpi_device *tmp_dev;
+
+		tmp_dev = device->parent;
+		if (tmp_dev->parent && (tmp_dev->parent->handle != ACPI_ROOT_OBJECT)) {
+			device = tmp_dev;
+			goto go_up;
+		}

Could we use plain old loop here?

drivers/acpi/video.c acpi_video_bus_DOS(struct acpi_video_bus · line 657

Quoted 2 lines
drivers/acpi/video.c +2 -0
+	printk(KERN_INFO PREFIX "data->dev =%p", &data->dev);
+	printk(KERN_INFO PREFIX "data->dev->dev =%p\n", &data->dev->dev);

I doubt this is useful info for non-debugging. dprintk?

drivers/acpi/video.c static void acpi_video_device_find_cap(s · line 690

Quoted 4 lines
drivers/acpi/video.c +2 -0
+	data = acpi_pci_get (device->video->device);
+        if (!data || !(data->dev)) {

tabs vs. spaces... more than once in this file.

drivers/acpi/video.c static void acpi_video_device_find_cap(s · line 692

Quoted 2 lines
drivers/acpi/video.c +2 -0
+		printk(KERN_ERR PREFIX "acpi_video_device:no valid data from acpi_pci_get\n");
+		return ;

return; looks more natural.

drivers/acpi/video.c static int acpi_video_bus_add(struct acp · line 1918

Quoted 8 lines
drivers/acpi/video.c +2 -1
@@ -1691,8 +1913,9 @@ static int acpi_video_bus_add(struct acp
 	int result = 0;
 	acpi_status status = 0;
 	struct acpi_video_bus *video = NULL;
+        char proc_dir_name[32];
 
-
+	memset(proc_dir_name, 0, 32);

What about '= { 0, };', instead?

Pavel

Signature · 1 line
Thanks for all the (sleeping) penguins.