From: Manfred Schlaegl <manfred.schlaegl@gmx.at>
To: David Airlie <airlied@linux.ie>,
Philipp Zabel <p.zabel@pengutronix.de>,
Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-api@vger.kernel.org,
Manfred Schlaegl <manfred.schlaegl@ginzinger.com>,
Steve Longerbeam <slongerbeam@gmail.com>,
Deepak Das <deepak_das@mentor.com>,
Jiada Wang <jiada_wang@mentor.com>,
linux-fbdev@vger.kernel.org
Subject: [RFC PATCH 1/2] drm: add support for for clk and de polarity
Date: Wed, 15 Jul 2015 17:50:18 +0200 [thread overview]
Message-ID: <55A6813A.8090706@gmx.at> (raw)
In-Reply-To: <55A67FDB.8010602@gmx.at>
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 <manfred.schlaegl@gmx.at>
---
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
next prev parent reply other threads:[~2015-07-15 15:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-15 15:44 [RFC PATCH 0/2] drm: add support for for clk and de polarity & gpu: ipu-v3: use clock and de polarity Manfred Schlaegl
2015-07-15 15:50 ` Manfred Schlaegl [this message]
2015-11-25 17:22 ` [RFC PATCH 1/2] drm: add support for for clk " Philipp Zabel
2015-11-26 14:20 ` Manfred Schlaegl
2015-11-27 7:37 ` Tomi Valkeinen
2015-11-30 21:09 ` Philipp Zabel
2015-07-15 15:51 ` [RFC PATCH 2/2] gpu: ipu-v3: use clock and de polarity from videomode Manfred Schlaegl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55A6813A.8090706@gmx.at \
--to=manfred.schlaegl@gmx.at \
--cc=airlied@linux.ie \
--cc=deepak_das@mentor.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jiada_wang@mentor.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred.schlaegl@ginzinger.com \
--cc=p.zabel@pengutronix.de \
--cc=plagnioj@jcrosoft.com \
--cc=slongerbeam@gmail.com \
--cc=tomi.valkeinen@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox