Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1405879

[PATCHv2 2/3] drm/imx: convey the pixelclk-active and de-active flags from DT to the ipu-di driver

From Lothar Waßmann <LW@KARO-electronics.de>
Newsgroups linux.kernel
Subject [PATCHv2 2/3] drm/imx: convey the pixelclk-active and de-active flags from DT to the ipu-di driver
Date 2016-05-24 08:40 +0200
Message-ID <rCeau-8d9-9@gated-at.bofh.it> (permalink)
References <rCeau-8d9-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Currently these flags are lost in the call
drm_display_mode_from_videomode()

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
---
 drivers/gpu/drm/imx/imx-ldb.c          | 37 ++++++++++++++++++++++++++--------
 drivers/gpu/drm/imx/parallel-display.c | 31 ++++++++++++++++++++++++----
 2 files changed, 56 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index b2dc4df..b17a246 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -27,6 +27,7 @@
 #include <linux/of_graph.h>
 #include <video/of_display_timing.h>
 #include <video/of_videomode.h>
+#include <video/videomode.h>
 #include <linux/regmap.h>
 #include <linux/videodev2.h>
 
@@ -65,7 +66,8 @@ struct imx_ldb_channel {
 	int edid_len;
 	struct drm_display_mode mode;
 	int mode_valid;
-	int bus_format;
+	u32 bus_format;
+	u32 bus_flags;
 };
 
 struct bus_mux {
@@ -102,8 +104,10 @@ static int imx_ldb_connector_get_modes(struct drm_connector *connector)
 		struct drm_display_info *di = &connector->display_info;
 
 		num_modes = imx_ldb_ch->panel->funcs->get_modes(imx_ldb_ch->panel);
-		if (!imx_ldb_ch->bus_format && di->num_bus_formats)
+		if (!imx_ldb_ch->bus_format && di->num_bus_formats) {
 			imx_ldb_ch->bus_format = di->bus_formats[0];
+			imx_ldb_ch->bus_flags = di->bus_flags;
+		}
 		if (num_modes > 0)
 			return num_modes;
 	}
@@ -202,7 +206,8 @@ static void imx_ldb_encoder_prepare(struct drm_encoder *encoder)
 		break;
 	}
 
-	imx_drm_set_bus_format(encoder, bus_format);
+	imx_drm_set_bus_config(encoder, bus_format, 2, 3,
+			imx_ldb_ch->bus_flags);
 }
 
 static void imx_ldb_encoder_commit(struct drm_encoder *encoder)
@@ -558,7 +563,7 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
 
 		ret = of_property_read_u32(child, "reg", &i);
 		if (ret || i < 0 || i > 1)
-			return -EINVAL;
+			return ret ?: -EINVAL;
 
 		if (dual && i > 0) {
 			dev_warn(dev, "dual-channel mode, ignoring second output\n");
@@ -601,10 +606,26 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
 			channel->edid = kmemdup(edidp, channel->edid_len,
 						GFP_KERNEL);
 		} else if (!channel->panel) {
-			ret = of_get_drm_display_mode(child, &channel->mode,
-						OF_USE_NATIVE_MODE);
-			if (!ret)
-				channel->mode_valid = 1;
+			struct videomode vm;
+
+			ret = of_get_videomode(child, &vm, OF_USE_NATIVE_MODE);
+			if (ret)
+				return ret;
+
+			drm_display_mode_from_videomode(&vm, &channel->mode);
+
+			if (vm.flags & DISPLAY_FLAGS_PIXDATA_POSEDGE)
+				channel->bus_flags |= DRM_BUS_FLAG_PIXDATA_POSEDGE;
+			if (vm.flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
+				channel->bus_flags |= DRM_BUS_FLAG_PIXDATA_NEGEDGE;
+
+			if (vm.flags & DISPLAY_FLAGS_DE_LOW)
+				channel->bus_flags |= DRM_BUS_FLAG_DE_LOW;
+			if (vm.flags & DISPLAY_FLAGS_DE_HIGH)
+				channel->bus_flags |= DRM_BUS_FLAG_DE_HIGH;
+
+			drm_mode_debug_printmodeline(&channel->mode);
+			channel->mode_valid = 1;
 		}
 
 		channel->bus_format = of_get_bus_format(dev, child);
diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c
index 3db634d..238057b 100644
--- a/drivers/gpu/drm/imx/parallel-display.c
+++ b/drivers/gpu/drm/imx/parallel-display.c
@@ -19,9 +19,12 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_panel.h>
+#include <linux/of_graph.h>
 #include <linux/videodev2.h>
+#include <video/display_timing.h>
 #include <video/of_display_timing.h>
-#include <linux/of_graph.h>
+#include <video/of_videomode.h>
+#include <video/videomode.h>
 
 #include "imx-drm.h"
 
@@ -35,6 +38,7 @@ struct imx_parallel_display {
 	void *edid;
 	int edid_len;
 	u32 bus_format;
+	u32 bus_flags;
 	int mode_valid;
 	struct drm_display_mode mode;
 	struct drm_panel *panel;
@@ -57,8 +61,10 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector)
 		struct drm_display_info *di = &connector->display_info;
 
 		num_modes = imxpd->panel->funcs->get_modes(imxpd->panel);
-		if (!imxpd->bus_format && di->num_bus_formats)
+		if (!imxpd->bus_format && di->num_bus_formats) {
 			imxpd->bus_format = di->bus_formats[0];
+			imxpd->bus_flags = di->bus_flags;
+		}
 		if (num_modes > 0)
 			return num_modes;
 	}
@@ -81,10 +87,27 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector)
 
 	if (np) {
 		struct drm_display_mode *mode = drm_mode_create(connector->dev);
+		struct videomode vm;
+		int ret;
 
 		if (!mode)
 			return -EINVAL;
-		of_get_drm_display_mode(np, &imxpd->mode, OF_USE_NATIVE_MODE);
+
+		ret = of_get_videomode(np, &vm, OF_USE_NATIVE_MODE);
+		if (ret)
+			return ret;
+		drm_display_mode_from_videomode(&vm, &imxpd->mode);
+		drm_mode_debug_printmodeline(&imxpd->mode);
+
+		if (vm.flags & DISPLAY_FLAGS_PIXDATA_POSEDGE)
+			imxpd->bus_flags |= DRM_BUS_FLAG_PIXDATA_POSEDGE;
+		if (vm.flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
+			imxpd->bus_flags |= DRM_BUS_FLAG_PIXDATA_NEGEDGE;
+
+		if (vm.flags & DISPLAY_FLAGS_DE_LOW)
+			imxpd->bus_flags |= DRM_BUS_FLAG_DE_LOW;
+		if (vm.flags & DISPLAY_FLAGS_DE_HIGH)
+			imxpd->bus_flags |= DRM_BUS_FLAG_DE_HIGH;
 		drm_mode_copy(mode, &imxpd->mode);
 		mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
 		drm_mode_probed_add(connector, mode);
@@ -116,7 +139,7 @@ static void imx_pd_encoder_prepare(struct drm_encoder *encoder)
 {
 	struct imx_parallel_display *imxpd = enc_to_imxpd(encoder);
 	imx_drm_set_bus_config(encoder, imxpd->bus_format, 2, 3,
-			       imxpd->connector.display_info.bus_flags);
+			       imxpd->bus_flags);
 }
 
 static void imx_pd_encoder_commit(struct drm_encoder *encoder)
-- 
2.1.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] drm/imx: convey the pixelclk-active and de-active flags to the ipu-di driver Lothar Waßmann <LW@KARO-electronics.de> - 2016-05-20 16:00 +0200
  [PATCH 2/3] drm/imx: convey the pixelclk-active and de-active flags from DT to the ipu-di driver Lothar Waßmann <LW@KARO-electronics.de> - 2016-05-20 16:00 +0200
    Re: [PATCH 2/3] drm/imx: convey the pixelclk-active and de-active  flags from DT to the ipu-di driver Philipp Zabel <p.zabel@pengutronix.de> - 2016-05-20 16:40 +0200
  [PATCHv2 0/3] drm/imx: convey the pixelclk-active and de-active flags from DT to the ipu-di driver Lothar Waßmann <LW@KARO-electronics.de> - 2016-05-24 08:40 +0200
    [PATCHv2 2/3] drm/imx: convey the pixelclk-active and de-active flags from DT to the ipu-di driver Lothar Waßmann <LW@KARO-electronics.de> - 2016-05-24 08:40 +0200
      Re: [PATCHv2 2/3] drm/imx: convey the pixelclk-active and de-active  flags from DT to the ipu-di driver Philipp Zabel <p.zabel@pengutronix.de> - 2016-05-24 16:20 +0200
        Re: [PATCHv2 2/3] drm/imx: convey the pixelclk-active and de-active  flags from DT to the ipu-di driver Lothar Waßmann <LW@KARO-electronics.de> - 2016-05-25 08:20 +0200
          Re: [PATCHv2 2/3] drm/imx: convey the pixelclk-active and de-active  flags from DT to the ipu-di driver Philipp Zabel <p.zabel@pengutronix.de> - 2016-05-25 12:30 +0200
    [PATCHv2 3/3] drm/imx: remove dead code Lothar Waßmann <LW@KARO-electronics.de> - 2016-05-24 08:40 +0200
    [PATCHv2 1/3] drm/imx: imx-ldb: honor 'native-mode' property when selecting video mode from DT Lothar Waßmann <LW@KARO-electronics.de> - 2016-05-24 08:40 +0200

csiph-web