Re: [PATCH] acpi: video: improve quirk check

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

 



On 08/03/2013 07:47 AM, Rafael J. Wysocki wrote:
> On Friday, August 02, 2013 02:37:09 PM Felipe Contreras wrote:
>> If the _BCL package is descending, the first level (br->levels[2]) will
>> be 0, and if the number of levels matches the number of steps, we might
>> confuse a returned level to mean the index.
>>
>> For example:
>>
>>   current_level = max_level = 100
>>   test_level = 0
>>   returned level = 100
>>
>> In this case 100 means the level, not the index, and _BCM failed. But if
>> the _BCL package is descending, the index of level 0 is also 100, so we
>> assume _BQC is indexed, when it's not.
>>
>> This causes all _BQC calls to return bogus values causing weird behavior
>> from the user's perspective. For example: xbacklight -set 10; xbacklight
>> -set 20; would flash to 90% and then slowly down to the desired level
>> (20).
>>
>> The solution is simple; test anything other than the first level (e.g.
>> 1).
>>
>> Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
> 
> Looks reasonable.
> 
> Aaron, what do you think?

Yes, the patch is correct, but I still prefer my own version :-)
https://github.com/aaronlu/linux/commit/0a3d2c5b59caf80ae5bb1ca1fda0f7bf448b38c9

In case you want to take mine and mine needs refresh, please let me know
and I can do the re-base, thanks.

-Aaron

> 
> Rafael
> 
> 
>> ---
>>
>> On top of this we might want to test yet another value, because br->levels[3]
>> might be the current value (although very unlikely).
>>
>>  drivers/acpi/video.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
>> index 0ec434d..e1284b8 100644
>> --- a/drivers/acpi/video.c
>> +++ b/drivers/acpi/video.c
>> @@ -689,7 +689,7 @@ static int acpi_video_bqc_quirk(struct acpi_video_device *device,
>>  	 * Some systems always report current brightness level as maximum
>>  	 * through _BQC, we need to test another value for them.
>>  	 */
>> -	test_level = current_level == max_level ? br->levels[2] : max_level;
>> +	test_level = current_level == max_level ? br->levels[3] : max_level;
>>  
>>  	result = acpi_video_device_lcd_set_level(device, test_level);
>>  	if (result)
>>

--
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