Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752141AbbGOPu0 (ORCPT ); Wed, 15 Jul 2015 11:50:26 -0400 Received: from mout.gmx.net ([212.227.15.18]:52298 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751546AbbGOPuZ (ORCPT ); Wed, 15 Jul 2015 11:50:25 -0400 Message-ID: <55A6813A.8090706@gmx.at> Date: Wed, 15 Jul 2015 17:50:18 +0200 From: Manfred Schlaegl User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-Version: 1.0 To: David Airlie , Philipp Zabel , Jean-Christophe Plagniol-Villard , Tomi Valkeinen CC: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Manfred Schlaegl , Steve Longerbeam , Deepak Das , Jiada Wang , linux-fbdev@vger.kernel.org Subject: [RFC PATCH 1/2] drm: add support for for clk and de polarity References: <55A67FDB.8010602@gmx.at> In-Reply-To: <55A67FDB.8010602@gmx.at> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:V65vBWctYdbe/uqKiI1iQYcQ1z5tFqBW3rrHhnKVkh7U9cxakMt w2Hw9uW2c+ku9jPfRfGCvZgK7AaX7Q2doeQJ1XB0+iw1Bz2UFU2Y1CvBgYtgousIpatyb3I tJ4wtd+LquuiPElIU+3H1gvkg9bJd13X+vl8X8glA7YpSGCtNEkmU2yxmUs/i52EwkDaW1C 3sEAtT/ofw5z5KMui5jMw== X-UI-Out-Filterresults: notjunk:1;V01:K0:mTydyn9TbIY=:i8kgPgqVM4UIflM39ex4W6 VFeBJDLnLbM9+48ZrHG55D4uUZCm96udXVyeLhgH8XwFHS1Aukxc8pjeAQIx5JT0LBKPshLAh qkp057u9EMT5pJXHxlfxY1cjIVTONGlhvFlWdjOJCwy5vu4DoRyN406LbI0haHa/o1nBhyDrd zn8/GXntkfFcwA+dSA7v49sVnjaU7C33umuCUG5SuhwlKM8/B2Q9oU9wn69WoDWQknwq4bbo9 8kVIJxa1WaHtIYEzdtWwBS0bKvGTITpSoRN8UdSO1g+wo6UBJtYl8/qUsNYlrag5Y+TjyA88m 5KGiDCqZuRJ8O0QqGkRlUq3nvju30GAudj64lHHrN/hCpZTlgIcYZbL3xMMs47b4whCzE6+do rHWhmWQNrpt52dzHedsctJ9zOsk3UVg2MJPCWbrMGeFpkAy2HV4MN4ksplSwn5gIgcR7WX/O5 /Y3bu+YkHH8SetxvusZjvTt4qMkD6UMls2HRFhtPEiSzeETWtBTW5rjxRvo5m7+b5RRVLeifs OB0NN9R8WsB+5G3JqNwHGsNc1AcezeAhXMzjXX0pVdlRu4/qGrFLmNcNHenSpjWbUHXf3kVCs 3emmI2hw5r2Lz450kh2bojiBSibNtOOVAgiFxCwzt9GptHBlzTVY1wenuc5oJUVaT+7Qtqy1R E6GFQQ9K5HplRbMEFs+jg/UTHms2S4SqQ346sHmehku1lI5dM8WESh6/fguP+4HERYP0= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3482 Lines: 93 To get full support for parallel and LVDS displays with drm: Add representation for clock and data enable polarity in drm_display_mode flags (similar to HSYNC/VSYNC polarity) and update conversion functions from/to videomode accordingly. This is especially important for embedded devices where parallel(RGB) and LVDS displays are still widely used and drm already plays an important role. Tested on Freescale i.MX53(parallel) and i.MX6(LVDS). Background: There was the ability to set polarity of clock and data enable signals in devicetree(display-timing), struct display_timing and struct videomode, but there was no representation for this in struct drm_display_mode. Example on Freescale i.MX53/i.MX6 SoC's: * A parallel display using different clock polarity is set up using display-timing in devicetree * ipuv3 parallel outputs clock with wrong polarity Signed-off-by: Manfred Schlaegl --- drivers/gpu/drm/drm_modes.c | 16 ++++++++++++++++ include/uapi/drm/drm_mode.h | 5 +++++ 2 files changed, 21 insertions(+) diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index cd74a09..dbb28b7 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -605,6 +605,14 @@ void drm_display_mode_from_videomode(const struct videomode *vm, dmode->flags |= DRM_MODE_FLAG_PVSYNC; else if (vm->flags & DISPLAY_FLAGS_VSYNC_LOW) dmode->flags |= DRM_MODE_FLAG_NVSYNC; + if (vm->flags & DISPLAY_FLAGS_DE_HIGH) + dmode->flags |= DRM_MODE_FLAG_PDE; + else if (vm->flags & DISPLAY_FLAGS_DE_LOW) + dmode->flags |= DRM_MODE_FLAG_NDE; + if (vm->flags & DISPLAY_FLAGS_PIXDATA_POSEDGE) + dmode->flags |= DRM_MODE_FLAG_PPIXDATA; + else if (vm->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE) + dmode->flags |= DRM_MODE_FLAG_NPIXDATA; if (vm->flags & DISPLAY_FLAGS_INTERLACED) dmode->flags |= DRM_MODE_FLAG_INTERLACE; if (vm->flags & DISPLAY_FLAGS_DOUBLESCAN) @@ -646,6 +654,14 @@ void drm_display_mode_to_videomode(const struct drm_display_mode *dmode, vm->flags |= DISPLAY_FLAGS_VSYNC_HIGH; else if (dmode->flags & DRM_MODE_FLAG_NVSYNC) vm->flags |= DISPLAY_FLAGS_VSYNC_LOW; + if (dmode->flags & DRM_MODE_FLAG_PDE) + vm->flags |= DISPLAY_FLAGS_DE_HIGH; + else if (dmode->flags & DRM_MODE_FLAG_NDE) + vm->flags |= DISPLAY_FLAGS_DE_LOW; + if (dmode->flags & DRM_MODE_FLAG_PPIXDATA) + vm->flags |= DISPLAY_FLAGS_PIXDATA_POSEDGE; + else if (dmode->flags & DRM_MODE_FLAG_NPIXDATA) + vm->flags |= DISPLAY_FLAGS_PIXDATA_NEGEDGE; if (dmode->flags & DRM_MODE_FLAG_INTERLACE) vm->flags |= DISPLAY_FLAGS_INTERLACED; if (dmode->flags & DRM_MODE_FLAG_DBLSCAN) diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h index 359107a..cb4912b 100644 --- a/include/uapi/drm/drm_mode.h +++ b/include/uapi/drm/drm_mode.h @@ -72,6 +72,11 @@ #define DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH (6<<14) #define DRM_MODE_FLAG_3D_TOP_AND_BOTTOM (7<<14) #define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF (8<<14) +/* flags for display data enable and clock polarity */ +#define DRM_MODE_FLAG_PDE (1<<19) +#define DRM_MODE_FLAG_NDE (1<<20) +#define DRM_MODE_FLAG_PPIXDATA (1<<21) +#define DRM_MODE_FLAG_NPIXDATA (1<<22) /* DPMS flags */ -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/