STRUCT BACKLIGHT_OPS(9)
π struct backlight_ops(9) π
okay so bestie, welcome to the Kernel API Manual β this page is literally all about struct backlight_ops, aka the backlight operations bundle. think of it as the little instruction card your backlight driver hands to the kernel so it knows what it's allowed to do π
β¨ SYNOPSIS β¨
struct backlight_ops {
unsigned int options;
#define BL_CORE_SUSPENDRESUME (1 << 0);
int (*update_status)(struct backlight_device *);
int (*get_brightness)(struct backlight_device *);
bool (*controls_device)(struct backlight_device *bd, struct device
*display_dev);
};
like, that's the whole vibe right there π four things: an options field, a magic #define, and three function pointers. no cap.
πΈ Members πΈ
β options
this one configures how the operations get called from the core β it's the settings knob, basically ποΈ
the options parameter is what you use to adjust the behaviour of the core. set BL_CORE_SUSPENDRESUME if you want the update_status operation to get called on suspend and resume. that's the whole point of that flag, fr fr π
β update_status
Operation called when properties have changed.
this is the one that fires off and tells the backlight driver "hey bestie, some property changed" π£ the update_status operation is protected by the update_lock β so yeah, there's a lock guarding it, respect the lock π
your backlight driver is expected to use backlight_is_blank to check whether the display is blanked, and then set the brightness accordingly. update_status gets called whenever any of the properties has changed. literally any of them. π
RETURNS:
0 on success, or a negative error code if any failure occurred. that's it, that's the deal π
β get_brightness
Return the current backlight brightness.
the driver may implement this as a readback from the HW β like, actually going and asking the hardware what's up π¦ this operation is optional, and if it's not present then the current brightness property value is used instead. so you're not doomed if you skip it β¨
RETURNS:
a brightness value which is 0 or a positive number. on failure, a negative error code comes back at you π
β controls_device
Check against the display device
this checks if the backlight controls the given display device π₯οΈ this operation is optional too, and if it's not implemented, it's just assumed that the display is always the one controlled by the backlight. lowkey a chill default ngl.
RETURNS:
if display_dev is NULL, or if display_dev matches the device controlled by the backlight, return true. otherwise return false. simple as that π
π¦ Description π¦
the backlight operations are specified when the backlight device is registered. that's when you hand over the whole card, okay? periodt. π
π SEE ALSO π
- Kernel file
./include/linux/backlight.h enum backlight_update_reason(9)enum backlight_type(9)struct backlight_properties(9)struct backlight_device(9)backlight_update_status(9)backlight_enable(9)backlight_disable(9)backlight_is_blank(9)backlight_get_brightness(9)bl_get_data(9)
and that's the page!! π«Ά this one lives over in ./include/linux and it's dated October 2026 β go read the whole backlight saga, it's iconic, iykyk πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms