[Intel-gfx] [PATCH 14/14] drm/i915: add AUO MIPI DSI display sub-encoder

Jani Nikula jani.nikula at intel.com
Tue Aug 13 15:29:53 CEST 2013


From: Shobhit Kumar <shobhit.kumar at intel.com>

Signed-off-by: Shobhit Kumar <shobhit.kumar at intel.com>
Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
 drivers/gpu/drm/i915/Makefile          |    1 +
 drivers/gpu/drm/i915/auo_dsi_display.c |  182 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_dsi.c       |    5 +
 drivers/gpu/drm/i915/intel_dsi.h       |    3 +
 4 files changed, 191 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/auo_dsi_display.c

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 65e60d2..18bf236 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -42,6 +42,7 @@ i915-y := i915_drv.o i915_dma.o i915_irq.o \
 	  intel_opregion.o \
 	  intel_sideband.o \
 	  intel_uncore.o \
+	  auo_dsi_display.o \
 	  dvo_ch7xxx.o \
 	  dvo_ch7017.o \
 	  dvo_ivch.o \
diff --git a/drivers/gpu/drm/i915/auo_dsi_display.c b/drivers/gpu/drm/i915/auo_dsi_display.c
new file mode 100644
index 0000000..771a725
--- /dev/null
+++ b/drivers/gpu/drm/i915/auo_dsi_display.c
@@ -0,0 +1,182 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Author: Jani Nikula <jani.nikula at intel.com>
+ *	   Shobhit Kumar <shobhit.kumar at intel.com>
+ */
+
+#include <drm/drmP.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_edid.h>
+#include <drm/i915_drm.h>
+#include <linux/slab.h>
+#include <video/mipi_display.h>
+#include "i915_drv.h"
+#include "intel_drv.h"
+#include "intel_dsi.h"
+#include "intel_dsi_cmd.h"
+
+#if 0 /* XXX */
+static void auo_vid_get_panel_info(int pipe, struct drm_connector *connector)
+{
+	DRM_DEBUG_KMS("\n");
+	if (!connector)
+		return;
+
+	if (pipe == 0) {
+		connector->display_info.width_mm = 216;
+		connector->display_info.height_mm = 135;
+	}
+
+	return;
+}
+#endif
+
+static bool auo_init(struct intel_dsi_device *dsi)
+{
+	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
+
+	DRM_DEBUG_KMS("\n");
+
+	intel_dsi->eot_disable = 0;
+	intel_dsi->pixel_format = VID_MODE_FORMAT_RGB888;
+	intel_dsi->video_mode_format = VIDEO_MODE_NON_BURST_WITH_SYNC_PULSE;
+	intel_dsi->lane_count = 4;
+
+	return true;
+}
+
+static void auo_enable(struct intel_dsi_device *dsi)
+{
+	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
+
+	DRM_DEBUG_KMS("\n");
+
+	dsi_vc_dcs_write_0(intel_dsi, 0, MIPI_DCS_EXIT_SLEEP_MODE);
+
+	dsi_vc_dcs_write_1(intel_dsi, 0, MIPI_DCS_SET_TEAR_ON, 0x00);
+
+	dsi_vc_dcs_write_0(intel_dsi, 0, MIPI_DCS_SET_DISPLAY_ON);
+	dsi_vc_dcs_write_1(intel_dsi, 0, 0x14, 0x55);
+}
+
+static void auo_disable(struct intel_dsi_device *dsi)
+{
+	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
+
+	DRM_DEBUG_KMS("\n");
+
+	dsi_vc_dcs_write_0(intel_dsi, 0, MIPI_DCS_SET_DISPLAY_OFF);
+	dsi_vc_dcs_write_0(intel_dsi, 0, MIPI_DCS_ENTER_SLEEP_MODE);
+}
+
+static int auo_mode_valid(struct intel_dsi_device *dsi,
+			  struct drm_display_mode *mode)
+{
+	return MODE_OK;
+}
+
+static bool auo_mode_fixup(struct intel_dsi_device *dsi,
+			   const struct drm_display_mode *mode,
+			   struct drm_display_mode *adjusted_mode)
+{
+	return true;
+}
+
+static void auo_mode_set(struct intel_dsi_device *dsi,
+			 struct drm_display_mode *mode,
+			 struct drm_display_mode *adjusted_mode)
+{
+}
+
+static enum drm_connector_status auo_detect(struct intel_dsi_device *dsi)
+{
+	return connector_status_connected;
+}
+
+static bool auo_get_hw_state(struct intel_dsi_device *dev)
+{
+	return true;
+}
+
+static struct drm_display_mode *auo_get_modes(struct intel_dsi_device *dsi)
+{
+	struct drm_display_mode *mode = NULL;
+	u32 hblank = 0x78;
+	u32 vblank = 0x0C;
+	u32 hsync_offset = 0x28;
+	u32 hsync_width  = 0x28;
+	u32 vsync_offset = 0x4;
+	u32 vsync_width  = 0x4;
+
+	/* Allocate */
+	mode = kzalloc(sizeof(*mode), GFP_KERNEL);
+	if (!mode) {
+		DRM_DEBUG_KMS("AUO Panel: No memory\n");
+		return NULL;
+	}
+
+	/* Hardcode 1920x1200*/
+	strcpy(mode->name, "1920x1200");
+	mode->hdisplay = 0x780;
+	mode->vdisplay = 0x4B0;
+	mode->vrefresh = 60;
+	mode->clock =  148350;
+
+	/* Calculate */
+	mode->hsync_start = mode->hdisplay + hsync_offset;
+	mode->hsync_end = mode->hdisplay + hsync_offset
+		+ hsync_width;
+	mode->htotal = mode->hdisplay + hblank;
+	mode->vsync_start = mode->vdisplay + vsync_offset;
+	mode->vsync_end = mode->vdisplay + vsync_offset
+		+ vsync_width;
+	mode->vtotal = mode->vdisplay + vblank;
+
+	/* Configure */
+	mode->flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC;
+	mode->type |= DRM_MODE_TYPE_PREFERRED;
+	mode->status = MODE_OK;
+
+	return mode;
+}
+
+static void auo_destroy(struct intel_dsi_device *dsi)
+{
+}
+
+/* Callbacks. We might not need them all. */
+struct intel_dsi_dev_ops auo_dsi_display_ops = {
+	.init = auo_init,
+#if 0 /* XXX */
+	.get_info = auo_vid_get_panel_info,
+#endif
+	.enable = auo_enable,
+	.disable = auo_disable,
+	.mode_valid = auo_mode_valid,
+	.mode_fixup = auo_mode_fixup,
+	.mode_set = auo_mode_set,
+	.detect = auo_detect,
+	.get_hw_state = auo_get_hw_state,
+	.get_modes = auo_get_modes,
+	.destroy = auo_destroy,
+};
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index d28be01..a78f4f3 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -35,6 +35,11 @@
 
 /* the sub-encoders aka panel drivers */
 static const struct intel_dsi_device intel_dsi_devices[] = {
+	{
+		.type = INTEL_DSI_VIDEO_MODE,
+		.name = "auo-dsi-vid-mode-display",
+		.dev_ops = &auo_dsi_display_ops,
+	},
 };
 
 
diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h
index 0e0a212..05f5ba1 100644
--- a/drivers/gpu/drm/i915/intel_dsi.h
+++ b/drivers/gpu/drm/i915/intel_dsi.h
@@ -98,4 +98,7 @@ static inline struct intel_dsi *enc_to_intel_dsi(struct drm_encoder *encoder)
 
 extern void vlv_enable_dsi_pll(struct intel_encoder *encoder);
 
+/* the panel drivers */
+extern struct intel_dsi_dev_ops auo_dsi_display_ops;
+
 #endif /* _INTEL_DSI_H */
-- 
1.7.9.5




More information about the Intel-gfx mailing list