Re: 4e231fa "ACPI video: ignore buggy _BQC" - causes regression for _BQC_use_index workaround?

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

 



I'm looking at cleaning up the ACPI video driver, and found what looks
like a regression in 2.6.31.  This is all from code inspection; I don't
have the hardware.  I think it will not hurt users, but it should still
be looked at.

The new "ignore buggy _BQC" workaround appears to override the
_BQC_use_index workaround.  This means that on some systems the sysfs
"actual_brightness" attribute will return a cached value, where
previously it would query the hardware for an up-to-date value.

> @@ -618,8 +619,15 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
> 
> 			}
> 			*level += bqc_offset_aml_bug_workaround;
> -			device->brightness->curr = *level;
> -			return 0;
> +			for (i = 2; i < device->brightness->count; i++)
> +				if (device->brightness->levels[i] == *level) {
> +					device->brightness->curr = *level;
> +					return 0;
> +			}
> +			/* BQC returned an invalid level. Stop using it.  */
> +			ACPI_WARNING((AE_INFO, "%s returned an invalid level",
> +						buf));
> +			device->cap._BQC = device->cap._BCQ = 0;


I believe this change will break the detection of _BQC_use_index in
acpi_video_init_brightness():

    /*
     * Set the level to maximum and check if _BQC uses indexed value
     */
    result = acpi_video_device_lcd_set_level(device, max_level);
    if (result)
        goto out_free_levels;

    result = acpi_video_device_lcd_get_level_current(device, &level);
    if (result)
        goto out_free_levels;

    br->flags._BQC_use_index = (level == max_level ? 0 : 1);


If _BQC returns an index, then the value it returns won't be present in
_BCL.   The initial call to get_level_current() will consider the _BQC
value invalid and disable _BQC  - because we haven't had a chance to set
_BQC_use_index yet.

I think the _BQC_use_index detection needs a "raw" version of
get_level_current(), which omits the validity check.  Would you like a
patch?

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