From patchwork Wed Oct 11 11:23:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Lothar_Wa=C3=9Fmann?= X-Patchwork-Id: 10001165 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DBA46602BF for ; Thu, 12 Oct 2017 07:34:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD9F928CF7 for ; Thu, 12 Oct 2017 07:34:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C28D028CF9; Thu, 12 Oct 2017 07:34:07 +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=-4.2 required=2.0 tests=BAYES_00, 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 15D2D28CF7 for ; Thu, 12 Oct 2017 07:34:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4AB106E78A; Thu, 12 Oct 2017 07:33:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 1192 seconds by postgrey-1.35 at gabe; Wed, 11 Oct 2017 12:02:57 UTC Received: from smtprelay02.ispgateway.de (smtprelay02.ispgateway.de [80.67.18.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id B32AD89C18 for ; Wed, 11 Oct 2017 12:02:57 +0000 (UTC) Received: from [89.1.81.74] (helo=ipc1.ka-ro) by smtprelay02.ispgateway.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89) (envelope-from ) id 1e2FPh-0002bm-I6; Wed, 11 Oct 2017 13:43:01 +0200 Received: from lothar by ipc1.ka-ro with local (Exim 4.84_2 #2 (Debian)) id 1e2FPh-0007tw-4K; Wed, 11 Oct 2017 13:43:01 +0200 From: =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= To: David Airlie , Mark Rutland , Rob Herring , Thierry Reding , devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/9] drm/panel: simple: add a macro for defining display modes in a simpler and less error prone way Date: Wed, 11 Oct 2017 13:23:33 +0200 Message-Id: <1507721021-28174-2-git-send-email-LW@KARO-electronics.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1507721021-28174-1-git-send-email-LW@KARO-electronics.de> References: <1507721021-28174-1-git-send-email-LW@KARO-electronics.de> MIME-Version: 1.0 X-Df-Sender: bHdAa2Fyby1lbGVjdHJvbmljcy5kZQ== X-Mailman-Approved-At: Thu, 12 Oct 2017 07:33:54 +0000 Cc: =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Create a macro that eases the definition of display mode parameters by accecpting the parameters: freq, hactive, hfront-porch, hsynclen, hback-porch, vactive, vfront-porch, vsynclen, vback-porch, vrefresh that can be usually directly taken from an LCD datasheet. Put the calculations that are now open coded repeating the same parameters multiple times into the macro expansion. Signed-off-by: Lothar Waßmann --- drivers/gpu/drm/panel/panel-simple.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 474fa75..dec639d 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -411,6 +411,20 @@ static const struct panel_desc ampire_am_480272h3tmqw_t01h = { .bus_format = MEDIA_BUS_FMT_RGB888_1X24, }; +#define SP_DISPLAY_MODE(freq, ha, hfp, hs, hbp, va, vfp, vs, vbp, vr, flgs) { \ + .clock = freq, \ + .hdisplay = ha, \ + .hsync_start = (ha) + (hfp), \ + .hsync_end = (ha) + (hfp) + (hs), \ + .htotal = (ha) + (hfp) + (hs) + (hbp), \ + .vdisplay = (va), \ + .vsync_start = (va) + (vfp), \ + .vsync_end = (va) + (vfp) + (vs), \ + .vtotal = (va) + (vfp) + (vs) + (vbp), \ + .vrefresh = vr, \ + .flags = flgs, \ + } + static const struct drm_display_mode ampire_am800480r3tmqwa1h_mode = { .clock = 33333, .hdisplay = 800,