From patchwork Thu Jan 1 11:01:19 1970 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Gmeiner X-Patchwork-Id: 306795 X-Patchwork-Delegate: agust@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id F22382C0086 for ; Sat, 4 Jan 2014 19:53:28 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0814C4AC96; Sat, 4 Jan 2014 09:53:25 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BTgAiuyI-3Eh; Sat, 4 Jan 2014 09:53:24 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8845C4AC8F; Sat, 4 Jan 2014 09:53:23 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E94894AC8F for ; Sat, 4 Jan 2014 09:53:21 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SUIb-Jvp7zEw for ; Sat, 4 Jan 2014 09:53:16 +0100 (CET) X-Greylist: delayed 1383 seconds by postgrey-1.27 at theia; Sat, 04 Jan 2014 09:53:14 CET X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 BL_NJABL=SKIP(-1.5) (only DNSBL check requested) Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com [74.125.83.53]) by theia.denx.de (Postfix) with ESMTPS id 11EBB4AC89 for ; Sat, 4 Jan 2014 09:53:14 +0100 (CET) Received: by mail-ee0-f53.google.com with SMTP id b57so7098807eek.12 for ; Sat, 04 Jan 2014 00:53:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=w7oV4vVzGHoRVsfOJ80roNwfBD7TG9Yl8lv4p3jjyhM=; b=wZTTXk2oZk6Iv8HDjEA6ckApGF5qt7x1i62epPN2GUcxq5w0pkDEnZIQghfa6Ku2HF Ebn0NIhHgGPkMoO6Ennr9WXfQtP8JtL+dYGVJP5z8CFnJhAZ3pCgBRBCKX0bbi/9f3hC +8+b/XElVAzub6c/WflG1p/enodYDncR9I9/MLcP4SAFK/JqJ8xmgc7dBBkc9pr0RYn5 V2kG6Ifo4jna7gTsRFgJdq8HehBPgnzvg/81xLCLPWbspak6Uar8cxRIH8FkBp1LaBB+ 8ydmgtvAYEnyON82St9hy+aMoVKGkMYFmwfsA8IoPJatFOtWSP5BzWVr4UPwl/EyCEbz auag== X-Received: by 10.14.205.201 with SMTP id j49mr6117429eeo.85.1388824210205; Sat, 04 Jan 2014 00:30:10 -0800 (PST) Received: from localhost.localdomain (188-22-31-137.adsl.highway.telekom.at. [188.22.31.137]) by mx.google.com with ESMTPSA id m1sm151608833eeg.0.2014.01.04.00.30.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 04 Jan 2014 00:30:09 -0800 (PST) From: Christian Gmeiner To: u-boot@lists.denx.de Date: Thu, 1 Jan 1970 11:01:19 +0000 Message-Id: <39679-8461-1-git-send-email-christian.gmeiner@gmail.com> X-Mailer: git-send-email 1.7.5.4 Subject: [U-Boot] [PATCH] edid: add function to convert edid to fb_videomode X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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. *