backlight: Expose brightness curve type through sysfs
authorMatthias Kaehlcke <mka@chromium.org>
Tue, 9 Jul 2019 19:00:05 +0000 (12:00 -0700)
committerLee Jones <lee.jones@linaro.org>
Mon, 2 Sep 2019 14:55:03 +0000 (15:55 +0100)
commitd55c028f8b25bdaaba9ae08026052b5b44d031b0
tree91c60f22e13ce2ab7eff27f81428e46f52728669
parent6451e123dec34e295cb0affcd48f671275bdb671
backlight: Expose brightness curve type through sysfs

Backlight brightness curves can have different shapes. The two main
types are linear and non-linear curves. The human eye doesn't
perceive linearly increasing/decreasing brightness as linear (see
also 88ba95bedb79 "backlight: pwm_bl: Compute brightness of LED
linearly to human eye"), hence many backlights use non-linear (often
logarithmic) brightness curves. The type of curve currently is opaque
to userspace, so userspace often uses more or less reliable heuristics
(like the number of brightness levels) to decide whether to treat a
backlight device as linear or non-linear.

Export the type of the brightness curve via the new sysfs attribute
'scale'. The value of the attribute can be 'linear', 'non-linear' or
'unknown'. For devices that don't provide information about the scale
of their brightness curve the value of the 'scale' attribute is 'unknown'.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Documentation/ABI/testing/sysfs-class-backlight [new file with mode: 0644]
MAINTAINERS
drivers/video/backlight/backlight.c
include/linux/backlight.h