From patchwork Thu Dec 5 18:28:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Denis Carikli X-Patchwork-Id: 3292081 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4EDC59F373 for ; Fri, 6 Dec 2013 00:59:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 62BA9204FB for ; Fri, 6 Dec 2013 00:59:28 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7910B204EC for ; Fri, 6 Dec 2013 00:59:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C268AFAAF7; Thu, 5 Dec 2013 16:59:25 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp5-g21.free.fr (smtp5-g21.free.fr [212.27.42.5]) by gabe.freedesktop.org (Postfix) with ESMTP id 5D1DCFAD47 for ; Thu, 5 Dec 2013 10:29:28 -0800 (PST) Received: from denis-N73SV.local.eukrea.com (unknown [88.170.243.169]) by smtp5-g21.free.fr (Postfix) with ESMTP id EC24DD48148; Thu, 5 Dec 2013 19:29:19 +0100 (CET) From: Denis Carikli To: Greg Kroah-Hartman Subject: [PATCHv5][ 4/8] staging: imx-drm: Use de-active and pixelclk-active display-timings. Date: Thu, 5 Dec 2013 19:28:08 +0100 Message-Id: <1386268092-21719-4-git-send-email-denis@eukrea.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1386268092-21719-1-git-send-email-denis@eukrea.com> References: <1386268092-21719-1-git-send-email-denis@eukrea.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 05 Dec 2013 16:58:16 -0800 Cc: Marek Vasut , devel@driverdev.osuosl.org, =?UTF-8?q?Eric=20B=C3=A9nard?= , driverdev-devel@linuxdriverproject.org, dri-devel@lists.freedesktop.org, Denis Carikli , Sascha Hauer , linux-arm-kernel@lists.infradead.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If de-active and/or pixelclk-active properties were set in the display-timings DT node, they were not used. Instead the data-enable and the pixel data clock polarity were hardcoded. This change is needed for making the eukrea-cpuimx51 QVGA display work. Greg Kroah-Hartman Cc: driverdev-devel@linuxdriverproject.org Cc: Philipp Zabel Cc: Sascha Hauer Cc: Shawn Guo Cc: linux-arm-kernel@lists.infradead.org Cc: David Airlie Cc: dri-devel@lists.freedesktop.org Cc: Eric BĂ©nard Signed-off-by: Denis Carikli --- ChangeLog v3->v4: - The old patch was named "staging: imx-drm: ipuv3-crtc: don't harcode some mode". - Reworked the patch entierly: we now takes the mode flags from the device tree. ChangeLog v2->v3: - Added some interested people in the Cc list. - Ajusted the flags to match the changes in "drm: Add the lacking DRM_MODE_FLAG_* for matching the DISPLAY_FLAGS_*" --- drivers/staging/imx-drm/imx-drm.h | 3 +++ drivers/staging/imx-drm/ipuv3-crtc.c | 11 +++++++++-- drivers/staging/imx-drm/parallel-display.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/drivers/staging/imx-drm/imx-drm.h b/drivers/staging/imx-drm/imx-drm.h index ae90c9c..dfdc180 100644 --- a/drivers/staging/imx-drm/imx-drm.h +++ b/drivers/staging/imx-drm/imx-drm.h @@ -5,6 +5,9 @@ #define IPU_PIX_FMT_GBR24 v4l2_fourcc('G', 'B', 'R', '3') +#define IMXDRM_MODE_FLAG_DE_HIGH (1<<0) +#define IMXDRM_MODE_FLAG_PIXDATA_POSEDGE (1<<1) + struct drm_crtc; struct drm_connector; struct drm_device; diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c b/drivers/staging/imx-drm/ipuv3-crtc.c index ce6ba98..f3d2cae 100644 --- a/drivers/staging/imx-drm/ipuv3-crtc.c +++ b/drivers/staging/imx-drm/ipuv3-crtc.c @@ -156,8 +156,15 @@ static int ipu_crtc_mode_set(struct drm_crtc *crtc, if (mode->flags & DRM_MODE_FLAG_PVSYNC) sig_cfg.Vsync_pol = 1; - sig_cfg.enable_pol = 1; - sig_cfg.clk_pol = 1; + /* Such flags are not availables in the DRM modes header, + * and we don't want to export them to userspace. + */ + if (mode->private_flags & IMXDRM_MODE_FLAG_DE_HIGH) + sig_cfg.enable_pol = 1; + + if (mode->private_flags & IMXDRM_MODE_FLAG_PIXDATA_POSEDGE) + sig_cfg.clk_pol = 1; + sig_cfg.width = mode->hdisplay; sig_cfg.height = mode->vdisplay; sig_cfg.pixel_fmt = out_pixel_fmt; diff --git a/drivers/staging/imx-drm/parallel-display.c b/drivers/staging/imx-drm/parallel-display.c index bb71d6d..65d0c18 100644 --- a/drivers/staging/imx-drm/parallel-display.c +++ b/drivers/staging/imx-drm/parallel-display.c @@ -74,7 +74,35 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector) if (np) { struct drm_display_mode *mode = drm_mode_create(connector->dev); + struct device_node *timings_np; + struct device_node *mode_np; + u32 val; + of_get_drm_display_mode(np, &imxpd->mode, 0); + + /* Such flags are not availables in the DRM modes header, + * and we don't want to export them to userspace. + */ + timings_np = of_get_child_by_name(np, "display-timings"); + if (timings_np) { + /* get the display mode node */ + mode_np = of_parse_phandle(timings_np, + "native-mode", 0); + if (!mode_np) + mode_np = of_get_next_child(timings_np, NULL); + + /* set de-active to 1 if not set */ + of_property_read_u32(mode_np, "de-active", &val); + if (!!val) + imxpd->mode.private_flags |= + IMXDRM_MODE_FLAG_DE_HIGH; + + /* set pixelclk-active to 1 if not set */ + of_property_read_u32(mode_np, "pixelclk-active", &val); + if (!!val) + imxpd->mode.private_flags |= + IMXDRM_MODE_FLAG_PIXDATA_POSEDGE; + } drm_mode_copy(mode, &imxpd->mode); mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED, drm_mode_probed_add(connector, mode);