[U-Boot] [PATCH 1/5] edid: add function to convert edid to fb_videomode
Anatolij Gustschin
agust at denx.de
Sun Jan 12 21:34:25 CET 2014
On Wed, 8 Jan 2014 08:24:21 +0100
Christian Gmeiner <christian.gmeiner at gmail.com> wrote:
> There may be some custom boards in the field which have
> an seperate eeprom chip to store edid informations in it.
> To make use of those edid information in the board code
> this patch add a function to convert edid to fb_videomode.
>
> Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
> ---
> common/edid.c | 29 +++++++++++++++++++++++++++++
> include/edid.h | 3 +++
> 2 files changed, 32 insertions(+)
Please check your patches with tools/checkpatch.pl and fix the
reported errors/warnings. Thanks!
> diff --git a/common/edid.c b/common/edid.c
> index e66108f..8841c25 100644
> --- a/common/edid.c
> +++ b/common/edid.c
> @@ -12,6 +12,7 @@
>
> #include <common.h>
> #include <edid.h>
> +#include <linux/fb.h>
> #include <linux/ctype.h>
> #include <linux/string.h>
>
> @@ -288,3 +289,31 @@ void edid_print_info(struct edid1_info *edid_info)
> if (!have_timing)
> printf("\tNone\n");
> }
> +
> +void edid_to_fb_videomode(struct edid1_info *edid, struct fb_videomode *mode)
> +{
> + struct edid_monitor_descriptor *monitor = &edid->monitor_details.descriptor[0];
> + unsigned char *bytes = (unsigned char *)monitor;
> + struct edid_detailed_timing *timing = (struct edid_detailed_timing *)monitor;
> +
> + uint32_t pixclock = EDID_DETAILED_TIMING_PIXEL_CLOCK(*timing);
> + uint32_t h_blanking = EDID_DETAILED_TIMING_HORIZONTAL_BLANKING(*timing);
> + uint32_t h_active = EDID_DETAILED_TIMING_HORIZONTAL_ACTIVE(*timing);
> + uint32_t h_sync_offset = EDID_DETAILED_TIMING_HSYNC_OFFSET(*timing);
> + uint32_t h_sync_width = EDID_DETAILED_TIMING_HSYNC_PULSE_WIDTH(*timing);
> + uint32_t v_blanking = EDID_DETAILED_TIMING_VERTICAL_BLANKING(*timing);
> + uint32_t v_active = EDID_DETAILED_TIMING_VERTICAL_ACTIVE(*timing);
> + uint32_t v_sync_offset = EDID_DETAILED_TIMING_VSYNC_OFFSET(*timing);
> + uint32_t v_sync_width = EDID_DETAILED_TIMING_VSYNC_PULSE_WIDTH(*timing);
> +
> + mode->name = "EDID";
> + mode->pixclock = pixclock;
as Eric already noticed, please use
mode->pixclock = KHZ2PICOS(pixclock/1000);
The unit for fb_videomode.pixclock is picoseconds, the EDID macro
returned the value in Hz. And when converting to device tree timing
node in patch 3/5 please use PICOS2KHZ(mode->pixclock) * 1000 when
setting the clock-frequency property.
Thanks,
Anatolij
More information about the U-Boot
mailing list