rpms/kernel/F-7 linux-2.6-acpi-video-backlight-rationalize.patch, NONE, 1.1 linux-2.6-acpi-video-brightness-bigger-buffer.patch, NONE, 1.1 linux-2.6-acpi-video-fix-multiple-busses.patch, NONE, 1.1 kernel-2.6.spec, 1.3425, 1.3426

Chuck Ebbert (cebbert) fedora-extras-commits at redhat.com
Wed Feb 6 00:52:38 UTC 2008


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12317

Modified Files:
	kernel-2.6.spec 
Added Files:
	linux-2.6-acpi-video-backlight-rationalize.patch 
	linux-2.6-acpi-video-brightness-bigger-buffer.patch 
	linux-2.6-acpi-video-fix-multiple-busses.patch 
Log Message:
* Tue Feb 05 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.23.14-75
- ACPI: fix multiple problems with brightness controls (F8#427518)


linux-2.6-acpi-video-backlight-rationalize.patch:

--- NEW FILE linux-2.6-acpi-video-backlight-rationalize.patch ---
From: Matthew Garrett <mjg59 at srcf.ucam.org>
Date: Wed, 26 Dec 2007 02:03:26 +0000 (+0000)
Subject: ACPI: video: Rationalise ACPI backlight implementation
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Flenb%2Flinux-acpi-2.6.git;a=commitdiff_plain;h=38531e6fe51ad5c7dfe72e0e066b5f54bc1921cd

ACPI: video: Rationalise ACPI backlight implementation

The sysfs backlight class provides no mechanism for querying the
acceptable brightness for a backlight. The ACPI spec states that values
are only valid if they are reported as available by the firmware. Since
we can't provide that information to userspace, instead collapse the
range to the number of actual values that can be set.

http://bugzilla.kernel.org/show_bug.cgi?id=9277

Signed-off-by: Matthew Garrett <mjg59 at srcf.ucam.org>
Acked-by: Zhang Rui <rui.zhang at intel.com>
Signed-off-by: Len Brown <len.brown at intel.com>
---

diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index bd77e81..59639c9 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -292,18 +292,26 @@ static int acpi_video_device_set_state(struct acpi_video_device *device, int sta
 static int acpi_video_get_brightness(struct backlight_device *bd)
 {
 	unsigned long cur_level;
+	int i;
 	struct acpi_video_device *vd =
 		(struct acpi_video_device *)bl_get_data(bd);
 	acpi_video_device_lcd_get_level_current(vd, &cur_level);
-	return (int) cur_level;
+	for (i = 2; i < vd->brightness->count; i++) {
+		if (vd->brightness->levels[i] == cur_level)
+			/* The first two entries are special - see page 575
+			   of the ACPI spec 3.0 */
+			return i-2;
+	}
+	return 0;
 }
 
 static int acpi_video_set_brightness(struct backlight_device *bd)
 {
-	int request_level = bd->props.brightness;
+	int request_level = bd->props.brightness+2;
 	struct acpi_video_device *vd =
 		(struct acpi_video_device *)bl_get_data(bd);
-	acpi_video_device_lcd_set_level(vd, request_level);
+	acpi_video_device_lcd_set_level(vd,
+					vd->brightness->levels[request_level]);
 	return 0;
 }
 
@@ -652,7 +660,6 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
 	kfree(obj);
 
 	if (device->cap._BCL && device->cap._BCM && device->cap._BQC && max_level > 0){
-		unsigned long tmp;
 		static int count = 0;
 		char *name;
 		name = kzalloc(MAX_NAME_LEN, GFP_KERNEL);
@@ -660,11 +667,10 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
 			return;
 
 		sprintf(name, "acpi_video%d", count++);
-		acpi_video_device_lcd_get_level_current(device, &tmp);
 		device->backlight = backlight_device_register(name,
 			NULL, device, &acpi_backlight_ops);
-		device->backlight->props.max_brightness = max_level;
-		device->backlight->props.brightness = (int)tmp;
+		device->backlight->props.max_brightness = device->brightness->count-3;
+		device->backlight->props.brightness = acpi_video_get_brightness(device->backlight);
 		backlight_update_status(device->backlight);
 
 		kfree(name);

linux-2.6-acpi-video-brightness-bigger-buffer.patch:

--- NEW FILE linux-2.6-acpi-video-brightness-bigger-buffer.patch ---
From: Danny Baumann <dannybaumann at web.de>
Date: Fri, 2 Nov 2007 12:47:53 +0000 (+0100)
Subject: ACPI: Video: Increase buffer size for writes to brightness proc file.
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Flenb%2Flinux-acpi-2.6.git;a=commitdiff_plain;h=c88c5786d3df51ccfa4e2d111fc9c8fc0f5b2797

ACPI: Video: Increase buffer size for writes to brightness proc file.

In order to be able to write the value "100"
to /proc/acpi/video/.../brightness, we have to allocate 5 bytes:
4 characters will be written (1, 0, 0 plus null byte),
and 1 byte should be buffer for a terminating NULL character.

http://bugzilla.kernel.org/show_bug.cgi?id=9278

Signed-off-by: Danny Baumann <dannybaumann at web.de>
Acked-by: Zhang Rui <rui.zhang at intel.com>
Signed-off-by: Len Brown <len.brown at intel.com>
---

diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index dce0a6e..44a0d9b 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -897,7 +897,7 @@ acpi_video_device_write_brightness(struct file *file,
 {
 	struct seq_file *m = file->private_data;
 	struct acpi_video_device *dev = m->private;
-	char str[4] = { 0 };
+	char str[5] = { 0 };
 	unsigned int level = 0;
 	int i;
 

linux-2.6-acpi-video-fix-multiple-busses.patch:

--- NEW FILE linux-2.6-acpi-video-fix-multiple-busses.patch ---
From: Len Brown <len.brown at intel.com>
Date: Sat, 2 Feb 2008 08:28:33 +0000 (-0500)
Subject: Pull bugzilla-9614 into test branch
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Flenb%2Flinux-acpi-2.6.git;a=commitdiff_plain;h=d5fec17bc3380568948d17d66a62394fd6b84952

Pull bugzilla-9614 into test branch
---

diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 59639c9..a54ff6b 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -1262,8 +1262,37 @@ acpi_video_bus_write_DOS(struct file *file,
 
 static int acpi_video_bus_add_fs(struct acpi_device *device)
 {
+	long device_id;
+	int status;
 	struct proc_dir_entry *entry = NULL;
 	struct acpi_video_bus *video;
+	struct device *dev;
+
+	status =
+	    acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
+
+	if (!ACPI_SUCCESS(status))
+		return -ENODEV;
+
+	/* 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 video device in the host bridge */
+	if (device_id >= 0x10000) {
+		/* It looks like a PCI device. Does it exist? */
+		dev = acpi_get_physical_device(device->handle);
+	} else {
+		/* It doesn't look like a PCI device. Does its parent
+		   exist? */
+		acpi_handle phandle;
+		if (acpi_get_parent(device->handle, &phandle))
+			return -ENODEV;
+		dev = acpi_get_physical_device(phandle);
+	}
+	if (!dev)
+		return -ENODEV;
+	put_device(dev);
+
 
 
 	video = acpi_driver_data(device);


Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-7/kernel-2.6.spec,v
retrieving revision 1.3425
retrieving revision 1.3426
diff -u -r1.3425 -r1.3426
--- kernel-2.6.spec	6 Feb 2008 00:03:52 -0000	1.3425
+++ kernel-2.6.spec	6 Feb 2008 00:51:49 -0000	1.3426
@@ -636,6 +636,9 @@
 Patch750: linux-2.6-firewire-git-update.patch
 
 Patch760: linux-2.6-acpi-button-send-initial-state.patch
+Patch761: linux-2.6-acpi-video-backlight-rationalize.patch
+Patch762: linux-2.6-acpi-video-brightness-bigger-buffer.patch
+Patch763: linux-2.6-acpi-video-fix-multiple-busses.patch
 
 Patch780: linux-2.6-usb-storage-initialize-huawei-e220-properly.patch
 Patch781: linux-2.6-usb-autosuspend-default-disable.patch
@@ -1371,6 +1374,10 @@
 # ACPI patches
 # suspend/resume fixes
 ApplyPatch linux-2.6-acpi-button-send-initial-state.patch
+# fix multiple ACPI brightness problems (F8#427518)
+ApplyPatch linux-2.6-acpi-video-backlight-rationalize.patch
+ApplyPatch linux-2.6-acpi-video-brightness-bigger-buffer.patch
+ApplyPatch linux-2.6-acpi-video-fix-multiple-busses.patch
 
 # Fix excessive wakeups
 # Make hdaps timer only tick when in use.
@@ -2322,6 +2329,9 @@
 %endif
 
 %changelog
+* Tue Feb 05 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.23.14-75
+- ACPI: fix multiple problems with brightness controls (F8#427518)
+
 * Tue Feb 05 2008 Jarod Wilson <jwilson at redhat.com> 2.6.23.14-74
 - FireWire updates from linux1394-git tree, should resolve a
   bunch of FireWire disk issues for people




More information about the fedora-extras-commits mailing list