Re: [PATCH 1/2] video: always update the brightness when poking "brightness"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2008-12-31 at 10:01 +0800, Matthew Garrett wrote:
> On Wed, Dec 31, 2008 at 09:43:01AM +0800, Zhang Rui wrote:
> 
> > then how about this case:
> > 1. set the brightness level to 5 via sysfs I/F
> > 2. set the backlight to another level via HOTKEYS.
> > 3. setting it back to 5 doesn't work because bd->props.brightness
> > is still 5.
> 
> If they're using the ACPI interface then video.c should update 
> props.brightness itself.
> 
> > IMO, the real problem is that bd->props.brightness doesn't reflect the
> > actual brightness.
> 
> If you want the actual brightness, why aren't you reading 
> actual_brightness?
> 
right, that's the problem.
because IMO, we don't need the actual_brightness any more. :)
And if you agree that bd->props.brightness doesn't reflect the actual
brightness, we can see that
                        if (bd->props.brightness != brightness) {
                                bd->props.brightness = brightness;
                                backlight_update_status(bd);
                        }
doesn't make sense because "bd->props.brightness != brightness" doesn't
mean anything.

But if bd->props.brightness does reflect the actual brightness, then do
we need "actual_brightness" any more?


> If they're using the ACPI interface then video.c should update 
> props.brightness itself.
that also makes sense, patch attached.
But anyway, we still need some changes in the video backlight class.
right?

From: Zhang Rui <rui.zhang@xxxxxxxxx>
Subject: always update props.brightness when brightness is changed

always update pros.brightness no matter the backlight is changed
via procfs, hotkeys or sysfs.

Sighed-off-by: Zhang Rui <rui.zhang@xxxxxxxxx>
---
 drivers/acpi/video.c |    5 +++++
 1 file changed, 5 insertions(+)

Index: linux-2.6/drivers/acpi/video.c
===================================================================
--- linux-2.6.orig/drivers/acpi/video.c
+++ linux-2.6/drivers/acpi/video.c
@@ -481,6 +481,7 @@ acpi_video_device_lcd_set_level(struct a
 	int status = AE_OK;
 	union acpi_object arg0 = { ACPI_TYPE_INTEGER };
 	struct acpi_object_list args = { 1, &arg0 };
+	int state;
 
 
 	arg0.integer.value = level;
@@ -489,6 +490,10 @@ acpi_video_device_lcd_set_level(struct a
 		status = acpi_evaluate_object(device->dev->handle, "_BCM",
 					      &args, NULL);
 	device->brightness->curr = level;
+	for (state = 2; state < device->brightness->count; state++)
+		if (level == device->brightness->levels[state])
+			device->backlight->props.brightness = state - 2;
+
 	return status;
 }
 


--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux