STRUCT DRM_PANEL_FUNCS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct drm_panel_funcs(9) β€” the Kernel API Manual, but make it make sense

okay so bestie, this is your whole cheat sheet for struct drm_panel_funcs β€” it's the ops struct for "perform operations on a given panel" ✨ From the Kernel API Manual, no cap. Scroll responsibly. 🫢


✨ SYNOPSIS ✨

Here's the whole vibe, exactly as written β€” every member, every signature, don't @ me:

struct drm_panel_funcs {
    int (*prepare)(struct drm_panel *panel);
    int (*enable)(struct drm_panel *panel);
    int (*disable)(struct drm_panel *panel);
    int (*unprepare)(struct drm_panel *panel);
    int (*get_modes)(struct drm_panel *panel, struct drm_connector
*connector);
    enum drm_panel_orientation (*get_orientation)(struct drm_panel
*panel);
    int (*get_timings)(struct drm_panel *panel, unsigned int
num_timings, struct display_timing *timings);
    void (*debugfs_init)(struct drm_panel *panel, struct dentry *root);
 };

πŸŽ€ Members πŸŽ€

These are the individual little guys. Let's do a vibe check on each one, one at a time, no skipping. πŸ‘‘

  • prepare β€” Turn on panel and perform set up.

This function is optional. 🌸

  • enable β€” Enable panel (turn on back light, etc.).

This function is optional. 🌸

  • disable β€” Disable panel (turn off back light, etc.).

This function is optional. 🌸

  • unprepare β€” Turn off panel.

This function is optional. 🌸

  • get_modes β€” Add modes to the connector that the panel is attached to and returns the number of modes added.

This function is mandatory. πŸ”₯ Not optional, bestie. Like, you have to implement this one.

  • get_orientation β€” Return the panel orientation set by device tree or EDID.

This function is optional. 🌸

  • get_timings β€” Copy display timings into the provided array and return the number of display timings available.

This function is optional. 🌸

  • debugfs_init β€” Allows panels to create panels-specific debugfs files.

(yes, it really says "panels-specific" β€” I'm just the messenger πŸ™ˆ)


🌈 Description 🌈

okay bestie here's the actual story time, because the ordering here is literally the whole point and it's giving choreography πŸ’ƒ

The .prepare function is typically called before the display controller starts to transmit video data. Panel drivers can use this to turn the panel on and wait for it to become ready. If additional configuration is required (via a control bus such as I2C, SPI or DSI for example) this is a good time to do that. ✨

After the display controller has started transmitting video data, it's safe to call the .enable function. This will typically enable the backlight to make the image on screen visible. Some panels require a certain amount of time or frames before the image is displayed. This function is responsible for taking this into account before enabling the backlight to avoid visual glitches. 😭 (the glitches are the villain, the waiting is the hero)

Before stopping video transmission from the display controller it can be necessary to turn off the panel to avoid visual glitches. This is done in the .disable function. Analogously to .enable this typically involves turning off the backlight and waiting for some time to make sure no image is visible on the panel. It is then safe for the display controller to cease transmission of video data. πŸ¦‹

To save power when no video data is transmitted, a driver can power down the panel. This is the job of the .unprepare function. πŸ”‹

Backlight can be handled automatically if configured using drm_panel_of_backlight or drm_panel_dp_aux_backlight. Then the driver does not need to implement the functionality to enable/disable backlight. 🫢 (free real estate, fr fr)


πŸ‘€ SEE ALSO πŸ‘€

Go touch these, bestie β€” they're in the kernel file ./include/drm/drm_panel.h:


lowkey reminding you: get_modes is the only mandatory one, everything else is optional, but the order of .prepare β†’ .enable β†’ .disable β†’ .unprepare is not a suggestion, it's the whole plot. πŸ’€

and that's a wrap, bestie πŸ§šπŸ’œ this little love letter lives in ./include/drm and it's stamped October 2026 β€” go slay your panel driver, mwah! πŸŽ€βœ¨

πŸ“¦ where this page comes from