[PATCH] ACPI: video: don't call absent methods

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

 



Ryan May wrote:
> Ryan May wrote:
>> Hi,
>>
>> I recently updated the BIOS on my HP Pavilion dv2125nr laptop to F.34
>> (to enable the virtualization instructions).  Since I did this, the Fn
>> keys to control brightness have failed to work properly under Linux,
>> though they work fine before booting (ie. at Grub).  Hitting the Fn keys
>> caused the brightness to change to the minimum possible.  In fact,
>> /proc/acpi/video/VGA/LCD/brightness would show that the level was set to
>> 0 (though 20 was the lowest available).  I was still able to control the
>> brightness manually via /proc interface however.
>>
>> My investigations seem to indicate that HP, in their wisdom, seem to
>> have removed the _BQC method from their BIOS code.  It seems that the
>> ACPI code in Linux that handles the key events to change the brightness
>> use the _BQC method without checking for success, which explains why the
>> level being set was garbage.  However, the /proc interface for
>> brightness seems to only use device->brightness->curr to get the current
>> level.
>>
>> The attached patch, which I'm sure isn't correct, fixes my problems by
>> making use of the brightness->curr field to track the current brightness.
>>
>> I'd love to know your opinion(s) on the problem and a proper fix
>> (including perhaps sysfs backlight support?).
>>
>> Thanks,
>>
>> Ryan
>>
>>
> 
> Just a bump here to see if anyone can help me get my (admittedly) broken
> HP backlight working in a stock kernel.  I have a patch (attached) that
> fixes my problem, though I am by no means a kernel hacker.
> 
> Any help would be greatly appreciated.
> 
> Thanks,
> 
> Ryan
Video.c has flags showing presence or absence of _BQC, etc. Updated your patch to use these.
Also, patch conforms (mostly) to patch guidelines :)
Regards,
Alex.




[PATCH] ACPI: video: Don't call absent methods

From: Alexey Starikovskiy <astarikovskiy@xxxxxxx>

Signed-off-by: Ryan May <rmay.ou.edu>
Signed-off-by: Alexey Starikovskiy <astarikovskiy@xxxxxxx>
---

 drivers/acpi/video.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 3c9bb85..83aa41c 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -409,14 +409,16 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
 static int
 acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
 {
-	int status;
+	int status = AE_OK;
 	union acpi_object arg0 = { ACPI_TYPE_INTEGER };
 	struct acpi_object_list args = { 1, &arg0 };
 
 
 	arg0.integer.value = level;
-	status = acpi_evaluate_object(device->dev->handle, "_BCM", &args, NULL);
-
+	if (device->cap._BCM)
+		status = acpi_evaluate_object(device->dev->handle, "_BCM",
+					      &args, NULL);
+	device->brightness->curr = level;
 	printk(KERN_DEBUG "set_level status: %x\n", status);
 	return status;
 }
@@ -425,11 +427,11 @@ static int
 acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
 					unsigned long *level)
 {
-	int status;
-
-	status = acpi_evaluate_integer(device->dev->handle, "_BQC", NULL, level);
-
-	return status;
+	if (device->cap._BQC)
+		return acpi_evaluate_integer(device->dev->handle, "_BQC", NULL,
+					     level);
+	*level = device->brightness->curr;
+	return AE_OK;
 }
 
 static int

[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