From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Babic Date: Wed, 08 Jan 2014 11:40:51 +0100 Subject: [U-Boot] [PATCH 1/5] edid: add function to convert edid to fb_videomode In-Reply-To: <1389165866-17509-1-git-send-email-christian.gmeiner@gmail.com> References: <1389165866-17509-1-git-send-email-christian.gmeiner@gmail.com> Message-ID: <52CD2B33.7040907@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de CC to Anatolij as video custodian On 08/01/2014 08:24, Christian Gmeiner 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 > --- > common/edid.c | 29 +++++++++++++++++++++++++++++ > include/edid.h | 3 +++ > 2 files changed, 32 insertions(+) > > 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 > #include > +#include > #include > #include > > @@ -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; > + mode->yres = v_active; > + mode->xres = h_active; > + mode->left_margin = h_blanking - h_sync_offset - h_sync_width; > + mode->right_margin = h_sync_offset; > + mode->upper_margin = v_blanking - v_sync_offset - v_sync_width; > + mode->lower_margin = v_sync_offset; > + mode->hsync_len = h_sync_width; > + mode->vsync_len = v_sync_width; > +} > diff --git a/include/edid.h b/include/edid.h > index 480a773..4423062 100644 > --- a/include/edid.h > +++ b/include/edid.h > @@ -233,6 +233,9 @@ struct edid1_info { > */ > void edid_print_info(struct edid1_info *edid_info); > > +struct fb_videomode; > +void edid_to_fb_videomode(struct edid1_info *edid, struct fb_videomode *mode); > + > /** > * Check the EDID info. > * > -- ===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================