STRUCT BACKLIGHT_OPS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 🌈


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