diff options
author | Giulio Benetti <giulio.benetti@benettiengineering.com> | 2020-04-08 18:10:11 +0300 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2020-04-18 13:54:43 +0300 |
commit | 10374da7778a6521778c08864379b9b8f0d2573e (patch) | |
tree | 1218a4c3ed0ac186db176c038ef319d3123a4cb3 /drivers/video/videomodes.c | |
parent | ecd8497bcb655390c77928408ba28b22886b286a (diff) | |
download | u-boot-10374da7778a6521778c08864379b9b8f0d2573e.tar.xz |
videomodes: add helper function to convert from ctfb to display_timing
This function converts from "struct ctf_res_modes" to
"struct display_timing".
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
Diffstat (limited to 'drivers/video/videomodes.c')
-rw-r--r-- | drivers/video/videomodes.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/video/videomodes.c b/drivers/video/videomodes.c index ac25b45f81..89003eea72 100644 --- a/drivers/video/videomodes.c +++ b/drivers/video/videomodes.c @@ -444,3 +444,32 @@ int video_edid_dtd_to_ctfb_res_modes(struct edid_detailed_timing *t, return 0; } + +void video_ctfb_mode_to_display_timing(const struct ctfb_res_modes *mode, + struct display_timing *timing) +{ + timing->pixelclock.typ = mode->pixclock_khz * 1000; + + timing->hactive.typ = mode->xres; + timing->hfront_porch.typ = mode->right_margin; + timing->hback_porch.typ = mode->left_margin; + timing->hsync_len.typ = mode->hsync_len; + + timing->vactive.typ = mode->yres; + timing->vfront_porch.typ = mode->lower_margin; + timing->vback_porch.typ = mode->upper_margin; + timing->vsync_len.typ = mode->vsync_len; + + timing->flags = 0; + + if (mode->sync & FB_SYNC_HOR_HIGH_ACT) + timing->flags |= DISPLAY_FLAGS_HSYNC_HIGH; + else + timing->flags |= DISPLAY_FLAGS_HSYNC_LOW; + if (mode->sync & FB_SYNC_VERT_HIGH_ACT) + timing->flags |= DISPLAY_FLAGS_VSYNC_HIGH; + else + timing->flags |= DISPLAY_FLAGS_VSYNC_LOW; + if (mode->vmode == FB_VMODE_INTERLACED) + timing->flags |= DISPLAY_FLAGS_INTERLACED; +} |