diff mbox

[57/72] imx-drm: Add support for interface pixel maps

Message ID 1414796095-10107-58-git-send-email-steve_longerbeam@mentor.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve Longerbeam Oct. 31, 2014, 10:54 p.m. UTC
Adds the framework that allows encoder/connector drivers to create
a new interface pixel mapping passed to imx_drm_panel_format(). The
crtc driver will then pass this pointer on to ipu_dc_init_sync() which
sets up the new mapping in the DC.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
---
 drivers/staging/imx-drm/imx-drm-core.c     |   19 ++++++++++++++-----
 drivers/staging/imx-drm/imx-drm.h          |   12 +++++++++---
 drivers/staging/imx-drm/imx-hdmi.c         |    3 +--
 drivers/staging/imx-drm/imx-ldb.c          |    2 +-
 drivers/staging/imx-drm/imx-tve.c          |    5 ++---
 drivers/staging/imx-drm/ipuv3-crtc.c       |   11 ++++++++---
 drivers/staging/imx-drm/ipuv3-plane.c      |    2 +-
 drivers/staging/imx-drm/parallel-display.c |    2 +-
 8 files changed, 37 insertions(+), 19 deletions(-)
diff mbox

Patch

diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c
index 4c85fd3..b31d291 100644
--- a/drivers/staging/imx-drm/imx-drm-core.c
+++ b/drivers/staging/imx-drm/imx-drm-core.c
@@ -136,7 +136,9 @@  static struct imx_drm_crtc *imx_drm_find_crtc_by_id(struct drm_device *drm,
 }
 
 int imx_drm_panel_format_pins(struct drm_encoder *encoder,
-		u32 interface_pix_fmt, int hsync_pin, int vsync_pin)
+			      u32 interface_pix_fmt,
+			      struct ipu_dc_if_map *interface_pix_map,
+			      int hsync_pin, int vsync_pin)
 {
 	struct imx_drm_crtc_helper_funcs *helper;
 	struct imx_drm_crtc *imx_crtc;
@@ -148,15 +150,22 @@  int imx_drm_panel_format_pins(struct drm_encoder *encoder,
 	helper = &imx_crtc->imx_drm_helper_funcs;
 	if (helper->set_interface_pix_fmt)
 		return helper->set_interface_pix_fmt(encoder->crtc,
-				encoder->encoder_type, interface_pix_fmt,
-				hsync_pin, vsync_pin);
+						     encoder->encoder_type,
+						     interface_pix_fmt,
+						     interface_pix_map,
+						     hsync_pin, vsync_pin);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(imx_drm_panel_format_pins);
 
-int imx_drm_panel_format(struct drm_encoder *encoder, u32 interface_pix_fmt)
+int imx_drm_panel_format(struct drm_encoder *encoder,
+			 u32 interface_pix_fmt,
+			 struct ipu_dc_if_map *interface_pix_map)
 {
-	return imx_drm_panel_format_pins(encoder, interface_pix_fmt, 2, 3);
+	return imx_drm_panel_format_pins(encoder,
+					 interface_pix_fmt,
+					 interface_pix_map,
+					 2, 3);
 }
 EXPORT_SYMBOL_GPL(imx_drm_panel_format);
 
diff --git a/drivers/staging/imx-drm/imx-drm.h b/drivers/staging/imx-drm/imx-drm.h
index 0bb4735..24b889a 100644
--- a/drivers/staging/imx-drm/imx-drm.h
+++ b/drivers/staging/imx-drm/imx-drm.h
@@ -1,6 +1,8 @@ 
 #ifndef _IMX_DRM_H_
 #define _IMX_DRM_H_
 
+#include <video/imx-ipu-v3.h>
+
 struct device_node;
 struct drm_crtc;
 struct drm_connector;
@@ -20,7 +22,8 @@  struct imx_drm_crtc_helper_funcs {
 	int (*enable_vblank)(struct drm_crtc *crtc, int pipe);
 	void (*disable_vblank)(struct drm_crtc *crtc, int pipe);
 	int (*set_interface_pix_fmt)(struct drm_crtc *crtc, u32 encoder_type,
-			u32 pix_fmt, int hsync_pin, int vsync_pin);
+				     u32 pix_fmt, struct ipu_dc_if_map *pix_map,
+				     int hsync_pin, int vsync_pin);
 	int (*gamma_set)(struct drm_crtc *crtc, bool enable, u32 *m, u32 *b);
 	const struct drm_crtc_helper_funcs *crtc_helper_funcs;
 	const struct drm_crtc_funcs *crtc_funcs;
@@ -41,9 +44,12 @@  void imx_drm_mode_config_init(struct drm_device *drm);
 struct drm_gem_cma_object *imx_drm_fb_get_obj(struct drm_framebuffer *fb);
 
 int imx_drm_panel_format_pins(struct drm_encoder *encoder,
-		u32 interface_pix_fmt, int hsync_pin, int vsync_pin);
+			      u32 interface_pix_fmt,
+			      struct ipu_dc_if_map *interface_pix_map,
+			      int hsync_pin, int vsync_pin);
 int imx_drm_panel_format(struct drm_encoder *encoder,
-		u32 interface_pix_fmt);
+			 u32 interface_pix_fmt,
+			 struct ipu_dc_if_map *interface_pix_map);
 
 int imx_drm_encoder_get_mux_id(struct device_node *node,
 		struct drm_encoder *encoder);
diff --git a/drivers/staging/imx-drm/imx-hdmi.c b/drivers/staging/imx-drm/imx-hdmi.c
index db3906f..4ef1c0a 100644
--- a/drivers/staging/imx-drm/imx-hdmi.c
+++ b/drivers/staging/imx-drm/imx-hdmi.c
@@ -27,7 +27,6 @@ 
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_encoder_slave.h>
-#include <video/imx-ipu-v3.h>
 
 #include "imx-hdmi.h"
 #include "imx-drm.h"
@@ -1455,7 +1454,7 @@  static void imx_hdmi_encoder_prepare(struct drm_encoder *encoder)
 	struct imx_hdmi *hdmi = container_of(encoder, struct imx_hdmi, encoder);
 
 	imx_hdmi_poweroff(hdmi);
-	imx_drm_panel_format(encoder, V4L2_PIX_FMT_RGB24);
+	imx_drm_panel_format(encoder, V4L2_PIX_FMT_RGB24, NULL);
 }
 
 static void imx_hdmi_encoder_commit(struct drm_encoder *encoder)
diff --git a/drivers/staging/imx-drm/imx-ldb.c b/drivers/staging/imx-drm/imx-ldb.c
index 6c16cf2..53d9d82 100644
--- a/drivers/staging/imx-drm/imx-ldb.c
+++ b/drivers/staging/imx-drm/imx-ldb.c
@@ -293,7 +293,7 @@  static void imx_ldb_encoder_prepare(struct drm_encoder *encoder)
 		pixel_fmt = V4L2_PIX_FMT_RGB24;
 	}
 
-	imx_drm_panel_format(encoder, pixel_fmt);
+	imx_drm_panel_format(encoder, pixel_fmt, NULL);
 }
 
 static void imx_ldb_encoder_commit(struct drm_encoder *encoder)
diff --git a/drivers/staging/imx-drm/imx-tve.c b/drivers/staging/imx-drm/imx-tve.c
index 42c651b..49feb91 100644
--- a/drivers/staging/imx-drm/imx-tve.c
+++ b/drivers/staging/imx-drm/imx-tve.c
@@ -30,7 +30,6 @@ 
 #include <drm/drmP.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_crtc_helper.h>
-#include <video/imx-ipu-v3.h>
 
 #include "imx-drm.h"
 
@@ -302,11 +301,11 @@  static void imx_tve_encoder_prepare(struct drm_encoder *encoder)
 
 	switch (tve->mode) {
 	case TVE_MODE_VGA:
-		imx_drm_panel_format_pins(encoder, IPU_PIX_FMT_GBR24,
+		imx_drm_panel_format_pins(encoder, IPU_PIX_FMT_GBR24, NULL,
 				tve->hsync_pin, tve->vsync_pin);
 		break;
 	case TVE_MODE_TVOUT:
-		imx_drm_panel_format(encoder, V4L2_PIX_FMT_YUV444);
+		imx_drm_panel_format(encoder, V4L2_PIX_FMT_YUV444, NULL);
 		break;
 	}
 }
diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c b/drivers/staging/imx-drm/ipuv3-crtc.c
index 8d7c998..bd158d6 100644
--- a/drivers/staging/imx-drm/ipuv3-crtc.c
+++ b/drivers/staging/imx-drm/ipuv3-crtc.c
@@ -31,7 +31,6 @@ 
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/imx_drm.h>
 
-#include <video/imx-ipu-v3.h>
 #include "imx-drm.h"
 #include "ipuv3-plane.h"
 
@@ -93,6 +92,8 @@  struct ipu_crtc {
 	int			enabled;
 
 	u32			interface_pix_fmt;
+	struct ipu_dc_if_map    *interface_pix_map;
+
 	unsigned long		di_clkflags;
 	int			di_hsync_pin;
 	int			di_vsync_pin;
@@ -272,6 +273,7 @@  static int ipu_crtc_mode_set(struct drm_crtc *crtc,
 	struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
 	int ret;
 	struct ipu_di_signal_cfg sig_cfg = {};
+	struct ipu_dc_if_map *out_pixel_map;
 	u32 out_pixel_fmt;
 
 	dev_dbg(ipu_crtc->dev, "%s: mode->hdisplay: %d\n", __func__,
@@ -280,6 +282,7 @@  static int ipu_crtc_mode_set(struct drm_crtc *crtc,
 			mode->vdisplay);
 
 	out_pixel_fmt = ipu_crtc->interface_pix_fmt;
+	out_pixel_map = ipu_crtc->interface_pix_map;
 
 	if (mode->flags & DRM_MODE_FLAG_INTERLACE)
 		sig_cfg.interlaced = 1;
@@ -309,7 +312,7 @@  static int ipu_crtc_mode_set(struct drm_crtc *crtc,
 	sig_cfg.vsync_pin = ipu_crtc->di_vsync_pin;
 
 	ret = ipu_dc_init_sync(ipu_crtc->dc, ipu_crtc->di, sig_cfg.interlaced,
-			out_pixel_fmt, NULL, mode->hdisplay);
+			out_pixel_fmt, out_pixel_map, mode->hdisplay);
 	if (ret) {
 		dev_err(ipu_crtc->dev,
 				"initializing display controller failed with %d\n",
@@ -382,11 +385,13 @@  static void ipu_disable_vblank(struct drm_crtc *crtc, int pipe)
 }
 
 static int ipu_set_interface_pix_fmt(struct drm_crtc *crtc, u32 encoder_type,
-		u32 pixfmt, int hsync_pin, int vsync_pin)
+				     u32 pixfmt, struct ipu_dc_if_map *pixmap,
+				     int hsync_pin, int vsync_pin)
 {
 	struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
 
 	ipu_crtc->interface_pix_fmt = pixfmt;
+	ipu_crtc->interface_pix_map = pixmap;
 	ipu_crtc->di_hsync_pin = hsync_pin;
 	ipu_crtc->di_vsync_pin = vsync_pin;
 
diff --git a/drivers/staging/imx-drm/ipuv3-plane.c b/drivers/staging/imx-drm/ipuv3-plane.c
index 2912aa6..61d47e9 100644
--- a/drivers/staging/imx-drm/ipuv3-plane.c
+++ b/drivers/staging/imx-drm/ipuv3-plane.c
@@ -17,7 +17,7 @@ 
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 
-#include "video/imx-ipu-v3.h"
+#include "imx-drm.h"
 #include "ipuv3-plane.h"
 
 #define to_ipu_plane(x)	container_of(x, struct ipu_plane, base)
diff --git a/drivers/staging/imx-drm/parallel-display.c b/drivers/staging/imx-drm/parallel-display.c
index 49f8308..667a9b3 100644
--- a/drivers/staging/imx-drm/parallel-display.c
+++ b/drivers/staging/imx-drm/parallel-display.c
@@ -123,7 +123,7 @@  static void imx_pd_encoder_prepare(struct drm_encoder *encoder)
 {
 	struct imx_parallel_display *imxpd = enc_to_imxpd(encoder);
 
-	imx_drm_panel_format(encoder, imxpd->interface_pix_fmt);
+	imx_drm_panel_format(encoder, imxpd->interface_pix_fmt, NULL);
 }
 
 static void imx_pd_encoder_commit(struct drm_encoder *encoder)