History

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

Matthias Kaehlcke committed 7 years ago

Commit d55c0281 parent 6451e124 files · +54 −0Browse files

Showing the changes to include/linux (1 of 4 files). Show all

Unified · Split

include/linux/backlight.h+8−0
@@ -46,6 +46,12 @@ enum backlight_notification { · 45 unmodified lines
4646 BACKLIGHT_UNREGISTERED,
4747 };
4848
49+enum backlight_scale {
50+ BACKLIGHT_SCALE_UNKNOWN = 0,
51+ BACKLIGHT_SCALE_LINEAR,
52+ BACKLIGHT_SCALE_NON_LINEAR,
53+};
54+
4955 struct backlight_device;
5056 struct fb_info;
5157
@@ -80,6 +86,8 @@ struct backlight_properties { · 28 unmodified lines
8086 enum backlight_type type;
8187 /* Flags used to signal drivers of state changes */
8288 unsigned int state;
89+ /* Type of the brightness scale (linear, non-linear, ...) */
90+ enum backlight_scale scale;
8391
8492 #define BL_CORE_SUSPENDED (1 << 0) /* backlight is suspended */
8593 #define BL_CORE_FBBLANK (1 << 1) /* backlight is under an fb blank event */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t