diff options
| author | Markus Schneider-Pargmann (TI.com) <[email protected]> | 2026-01-05 10:36:27 +0100 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-01-16 09:07:28 -0600 |
| commit | 36829e951bfeddb7b2e9eaa93223d646577fcc02 (patch) | |
| tree | b0b5d0b6f1612334b038d1f032ada685e70ee5bc /include | |
| parent | 60f5170c1fe2a438e36b71eea0237ca166e6ef23 (diff) | |
panel: Lightweight support of get_modes()
Linux uses get_modes() to fetch all available panel modes from the
driver. This is also used to fetch the modes from Linux's simple panel
implementation where a list of drm_display_mode structs is used to
define the different possible panels.
To make our work easier, create a compatible way of fetching and
defining these modes in u-boot. get_modes() fetches the available modes
from the panel driver. The get_display_timing() call maps the
drm_display_mode properties to the display_timing struct. This call now
uses whatever panel operation is available, get_display_timing() or
get_modes().
Reviewed-by: Fabio Estevam <[email protected]>
Signed-off-by: Markus Schneider-Pargmann (TI.com) <[email protected]>
Diffstat (limited to 'include')
| -rw-r--r-- | include/panel.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/include/panel.h b/include/panel.h index e2764d72c57..8d46fb26a07 100644 --- a/include/panel.h +++ b/include/panel.h @@ -7,6 +7,62 @@ #ifndef _PANEL_H #define _PANEL_H +#include <video.h> +#include <fdtdec.h> + +/* DRM mode flags mapped to U-Boot DISPLAY_FLAGS for direct compatibility */ +#define DRM_MODE_FLAG_NHSYNC DISPLAY_FLAGS_HSYNC_LOW +#define DRM_MODE_FLAG_PHSYNC DISPLAY_FLAGS_HSYNC_HIGH +#define DRM_MODE_FLAG_NVSYNC DISPLAY_FLAGS_VSYNC_LOW +#define DRM_MODE_FLAG_PVSYNC DISPLAY_FLAGS_VSYNC_HIGH +#define DRM_MODE_FLAG_INTERLACE DISPLAY_FLAGS_INTERLACED +#define DRM_MODE_FLAG_DBLSCAN DISPLAY_FLAGS_DOUBLESCAN +#define DRM_MODE_FLAG_DBLCLK DISPLAY_FLAGS_DOUBLECLK + +/** + * struct drm_display_mode - DRM kernel-internal display mode structure + * simplified for U-Boot + * @hdisplay: horizontal display size + * @hsync_start: horizontal sync start + * @hsync_end: horizontal sync end + * @htotal: horizontal total size + * @vdisplay: vertical display size + * @vsync_start: vertical sync start + * @vsync_end: vertical sync end + * @vtotal: vertical total size + * + * The horizontal and vertical timings are defined per the following diagram. + * + * :: + * + * + * Active Front Sync Back + * Region Porch Porch + * <-----------------------><----------------><-------------><--------------> + * //////////////////////| + * ////////////////////// | + * ////////////////////// |.................. ................ + * _______________ + * <----- [hv]display -----> + * <------------- [hv]sync_start ------------> + * <--------------------- [hv]sync_end ---------------------> + * <-------------------------------- [hv]total ----------------------------->* + */ +struct drm_display_mode { + unsigned int clock; /* in kHz */ + + u16 hdisplay; + u16 hsync_start; + u16 hsync_end; + u16 htotal; + u16 vdisplay; + u16 vsync_start; + u16 vsync_end; + u16 vtotal; + + u32 flags; +}; + struct panel_ops { /** * enable_backlight() - Enable the panel backlight @@ -34,6 +90,19 @@ struct panel_ops { */ int (*get_display_timing)(struct udevice *dev, struct display_timing *timing); + + /** + * get_modes() - Get display modes from panel + * + * Returns an array of display modes supported by the panel. + * Similar to Linux's drm_panel_funcs->get_modes(). + * + * @dev: Panel device + * @modes: Pointer to an array of modes + * @return number of modes if OK, -ve on error + */ + int (*get_modes)(struct udevice *dev, + const struct drm_display_mode **modes); }; #define panel_get_ops(dev) ((struct panel_ops *)(dev)->driver->ops) |
