+acpi_video_index_to_level(struct acpi_video_device *device,
+ unsigned long long index)
+{
+ if (device->brightness->flags._BCL_reversed)
+ index = device->brightness->count - 3 - index;
+
+ return device->brightness->levels[index + 2];
+}
What about making this function also take care of the
bqc_offset_aml_bug_workaround? so that this function serves more like a
conversion from raw value to fixed value, the function name can perhaps
be named as: acpi_video_fix_bqc_value, or whatever you think is more
appropriate.
@@ -742,9 +749,7 @@ acpi_video_init_brightness(struct acpi_video_device *device)
}
}
} else {
- if (br->flags._BCL_reversed)
- level_old = (br->count - 1) - level_old;
- level = br->levels[level_old];
+ level = acpi_video_index_to_level(device, level_old);
And here, that new function should be used, which also takes care of the
offset_aml_bug problem(though in theory, the two problems may not happen
on the same BIOS table).
And the acpi_video_device_lcd_get_level_current's param init can
probably be renamed as raw, meaning if raw value is desired or fixed
value, but it's not a big deal.