From patchwork Mon Nov 5 08:48:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Niedermaier X-Patchwork-Id: 10669895 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 017E413BF for ; Tue, 6 Nov 2018 08:15:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8EE62A13D for ; Tue, 6 Nov 2018 08:15:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD3ED2A177; Tue, 6 Nov 2018 08:15:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 752242A13D for ; Tue, 6 Nov 2018 08:15:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E8BA6E35F; Tue, 6 Nov 2018 08:15:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 323 seconds by postgrey-1.36 at gabe; Mon, 05 Nov 2018 08:53:59 UTC Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.131]) by gabe.freedesktop.org (Postfix) with ESMTPS id 54F736E15F for ; Mon, 5 Nov 2018 08:53:59 +0000 (UTC) Received: from sun05.dh.corp ([188.193.90.127]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPA (Nemesis) id 1MHX3R-1gFVxW0wPx-00DVeR; Mon, 05 Nov 2018 09:48:31 +0100 Received: from sun05.dh.corp ([188.193.90.127]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPA (Nemesis) id 1MHX3R-1gFVxW0wPx-00DVeR; Mon, 05 Nov 2018 09:48:31 +0100 Received: from sun1049.dh.corp (unknown [10.64.9.49]) by sun05.dh.corp (Postfix) with ESMTP id 18E5F1FC8F; Mon, 5 Nov 2018 09:48:30 +0100 (CET) Received: from localhost (10.64.31.3) by sun1049.dh.corp (10.64.9.49) with Microsoft SMTP Server id 14.3.408.0; Mon, 5 Nov 2018 09:48:36 +0100 From: Christoph Niedermaier To: , Subject: [PATCH 2/2] Docs/EDID: Calculate CRC while building the code Date: Mon, 5 Nov 2018 09:48:35 +0100 Message-ID: <1541407715-5417-3-git-send-email-cniedermaier@dh-electronics.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1541407715-5417-1-git-send-email-cniedermaier@dh-electronics.de> References: <1541407715-5417-1-git-send-email-cniedermaier@dh-electronics.de> MIME-Version: 1.0 X-Originating-IP: [10.64.31.3] X-Provags-ID: V03:K1:mFwzcpuctcdwSybWEjcPmOPRKhqqGg+HItzELNjJ9uXpW6Ep7zB aIuWrNEl22ijh9DIvH2Hf7pDTq1dUBCg0rLN0XirwpxbVd+dv6Wynp7tK94YRWQoL+ND08N 1v+uqDEKxWman3It8oVoMENcc4XEliBRXLWC06RZUfskL+BLxs4QHhkxlu6zflqVD3H7KKp +PeC/CxQofTu313xBMnuQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:eqBeHavCTJk=:smkEnM1VR6A1lVDeIqDcK4 ALX5bhJfE+uigAp+ILPAMvVTVpHBi4JE72bd/mz53olOW+4Lqm+8tjbnltYTtDsF9UUQWeUaD Fehjkhip77ed0BOL1Op658Nf8owmLnfG1FsEmOX2HvtH82ZjlZBzFJhdCp1f8jJJXnkFMcsxC jrmTf8fXHX2ZpbNil+uPcvlyAspOXQjEkQBjBr1KHrEc4r3iOs8GTYEs2M0EOwPrXEe8Ryzl7 991PU1j3gdWV1bJz7x5WHezHU5hGpmZnubTXLShJBmU5y5/6iLXE9TrCLUMiwIFTHlAcNlLV/ 3ugR9mpsEBzz9W0lNEX9sa5L2KzG3BzBoIO8A+pUVOTXtFaXkVhD5Htg7EOComqg1JyPuDyvq A8VX7ohgGOvDj4Kt2qq07nFiELOxTD0NwxxZHkMLQ5ZBAe0+kQE2vuTbq/bx4RCW5UVXQiYoa lMe6+dyubYE0iLISg/oh6zu5R36ZUCA3ZL8v+9nWejD7+PxmKSddzO3R9yPRsI8QKiTAD9TnD TGRjOXyVLU0oF3+mGbjktCH1w51JohJ3QZOIMqLSsI+O2Matw4Rblg7ewEoH3CrlaLmjrGe9F KeD3TU31i5j6yAtLtxHdK39sqRp3r+3IPFJYwNo9kbjJ09YGLALNIYcW3jO/mXHjZawDd/a1I tYbHRv3lFk/OYBtnwxX5f7lW7UDxtBWFuslQ4gFHwHXJJWgRznx0GDjPJPGxc/FvzMovnz1cV nC+lfVeD6rGcNt9f X-Mailman-Approved-At: Tue, 06 Nov 2018 08:14:57 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The previous version made it necessary to first generate an EDID data set without correct CRC and then to fix the CRC in a second step. This patch adds the CRC calculation to the makefile in such a way that a correct EDID data set is generated in a single build step. Successfully tested with all existing and a couple of new data sets. Signed-off-by: Christoph Niedermaier Reviewed-by: Carsten Emde --- Documentation/EDID/1024x768.S | 1 - Documentation/EDID/1280x1024.S | 1 - Documentation/EDID/1600x1200.S | 1 - Documentation/EDID/1680x1050.S | 1 - Documentation/EDID/1920x1080.S | 1 - Documentation/EDID/800x600.S | 1 - Documentation/EDID/HOWTO.txt | 9 --------- Documentation/EDID/Makefile | 15 +++++++++++++-- 8 files changed, 13 insertions(+), 17 deletions(-) diff --git a/Documentation/EDID/1024x768.S b/Documentation/EDID/1024x768.S index ff4013e..4aed3f9 100644 --- a/Documentation/EDID/1024x768.S +++ b/Documentation/EDID/1024x768.S @@ -39,6 +39,5 @@ #define ESTABLISHED_TIMING2_BITS 0x08 /* Bit 3 -> 1024x768 @60 Hz */ #define HSYNC_POL 0 #define VSYNC_POL 0 -#define CRC 0x55 #include "edid.S" diff --git a/Documentation/EDID/1280x1024.S b/Documentation/EDID/1280x1024.S index ce0e85b..b26dd42 100644 --- a/Documentation/EDID/1280x1024.S +++ b/Documentation/EDID/1280x1024.S @@ -39,6 +39,5 @@ /* No ESTABLISHED_TIMINGx_BITS */ #define HSYNC_POL 1 #define VSYNC_POL 1 -#define CRC 0xa0 #include "edid.S" diff --git a/Documentation/EDID/1600x1200.S b/Documentation/EDID/1600x1200.S index 5eeb751..0d091b2 100644 --- a/Documentation/EDID/1600x1200.S +++ b/Documentation/EDID/1600x1200.S @@ -39,6 +39,5 @@ /* No ESTABLISHED_TIMINGx_BITS */ #define HSYNC_POL 1 #define VSYNC_POL 1 -#define CRC 0x9d #include "edid.S" diff --git a/Documentation/EDID/1680x1050.S b/Documentation/EDID/1680x1050.S index ec67950..7dfed9a 100644 --- a/Documentation/EDID/1680x1050.S +++ b/Documentation/EDID/1680x1050.S @@ -39,6 +39,5 @@ /* No ESTABLISHED_TIMINGx_BITS */ #define HSYNC_POL 1 #define VSYNC_POL 1 -#define CRC 0x26 #include "edid.S" diff --git a/Documentation/EDID/1920x1080.S b/Documentation/EDID/1920x1080.S index e0657af..d6ffbba 100644 --- a/Documentation/EDID/1920x1080.S +++ b/Documentation/EDID/1920x1080.S @@ -39,6 +39,5 @@ /* No ESTABLISHED_TIMINGx_BITS */ #define HSYNC_POL 1 #define VSYNC_POL 1 -#define CRC 0x05 #include "edid.S" diff --git a/Documentation/EDID/800x600.S b/Documentation/EDID/800x600.S index b6853b2..a561658 100644 --- a/Documentation/EDID/800x600.S +++ b/Documentation/EDID/800x600.S @@ -36,6 +36,5 @@ #define ESTABLISHED_TIMING1_BITS 0x01 /* Bit 0: 800x600 @ 60Hz */ #define HSYNC_POL 1 #define VSYNC_POL 1 -#define CRC 0xc2 #include "edid.S" diff --git a/Documentation/EDID/HOWTO.txt b/Documentation/EDID/HOWTO.txt index 7d05a7d..539871c 100644 --- a/Documentation/EDID/HOWTO.txt +++ b/Documentation/EDID/HOWTO.txt @@ -47,12 +47,3 @@ EDID: #define YBLANK vtotal-vdisp #define YOFFSET vsyncstart-vdisp #define YPULSE vsyncend-vsyncstart - -The CRC value in the last line - #define CRC 0x55 -also is a bit tricky. After a first version of the binary data set is -created, it must be checked with the "edid-decode" utility which will -most probably complain about a wrong CRC. Fortunately, the utility also -displays the correct CRC which must then be inserted into the source -file. After the make procedure is repeated, the EDID data set is ready -to be used. diff --git a/Documentation/EDID/Makefile b/Documentation/EDID/Makefile index 17763ca..85a927d 100644 --- a/Documentation/EDID/Makefile +++ b/Documentation/EDID/Makefile @@ -15,10 +15,21 @@ clean: %.o: %.S @cc -c $^ -%.bin: %.o +%.bin.nocrc: %.o @objcopy -Obinary $^ $@ -%.bin.ihex: %.o +%.crc: %.bin.nocrc + @list=$$(for i in `seq 1 127`; do head -c$$i $^ | tail -c1 \ + | hexdump -v -e '/1 "%02X+"'; done); \ + echo "ibase=16;100-($${list%?})%100" | bc >$@ + +%.p: %.crc %.S + @cc -c -DCRC="$$(cat $*.crc)" -o $@ $*.S + +%.bin: %.p + @objcopy -Obinary $^ $@ + +%.bin.ihex: %.p @objcopy -Oihex $^ $@ @dos2unix $@ 2>/dev/null