All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks
@ 2015-01-16 12:27 Jani Nikula
  2015-01-16 12:27 ` [RFC PATCH 01/12] drm/i915/dsi: call dpi_send_cmd() for each dsi port at a higher level Jani Nikula
                   ` (12 more replies)
  0 siblings, 13 replies; 45+ messages in thread
From: Jani Nikula @ 2015-01-16 12:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula, Shobhit Kumar, Thierry Reding

This series ports our DSI code over to the drm_panel and
mipi_dsi_host/mipi_dsi_device. There are some rough edges towards the
end of the series, see commit message for patch 8 for details.

Patches 1-6 are prep work, fairly independent

Patch 7 ports the driver over to drm_panel

Patches 8-10 port the driver over to mipi_dsi_host/device

Patches 11-12 do some additional cleanup

BR,
Jani.


Jani Nikula (12):
  drm/i915/dsi: call dpi_send_cmd() for each dsi port at a higher level
  drm/i915/dsi: set max return packet size for each dsi port
  drm/i915/dsi: move wait_for_dsi_fifo_empty to intel_dsi.c
  drm/i915/dsi: call wait_for_dsi_fifo_empty() for each dsi port
  drm/i915/dsi: remove unnecessary dsi device callbacks
  drm/i915/dsi: add some constness to vbt panel driver
  drm/i915/dsi: switch to drm_panel interface
  drm/i915/dsi: add drm mipi dsi host support
  drm/i915/dsi: make the vbt panel driver use mipi_dsi_device for
    transfers
  drm/i915/dsi: remove old read/write functions in favor of new stuff
  drm/i915/dsi: move dpi_send_cmd() to intel_dsi.c and make it static
  drm/i915/dsi: remove intel_dsi_cmd.c and the unused functions therein

 drivers/gpu/drm/i915/Kconfig               |   2 +
 drivers/gpu/drm/i915/Makefile              |   1 -
 drivers/gpu/drm/i915/intel_dsi.c           | 336 +++++++++++++++++-----
 drivers/gpu/drm/i915/intel_dsi.h           |  69 ++---
 drivers/gpu/drm/i915/intel_dsi_cmd.c       | 432 -----------------------------
 drivers/gpu/drm/i915/intel_dsi_cmd.h       |  78 ------
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 289 ++++++++++---------
 7 files changed, 441 insertions(+), 766 deletions(-)
 delete mode 100644 drivers/gpu/drm/i915/intel_dsi_cmd.c

-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [RFC PATCH 01/12] drm/i915/dsi: call dpi_send_cmd() for each dsi port at a higher level
  2015-01-16 12:27 [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks Jani Nikula
@ 2015-01-16 12:27 ` Jani Nikula
  2015-01-22  8:48   ` Shobhit Kumar
  2015-01-16 12:27 ` [RFC PATCH 02/12] drm/i915/dsi: set max return packet size for each dsi port Jani Nikula
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 45+ messages in thread
From: Jani Nikula @ 2015-01-16 12:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula, Shobhit Kumar, Thierry Reding

Instead of having the for each dsi port loop within dpi_send_cmd(), add
a port parameter to the function and call it for each port instead.

This is a rewrite of

commit 4510cd779e5897eeb8691aecbd639bb62ec27d55
Author: Gaurav K Singh <gaurav.k.singh@intel.com>
Date:   Thu Dec 4 10:58:51 2014 +0530

    drm/i915: Dual link needs Shutdown and Turn on packet for both ports

to add more flexibility in using dpi_send_cmd() for just one port as
necessary. No functional changes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_dsi.c     |  7 +++++--
 drivers/gpu/drm/i915/intel_dsi_cmd.c | 26 ++++++++++----------------
 drivers/gpu/drm/i915/intel_dsi_cmd.h |  2 +-
 3 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 42b6d6f5cecc..36b19c7e87b9 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -207,7 +207,8 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
 		I915_WRITE(MIPI_MAX_RETURN_PKT_SIZE(port), 8 * 4);
 	else {
 		msleep(20); /* XXX */
-		dpi_send_cmd(intel_dsi, TURN_ON, DPI_LP_MODE_EN);
+		for_each_dsi_port(port, intel_dsi->ports)
+			dpi_send_cmd(intel_dsi, TURN_ON, DPI_LP_MODE_EN, port);
 		msleep(100);
 
 		if (intel_dsi->dev.dev_ops->enable)
@@ -275,12 +276,14 @@ static void intel_dsi_enable_nop(struct intel_encoder *encoder)
 static void intel_dsi_pre_disable(struct intel_encoder *encoder)
 {
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
+	enum port port;
 
 	DRM_DEBUG_KMS("\n");
 
 	if (is_vid_mode(intel_dsi)) {
 		/* Send Shutdown command to the panel in LP mode */
-		dpi_send_cmd(intel_dsi, SHUTDOWN, DPI_LP_MODE_EN);
+		for_each_dsi_port(port, intel_dsi->ports)
+			dpi_send_cmd(intel_dsi, SHUTDOWN, DPI_LP_MODE_EN, port);
 		msleep(10);
 	}
 }
diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.c b/drivers/gpu/drm/i915/intel_dsi_cmd.c
index 562811c1a9d2..5f63c807acea 100644
--- a/drivers/gpu/drm/i915/intel_dsi_cmd.c
+++ b/drivers/gpu/drm/i915/intel_dsi_cmd.c
@@ -380,12 +380,11 @@ int dsi_vc_generic_read(struct intel_dsi *intel_dsi, int channel,
  *
  * XXX: commands with data in MIPI_DPI_DATA?
  */
-int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs)
+int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs, enum port port)
 {
 	struct drm_encoder *encoder = &intel_dsi->base.base;
 	struct drm_device *dev = encoder->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	enum port port;
 	u32 mask;
 
 	/* XXX: pipe, hs */
@@ -394,23 +393,18 @@ int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs)
 	else
 		cmd |= DPI_LP_MODE;
 
-	for_each_dsi_port(port, intel_dsi->ports) {
-		/* clear bit */
-		I915_WRITE(MIPI_INTR_STAT(port), SPL_PKT_SENT_INTERRUPT);
+	/* clear bit */
+	I915_WRITE(MIPI_INTR_STAT(port), SPL_PKT_SENT_INTERRUPT);
 
-		/* XXX: old code skips write if control unchanged */
-		if (cmd == I915_READ(MIPI_DPI_CONTROL(port)))
-			DRM_ERROR("Same special packet %02x twice in a row.\n",
-									cmd);
+	/* XXX: old code skips write if control unchanged */
+	if (cmd == I915_READ(MIPI_DPI_CONTROL(port)))
+		DRM_ERROR("Same special packet %02x twice in a row.\n", cmd);
 
-		I915_WRITE(MIPI_DPI_CONTROL(port), cmd);
+	I915_WRITE(MIPI_DPI_CONTROL(port), cmd);
 
-		mask = SPL_PKT_SENT_INTERRUPT;
-		if (wait_for((I915_READ(MIPI_INTR_STAT(port)) & mask) == mask,
-									100))
-			DRM_ERROR("Video mode command 0x%08x send failed.\n",
-									cmd);
-	}
+	mask = SPL_PKT_SENT_INTERRUPT;
+	if (wait_for((I915_READ(MIPI_INTR_STAT(port)) & mask) == mask, 100))
+		DRM_ERROR("Video mode command 0x%08x send failed.\n", cmd);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.h b/drivers/gpu/drm/i915/intel_dsi_cmd.h
index 326a5ac55561..1d1a716e473a 100644
--- a/drivers/gpu/drm/i915/intel_dsi_cmd.h
+++ b/drivers/gpu/drm/i915/intel_dsi_cmd.h
@@ -51,7 +51,7 @@ int dsi_vc_dcs_read(struct intel_dsi *intel_dsi, int channel, u8 dcs_cmd,
 int dsi_vc_generic_read(struct intel_dsi *intel_dsi, int channel,
 		u8 *reqdata, int reqlen, u8 *buf, int buflen, enum port port);
 
-int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs);
+int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs, enum port port);
 void wait_for_dsi_fifo_empty(struct intel_dsi *intel_dsi);
 
 /* XXX: questionable write helpers */
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [RFC PATCH 02/12] drm/i915/dsi: set max return packet size for each dsi port
  2015-01-16 12:27 [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks Jani Nikula
  2015-01-16 12:27 ` [RFC PATCH 01/12] drm/i915/dsi: call dpi_send_cmd() for each dsi port at a higher level Jani Nikula
@ 2015-01-16 12:27 ` Jani Nikula
  2015-01-22 10:53   ` Shobhit Kumar
  2015-01-22 13:01   ` [PATCH v2] " Jani Nikula
  2015-01-16 12:27 ` [RFC PATCH 03/12] drm/i915/dsi: move wait_for_dsi_fifo_empty to intel_dsi.c Jani Nikula
                   ` (10 subsequent siblings)
  12 siblings, 2 replies; 45+ messages in thread
From: Jani Nikula @ 2015-01-16 12:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula, Shobhit Kumar, Thierry Reding

This seems like the right thing to do. This also gets rid of a call to
intel_dsi_pipe_to_port() which we want to remove eventually.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_dsi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 36b19c7e87b9..49e186bc080f 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -197,14 +197,14 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
 {
 	struct drm_device *dev = encoder->base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
-	enum port port = intel_dsi_pipe_to_port(intel_crtc->pipe);
+	enum port port;
 
 	DRM_DEBUG_KMS("\n");
 
 	if (is_cmd_mode(intel_dsi))
-		I915_WRITE(MIPI_MAX_RETURN_PKT_SIZE(port), 8 * 4);
+		for_each_dsi_port(port, intel_dsi->ports)
+			I915_WRITE(MIPI_MAX_RETURN_PKT_SIZE(port), 8 * 4);
 	else {
 		msleep(20); /* XXX */
 		for_each_dsi_port(port, intel_dsi->ports)
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [RFC PATCH 03/12] drm/i915/dsi: move wait_for_dsi_fifo_empty to intel_dsi.c
  2015-01-16 12:27 [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks Jani Nikula
  2015-01-16 12:27 ` [RFC PATCH 01/12] drm/i915/dsi: call dpi_send_cmd() for each dsi port at a higher level Jani Nikula
  2015-01-16 12:27 ` [RFC PATCH 02/12] drm/i915/dsi: set max return packet size for each dsi port Jani Nikula
@ 2015-01-16 12:27 ` Jani Nikula
  2015-01-22  9:01   ` Shobhit Kumar
  2015-01-16 12:27 ` [RFC PATCH 04/12] drm/i915/dsi: call wait_for_dsi_fifo_empty() for each dsi port Jani Nikula
                   ` (9 subsequent siblings)
  12 siblings, 1 reply; 45+ messages in thread
From: Jani Nikula @ 2015-01-16 12:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula, Shobhit Kumar, Thierry Reding

wait_for_dsi_fifo_empty can be static in intel_dsi.c. No functional
changes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_dsi.c     | 16 ++++++++++++++++
 drivers/gpu/drm/i915/intel_dsi_cmd.c | 16 ----------------
 drivers/gpu/drm/i915/intel_dsi_cmd.h |  1 -
 3 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 49e186bc080f..e82cf5f65c9a 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -42,6 +42,22 @@ static const struct intel_dsi_device intel_dsi_devices[] = {
 	},
 };
 
+static void wait_for_dsi_fifo_empty(struct intel_dsi *intel_dsi)
+{
+	struct drm_encoder *encoder = &intel_dsi->base.base;
+	struct drm_device *dev = encoder->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
+	enum port port = intel_dsi_pipe_to_port(intel_crtc->pipe);
+	u32 mask;
+
+	mask = LP_CTRL_FIFO_EMPTY | HS_CTRL_FIFO_EMPTY |
+		LP_DATA_FIFO_EMPTY | HS_DATA_FIFO_EMPTY;
+
+	if (wait_for((I915_READ(MIPI_GEN_FIFO_STAT(port)) & mask) == mask, 100))
+		DRM_ERROR("DPI FIFOs are not empty\n");
+}
+
 static void band_gap_reset(struct drm_i915_private *dev_priv)
 {
 	mutex_lock(&dev_priv->dpio_lock);
diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.c b/drivers/gpu/drm/i915/intel_dsi_cmd.c
index 5f63c807acea..17b892a365ee 100644
--- a/drivers/gpu/drm/i915/intel_dsi_cmd.c
+++ b/drivers/gpu/drm/i915/intel_dsi_cmd.c
@@ -408,19 +408,3 @@ int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs, enum port port)
 
 	return 0;
 }
-
-void wait_for_dsi_fifo_empty(struct intel_dsi *intel_dsi)
-{
-	struct drm_encoder *encoder = &intel_dsi->base.base;
-	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
-	enum port port = intel_dsi_pipe_to_port(intel_crtc->pipe);
-	u32 mask;
-
-	mask = LP_CTRL_FIFO_EMPTY | HS_CTRL_FIFO_EMPTY |
-		LP_DATA_FIFO_EMPTY | HS_DATA_FIFO_EMPTY;
-
-	if (wait_for((I915_READ(MIPI_GEN_FIFO_STAT(port)) & mask) == mask, 100))
-		DRM_ERROR("DPI FIFOs are not empty\n");
-}
diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.h b/drivers/gpu/drm/i915/intel_dsi_cmd.h
index 1d1a716e473a..70f24666a1f9 100644
--- a/drivers/gpu/drm/i915/intel_dsi_cmd.h
+++ b/drivers/gpu/drm/i915/intel_dsi_cmd.h
@@ -52,7 +52,6 @@ int dsi_vc_generic_read(struct intel_dsi *intel_dsi, int channel,
 		u8 *reqdata, int reqlen, u8 *buf, int buflen, enum port port);
 
 int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs, enum port port);
-void wait_for_dsi_fifo_empty(struct intel_dsi *intel_dsi);
 
 /* XXX: questionable write helpers */
 static inline int dsi_vc_dcs_write_0(struct intel_dsi *intel_dsi,
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [RFC PATCH 04/12] drm/i915/dsi: call wait_for_dsi_fifo_empty() for each dsi port
  2015-01-16 12:27 [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks Jani Nikula
                   ` (2 preceding siblings ...)
  2015-01-16 12:27 ` [RFC PATCH 03/12] drm/i915/dsi: move wait_for_dsi_fifo_empty to intel_dsi.c Jani Nikula
@ 2015-01-16 12:27 ` Jani Nikula
  2015-01-22 10:55   ` Shobhit Kumar
  2015-01-16 12:27 ` [RFC PATCH 05/12] drm/i915/dsi: remove unnecessary dsi device callbacks Jani Nikula
                   ` (8 subsequent siblings)
  12 siblings, 1 reply; 45+ messages in thread
From: Jani Nikula @ 2015-01-16 12:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula, Shobhit Kumar, Thierry Reding

Add port parameter to wait_for_dsi_fifo_empty, and call it for each dsi
port.

We can now remove the transitional intel_dsi_pipe_to_port() function.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_dsi.c | 17 ++++++++++-------
 drivers/gpu/drm/i915/intel_dsi.h | 12 ------------
 2 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index e82cf5f65c9a..9b0eaa9db845 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -42,13 +42,11 @@ static const struct intel_dsi_device intel_dsi_devices[] = {
 	},
 };
 
-static void wait_for_dsi_fifo_empty(struct intel_dsi *intel_dsi)
+static void wait_for_dsi_fifo_empty(struct intel_dsi *intel_dsi, enum port port)
 {
 	struct drm_encoder *encoder = &intel_dsi->base.base;
 	struct drm_device *dev = encoder->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
-	enum port port = intel_dsi_pipe_to_port(intel_crtc->pipe);
 	u32 mask;
 
 	mask = LP_CTRL_FIFO_EMPTY | HS_CTRL_FIFO_EMPTY |
@@ -230,7 +228,8 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
 		if (intel_dsi->dev.dev_ops->enable)
 			intel_dsi->dev.dev_ops->enable(&intel_dsi->dev);
 
-		wait_for_dsi_fifo_empty(intel_dsi);
+		for_each_dsi_port(port, intel_dsi->ports)
+			wait_for_dsi_fifo_empty(intel_dsi, port);
 
 		intel_dsi_port_enable(encoder);
 	}
@@ -243,6 +242,7 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
 	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
 	enum pipe pipe = intel_crtc->pipe;
+	enum port port;
 	u32 tmp;
 
 	DRM_DEBUG_KMS("\n");
@@ -272,7 +272,8 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)
 	if (intel_dsi->dev.dev_ops->send_otp_cmds)
 		intel_dsi->dev.dev_ops->send_otp_cmds(&intel_dsi->dev);
 
-	wait_for_dsi_fifo_empty(intel_dsi);
+	for_each_dsi_port(port, intel_dsi->ports)
+		wait_for_dsi_fifo_empty(intel_dsi, port);
 
 	/* Enable port in pre-enable phase itself because as per hw team
 	 * recommendation, port should be enabled befor plane & pipe */
@@ -315,7 +316,8 @@ static void intel_dsi_disable(struct intel_encoder *encoder)
 	DRM_DEBUG_KMS("\n");
 
 	if (is_vid_mode(intel_dsi)) {
-		wait_for_dsi_fifo_empty(intel_dsi);
+		for_each_dsi_port(port, intel_dsi->ports)
+			wait_for_dsi_fifo_empty(intel_dsi, port);
 
 		intel_dsi_port_disable(encoder);
 		msleep(2);
@@ -344,7 +346,8 @@ static void intel_dsi_disable(struct intel_encoder *encoder)
 	if (intel_dsi->dev.dev_ops->disable)
 		intel_dsi->dev.dev_ops->disable(&intel_dsi->dev);
 
-	wait_for_dsi_fifo_empty(intel_dsi);
+	for_each_dsi_port(port, intel_dsi->ports)
+		wait_for_dsi_fifo_empty(intel_dsi, port);
 }
 
 static void intel_dsi_clear_device_ready(struct intel_encoder *encoder)
diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h
index 8fe2064dd804..2bb8c46c7889 100644
--- a/drivers/gpu/drm/i915/intel_dsi.h
+++ b/drivers/gpu/drm/i915/intel_dsi.h
@@ -137,18 +137,6 @@ struct intel_dsi {
 	u16 panel_pwr_cycle_delay;
 };
 
-/* XXX: Transitional before dual port configuration */
-static inline enum port intel_dsi_pipe_to_port(enum pipe pipe)
-{
-	if (pipe == PIPE_A)
-		return PORT_A;
-	else if (pipe == PIPE_B)
-		return PORT_C;
-
-	WARN(1, "DSI on pipe %c, assuming port C\n", pipe_name(pipe));
-	return PORT_C;
-}
-
 #define for_each_dsi_port(__port, __ports_mask) \
 	for ((__port) = PORT_A; (__port) < I915_MAX_PORTS; (__port)++)	\
 		if ((__ports_mask) & (1 << (__port)))
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [RFC PATCH 05/12] drm/i915/dsi: remove unnecessary dsi device callbacks
  2015-01-16 12:27 [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks Jani Nikula
                   ` (3 preceding siblings ...)
  2015-01-16 12:27 ` [RFC PATCH 04/12] drm/i915/dsi: call wait_for_dsi_fifo_empty() for each dsi port Jani Nikula
@ 2015-01-16 12:27 ` Jani Nikula
  2015-01-22 11:23   ` Shobhit Kumar
  2015-01-16 12:27 ` [RFC PATCH 06/12] drm/i915/dsi: add some constness to vbt panel driver Jani Nikula
                   ` (7 subsequent siblings)
  12 siblings, 1 reply; 45+ messages in thread
From: Jani Nikula @ 2015-01-16 12:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula, Shobhit Kumar, Thierry Reding

Remove all the trivial and/or dummy callbacks from intel dsi device
ops. Merge send_otp_cmds into panel_reset as they're called back to
back.

This will be helpful for switching to use drm_panel for the
callbacks. If we ever need the additional callbacks, we should add them
to drm_panel funcs.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_dsi.c           | 32 ++-------------------
 drivers/gpu/drm/i915/intel_dsi.h           | 20 -------------
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 45 ++----------------------------
 3 files changed, 5 insertions(+), 92 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 9b0eaa9db845..fc218b7754b3 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -70,12 +70,6 @@ static void band_gap_reset(struct drm_i915_private *dev_priv)
 	mutex_unlock(&dev_priv->dpio_lock);
 }
 
-static struct intel_dsi *intel_attached_dsi(struct drm_connector *connector)
-{
-	return container_of(intel_attached_encoder(connector),
-			    struct intel_dsi, base);
-}
-
 static inline bool is_vid_mode(struct intel_dsi *intel_dsi)
 {
 	return intel_dsi->operation_mode == INTEL_DSI_VIDEO_MODE;
@@ -99,7 +93,6 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
 	struct intel_connector *intel_connector = intel_dsi->attached_connector;
 	struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
 	struct drm_display_mode *adjusted_mode = &config->adjusted_mode;
-	struct drm_display_mode *mode = &config->requested_mode;
 
 	DRM_DEBUG_KMS("\n");
 
@@ -109,10 +102,6 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
 	/* DSI uses short packets for sync events, so clear mode flags for DSI */
 	adjusted_mode->flags = 0;
 
-	if (intel_dsi->dev.dev_ops->mode_fixup)
-		return intel_dsi->dev.dev_ops->mode_fixup(&intel_dsi->dev,
-							  mode, adjusted_mode);
-
 	return true;
 }
 
@@ -269,9 +258,6 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)
 	if (intel_dsi->dev.dev_ops->panel_reset)
 		intel_dsi->dev.dev_ops->panel_reset(&intel_dsi->dev);
 
-	if (intel_dsi->dev.dev_ops->send_otp_cmds)
-		intel_dsi->dev.dev_ops->send_otp_cmds(&intel_dsi->dev);
-
 	for_each_dsi_port(port, intel_dsi->ports)
 		wait_for_dsi_fifo_empty(intel_dsi, port);
 
@@ -484,7 +470,6 @@ intel_dsi_mode_valid(struct drm_connector *connector,
 {
 	struct intel_connector *intel_connector = to_intel_connector(connector);
 	struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
-	struct intel_dsi *intel_dsi = intel_attached_dsi(connector);
 
 	DRM_DEBUG_KMS("\n");
 
@@ -500,7 +485,7 @@ intel_dsi_mode_valid(struct drm_connector *connector,
 			return MODE_PANEL;
 	}
 
-	return intel_dsi->dev.dev_ops->mode_valid(&intel_dsi->dev, mode);
+	return MODE_OK;
 }
 
 /* return txclkesc cycles in terms of divider and duration in us */
@@ -749,20 +734,7 @@ static void intel_dsi_pre_pll_enable(struct intel_encoder *encoder)
 static enum drm_connector_status
 intel_dsi_detect(struct drm_connector *connector, bool force)
 {
-	struct intel_dsi *intel_dsi = intel_attached_dsi(connector);
-	struct intel_encoder *intel_encoder = &intel_dsi->base;
-	enum intel_display_power_domain power_domain;
-	enum drm_connector_status connector_status;
-	struct drm_i915_private *dev_priv = intel_encoder->base.dev->dev_private;
-
-	DRM_DEBUG_KMS("\n");
-	power_domain = intel_display_port_power_domain(intel_encoder);
-
-	intel_display_power_get(dev_priv, power_domain);
-	connector_status = intel_dsi->dev.dev_ops->detect(&intel_dsi->dev);
-	intel_display_power_put(dev_priv, power_domain);
-
-	return connector_status;
+	return connector_status_connected;
 }
 
 static int intel_dsi_get_modes(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h
index 2bb8c46c7889..22f87036a256 100644
--- a/drivers/gpu/drm/i915/intel_dsi.h
+++ b/drivers/gpu/drm/i915/intel_dsi.h
@@ -47,33 +47,13 @@ struct intel_dsi_dev_ops {
 
 	void (*disable_panel_power)(struct intel_dsi_device *dsi);
 
-	/* one time programmable commands if needed */
-	void (*send_otp_cmds)(struct intel_dsi_device *dsi);
-
 	/* This callback must be able to assume DSI commands can be sent */
 	void (*enable)(struct intel_dsi_device *dsi);
 
 	/* This callback must be able to assume DSI commands can be sent */
 	void (*disable)(struct intel_dsi_device *dsi);
 
-	int (*mode_valid)(struct intel_dsi_device *dsi,
-			  struct drm_display_mode *mode);
-
-	bool (*mode_fixup)(struct intel_dsi_device *dsi,
-			   const struct drm_display_mode *mode,
-			   struct drm_display_mode *adjusted_mode);
-
-	void (*mode_set)(struct intel_dsi_device *dsi,
-			 struct drm_display_mode *mode,
-			 struct drm_display_mode *adjusted_mode);
-
-	enum drm_connector_status (*detect)(struct intel_dsi_device *dsi);
-
-	bool (*get_hw_state)(struct intel_dsi_device *dev);
-
 	struct drm_display_mode *(*get_modes)(struct intel_dsi_device *dsi);
-
-	void (*destroy) (struct intel_dsi_device *dsi);
 };
 
 struct intel_dsi {
diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
index 5493aef5a6a3..b0e7327a485f 100644
--- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
+++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
@@ -559,18 +559,6 @@ static bool generic_init(struct intel_dsi_device *dsi)
 	return true;
 }
 
-static int generic_mode_valid(struct intel_dsi_device *dsi,
-		   struct drm_display_mode *mode)
-{
-	return MODE_OK;
-}
-
-static bool generic_mode_fixup(struct intel_dsi_device *dsi,
-		    const struct drm_display_mode *mode,
-		    struct drm_display_mode *adjusted_mode) {
-	return true;
-}
-
 static void generic_panel_reset(struct intel_dsi_device *dsi)
 {
 	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
@@ -580,26 +568,18 @@ static void generic_panel_reset(struct intel_dsi_device *dsi)
 	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_ASSERT_RESET];
 
 	generic_exec_sequence(intel_dsi, sequence);
-}
-
-static void generic_disable_panel_power(struct intel_dsi_device *dsi)
-{
-	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
-	struct drm_device *dev = intel_dsi->base.base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-
-	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET];
 
+	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP];
 	generic_exec_sequence(intel_dsi, sequence);
 }
 
-static void generic_send_otp_cmds(struct intel_dsi_device *dsi)
+static void generic_disable_panel_power(struct intel_dsi_device *dsi)
 {
 	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
 	struct drm_device *dev = intel_dsi->base.base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP];
+	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET];
 
 	generic_exec_sequence(intel_dsi, sequence);
 }
@@ -626,16 +606,6 @@ static void generic_disable(struct intel_dsi_device *dsi)
 	generic_exec_sequence(intel_dsi, sequence);
 }
 
-static enum drm_connector_status generic_detect(struct intel_dsi_device *dsi)
-{
-	return connector_status_connected;
-}
-
-static bool generic_get_hw_state(struct intel_dsi_device *dev)
-{
-	return true;
-}
-
 static struct drm_display_mode *generic_get_modes(struct intel_dsi_device *dsi)
 {
 	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
@@ -646,20 +616,11 @@ static struct drm_display_mode *generic_get_modes(struct intel_dsi_device *dsi)
 	return dev_priv->vbt.lfp_lvds_vbt_mode;
 }
 
-static void generic_destroy(struct intel_dsi_device *dsi) { }
-
-/* Callbacks. We might not need them all. */
 struct intel_dsi_dev_ops vbt_generic_dsi_display_ops = {
 	.init = generic_init,
-	.mode_valid = generic_mode_valid,
-	.mode_fixup = generic_mode_fixup,
 	.panel_reset = generic_panel_reset,
 	.disable_panel_power = generic_disable_panel_power,
-	.send_otp_cmds = generic_send_otp_cmds,
 	.enable = generic_enable,
 	.disable = generic_disable,
-	.detect = generic_detect,
-	.get_hw_state = generic_get_hw_state,
 	.get_modes = generic_get_modes,
-	.destroy = generic_destroy,
 };
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [RFC PATCH 06/12] drm/i915/dsi: add some constness to vbt panel driver
  2015-01-16 12:27 [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks Jani Nikula
                   ` (4 preceding siblings ...)
  2015-01-16 12:27 ` [RFC PATCH 05/12] drm/i915/dsi: remove unnecessary dsi device callbacks Jani Nikula
@ 2015-01-16 12:27 ` Jani Nikula
  2015-01-22 11:25   ` Shobhit Kumar
  2015-01-16 12:27 ` [RFC PATCH 07/12] drm/i915/dsi: switch to drm_panel interface Jani Nikula
                   ` (6 subsequent siblings)
  12 siblings, 1 reply; 45+ messages in thread
From: Jani Nikula @ 2015-01-16 12:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula, Shobhit Kumar, Thierry Reding

Const is good for you. No functional changes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
index b0e7327a485f..561ec2981dfd 100644
--- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
+++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
@@ -99,7 +99,8 @@ static inline enum port intel_dsi_seq_port_to_port(u8 port)
 	return port ? PORT_C : PORT_A;
 }
 
-static u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi, u8 *data)
+static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi,
+				       const u8 *data)
 {
 	u8 type, byte, mode, vc, seq_port;
 	u16 len;
@@ -165,9 +166,9 @@ static u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi, u8 *data)
 	return data;
 }
 
-static u8 *mipi_exec_delay(struct intel_dsi *intel_dsi, u8 *data)
+static const u8 *mipi_exec_delay(struct intel_dsi *intel_dsi, const u8 *data)
 {
-	u32 delay = *((u32 *) data);
+	u32 delay = *((const u32 *) data);
 
 	usleep_range(delay, delay + 10);
 	data += 4;
@@ -175,7 +176,7 @@ static u8 *mipi_exec_delay(struct intel_dsi *intel_dsi, u8 *data)
 	return data;
 }
 
-static u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, u8 *data)
+static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
 {
 	u8 gpio, action;
 	u16 function, pad;
@@ -208,7 +209,8 @@ static u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, u8 *data)
 	return data;
 }
 
-typedef u8 * (*fn_mipi_elem_exec)(struct intel_dsi *intel_dsi, u8 *data);
+typedef const u8 * (*fn_mipi_elem_exec)(struct intel_dsi *intel_dsi,
+					const u8 *data);
 static const fn_mipi_elem_exec exec_elem[] = {
 	NULL, /* reserved */
 	mipi_exec_send_packet,
@@ -232,13 +234,12 @@ static const char * const seq_name[] = {
 	"MIPI_SEQ_DEASSERT_RESET"
 };
 
-static void generic_exec_sequence(struct intel_dsi *intel_dsi, char *sequence)
+static void generic_exec_sequence(struct intel_dsi *intel_dsi, const u8 *data)
 {
-	u8 *data = sequence;
 	fn_mipi_elem_exec mipi_elem_exec;
 	int index;
 
-	if (!sequence)
+	if (!data)
 		return;
 
 	DRM_DEBUG_DRIVER("Starting MIPI sequence - %s\n", seq_name[*data]);
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [RFC PATCH 07/12] drm/i915/dsi: switch to drm_panel interface
  2015-01-16 12:27 [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks Jani Nikula
                   ` (5 preceding siblings ...)
  2015-01-16 12:27 ` [RFC PATCH 06/12] drm/i915/dsi: add some constness to vbt panel driver Jani Nikula
@ 2015-01-16 12:27 ` Jani Nikula
  2015-01-23 10:57   ` Shobhit Kumar
  2015-01-23 13:30   ` [PATCH v2] " Jani Nikula
  2015-01-16 12:27 ` [RFC PATCH 08/12] drm/i915/dsi: add drm mipi dsi host support Jani Nikula
                   ` (5 subsequent siblings)
  12 siblings, 2 replies; 45+ messages in thread
From: Jani Nikula @ 2015-01-16 12:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula, Shobhit Kumar, Thierry Reding

Replace intel_dsi_device and intel_dsi_dev_ops with drm_panel and
drm_panel_funcs. They are adequate for what we have now, and if we end
up needing more than this we should improve drm_panel. This will keep us
better aligned with the drm core infrastructure.

The panel driver initialization changes a bit. It still remains hideous,
but fixing that is beyond the scope here.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/Kconfig               |   1 +
 drivers/gpu/drm/i915/intel_dsi.c           |  68 +++++++----
 drivers/gpu/drm/i915/intel_dsi.h           |  27 +----
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 179 ++++++++++++++++++-----------
 4 files changed, 156 insertions(+), 119 deletions(-)

diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig
index 4e39ab34eb1c..da196cd07263 100644
--- a/drivers/gpu/drm/i915/Kconfig
+++ b/drivers/gpu/drm/i915/Kconfig
@@ -11,6 +11,7 @@ config DRM_I915
 	select SHMEM
 	select TMPFS
 	select DRM_KMS_HELPER
+	select DRM_PANEL
 	# i915 depends on ACPI_VIDEO when ACPI is enabled
 	# but for select to work, need to select ACPI_VIDEO's dependencies, ick
 	select BACKLIGHT_LCD_SUPPORT if ACPI
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index fc218b7754b3..19a9955eab0e 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -27,18 +27,20 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_edid.h>
 #include <drm/i915_drm.h>
+#include <drm/drm_panel.h>
 #include <linux/slab.h>
 #include "i915_drv.h"
 #include "intel_drv.h"
 #include "intel_dsi.h"
 #include "intel_dsi_cmd.h"
 
-/* the sub-encoders aka panel drivers */
-static const struct intel_dsi_device intel_dsi_devices[] = {
+static const struct {
+	u16 panel_id;
+	struct drm_panel * (*init)(struct intel_dsi *intel_dsi, u16 panel_id);
+} intel_dsi_drivers[] = {
 	{
 		.panel_id = MIPI_DSI_GENERIC_PANEL_ID,
-		.name = "vbt-generic-dsi-vid-mode-display",
-		.dev_ops = &vbt_generic_dsi_display_ops,
+		.init = vbt_panel_init,
 	},
 };
 
@@ -214,8 +216,7 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
 			dpi_send_cmd(intel_dsi, TURN_ON, DPI_LP_MODE_EN, port);
 		msleep(100);
 
-		if (intel_dsi->dev.dev_ops->enable)
-			intel_dsi->dev.dev_ops->enable(&intel_dsi->dev);
+		drm_panel_enable(intel_dsi->panel);
 
 		for_each_dsi_port(port, intel_dsi->ports)
 			wait_for_dsi_fifo_empty(intel_dsi, port);
@@ -255,8 +256,7 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)
 
 	msleep(intel_dsi->panel_on_delay);
 
-	if (intel_dsi->dev.dev_ops->panel_reset)
-		intel_dsi->dev.dev_ops->panel_reset(&intel_dsi->dev);
+	drm_panel_prepare(intel_dsi->panel);
 
 	for_each_dsi_port(port, intel_dsi->ports)
 		wait_for_dsi_fifo_empty(intel_dsi, port);
@@ -329,8 +329,7 @@ static void intel_dsi_disable(struct intel_encoder *encoder)
 	}
 	/* if disable packets are sent before sending shutdown packet then in
 	 * some next enable sequence send turn on packet error is observed */
-	if (intel_dsi->dev.dev_ops->disable)
-		intel_dsi->dev.dev_ops->disable(&intel_dsi->dev);
+	drm_panel_disable(intel_dsi->panel);
 
 	for_each_dsi_port(port, intel_dsi->ports)
 		wait_for_dsi_fifo_empty(intel_dsi, port);
@@ -395,8 +394,7 @@ static void intel_dsi_post_disable(struct intel_encoder *encoder)
 	val &= ~DPOUNIT_CLOCK_GATE_DISABLE;
 	I915_WRITE(DSPCLK_GATE_D, val);
 
-	if (intel_dsi->dev.dev_ops->disable_panel_power)
-		intel_dsi->dev.dev_ops->disable_panel_power(&intel_dsi->dev);
+	drm_panel_unprepare(intel_dsi->panel);
 
 	msleep(intel_dsi->panel_off_delay);
 	msleep(intel_dsi->panel_pwr_cycle_delay);
@@ -760,7 +758,7 @@ static int intel_dsi_get_modes(struct drm_connector *connector)
 	return 1;
 }
 
-static void intel_dsi_destroy(struct drm_connector *connector)
+static void intel_dsi_connector_destroy(struct drm_connector *connector)
 {
 	struct intel_connector *intel_connector = to_intel_connector(connector);
 
@@ -770,8 +768,20 @@ static void intel_dsi_destroy(struct drm_connector *connector)
 	kfree(connector);
 }
 
+static void intel_dsi_encoder_destroy(struct drm_encoder *encoder)
+{
+	struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
+
+	if (intel_dsi->panel) {
+		drm_panel_detach(intel_dsi->panel);
+		/* XXX: Logically this call belongs in the panel driver. */
+		drm_panel_remove(intel_dsi->panel);
+	}
+	intel_encoder_destroy(encoder);
+}
+
 static const struct drm_encoder_funcs intel_dsi_funcs = {
-	.destroy = intel_encoder_destroy,
+	.destroy = intel_dsi_encoder_destroy,
 };
 
 static const struct drm_connector_helper_funcs intel_dsi_connector_helper_funcs = {
@@ -783,7 +793,7 @@ static const struct drm_connector_helper_funcs intel_dsi_connector_helper_funcs
 static const struct drm_connector_funcs intel_dsi_connector_funcs = {
 	.dpms = intel_connector_dpms,
 	.detect = intel_dsi_detect,
-	.destroy = intel_dsi_destroy,
+	.destroy = intel_dsi_connector_destroy,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 };
 
@@ -794,9 +804,8 @@ void intel_dsi_init(struct drm_device *dev)
 	struct drm_encoder *encoder;
 	struct intel_connector *intel_connector;
 	struct drm_connector *connector;
-	struct drm_display_mode *fixed_mode = NULL;
+	struct drm_display_mode *scan, *fixed_mode = NULL;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	const struct intel_dsi_device *dsi;
 	unsigned int i;
 
 	DRM_DEBUG_KMS("\n");
@@ -853,15 +862,14 @@ void intel_dsi_init(struct drm_device *dev)
 		intel_dsi->ports = (1 << PORT_C);
 	}
 
-	for (i = 0; i < ARRAY_SIZE(intel_dsi_devices); i++) {
-		dsi = &intel_dsi_devices[i];
-		intel_dsi->dev = *dsi;
-
-		if (dsi->dev_ops->init(&intel_dsi->dev))
+	for (i = 0; i < ARRAY_SIZE(intel_dsi_drivers); i++) {
+		intel_dsi->panel = intel_dsi_drivers[i].init(intel_dsi,
+							     intel_dsi_drivers[i].panel_id);
+		if (intel_dsi->panel)
 			break;
 	}
 
-	if (i == ARRAY_SIZE(intel_dsi_devices)) {
+	if (!intel_dsi->panel) {
 		DRM_DEBUG_KMS("no device found\n");
 		goto err;
 	}
@@ -881,13 +889,23 @@ void intel_dsi_init(struct drm_device *dev)
 
 	drm_connector_register(connector);
 
-	fixed_mode = dsi->dev_ops->get_modes(&intel_dsi->dev);
+	drm_panel_attach(intel_dsi->panel, connector);
+	drm_panel_get_modes(intel_dsi->panel);
+
+	mutex_lock(&dev->mode_config.mutex);
+	list_for_each_entry(scan, &connector->probed_modes, head) {
+		if ((scan->type & DRM_MODE_TYPE_PREFERRED)) {
+			fixed_mode = drm_mode_duplicate(dev, scan);
+			break;
+		}
+	}
+	mutex_unlock(&dev->mode_config.mutex);
+
 	if (!fixed_mode) {
 		DRM_DEBUG_KMS("no fixed mode\n");
 		goto err;
 	}
 
-	fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
 	intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
 
 	return;
diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h
index 22f87036a256..fc0b2b8d90f1 100644
--- a/drivers/gpu/drm/i915/intel_dsi.h
+++ b/drivers/gpu/drm/i915/intel_dsi.h
@@ -33,33 +33,10 @@
 #define DSI_DUAL_LINK_FRONT_BACK	1
 #define DSI_DUAL_LINK_PIXEL_ALT		2
 
-struct intel_dsi_device {
-	unsigned int panel_id;
-	const char *name;
-	const struct intel_dsi_dev_ops *dev_ops;
-	void *dev_priv;
-};
-
-struct intel_dsi_dev_ops {
-	bool (*init)(struct intel_dsi_device *dsi);
-
-	void (*panel_reset)(struct intel_dsi_device *dsi);
-
-	void (*disable_panel_power)(struct intel_dsi_device *dsi);
-
-	/* This callback must be able to assume DSI commands can be sent */
-	void (*enable)(struct intel_dsi_device *dsi);
-
-	/* This callback must be able to assume DSI commands can be sent */
-	void (*disable)(struct intel_dsi_device *dsi);
-
-	struct drm_display_mode *(*get_modes)(struct intel_dsi_device *dsi);
-};
-
 struct intel_dsi {
 	struct intel_encoder base;
 
-	struct intel_dsi_device dev;
+	struct drm_panel *panel;
 
 	struct intel_connector *attached_connector;
 
@@ -130,6 +107,6 @@ extern void vlv_enable_dsi_pll(struct intel_encoder *encoder);
 extern void vlv_disable_dsi_pll(struct intel_encoder *encoder);
 extern u32 vlv_get_dsi_pclk(struct intel_encoder *encoder, int pipe_bpp);
 
-extern struct intel_dsi_dev_ops vbt_generic_dsi_display_ops;
+struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id);
 
 #endif /* _INTEL_DSI_H */
diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
index 561ec2981dfd..204f54df8fe1 100644
--- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
+++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
@@ -28,6 +28,7 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_edid.h>
 #include <drm/i915_drm.h>
+#include <drm/drm_panel.h>
 #include <linux/slab.h>
 #include <video/mipi_display.h>
 #include <asm/intel-mid.h>
@@ -37,6 +38,16 @@
 #include "intel_dsi.h"
 #include "intel_dsi_cmd.h"
 
+struct vbt_panel {
+	struct drm_panel panel;
+	struct intel_dsi *intel_dsi;
+};
+
+static inline struct vbt_panel *to_vbt_panel(struct drm_panel *panel)
+{
+	return container_of(panel, struct vbt_panel, panel);
+}
+
 #define MIPI_TRANSFER_MODE_SHIFT	0
 #define MIPI_VIRTUAL_CHANNEL_SHIFT	1
 #define MIPI_PORT_SHIFT			3
@@ -272,14 +283,103 @@ static void generic_exec_sequence(struct intel_dsi *intel_dsi, const u8 *data)
 	}
 }
 
-static bool generic_init(struct intel_dsi_device *dsi)
+static int vbt_panel_prepare(struct drm_panel *panel)
+{
+	struct vbt_panel *vbt_panel = to_vbt_panel(panel);
+	struct intel_dsi *intel_dsi = vbt_panel->intel_dsi;
+	struct drm_device *dev = intel_dsi->base.base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	const u8 *sequence;
+
+	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_ASSERT_RESET];
+	generic_exec_sequence(intel_dsi, sequence);
+
+	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP];
+	generic_exec_sequence(intel_dsi, sequence);
+
+	return 0;
+}
+
+static int vbt_panel_unprepare(struct drm_panel *panel)
+{
+	struct vbt_panel *vbt_panel = to_vbt_panel(panel);
+	struct intel_dsi *intel_dsi = vbt_panel->intel_dsi;
+	struct drm_device *dev = intel_dsi->base.base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	const u8 *sequence;
+
+	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET];
+	generic_exec_sequence(intel_dsi, sequence);
+
+	return 0;
+}
+
+static int vbt_panel_enable(struct drm_panel *panel)
+{
+	struct vbt_panel *vbt_panel = to_vbt_panel(panel);
+	struct intel_dsi *intel_dsi = vbt_panel->intel_dsi;
+	struct drm_device *dev = intel_dsi->base.base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	const u8 *sequence;
+
+	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DISPLAY_ON];
+	generic_exec_sequence(intel_dsi, sequence);
+
+	return 0;
+}
+
+static int vbt_panel_disable(struct drm_panel *panel)
+{
+	struct vbt_panel *vbt_panel = to_vbt_panel(panel);
+	struct intel_dsi *intel_dsi = vbt_panel->intel_dsi;
+	struct drm_device *dev = intel_dsi->base.base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	const u8 *sequence;
+
+	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DISPLAY_OFF];
+	generic_exec_sequence(intel_dsi, sequence);
+
+	return 0;
+}
+
+static int vbt_panel_get_modes(struct drm_panel *panel)
+{
+	struct vbt_panel *vbt_panel = to_vbt_panel(panel);
+	struct intel_dsi *intel_dsi = vbt_panel->intel_dsi;
+	struct drm_device *dev = intel_dsi->base.base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_display_mode *mode;
+
+	if (!panel->connector)
+		return 0;
+
+	mode = drm_mode_duplicate(dev, dev_priv->vbt.lfp_lvds_vbt_mode);
+	if (!mode)
+		return 0;
+
+	mode->type |= DRM_MODE_TYPE_PREFERRED;
+
+	drm_mode_probed_add(panel->connector, mode);
+
+	return 1;
+}
+
+static const struct drm_panel_funcs vbt_panel_funcs = {
+	.disable = vbt_panel_disable,
+	.unprepare = vbt_panel_unprepare,
+	.prepare = vbt_panel_prepare,
+	.enable = vbt_panel_enable,
+	.get_modes = vbt_panel_get_modes,
+};
+
+struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
 {
-	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
 	struct drm_device *dev = intel_dsi->base.base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct mipi_config *mipi_config = dev_priv->vbt.dsi.config;
 	struct mipi_pps_data *pps = dev_priv->vbt.dsi.pps;
 	struct drm_display_mode *mode = dev_priv->vbt.lfp_lvds_vbt_mode;
+	struct vbt_panel *vbt_panel;
 	u32 bits_per_pixel = 24;
 	u32 tlpx_ns, extra_byte_count, bitrate, tlpx_ui;
 	u32 ui_num, ui_den;
@@ -346,7 +446,7 @@ static bool generic_init(struct intel_dsi_device *dsi)
 			if (mipi_config->target_burst_mode_freq <
 								computed_ddr) {
 				DRM_ERROR("Burst mode freq is less than computed\n");
-				return false;
+				return NULL;
 			}
 
 			burst_mode_ratio = DIV_ROUND_UP(
@@ -356,7 +456,7 @@ static bool generic_init(struct intel_dsi_device *dsi)
 			pclk = DIV_ROUND_UP(pclk * burst_mode_ratio, 100);
 		} else {
 			DRM_ERROR("Burst mode target is not set\n");
-			return false;
+			return NULL;
 		}
 	} else
 		burst_mode_ratio = 100;
@@ -557,71 +657,12 @@ static bool generic_init(struct intel_dsi_device *dsi)
 	intel_dsi->panel_off_delay = pps->panel_off_delay / 10;
 	intel_dsi->panel_pwr_cycle_delay = pps->panel_power_cycle_delay / 10;
 
-	return true;
-}
-
-static void generic_panel_reset(struct intel_dsi_device *dsi)
-{
-	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
-	struct drm_device *dev = intel_dsi->base.base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-
-	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_ASSERT_RESET];
-
-	generic_exec_sequence(intel_dsi, sequence);
-
-	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP];
-	generic_exec_sequence(intel_dsi, sequence);
-}
-
-static void generic_disable_panel_power(struct intel_dsi_device *dsi)
-{
-	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
-	struct drm_device *dev = intel_dsi->base.base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-
-	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET];
-
-	generic_exec_sequence(intel_dsi, sequence);
-}
-
-static void generic_enable(struct intel_dsi_device *dsi)
-{
-	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
-	struct drm_device *dev = intel_dsi->base.base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	/* This is cheating a bit with the cleanup. */
+	vbt_panel = devm_kzalloc(dev->dev, sizeof(*vbt_panel), GFP_KERNEL);
 
-	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DISPLAY_ON];
+	drm_panel_init(&vbt_panel->panel);
+	vbt_panel->panel.funcs = &vbt_panel_funcs;
+	drm_panel_add(&vbt_panel->panel);
 
-	generic_exec_sequence(intel_dsi, sequence);
+	return &vbt_panel->panel;
 }
-
-static void generic_disable(struct intel_dsi_device *dsi)
-{
-	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
-	struct drm_device *dev = intel_dsi->base.base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-
-	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DISPLAY_OFF];
-
-	generic_exec_sequence(intel_dsi, sequence);
-}
-
-static struct drm_display_mode *generic_get_modes(struct intel_dsi_device *dsi)
-{
-	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
-	struct drm_device *dev = intel_dsi->base.base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-
-	dev_priv->vbt.lfp_lvds_vbt_mode->type |= DRM_MODE_TYPE_PREFERRED;
-	return dev_priv->vbt.lfp_lvds_vbt_mode;
-}
-
-struct intel_dsi_dev_ops vbt_generic_dsi_display_ops = {
-	.init = generic_init,
-	.panel_reset = generic_panel_reset,
-	.disable_panel_power = generic_disable_panel_power,
-	.enable = generic_enable,
-	.disable = generic_disable,
-	.get_modes = generic_get_modes,
-};
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [RFC PATCH 08/12] drm/i915/dsi: add drm mipi dsi host support
  2015-01-16 12:27 [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks Jani Nikula
                   ` (6 preceding siblings ...)
  2015-01-16 12:27 ` [RFC PATCH 07/12] drm/i915/dsi: switch to drm_panel interface Jani Nikula
@ 2015-01-16 12:27 ` Jani Nikula
  2015-01-23 12:21   ` Shobhit Kumar
  2015-01-16 12:27 ` [RFC PATCH 09/12] drm/i915/dsi: make the vbt panel driver use mipi_dsi_device for transfers Jani Nikula
                   ` (4 subsequent siblings)
  12 siblings, 1 reply; 45+ messages in thread
From: Jani Nikula @ 2015-01-16 12:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula, Shobhit Kumar, Thierry Reding

Add basic support for using the drm mipi dsi framework for DSI. We don't
use device tree which is pretty much required by mipi_dsi_host_register
and friends, and we don't have the kind of device model the functions
expect either. So we cheat and use it as a library to abstract what we
need: a nice, clean interface for DSI transfers. This means we will have
to be careful with what functions we call, as the driver model devices
in mipi_dsi_host and mipi_dsi_device will *not* be initialized.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/Kconfig               |   1 +
 drivers/gpu/drm/i915/intel_dsi.c           | 162 ++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/intel_dsi.h           |  18 ++++
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c |   3 -
 4 files changed, 180 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig
index da196cd07263..74acca9bcd9d 100644
--- a/drivers/gpu/drm/i915/Kconfig
+++ b/drivers/gpu/drm/i915/Kconfig
@@ -12,6 +12,7 @@ config DRM_I915
 	select TMPFS
 	select DRM_KMS_HELPER
 	select DRM_PANEL
+	select DRM_MIPI_DSI
 	# i915 depends on ACPI_VIDEO when ACPI is enabled
 	# but for select to work, need to select ACPI_VIDEO's dependencies, ick
 	select BACKLIGHT_LCD_SUPPORT if ACPI
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 19a9955eab0e..5cfa3431785a 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -28,6 +28,7 @@
 #include <drm/drm_edid.h>
 #include <drm/i915_drm.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_mipi_dsi.h>
 #include <linux/slab.h>
 #include "i915_drv.h"
 #include "intel_drv.h"
@@ -58,6 +59,149 @@ static void wait_for_dsi_fifo_empty(struct intel_dsi *intel_dsi, enum port port)
 		DRM_ERROR("DPI FIFOs are not empty\n");
 }
 
+static void write_data(struct drm_i915_private *dev_priv, u32 reg,
+		       const u8 *data, u32 len)
+{
+	u32 i, j;
+
+	for (i = 0; i < len; i += 4) {
+		u32 val = 0;
+
+		for (j = 0; j < min_t(u32, len - i, 4); j++)
+			val |= *data++ << 8 * j;
+
+		I915_WRITE(reg, val);
+	}
+}
+
+static void read_data(struct drm_i915_private *dev_priv, u32 reg,
+		      u8 *data, u32 len)
+{
+	u32 i, j;
+
+	for (i = 0; i < len; i += 4) {
+		u32 val = I915_READ(reg);
+
+		for (j = 0; j < min_t(u32, len - i, 4); j++)
+			*data++ = val >> 8 * j;
+	}
+}
+
+static ssize_t intel_dsi_host_transfer(struct mipi_dsi_host *host,
+				       const struct mipi_dsi_msg *msg)
+{
+	struct intel_dsi_host *intel_dsi_host = to_intel_dsi_host(host);
+	struct drm_device *dev = intel_dsi_host->intel_dsi->base.base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	enum port port = intel_dsi_host->port;
+	struct mipi_dsi_packet packet;
+	ssize_t ret;
+	const u8 *header, *data;
+	u32 data_reg, data_mask, ctrl_reg, ctrl_mask;
+
+	ret = mipi_dsi_create_packet(&packet, msg);
+	if (ret < 0)
+		return ret;
+
+	header = packet.header;
+	data = packet.payload;
+
+	if (msg->flags & MIPI_DSI_MSG_USE_LPM) {
+		data_reg = MIPI_LP_GEN_DATA(port);
+		data_mask = LP_DATA_FIFO_FULL;
+		ctrl_reg = MIPI_LP_GEN_CTRL(port);
+		ctrl_mask = LP_CTRL_FIFO_FULL;
+	} else {
+		data_reg = MIPI_HS_GEN_DATA(port);
+		data_mask = HS_DATA_FIFO_FULL;
+		ctrl_reg = MIPI_HS_GEN_CTRL(port);
+		ctrl_mask = HS_CTRL_FIFO_FULL;
+	}
+
+	/* note: this is never true for reads */
+	if (packet.payload_length) {
+
+		if (wait_for((I915_READ(MIPI_GEN_FIFO_STAT(port)) & data_mask) == 0, 50))
+			DRM_ERROR("Timeout waiting for HS/LP DATA FIFO !full\n");
+
+		write_data(dev_priv, data_reg, packet.payload,
+			   packet.payload_length);
+	}
+
+	if (msg->rx_len) {
+		I915_WRITE(MIPI_INTR_STAT(port), GEN_READ_DATA_AVAIL);
+	}
+
+	if (wait_for((I915_READ(MIPI_GEN_FIFO_STAT(port)) & ctrl_mask) == 0, 50)) {
+		DRM_ERROR("Timeout waiting for HS/LP CTRL FIFO !full\n");
+	}
+
+	I915_WRITE(ctrl_reg, header[2] << 16 | header[1] << 8 | header[0]);
+
+	/* ->rx_len is set only for reads */
+	if (msg->rx_len) {
+		data_mask = GEN_READ_DATA_AVAIL;
+		if (wait_for((I915_READ(MIPI_INTR_STAT(port)) & data_mask) == data_mask, 50))
+			DRM_ERROR("Timeout waiting for read data.\n");
+
+		read_data(dev_priv, data_reg, msg->rx_buf, msg->rx_len);
+	}
+
+	/* XXX: fix for reads and writes */
+	return 4 + packet.payload_length;
+}
+
+static int intel_dsi_host_attach(struct mipi_dsi_host *host,
+				 struct mipi_dsi_device *dsi)
+{
+	return 0;
+}
+
+static int intel_dsi_host_detach(struct mipi_dsi_host *host,
+				 struct mipi_dsi_device *dsi)
+{
+	return 0;
+}
+
+static const struct mipi_dsi_host_ops intel_dsi_host_ops = {
+	.attach = intel_dsi_host_attach,
+	.detach = intel_dsi_host_detach,
+	.transfer = intel_dsi_host_transfer,
+};
+
+static struct intel_dsi_host *intel_dsi_host_init(struct intel_dsi *intel_dsi,
+						  enum port port)
+{
+	struct intel_dsi_host *host;
+	struct mipi_dsi_device *device;
+
+	host = kzalloc(sizeof(*host), GFP_KERNEL);
+	if (!host)
+		return NULL;
+
+	host->base.ops = &intel_dsi_host_ops;
+	host->intel_dsi = intel_dsi;
+	host->port = port;
+
+	/*
+	 * We should call mipi_dsi_host_register(&host->base) here, but we don't
+	 * have a host->dev, and we don't have OF stuff either. So just use the
+	 * dsi framework as a library and hope for the best. Create the dsi
+	 * devices by ourselves here too. Need to be careful though, because we
+	 * don't initialize any of the driver model devices here.
+	 */
+	device = kzalloc(sizeof(*device), GFP_KERNEL);
+	if (!device) {
+		kfree(host);
+		return NULL;
+	}
+
+	device->host = &host->base;
+	host->device = device;
+
+	return host;
+}
+
 static void band_gap_reset(struct drm_i915_private *dev_priv)
 {
 	mutex_lock(&dev_priv->dpio_lock);
@@ -806,6 +950,7 @@ void intel_dsi_init(struct drm_device *dev)
 	struct drm_connector *connector;
 	struct drm_display_mode *scan, *fixed_mode = NULL;
 	struct drm_i915_private *dev_priv = dev->dev_private;
+	enum port port;
 	unsigned int i;
 
 	DRM_DEBUG_KMS("\n");
@@ -854,7 +999,11 @@ void intel_dsi_init(struct drm_device *dev)
 	intel_connector->unregister = intel_connector_unregister;
 
 	/* Pipe A maps to MIPI DSI port A, pipe B maps to MIPI DSI port C */
-	if (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA) {
+	if (dev_priv->vbt.dsi.config->dual_link) {
+		/* XXX: does dual link work on either pipe? */
+		intel_encoder->crtc_mask = (1 << PIPE_A);
+		intel_dsi->ports = ((1 << PORT_A) | (1 << PORT_C));
+	} else if (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA) {
 		intel_encoder->crtc_mask = (1 << PIPE_A);
 		intel_dsi->ports = (1 << PORT_A);
 	} else if (dev_priv->vbt.dsi.port == DVO_PORT_MIPIC) {
@@ -862,6 +1011,17 @@ void intel_dsi_init(struct drm_device *dev)
 		intel_dsi->ports = (1 << PORT_C);
 	}
 
+	/* Create a DSI host (and a device) for each port. */
+	for_each_dsi_port(port, intel_dsi->ports) {
+		struct intel_dsi_host *host;
+
+		host = intel_dsi_host_init(intel_dsi, port);
+		if (!host)
+			goto err;
+
+		intel_dsi->dsi_hosts[port] = host;
+	}
+
 	for (i = 0; i < ARRAY_SIZE(intel_dsi_drivers); i++) {
 		intel_dsi->panel = intel_dsi_drivers[i].init(intel_dsi,
 							     intel_dsi_drivers[i].panel_id);
diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h
index fc0b2b8d90f1..2784ac442368 100644
--- a/drivers/gpu/drm/i915/intel_dsi.h
+++ b/drivers/gpu/drm/i915/intel_dsi.h
@@ -26,6 +26,7 @@
 
 #include <drm/drmP.h>
 #include <drm/drm_crtc.h>
+#include <drm/drm_mipi_dsi.h>
 #include "intel_drv.h"
 
 /* Dual Link support */
@@ -33,10 +34,13 @@
 #define DSI_DUAL_LINK_FRONT_BACK	1
 #define DSI_DUAL_LINK_PIXEL_ALT		2
 
+struct intel_dsi_host;
+
 struct intel_dsi {
 	struct intel_encoder base;
 
 	struct drm_panel *panel;
+	struct intel_dsi_host *dsi_hosts[I915_MAX_PORTS];
 
 	struct intel_connector *attached_connector;
 
@@ -94,6 +98,20 @@ struct intel_dsi {
 	u16 panel_pwr_cycle_delay;
 };
 
+struct intel_dsi_host {
+	struct mipi_dsi_host base;
+	struct intel_dsi *intel_dsi;
+	enum port port;
+
+	/* our little hack */
+	struct mipi_dsi_device *device;
+};
+
+static inline struct intel_dsi_host *to_intel_dsi_host(struct mipi_dsi_host *h)
+{
+	return container_of(h, struct intel_dsi_host, base);
+}
+
 #define for_each_dsi_port(__port, __ports_mask) \
 	for ((__port) = PORT_A; (__port) < I915_MAX_PORTS; (__port)++)	\
 		if ((__ports_mask) & (1 << (__port)))
diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
index 204f54df8fe1..e363c26a2b05 100644
--- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
+++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
@@ -399,9 +399,6 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
 	intel_dsi->dual_link = mipi_config->dual_link;
 	intel_dsi->pixel_overlap = mipi_config->pixel_overlap;
 
-	if (intel_dsi->dual_link)
-		intel_dsi->ports = ((1 << PORT_A) | (1 << PORT_C));
-
 	if (intel_dsi->pixel_format == VID_MODE_FORMAT_RGB666)
 		bits_per_pixel = 18;
 	else if (intel_dsi->pixel_format == VID_MODE_FORMAT_RGB565)
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [RFC PATCH 09/12] drm/i915/dsi: make the vbt panel driver use mipi_dsi_device for transfers
  2015-01-16 12:27 [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks Jani Nikula
                   ` (7 preceding siblings ...)
  2015-01-16 12:27 ` [RFC PATCH 08/12] drm/i915/dsi: add drm mipi dsi host support Jani Nikula
@ 2015-01-16 12:27 ` Jani Nikula
  2015-01-23 12:24   ` Shobhit Kumar
  2015-01-16 12:27 ` [RFC PATCH 10/12] drm/i915/dsi: remove old read/write functions in favor of new stuff Jani Nikula
                   ` (3 subsequent siblings)
  12 siblings, 1 reply; 45+ messages in thread
From: Jani Nikula @ 2015-01-16 12:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula, Shobhit Kumar, Thierry Reding

Use the drm core interfaces in preparation of removing our homebrew.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 52 +++++++++++++++++++-----------
 1 file changed, 34 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
index e363c26a2b05..0b09e66f7e29 100644
--- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
+++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
@@ -113,14 +113,18 @@ static inline enum port intel_dsi_seq_port_to_port(u8 port)
 static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi,
 				       const u8 *data)
 {
-	u8 type, byte, mode, vc, seq_port;
+	struct mipi_dsi_device *dsi_device;
+	u8 type, flags, seq_port;
 	u16 len;
 	enum port port;
 
-	byte = *data++;
-	mode = (byte >> MIPI_TRANSFER_MODE_SHIFT) & 0x1;
-	vc = (byte >> MIPI_VIRTUAL_CHANNEL_SHIFT) & 0x3;
-	seq_port = (byte >> MIPI_PORT_SHIFT) & 0x3;
+	flags = *data++;
+	type = *data++;
+
+	len = *((u16 *) data);
+	data += 2;
+
+	seq_port = (flags >> MIPI_PORT_SHIFT) & 3;
 
 	/* For DSI single link on Port A & C, the seq_port value which is
 	 * parsed from Sequence Block#53 of VBT has been set to 0
@@ -131,24 +135,29 @@ static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi,
 		port = PORT_C;
 	else
 		port = intel_dsi_seq_port_to_port(seq_port);
-	/* LP or HS mode */
-	intel_dsi->hs = mode;
 
-	/* get packet type and increment the pointer */
-	type = *data++;
+	dsi_device = intel_dsi->dsi_hosts[port]->device;
+	if (!dsi_device) {
+		DRM_DEBUG_KMS("no dsi device for port %c\n", port_name(port));
+		goto out;
+	}
 
-	len = *((u16 *) data);
-	data += 2;
+	if ((flags >> MIPI_TRANSFER_MODE_SHIFT) & 1)
+		dsi_device->mode_flags &= ~MIPI_DSI_MODE_LPM;
+	else
+		dsi_device->mode_flags |= MIPI_DSI_MODE_LPM;
+
+	dsi_device->channel = (flags >> MIPI_VIRTUAL_CHANNEL_SHIFT) & 3;
 
 	switch (type) {
 	case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
-		dsi_vc_generic_write_0(intel_dsi, vc, port);
+		mipi_dsi_generic_write(dsi_device, NULL, 0);
 		break;
 	case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
-		dsi_vc_generic_write_1(intel_dsi, vc, *data, port);
+		mipi_dsi_generic_write(dsi_device, data, 1);
 		break;
 	case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
-		dsi_vc_generic_write_2(intel_dsi, vc, *data, *(data + 1), port);
+		mipi_dsi_generic_write(dsi_device, data, 2);
 		break;
 	case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
 	case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
@@ -156,22 +165,23 @@ static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi,
 		DRM_DEBUG_DRIVER("Generic Read not yet implemented or used\n");
 		break;
 	case MIPI_DSI_GENERIC_LONG_WRITE:
-		dsi_vc_generic_write(intel_dsi, vc, data, len, port);
+		mipi_dsi_generic_write(dsi_device, data, len);
 		break;
 	case MIPI_DSI_DCS_SHORT_WRITE:
-		dsi_vc_dcs_write_0(intel_dsi, vc, *data, port);
+		mipi_dsi_dcs_write_buffer(dsi_device, data, 1);
 		break;
 	case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
-		dsi_vc_dcs_write_1(intel_dsi, vc, *data, *(data + 1), port);
+		mipi_dsi_dcs_write_buffer(dsi_device, data, 2);
 		break;
 	case MIPI_DSI_DCS_READ:
 		DRM_DEBUG_DRIVER("DCS Read not yet implemented or used\n");
 		break;
 	case MIPI_DSI_DCS_LONG_WRITE:
-		dsi_vc_dcs_write(intel_dsi, vc, data, len, port);
+		mipi_dsi_dcs_write_buffer(dsi_device, data, len);
 		break;
 	}
 
+out:
 	data += len;
 
 	return data;
@@ -389,6 +399,7 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
 	u32 lp_to_hs_switch, hs_to_lp_switch;
 	u32 pclk, computed_ddr;
 	u16 burst_mode_ratio;
+	enum port port;
 
 	DRM_DEBUG_KMS("\n");
 
@@ -661,5 +672,10 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
 	vbt_panel->panel.funcs = &vbt_panel_funcs;
 	drm_panel_add(&vbt_panel->panel);
 
+	/* a regular driver would get the device in probe */
+	for_each_dsi_port(port, intel_dsi->ports) {
+		mipi_dsi_attach(intel_dsi->dsi_hosts[port]->device);
+	}
+
 	return &vbt_panel->panel;
 }
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [RFC PATCH 10/12] drm/i915/dsi: remove old read/write functions in favor of new stuff
  2015-01-16 12:27 [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks Jani Nikula
                   ` (8 preceding siblings ...)
  2015-01-16 12:27 ` [RFC PATCH 09/12] drm/i915/dsi: make the vbt panel driver use mipi_dsi_device for transfers Jani Nikula
@ 2015-01-16 12:27 ` Jani Nikula
  2015-01-23 12:25   ` Shobhit Kumar
  2015-01-16 12:27 ` [RFC PATCH 11/12] drm/i915/dsi: move dpi_send_cmd() to intel_dsi.c and make it static Jani Nikula
                   ` (2 subsequent siblings)
  12 siblings, 1 reply; 45+ messages in thread
From: Jani Nikula @ 2015-01-16 12:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula, Shobhit Kumar, Thierry Reding

All of these are replaced by the drm core mipi dsi functions.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_dsi_cmd.c | 259 -----------------------------------
 drivers/gpu/drm/i915/intel_dsi_cmd.h |  72 ----------
 2 files changed, 331 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.c b/drivers/gpu/drm/i915/intel_dsi_cmd.c
index 17b892a365ee..6baaa374fc89 100644
--- a/drivers/gpu/drm/i915/intel_dsi_cmd.c
+++ b/drivers/gpu/drm/i915/intel_dsi_cmd.c
@@ -96,11 +96,6 @@ static void print_stat(struct intel_dsi *intel_dsi, enum port port)
 #undef STAT_BIT
 }
 
-enum dsi_type {
-	DSI_DCS,
-	DSI_GENERIC,
-};
-
 /* enable or disable command mode hs transmissions */
 void dsi_hs_mode_enable(struct intel_dsi *intel_dsi, bool enable,
 						enum port port)
@@ -121,260 +116,6 @@ void dsi_hs_mode_enable(struct intel_dsi *intel_dsi, bool enable,
 	intel_dsi->hs = enable;
 }
 
-static int dsi_vc_send_short(struct intel_dsi *intel_dsi, int channel,
-			     u8 data_type, u16 data, enum port port)
-{
-	struct drm_encoder *encoder = &intel_dsi->base.base;
-	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-	u32 ctrl_reg;
-	u32 ctrl;
-	u32 mask;
-
-	DRM_DEBUG_KMS("channel %d, data_type %d, data %04x\n",
-		      channel, data_type, data);
-
-	if (intel_dsi->hs) {
-		ctrl_reg = MIPI_HS_GEN_CTRL(port);
-		mask = HS_CTRL_FIFO_FULL;
-	} else {
-		ctrl_reg = MIPI_LP_GEN_CTRL(port);
-		mask = LP_CTRL_FIFO_FULL;
-	}
-
-	if (wait_for((I915_READ(MIPI_GEN_FIFO_STAT(port)) & mask) == 0, 50)) {
-		DRM_ERROR("Timeout waiting for HS/LP CTRL FIFO !full\n");
-		print_stat(intel_dsi, port);
-	}
-
-	/*
-	 * Note: This function is also used for long packets, with length passed
-	 * as data, since SHORT_PACKET_PARAM_SHIFT ==
-	 * LONG_PACKET_WORD_COUNT_SHIFT.
-	 */
-	ctrl = data << SHORT_PACKET_PARAM_SHIFT |
-		channel << VIRTUAL_CHANNEL_SHIFT |
-		data_type << DATA_TYPE_SHIFT;
-
-	I915_WRITE(ctrl_reg, ctrl);
-
-	return 0;
-}
-
-static int dsi_vc_send_long(struct intel_dsi *intel_dsi, int channel,
-		u8 data_type, const u8 *data, int len, enum port port)
-{
-	struct drm_encoder *encoder = &intel_dsi->base.base;
-	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-	u32 data_reg;
-	int i, j, n;
-	u32 mask;
-
-	DRM_DEBUG_KMS("channel %d, data_type %d, len %04x\n",
-		      channel, data_type, len);
-
-	if (intel_dsi->hs) {
-		data_reg = MIPI_HS_GEN_DATA(port);
-		mask = HS_DATA_FIFO_FULL;
-	} else {
-		data_reg = MIPI_LP_GEN_DATA(port);
-		mask = LP_DATA_FIFO_FULL;
-	}
-
-	if (wait_for((I915_READ(MIPI_GEN_FIFO_STAT(port)) & mask) == 0, 50))
-		DRM_ERROR("Timeout waiting for HS/LP DATA FIFO !full\n");
-
-	for (i = 0; i < len; i += n) {
-		u32 val = 0;
-		n = min_t(int, len - i, 4);
-
-		for (j = 0; j < n; j++)
-			val |= *data++ << 8 * j;
-
-		I915_WRITE(data_reg, val);
-		/* XXX: check for data fifo full, once that is set, write 4
-		 * dwords, then wait for not set, then continue. */
-	}
-
-	return dsi_vc_send_short(intel_dsi, channel, data_type, len, port);
-}
-
-static int dsi_vc_write_common(struct intel_dsi *intel_dsi,
-			       int channel, const u8 *data, int len,
-			       enum dsi_type type, enum port port)
-{
-	int ret;
-
-	if (len == 0) {
-		BUG_ON(type == DSI_GENERIC);
-		ret = dsi_vc_send_short(intel_dsi, channel,
-					MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM,
-					0, port);
-	} else if (len == 1) {
-		ret = dsi_vc_send_short(intel_dsi, channel,
-					type == DSI_GENERIC ?
-					MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM :
-					MIPI_DSI_DCS_SHORT_WRITE, data[0],
-					port);
-	} else if (len == 2) {
-		ret = dsi_vc_send_short(intel_dsi, channel,
-					type == DSI_GENERIC ?
-					MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM :
-					MIPI_DSI_DCS_SHORT_WRITE_PARAM,
-					(data[1] << 8) | data[0], port);
-	} else {
-		ret = dsi_vc_send_long(intel_dsi, channel,
-					type == DSI_GENERIC ?
-					MIPI_DSI_GENERIC_LONG_WRITE :
-					MIPI_DSI_DCS_LONG_WRITE, data, len,
-					port);
-	}
-
-	return ret;
-}
-
-int dsi_vc_dcs_write(struct intel_dsi *intel_dsi, int channel,
-		     const u8 *data, int len, enum port port)
-{
-	return dsi_vc_write_common(intel_dsi, channel, data, len, DSI_DCS,
-									port);
-}
-
-int dsi_vc_generic_write(struct intel_dsi *intel_dsi, int channel,
-			 const u8 *data, int len, enum port port)
-{
-	return dsi_vc_write_common(intel_dsi, channel, data, len, DSI_GENERIC,
-									port);
-}
-
-static int dsi_vc_dcs_send_read_request(struct intel_dsi *intel_dsi,
-				int channel, u8 dcs_cmd, enum port port)
-{
-	return dsi_vc_send_short(intel_dsi, channel, MIPI_DSI_DCS_READ,
-				 dcs_cmd, port);
-}
-
-static int dsi_vc_generic_send_read_request(struct intel_dsi *intel_dsi,
-					    int channel, u8 *reqdata,
-					    int reqlen, enum port port)
-{
-	u16 data;
-	u8 data_type;
-
-	switch (reqlen) {
-	case 0:
-		data_type = MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM;
-		data = 0;
-		break;
-	case 1:
-		data_type = MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM;
-		data = reqdata[0];
-		break;
-	case 2:
-		data_type = MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM;
-		data = (reqdata[1] << 8) | reqdata[0];
-		break;
-	default:
-		BUG();
-	}
-
-	return dsi_vc_send_short(intel_dsi, channel, data_type, data, port);
-}
-
-static int dsi_read_data_return(struct intel_dsi *intel_dsi,
-				u8 *buf, int buflen, enum port port)
-{
-	struct drm_encoder *encoder = &intel_dsi->base.base;
-	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-	int i, len = 0;
-	u32 data_reg, val;
-
-	if (intel_dsi->hs) {
-		data_reg = MIPI_HS_GEN_DATA(port);
-	} else {
-		data_reg = MIPI_LP_GEN_DATA(port);
-	}
-
-	while (len < buflen) {
-		val = I915_READ(data_reg);
-		for (i = 0; i < 4 && len < buflen; i++, len++)
-			buf[len] = val >> 8 * i;
-	}
-
-	return len;
-}
-
-int dsi_vc_dcs_read(struct intel_dsi *intel_dsi, int channel, u8 dcs_cmd,
-		    u8 *buf, int buflen, enum port port)
-{
-	struct drm_encoder *encoder = &intel_dsi->base.base;
-	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-	u32 mask;
-	int ret;
-
-	/*
-	 * XXX: should issue multiple read requests and reads if request is
-	 * longer than MIPI_MAX_RETURN_PKT_SIZE
-	 */
-
-	I915_WRITE(MIPI_INTR_STAT(port), GEN_READ_DATA_AVAIL);
-
-	ret = dsi_vc_dcs_send_read_request(intel_dsi, channel, dcs_cmd, port);
-	if (ret)
-		return ret;
-
-	mask = GEN_READ_DATA_AVAIL;
-	if (wait_for((I915_READ(MIPI_INTR_STAT(port)) & mask) == mask, 50))
-		DRM_ERROR("Timeout waiting for read data.\n");
-
-	ret = dsi_read_data_return(intel_dsi, buf, buflen, port);
-	if (ret < 0)
-		return ret;
-
-	if (ret != buflen)
-		return -EIO;
-
-	return 0;
-}
-
-int dsi_vc_generic_read(struct intel_dsi *intel_dsi, int channel,
-		u8 *reqdata, int reqlen, u8 *buf, int buflen, enum port port)
-{
-	struct drm_encoder *encoder = &intel_dsi->base.base;
-	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-	u32 mask;
-	int ret;
-
-	/*
-	 * XXX: should issue multiple read requests and reads if request is
-	 * longer than MIPI_MAX_RETURN_PKT_SIZE
-	 */
-
-	I915_WRITE(MIPI_INTR_STAT(port), GEN_READ_DATA_AVAIL);
-
-	ret = dsi_vc_generic_send_read_request(intel_dsi, channel, reqdata,
-					       reqlen, port);
-	if (ret)
-		return ret;
-
-	mask = GEN_READ_DATA_AVAIL;
-	if (wait_for((I915_READ(MIPI_INTR_STAT(port)) & mask) == mask, 50))
-		DRM_ERROR("Timeout waiting for read data.\n");
-
-	ret = dsi_read_data_return(intel_dsi, buf, buflen, port);
-	if (ret < 0)
-		return ret;
-
-	if (ret != buflen)
-		return -EIO;
-
-	return 0;
-}
-
 /*
  * send a video mode command
  *
diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.h b/drivers/gpu/drm/i915/intel_dsi_cmd.h
index 70f24666a1f9..9a28ff58a92b 100644
--- a/drivers/gpu/drm/i915/intel_dsi_cmd.h
+++ b/drivers/gpu/drm/i915/intel_dsi_cmd.h
@@ -39,78 +39,6 @@
 void dsi_hs_mode_enable(struct intel_dsi *intel_dsi, bool enable,
 						enum port port);
 
-int dsi_vc_dcs_write(struct intel_dsi *intel_dsi, int channel,
-		     const u8 *data, int len, enum port port);
-
-int dsi_vc_generic_write(struct intel_dsi *intel_dsi, int channel,
-			 const u8 *data, int len, enum port port);
-
-int dsi_vc_dcs_read(struct intel_dsi *intel_dsi, int channel, u8 dcs_cmd,
-		    u8 *buf, int buflen, enum port port);
-
-int dsi_vc_generic_read(struct intel_dsi *intel_dsi, int channel,
-		u8 *reqdata, int reqlen, u8 *buf, int buflen, enum port port);
-
 int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs, enum port port);
 
-/* XXX: questionable write helpers */
-static inline int dsi_vc_dcs_write_0(struct intel_dsi *intel_dsi,
-				     int channel, u8 dcs_cmd, enum port port)
-{
-	return dsi_vc_dcs_write(intel_dsi, channel, &dcs_cmd, 1, port);
-}
-
-static inline int dsi_vc_dcs_write_1(struct intel_dsi *intel_dsi,
-			int channel, u8 dcs_cmd, u8 param, enum port port)
-{
-	u8 buf[2] = { dcs_cmd, param };
-	return dsi_vc_dcs_write(intel_dsi, channel, buf, 2, port);
-}
-
-static inline int dsi_vc_generic_write_0(struct intel_dsi *intel_dsi,
-					 int channel, enum port port)
-{
-	return dsi_vc_generic_write(intel_dsi, channel, NULL, 0, port);
-}
-
-static inline int dsi_vc_generic_write_1(struct intel_dsi *intel_dsi,
-					 int channel, u8 param, enum port port)
-{
-	return dsi_vc_generic_write(intel_dsi, channel, &param, 1, port);
-}
-
-static inline int dsi_vc_generic_write_2(struct intel_dsi *intel_dsi,
-			int channel, u8 param1, u8 param2, enum port port)
-{
-	u8 buf[2] = { param1, param2 };
-	return dsi_vc_generic_write(intel_dsi, channel, buf, 2, port);
-}
-
-/* XXX: questionable read helpers */
-static inline int dsi_vc_generic_read_0(struct intel_dsi *intel_dsi,
-			int channel, u8 *buf, int buflen, enum port port)
-{
-	return dsi_vc_generic_read(intel_dsi, channel, NULL, 0, buf, buflen,
-									port);
-}
-
-static inline int dsi_vc_generic_read_1(struct intel_dsi *intel_dsi,
-					int channel, u8 param, u8 *buf,
-					int buflen, enum port port)
-{
-	return dsi_vc_generic_read(intel_dsi, channel, &param, 1, buf, buflen,
-									port);
-}
-
-static inline int dsi_vc_generic_read_2(struct intel_dsi *intel_dsi,
-					int channel, u8 param1, u8 param2,
-					u8 *buf, int buflen, enum port port)
-{
-	u8 req[2] = { param1, param2 };
-
-	return dsi_vc_generic_read(intel_dsi, channel, req, 2, buf, buflen,
-									port);
-}
-
-
 #endif /* _INTEL_DSI_DSI_H */
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [RFC PATCH 11/12] drm/i915/dsi: move dpi_send_cmd() to intel_dsi.c and make it static
  2015-01-16 12:27 [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks Jani Nikula
                   ` (9 preceding siblings ...)
  2015-01-16 12:27 ` [RFC PATCH 10/12] drm/i915/dsi: remove old read/write functions in favor of new stuff Jani Nikula
@ 2015-01-16 12:27 ` Jani Nikula
  2015-01-23 12:27   ` Shobhit Kumar
  2015-01-16 12:27 ` [RFC PATCH 12/12] drm/i915/dsi: remove intel_dsi_cmd.c and the unused functions therein Jani Nikula
  2015-01-22 11:46 ` [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks Shobhit Kumar
  12 siblings, 1 reply; 45+ messages in thread
From: Jani Nikula @ 2015-01-16 12:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula, Shobhit Kumar, Thierry Reding

No functional changes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_dsi.c     | 39 ++++++++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_dsi_cmd.c | 34 -------------------------------
 drivers/gpu/drm/i915/intel_dsi_cmd.h |  5 -----
 3 files changed, 37 insertions(+), 41 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 5cfa3431785a..791d90b4c047 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -202,6 +202,41 @@ static struct intel_dsi_host *intel_dsi_host_init(struct intel_dsi *intel_dsi,
 	return host;
 }
 
+/*
+ * send a video mode command
+ *
+ * XXX: commands with data in MIPI_DPI_DATA?
+ */
+static int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs,
+			enum port port)
+{
+	struct drm_encoder *encoder = &intel_dsi->base.base;
+	struct drm_device *dev = encoder->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	u32 mask;
+
+	/* XXX: pipe, hs */
+	if (hs)
+		cmd &= ~DPI_LP_MODE;
+	else
+		cmd |= DPI_LP_MODE;
+
+	/* clear bit */
+	I915_WRITE(MIPI_INTR_STAT(port), SPL_PKT_SENT_INTERRUPT);
+
+	/* XXX: old code skips write if control unchanged */
+	if (cmd == I915_READ(MIPI_DPI_CONTROL(port)))
+		DRM_ERROR("Same special packet %02x twice in a row.\n", cmd);
+
+	I915_WRITE(MIPI_DPI_CONTROL(port), cmd);
+
+	mask = SPL_PKT_SENT_INTERRUPT;
+	if (wait_for((I915_READ(MIPI_INTR_STAT(port)) & mask) == mask, 100))
+		DRM_ERROR("Video mode command 0x%08x send failed.\n", cmd);
+
+	return 0;
+}
+
 static void band_gap_reset(struct drm_i915_private *dev_priv)
 {
 	mutex_lock(&dev_priv->dpio_lock);
@@ -357,7 +392,7 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
 	else {
 		msleep(20); /* XXX */
 		for_each_dsi_port(port, intel_dsi->ports)
-			dpi_send_cmd(intel_dsi, TURN_ON, DPI_LP_MODE_EN, port);
+			dpi_send_cmd(intel_dsi, TURN_ON, false, port);
 		msleep(100);
 
 		drm_panel_enable(intel_dsi->panel);
@@ -430,7 +465,7 @@ static void intel_dsi_pre_disable(struct intel_encoder *encoder)
 	if (is_vid_mode(intel_dsi)) {
 		/* Send Shutdown command to the panel in LP mode */
 		for_each_dsi_port(port, intel_dsi->ports)
-			dpi_send_cmd(intel_dsi, SHUTDOWN, DPI_LP_MODE_EN, port);
+			dpi_send_cmd(intel_dsi, SHUTDOWN, false, port);
 		msleep(10);
 	}
 }
diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.c b/drivers/gpu/drm/i915/intel_dsi_cmd.c
index 6baaa374fc89..acdc5da7b46f 100644
--- a/drivers/gpu/drm/i915/intel_dsi_cmd.c
+++ b/drivers/gpu/drm/i915/intel_dsi_cmd.c
@@ -115,37 +115,3 @@ void dsi_hs_mode_enable(struct intel_dsi *intel_dsi, bool enable,
 
 	intel_dsi->hs = enable;
 }
-
-/*
- * send a video mode command
- *
- * XXX: commands with data in MIPI_DPI_DATA?
- */
-int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs, enum port port)
-{
-	struct drm_encoder *encoder = &intel_dsi->base.base;
-	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-	u32 mask;
-
-	/* XXX: pipe, hs */
-	if (hs)
-		cmd &= ~DPI_LP_MODE;
-	else
-		cmd |= DPI_LP_MODE;
-
-	/* clear bit */
-	I915_WRITE(MIPI_INTR_STAT(port), SPL_PKT_SENT_INTERRUPT);
-
-	/* XXX: old code skips write if control unchanged */
-	if (cmd == I915_READ(MIPI_DPI_CONTROL(port)))
-		DRM_ERROR("Same special packet %02x twice in a row.\n", cmd);
-
-	I915_WRITE(MIPI_DPI_CONTROL(port), cmd);
-
-	mask = SPL_PKT_SENT_INTERRUPT;
-	if (wait_for((I915_READ(MIPI_INTR_STAT(port)) & mask) == mask, 100))
-		DRM_ERROR("Video mode command 0x%08x send failed.\n", cmd);
-
-	return 0;
-}
diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.h b/drivers/gpu/drm/i915/intel_dsi_cmd.h
index 9a28ff58a92b..886779030f1a 100644
--- a/drivers/gpu/drm/i915/intel_dsi_cmd.h
+++ b/drivers/gpu/drm/i915/intel_dsi_cmd.h
@@ -33,12 +33,7 @@
 #include "intel_drv.h"
 #include "intel_dsi.h"
 
-#define DPI_LP_MODE_EN	false
-#define DPI_HS_MODE_EN	true
-
 void dsi_hs_mode_enable(struct intel_dsi *intel_dsi, bool enable,
 						enum port port);
 
-int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs, enum port port);
-
 #endif /* _INTEL_DSI_DSI_H */
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [RFC PATCH 12/12] drm/i915/dsi: remove intel_dsi_cmd.c and the unused functions therein
  2015-01-16 12:27 [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks Jani Nikula
                   ` (10 preceding siblings ...)
  2015-01-16 12:27 ` [RFC PATCH 11/12] drm/i915/dsi: move dpi_send_cmd() to intel_dsi.c and make it static Jani Nikula
@ 2015-01-16 12:27 ` Jani Nikula
  2015-01-23 12:28   ` Shobhit Kumar
  2015-01-22 11:46 ` [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks Shobhit Kumar
  12 siblings, 1 reply; 45+ messages in thread
From: Jani Nikula @ 2015-01-16 12:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula, Shobhit Kumar, Thierry Reding

The removed functions can be resurrected in intel_dsi.c as need arises.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/Makefile              |   1 -
 drivers/gpu/drm/i915/intel_dsi.c           |   1 -
 drivers/gpu/drm/i915/intel_dsi_cmd.c       | 117 -----------------------------
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c |   1 -
 4 files changed, 120 deletions(-)
 delete mode 100644 drivers/gpu/drm/i915/intel_dsi_cmd.c

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 16e3dc350274..63afe63bf0e4 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -71,7 +71,6 @@ i915-y += dvo_ch7017.o \
 	  intel_ddi.o \
 	  intel_dp.o \
 	  intel_dp_mst.o \
-	  intel_dsi_cmd.o \
 	  intel_dsi.o \
 	  intel_dsi_pll.o \
 	  intel_dsi_panel_vbt.o \
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 791d90b4c047..02ae5e583b27 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -33,7 +33,6 @@
 #include "i915_drv.h"
 #include "intel_drv.h"
 #include "intel_dsi.h"
-#include "intel_dsi_cmd.h"
 
 static const struct {
 	u16 panel_id;
diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.c b/drivers/gpu/drm/i915/intel_dsi_cmd.c
deleted file mode 100644
index acdc5da7b46f..000000000000
--- a/drivers/gpu/drm/i915/intel_dsi_cmd.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * 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@intel.com>
- */
-
-#include <linux/export.h>
-#include <drm/drmP.h>
-#include <drm/drm_crtc.h>
-#include <video/mipi_display.h>
-#include "i915_drv.h"
-#include "intel_drv.h"
-#include "intel_dsi.h"
-#include "intel_dsi_cmd.h"
-
-/*
- * XXX: MIPI_DATA_ADDRESS, MIPI_DATA_LENGTH, MIPI_COMMAND_LENGTH, and
- * MIPI_COMMAND_ADDRESS registers.
- *
- * Apparently these registers provide a MIPI adapter level way to send (lots of)
- * commands and data to the receiver, without having to write the commands and
- * data to MIPI_{HS,LP}_GEN_{CTRL,DATA} registers word by word.
- *
- * Presumably for anything other than MIPI_DCS_WRITE_MEMORY_START and
- * MIPI_DCS_WRITE_MEMORY_CONTINUE (which are used to update the external
- * framebuffer in command mode displays) these are just an optimization that can
- * come later.
- *
- * For memory writes, these should probably be used for performance.
- */
-
-static void print_stat(struct intel_dsi *intel_dsi, enum port port)
-{
-	struct drm_encoder *encoder = &intel_dsi->base.base;
-	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-	u32 val;
-
-	val = I915_READ(MIPI_INTR_STAT(port));
-
-#define STAT_BIT(val, bit) (val) & (bit) ? " " #bit : ""
-	DRM_DEBUG_KMS("MIPI_INTR_STAT(%c) = %08x"
-		      "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
-		      "\n", port_name(port), val,
-		      STAT_BIT(val, TEARING_EFFECT),
-		      STAT_BIT(val, SPL_PKT_SENT_INTERRUPT),
-		      STAT_BIT(val, GEN_READ_DATA_AVAIL),
-		      STAT_BIT(val, LP_GENERIC_WR_FIFO_FULL),
-		      STAT_BIT(val, HS_GENERIC_WR_FIFO_FULL),
-		      STAT_BIT(val, RX_PROT_VIOLATION),
-		      STAT_BIT(val, RX_INVALID_TX_LENGTH),
-		      STAT_BIT(val, ACK_WITH_NO_ERROR),
-		      STAT_BIT(val, TURN_AROUND_ACK_TIMEOUT),
-		      STAT_BIT(val, LP_RX_TIMEOUT),
-		      STAT_BIT(val, HS_TX_TIMEOUT),
-		      STAT_BIT(val, DPI_FIFO_UNDERRUN),
-		      STAT_BIT(val, LOW_CONTENTION),
-		      STAT_BIT(val, HIGH_CONTENTION),
-		      STAT_BIT(val, TXDSI_VC_ID_INVALID),
-		      STAT_BIT(val, TXDSI_DATA_TYPE_NOT_RECOGNISED),
-		      STAT_BIT(val, TXCHECKSUM_ERROR),
-		      STAT_BIT(val, TXECC_MULTIBIT_ERROR),
-		      STAT_BIT(val, TXECC_SINGLE_BIT_ERROR),
-		      STAT_BIT(val, TXFALSE_CONTROL_ERROR),
-		      STAT_BIT(val, RXDSI_VC_ID_INVALID),
-		      STAT_BIT(val, RXDSI_DATA_TYPE_NOT_REGOGNISED),
-		      STAT_BIT(val, RXCHECKSUM_ERROR),
-		      STAT_BIT(val, RXECC_MULTIBIT_ERROR),
-		      STAT_BIT(val, RXECC_SINGLE_BIT_ERROR),
-		      STAT_BIT(val, RXFALSE_CONTROL_ERROR),
-		      STAT_BIT(val, RXHS_RECEIVE_TIMEOUT_ERROR),
-		      STAT_BIT(val, RX_LP_TX_SYNC_ERROR),
-		      STAT_BIT(val, RXEXCAPE_MODE_ENTRY_ERROR),
-		      STAT_BIT(val, RXEOT_SYNC_ERROR),
-		      STAT_BIT(val, RXSOT_SYNC_ERROR),
-		      STAT_BIT(val, RXSOT_ERROR));
-#undef STAT_BIT
-}
-
-/* enable or disable command mode hs transmissions */
-void dsi_hs_mode_enable(struct intel_dsi *intel_dsi, bool enable,
-						enum port port)
-{
-	struct drm_encoder *encoder = &intel_dsi->base.base;
-	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-	u32 temp;
-	u32 mask = DBI_FIFO_EMPTY;
-
-	if (wait_for((I915_READ(MIPI_GEN_FIFO_STAT(port)) & mask) == mask, 50))
-		DRM_ERROR("Timeout waiting for DBI FIFO empty\n");
-
-	temp = I915_READ(MIPI_HS_LP_DBI_ENABLE(port));
-	temp &= DBI_HS_LP_MODE_MASK;
-	I915_WRITE(MIPI_HS_LP_DBI_ENABLE(port), enable ? DBI_HS_MODE : DBI_LP_MODE);
-
-	intel_dsi->hs = enable;
-}
diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
index 0b09e66f7e29..c3eec66f5076 100644
--- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
+++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
@@ -36,7 +36,6 @@
 #include "i915_drv.h"
 #include "intel_drv.h"
 #include "intel_dsi.h"
-#include "intel_dsi_cmd.h"
 
 struct vbt_panel {
 	struct drm_panel panel;
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 01/12] drm/i915/dsi: call dpi_send_cmd() for each dsi port at a higher level
  2015-01-16 12:27 ` [RFC PATCH 01/12] drm/i915/dsi: call dpi_send_cmd() for each dsi port at a higher level Jani Nikula
@ 2015-01-22  8:48   ` Shobhit Kumar
  0 siblings, 0 replies; 45+ messages in thread
From: Shobhit Kumar @ 2015-01-22  8:48 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx; +Cc: Shobhit Kumar, Thierry Reding

On 01/16/2015 05:57 PM, Jani Nikula wrote:
> Instead of having the for each dsi port loop within dpi_send_cmd(), add
> a port parameter to the function and call it for each port instead.
>
> This is a rewrite of
>
> commit 4510cd779e5897eeb8691aecbd639bb62ec27d55
> Author: Gaurav K Singh <gaurav.k.singh@intel.com>
> Date:   Thu Dec 4 10:58:51 2014 +0530
>
>      drm/i915: Dual link needs Shutdown and Turn on packet for both ports
>
> to add more flexibility in using dpi_send_cmd() for just one port as
> necessary. No functional changes.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Better this way.

Reviewed-By: Shobhit Kumar <shobhit.kumar@intel.com>

> ---
>   drivers/gpu/drm/i915/intel_dsi.c     |  7 +++++--
>   drivers/gpu/drm/i915/intel_dsi_cmd.c | 26 ++++++++++----------------
>   drivers/gpu/drm/i915/intel_dsi_cmd.h |  2 +-
>   3 files changed, 16 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index 42b6d6f5cecc..36b19c7e87b9 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -207,7 +207,8 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
>   		I915_WRITE(MIPI_MAX_RETURN_PKT_SIZE(port), 8 * 4);
>   	else {
>   		msleep(20); /* XXX */
> -		dpi_send_cmd(intel_dsi, TURN_ON, DPI_LP_MODE_EN);
> +		for_each_dsi_port(port, intel_dsi->ports)
> +			dpi_send_cmd(intel_dsi, TURN_ON, DPI_LP_MODE_EN, port);
>   		msleep(100);
>
>   		if (intel_dsi->dev.dev_ops->enable)
> @@ -275,12 +276,14 @@ static void intel_dsi_enable_nop(struct intel_encoder *encoder)
>   static void intel_dsi_pre_disable(struct intel_encoder *encoder)
>   {
>   	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
> +	enum port port;
>
>   	DRM_DEBUG_KMS("\n");
>
>   	if (is_vid_mode(intel_dsi)) {
>   		/* Send Shutdown command to the panel in LP mode */
> -		dpi_send_cmd(intel_dsi, SHUTDOWN, DPI_LP_MODE_EN);
> +		for_each_dsi_port(port, intel_dsi->ports)
> +			dpi_send_cmd(intel_dsi, SHUTDOWN, DPI_LP_MODE_EN, port);
>   		msleep(10);
>   	}
>   }
> diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.c b/drivers/gpu/drm/i915/intel_dsi_cmd.c
> index 562811c1a9d2..5f63c807acea 100644
> --- a/drivers/gpu/drm/i915/intel_dsi_cmd.c
> +++ b/drivers/gpu/drm/i915/intel_dsi_cmd.c
> @@ -380,12 +380,11 @@ int dsi_vc_generic_read(struct intel_dsi *intel_dsi, int channel,
>    *
>    * XXX: commands with data in MIPI_DPI_DATA?
>    */
> -int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs)
> +int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs, enum port port)
>   {
>   	struct drm_encoder *encoder = &intel_dsi->base.base;
>   	struct drm_device *dev = encoder->dev;
>   	struct drm_i915_private *dev_priv = dev->dev_private;
> -	enum port port;
>   	u32 mask;
>
>   	/* XXX: pipe, hs */
> @@ -394,23 +393,18 @@ int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs)
>   	else
>   		cmd |= DPI_LP_MODE;
>
> -	for_each_dsi_port(port, intel_dsi->ports) {
> -		/* clear bit */
> -		I915_WRITE(MIPI_INTR_STAT(port), SPL_PKT_SENT_INTERRUPT);
> +	/* clear bit */
> +	I915_WRITE(MIPI_INTR_STAT(port), SPL_PKT_SENT_INTERRUPT);
>
> -		/* XXX: old code skips write if control unchanged */
> -		if (cmd == I915_READ(MIPI_DPI_CONTROL(port)))
> -			DRM_ERROR("Same special packet %02x twice in a row.\n",
> -									cmd);
> +	/* XXX: old code skips write if control unchanged */
> +	if (cmd == I915_READ(MIPI_DPI_CONTROL(port)))
> +		DRM_ERROR("Same special packet %02x twice in a row.\n", cmd);
>
> -		I915_WRITE(MIPI_DPI_CONTROL(port), cmd);
> +	I915_WRITE(MIPI_DPI_CONTROL(port), cmd);
>
> -		mask = SPL_PKT_SENT_INTERRUPT;
> -		if (wait_for((I915_READ(MIPI_INTR_STAT(port)) & mask) == mask,
> -									100))
> -			DRM_ERROR("Video mode command 0x%08x send failed.\n",
> -									cmd);
> -	}
> +	mask = SPL_PKT_SENT_INTERRUPT;
> +	if (wait_for((I915_READ(MIPI_INTR_STAT(port)) & mask) == mask, 100))
> +		DRM_ERROR("Video mode command 0x%08x send failed.\n", cmd);
>
>   	return 0;
>   }
> diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.h b/drivers/gpu/drm/i915/intel_dsi_cmd.h
> index 326a5ac55561..1d1a716e473a 100644
> --- a/drivers/gpu/drm/i915/intel_dsi_cmd.h
> +++ b/drivers/gpu/drm/i915/intel_dsi_cmd.h
> @@ -51,7 +51,7 @@ int dsi_vc_dcs_read(struct intel_dsi *intel_dsi, int channel, u8 dcs_cmd,
>   int dsi_vc_generic_read(struct intel_dsi *intel_dsi, int channel,
>   		u8 *reqdata, int reqlen, u8 *buf, int buflen, enum port port);
>
> -int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs);
> +int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs, enum port port);
>   void wait_for_dsi_fifo_empty(struct intel_dsi *intel_dsi);
>
>   /* XXX: questionable write helpers */
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 03/12] drm/i915/dsi: move wait_for_dsi_fifo_empty to intel_dsi.c
  2015-01-16 12:27 ` [RFC PATCH 03/12] drm/i915/dsi: move wait_for_dsi_fifo_empty to intel_dsi.c Jani Nikula
@ 2015-01-22  9:01   ` Shobhit Kumar
  0 siblings, 0 replies; 45+ messages in thread
From: Shobhit Kumar @ 2015-01-22  9:01 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx; +Cc: Thierry Reding

On 01/16/2015 05:57 PM, Jani Nikula wrote:
> wait_for_dsi_fifo_empty can be static in intel_dsi.c. No functional
> changes.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-By: Shobhit Kumar <shobhit.kumar@intel.com>

> ---
>   drivers/gpu/drm/i915/intel_dsi.c     | 16 ++++++++++++++++
>   drivers/gpu/drm/i915/intel_dsi_cmd.c | 16 ----------------
>   drivers/gpu/drm/i915/intel_dsi_cmd.h |  1 -
>   3 files changed, 16 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index 49e186bc080f..e82cf5f65c9a 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -42,6 +42,22 @@ static const struct intel_dsi_device intel_dsi_devices[] = {
>   	},
>   };
>
> +static void wait_for_dsi_fifo_empty(struct intel_dsi *intel_dsi)
> +{
> +	struct drm_encoder *encoder = &intel_dsi->base.base;
> +	struct drm_device *dev = encoder->dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
> +	enum port port = intel_dsi_pipe_to_port(intel_crtc->pipe);
> +	u32 mask;
> +
> +	mask = LP_CTRL_FIFO_EMPTY | HS_CTRL_FIFO_EMPTY |
> +		LP_DATA_FIFO_EMPTY | HS_DATA_FIFO_EMPTY;
> +
> +	if (wait_for((I915_READ(MIPI_GEN_FIFO_STAT(port)) & mask) == mask, 100))
> +		DRM_ERROR("DPI FIFOs are not empty\n");
> +}
> +
>   static void band_gap_reset(struct drm_i915_private *dev_priv)
>   {
>   	mutex_lock(&dev_priv->dpio_lock);
> diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.c b/drivers/gpu/drm/i915/intel_dsi_cmd.c
> index 5f63c807acea..17b892a365ee 100644
> --- a/drivers/gpu/drm/i915/intel_dsi_cmd.c
> +++ b/drivers/gpu/drm/i915/intel_dsi_cmd.c
> @@ -408,19 +408,3 @@ int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs, enum port port)
>
>   	return 0;
>   }
> -
> -void wait_for_dsi_fifo_empty(struct intel_dsi *intel_dsi)
> -{
> -	struct drm_encoder *encoder = &intel_dsi->base.base;
> -	struct drm_device *dev = encoder->dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
> -	enum port port = intel_dsi_pipe_to_port(intel_crtc->pipe);
> -	u32 mask;
> -
> -	mask = LP_CTRL_FIFO_EMPTY | HS_CTRL_FIFO_EMPTY |
> -		LP_DATA_FIFO_EMPTY | HS_DATA_FIFO_EMPTY;
> -
> -	if (wait_for((I915_READ(MIPI_GEN_FIFO_STAT(port)) & mask) == mask, 100))
> -		DRM_ERROR("DPI FIFOs are not empty\n");
> -}
> diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.h b/drivers/gpu/drm/i915/intel_dsi_cmd.h
> index 1d1a716e473a..70f24666a1f9 100644
> --- a/drivers/gpu/drm/i915/intel_dsi_cmd.h
> +++ b/drivers/gpu/drm/i915/intel_dsi_cmd.h
> @@ -52,7 +52,6 @@ int dsi_vc_generic_read(struct intel_dsi *intel_dsi, int channel,
>   		u8 *reqdata, int reqlen, u8 *buf, int buflen, enum port port);
>
>   int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs, enum port port);
> -void wait_for_dsi_fifo_empty(struct intel_dsi *intel_dsi);
>
>   /* XXX: questionable write helpers */
>   static inline int dsi_vc_dcs_write_0(struct intel_dsi *intel_dsi,
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 02/12] drm/i915/dsi: set max return packet size for each dsi port
  2015-01-16 12:27 ` [RFC PATCH 02/12] drm/i915/dsi: set max return packet size for each dsi port Jani Nikula
@ 2015-01-22 10:53   ` Shobhit Kumar
  2015-01-22 12:57     ` Jani Nikula
  2015-01-22 13:01   ` [PATCH v2] " Jani Nikula
  1 sibling, 1 reply; 45+ messages in thread
From: Shobhit Kumar @ 2015-01-22 10:53 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx; +Cc: Shobhit Kumar, Thierry Reding

On 01/16/2015 05:57 PM, Jani Nikula wrote:
> This seems like the right thing to do. This also gets rid of a call to
> intel_dsi_pipe_to_port() which we want to remove eventually.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_dsi.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index 36b19c7e87b9..49e186bc080f 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -197,14 +197,14 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
>   {
>   	struct drm_device *dev = encoder->base.dev;
>   	struct drm_i915_private *dev_priv = dev->dev_private;
> -	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
>   	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
> -	enum port port = intel_dsi_pipe_to_port(intel_crtc->pipe);
> +	enum port port;
>
>   	DRM_DEBUG_KMS("\n");
>
>   	if (is_cmd_mode(intel_dsi))
> -		I915_WRITE(MIPI_MAX_RETURN_PKT_SIZE(port), 8 * 4);
> +		for_each_dsi_port(port, intel_dsi->ports)
> +			I915_WRITE(MIPI_MAX_RETURN_PKT_SIZE(port), 8 * 4);

Using for_each_dsi_port() macro in this way will make the following else 
below as "else" part for that "if" inside the macro, breaking the whole 
logic. We should enclose the true part of is_cmd_mode check in braces

>   	else {
>   		msleep(20); /* XXX */
>   		for_each_dsi_port(port, intel_dsi->ports)
>

Regards
Shobhit
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 04/12] drm/i915/dsi: call wait_for_dsi_fifo_empty() for each dsi port
  2015-01-16 12:27 ` [RFC PATCH 04/12] drm/i915/dsi: call wait_for_dsi_fifo_empty() for each dsi port Jani Nikula
@ 2015-01-22 10:55   ` Shobhit Kumar
  0 siblings, 0 replies; 45+ messages in thread
From: Shobhit Kumar @ 2015-01-22 10:55 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx; +Cc: Shobhit Kumar, Thierry Reding

On 01/16/2015 05:57 PM, Jani Nikula wrote:
> Add port parameter to wait_for_dsi_fifo_empty, and call it for each dsi
> port.
>
> We can now remove the transitional intel_dsi_pipe_to_port() function.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-By: Shobhit Kumar <shobhit.kumar@intel.com>


> ---
>   drivers/gpu/drm/i915/intel_dsi.c | 17 ++++++++++-------
>   drivers/gpu/drm/i915/intel_dsi.h | 12 ------------
>   2 files changed, 10 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index e82cf5f65c9a..9b0eaa9db845 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -42,13 +42,11 @@ static const struct intel_dsi_device intel_dsi_devices[] = {
>   	},
>   };
>
> -static void wait_for_dsi_fifo_empty(struct intel_dsi *intel_dsi)
> +static void wait_for_dsi_fifo_empty(struct intel_dsi *intel_dsi, enum port port)
>   {
>   	struct drm_encoder *encoder = &intel_dsi->base.base;
>   	struct drm_device *dev = encoder->dev;
>   	struct drm_i915_private *dev_priv = dev->dev_private;
> -	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
> -	enum port port = intel_dsi_pipe_to_port(intel_crtc->pipe);
>   	u32 mask;
>
>   	mask = LP_CTRL_FIFO_EMPTY | HS_CTRL_FIFO_EMPTY |
> @@ -230,7 +228,8 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
>   		if (intel_dsi->dev.dev_ops->enable)
>   			intel_dsi->dev.dev_ops->enable(&intel_dsi->dev);
>
> -		wait_for_dsi_fifo_empty(intel_dsi);
> +		for_each_dsi_port(port, intel_dsi->ports)
> +			wait_for_dsi_fifo_empty(intel_dsi, port);
>
>   		intel_dsi_port_enable(encoder);
>   	}
> @@ -243,6 +242,7 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)
>   	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
>   	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
>   	enum pipe pipe = intel_crtc->pipe;
> +	enum port port;
>   	u32 tmp;
>
>   	DRM_DEBUG_KMS("\n");
> @@ -272,7 +272,8 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)
>   	if (intel_dsi->dev.dev_ops->send_otp_cmds)
>   		intel_dsi->dev.dev_ops->send_otp_cmds(&intel_dsi->dev);
>
> -	wait_for_dsi_fifo_empty(intel_dsi);
> +	for_each_dsi_port(port, intel_dsi->ports)
> +		wait_for_dsi_fifo_empty(intel_dsi, port);
>
>   	/* Enable port in pre-enable phase itself because as per hw team
>   	 * recommendation, port should be enabled befor plane & pipe */
> @@ -315,7 +316,8 @@ static void intel_dsi_disable(struct intel_encoder *encoder)
>   	DRM_DEBUG_KMS("\n");
>
>   	if (is_vid_mode(intel_dsi)) {
> -		wait_for_dsi_fifo_empty(intel_dsi);
> +		for_each_dsi_port(port, intel_dsi->ports)
> +			wait_for_dsi_fifo_empty(intel_dsi, port);
>
>   		intel_dsi_port_disable(encoder);
>   		msleep(2);
> @@ -344,7 +346,8 @@ static void intel_dsi_disable(struct intel_encoder *encoder)
>   	if (intel_dsi->dev.dev_ops->disable)
>   		intel_dsi->dev.dev_ops->disable(&intel_dsi->dev);
>
> -	wait_for_dsi_fifo_empty(intel_dsi);
> +	for_each_dsi_port(port, intel_dsi->ports)
> +		wait_for_dsi_fifo_empty(intel_dsi, port);
>   }
>
>   static void intel_dsi_clear_device_ready(struct intel_encoder *encoder)
> diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h
> index 8fe2064dd804..2bb8c46c7889 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.h
> +++ b/drivers/gpu/drm/i915/intel_dsi.h
> @@ -137,18 +137,6 @@ struct intel_dsi {
>   	u16 panel_pwr_cycle_delay;
>   };
>
> -/* XXX: Transitional before dual port configuration */
> -static inline enum port intel_dsi_pipe_to_port(enum pipe pipe)
> -{
> -	if (pipe == PIPE_A)
> -		return PORT_A;
> -	else if (pipe == PIPE_B)
> -		return PORT_C;
> -
> -	WARN(1, "DSI on pipe %c, assuming port C\n", pipe_name(pipe));
> -	return PORT_C;
> -}
> -
>   #define for_each_dsi_port(__port, __ports_mask) \
>   	for ((__port) = PORT_A; (__port) < I915_MAX_PORTS; (__port)++)	\
>   		if ((__ports_mask) & (1 << (__port)))
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 05/12] drm/i915/dsi: remove unnecessary dsi device callbacks
  2015-01-16 12:27 ` [RFC PATCH 05/12] drm/i915/dsi: remove unnecessary dsi device callbacks Jani Nikula
@ 2015-01-22 11:23   ` Shobhit Kumar
  2015-01-22 13:23     ` Jani Nikula
  0 siblings, 1 reply; 45+ messages in thread
From: Shobhit Kumar @ 2015-01-22 11:23 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx; +Cc: Shobhit Kumar, Thierry Reding

On 01/16/2015 05:57 PM, Jani Nikula wrote:
> Remove all the trivial and/or dummy callbacks from intel dsi device
> ops. Merge send_otp_cmds into panel_reset as they're called back to
> back.
>
> This will be helpful for switching to use drm_panel for the
> callbacks. If we ever need the additional callbacks, we should add them
> to drm_panel funcs.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_dsi.c           | 32 ++-------------------
>   drivers/gpu/drm/i915/intel_dsi.h           | 20 -------------
>   drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 45 ++----------------------------
>   3 files changed, 5 insertions(+), 92 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index 9b0eaa9db845..fc218b7754b3 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -70,12 +70,6 @@ static void band_gap_reset(struct drm_i915_private *dev_priv)
>   	mutex_unlock(&dev_priv->dpio_lock);
>   }
>
> -static struct intel_dsi *intel_attached_dsi(struct drm_connector *connector)
> -{
> -	return container_of(intel_attached_encoder(connector),
> -			    struct intel_dsi, base);
> -}
> -
>   static inline bool is_vid_mode(struct intel_dsi *intel_dsi)
>   {
>   	return intel_dsi->operation_mode == INTEL_DSI_VIDEO_MODE;
> @@ -99,7 +93,6 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>   	struct intel_connector *intel_connector = intel_dsi->attached_connector;
>   	struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
>   	struct drm_display_mode *adjusted_mode = &config->adjusted_mode;
> -	struct drm_display_mode *mode = &config->requested_mode;
>
>   	DRM_DEBUG_KMS("\n");
>
> @@ -109,10 +102,6 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>   	/* DSI uses short packets for sync events, so clear mode flags for DSI */
>   	adjusted_mode->flags = 0;
>
> -	if (intel_dsi->dev.dev_ops->mode_fixup)
> -		return intel_dsi->dev.dev_ops->mode_fixup(&intel_dsi->dev,
> -							  mode, adjusted_mode);
> -

There had been a instance where we had to drive different resolution 
(lower) than the native one. Also in VBT there is a field to make this 
generic at least from driver perspective to give the needed target 
resolution. In case target resolution is same as native, nothing gets 
changed, else mode_fixup function adjusts the mode accordingly keeping 
timing as same and enabling scalar. Might not be useful in general, but 
did find a use internally.

Either way

Reviewed-By: Shobhit Kumar <shobhit.kumar@intel.com>

>   	return true;
>   }
>
> @@ -269,9 +258,6 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)
>   	if (intel_dsi->dev.dev_ops->panel_reset)
>   		intel_dsi->dev.dev_ops->panel_reset(&intel_dsi->dev);
>
> -	if (intel_dsi->dev.dev_ops->send_otp_cmds)
> -		intel_dsi->dev.dev_ops->send_otp_cmds(&intel_dsi->dev);
> -
>   	for_each_dsi_port(port, intel_dsi->ports)
>   		wait_for_dsi_fifo_empty(intel_dsi, port);
>
> @@ -484,7 +470,6 @@ intel_dsi_mode_valid(struct drm_connector *connector,
>   {
>   	struct intel_connector *intel_connector = to_intel_connector(connector);
>   	struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
> -	struct intel_dsi *intel_dsi = intel_attached_dsi(connector);
>
>   	DRM_DEBUG_KMS("\n");
>
> @@ -500,7 +485,7 @@ intel_dsi_mode_valid(struct drm_connector *connector,
>   			return MODE_PANEL;
>   	}
>
> -	return intel_dsi->dev.dev_ops->mode_valid(&intel_dsi->dev, mode);
> +	return MODE_OK;
>   }
>
>   /* return txclkesc cycles in terms of divider and duration in us */
> @@ -749,20 +734,7 @@ static void intel_dsi_pre_pll_enable(struct intel_encoder *encoder)
>   static enum drm_connector_status
>   intel_dsi_detect(struct drm_connector *connector, bool force)
>   {
> -	struct intel_dsi *intel_dsi = intel_attached_dsi(connector);
> -	struct intel_encoder *intel_encoder = &intel_dsi->base;
> -	enum intel_display_power_domain power_domain;
> -	enum drm_connector_status connector_status;
> -	struct drm_i915_private *dev_priv = intel_encoder->base.dev->dev_private;
> -
> -	DRM_DEBUG_KMS("\n");
> -	power_domain = intel_display_port_power_domain(intel_encoder);
> -
> -	intel_display_power_get(dev_priv, power_domain);
> -	connector_status = intel_dsi->dev.dev_ops->detect(&intel_dsi->dev);
> -	intel_display_power_put(dev_priv, power_domain);
> -
> -	return connector_status;
> +	return connector_status_connected;
>   }
>
>   static int intel_dsi_get_modes(struct drm_connector *connector)
> diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h
> index 2bb8c46c7889..22f87036a256 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.h
> +++ b/drivers/gpu/drm/i915/intel_dsi.h
> @@ -47,33 +47,13 @@ struct intel_dsi_dev_ops {
>
>   	void (*disable_panel_power)(struct intel_dsi_device *dsi);
>
> -	/* one time programmable commands if needed */
> -	void (*send_otp_cmds)(struct intel_dsi_device *dsi);
> -
>   	/* This callback must be able to assume DSI commands can be sent */
>   	void (*enable)(struct intel_dsi_device *dsi);
>
>   	/* This callback must be able to assume DSI commands can be sent */
>   	void (*disable)(struct intel_dsi_device *dsi);
>
> -	int (*mode_valid)(struct intel_dsi_device *dsi,
> -			  struct drm_display_mode *mode);
> -
> -	bool (*mode_fixup)(struct intel_dsi_device *dsi,
> -			   const struct drm_display_mode *mode,
> -			   struct drm_display_mode *adjusted_mode);
> -
> -	void (*mode_set)(struct intel_dsi_device *dsi,
> -			 struct drm_display_mode *mode,
> -			 struct drm_display_mode *adjusted_mode);
> -
> -	enum drm_connector_status (*detect)(struct intel_dsi_device *dsi);
> -
> -	bool (*get_hw_state)(struct intel_dsi_device *dev);
> -
>   	struct drm_display_mode *(*get_modes)(struct intel_dsi_device *dsi);
> -
> -	void (*destroy) (struct intel_dsi_device *dsi);
>   };
>
>   struct intel_dsi {
> diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> index 5493aef5a6a3..b0e7327a485f 100644
> --- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> +++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> @@ -559,18 +559,6 @@ static bool generic_init(struct intel_dsi_device *dsi)
>   	return true;
>   }
>
> -static int generic_mode_valid(struct intel_dsi_device *dsi,
> -		   struct drm_display_mode *mode)
> -{
> -	return MODE_OK;
> -}
> -
> -static bool generic_mode_fixup(struct intel_dsi_device *dsi,
> -		    const struct drm_display_mode *mode,
> -		    struct drm_display_mode *adjusted_mode) {
> -	return true;
> -}
> -
>   static void generic_panel_reset(struct intel_dsi_device *dsi)
>   {
>   	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
> @@ -580,26 +568,18 @@ static void generic_panel_reset(struct intel_dsi_device *dsi)
>   	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_ASSERT_RESET];
>
>   	generic_exec_sequence(intel_dsi, sequence);
> -}
> -
> -static void generic_disable_panel_power(struct intel_dsi_device *dsi)
> -{
> -	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
> -	struct drm_device *dev = intel_dsi->base.base.dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -
> -	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET];
>
> +	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP];
>   	generic_exec_sequence(intel_dsi, sequence);
>   }
>
> -static void generic_send_otp_cmds(struct intel_dsi_device *dsi)
> +static void generic_disable_panel_power(struct intel_dsi_device *dsi)
>   {
>   	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
>   	struct drm_device *dev = intel_dsi->base.base.dev;
>   	struct drm_i915_private *dev_priv = dev->dev_private;
>
> -	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP];
> +	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET];
>
>   	generic_exec_sequence(intel_dsi, sequence);
>   }
> @@ -626,16 +606,6 @@ static void generic_disable(struct intel_dsi_device *dsi)
>   	generic_exec_sequence(intel_dsi, sequence);
>   }
>
> -static enum drm_connector_status generic_detect(struct intel_dsi_device *dsi)
> -{
> -	return connector_status_connected;
> -}
> -
> -static bool generic_get_hw_state(struct intel_dsi_device *dev)
> -{
> -	return true;
> -}
> -
>   static struct drm_display_mode *generic_get_modes(struct intel_dsi_device *dsi)
>   {
>   	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
> @@ -646,20 +616,11 @@ static struct drm_display_mode *generic_get_modes(struct intel_dsi_device *dsi)
>   	return dev_priv->vbt.lfp_lvds_vbt_mode;
>   }
>
> -static void generic_destroy(struct intel_dsi_device *dsi) { }
> -
> -/* Callbacks. We might not need them all. */
>   struct intel_dsi_dev_ops vbt_generic_dsi_display_ops = {
>   	.init = generic_init,
> -	.mode_valid = generic_mode_valid,
> -	.mode_fixup = generic_mode_fixup,
>   	.panel_reset = generic_panel_reset,
>   	.disable_panel_power = generic_disable_panel_power,
> -	.send_otp_cmds = generic_send_otp_cmds,
>   	.enable = generic_enable,
>   	.disable = generic_disable,
> -	.detect = generic_detect,
> -	.get_hw_state = generic_get_hw_state,
>   	.get_modes = generic_get_modes,
> -	.destroy = generic_destroy,
>   };
>

Regards
Shobhit
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 06/12] drm/i915/dsi: add some constness to vbt panel driver
  2015-01-16 12:27 ` [RFC PATCH 06/12] drm/i915/dsi: add some constness to vbt panel driver Jani Nikula
@ 2015-01-22 11:25   ` Shobhit Kumar
  0 siblings, 0 replies; 45+ messages in thread
From: Shobhit Kumar @ 2015-01-22 11:25 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx; +Cc: Shobhit Kumar, Thierry Reding

On 01/16/2015 05:57 PM, Jani Nikula wrote:
> Const is good for you. No functional changes.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-By: Shobhit Kumar <shobhit.kumar@intel.com>

> ---
>   drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 17 +++++++++--------
>   1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> index b0e7327a485f..561ec2981dfd 100644
> --- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> +++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> @@ -99,7 +99,8 @@ static inline enum port intel_dsi_seq_port_to_port(u8 port)
>   	return port ? PORT_C : PORT_A;
>   }
>
> -static u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi, u8 *data)
> +static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi,
> +				       const u8 *data)
>   {
>   	u8 type, byte, mode, vc, seq_port;
>   	u16 len;
> @@ -165,9 +166,9 @@ static u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi, u8 *data)
>   	return data;
>   }
>
> -static u8 *mipi_exec_delay(struct intel_dsi *intel_dsi, u8 *data)
> +static const u8 *mipi_exec_delay(struct intel_dsi *intel_dsi, const u8 *data)
>   {
> -	u32 delay = *((u32 *) data);
> +	u32 delay = *((const u32 *) data);
>
>   	usleep_range(delay, delay + 10);
>   	data += 4;
> @@ -175,7 +176,7 @@ static u8 *mipi_exec_delay(struct intel_dsi *intel_dsi, u8 *data)
>   	return data;
>   }
>
> -static u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, u8 *data)
> +static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
>   {
>   	u8 gpio, action;
>   	u16 function, pad;
> @@ -208,7 +209,8 @@ static u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, u8 *data)
>   	return data;
>   }
>
> -typedef u8 * (*fn_mipi_elem_exec)(struct intel_dsi *intel_dsi, u8 *data);
> +typedef const u8 * (*fn_mipi_elem_exec)(struct intel_dsi *intel_dsi,
> +					const u8 *data);
>   static const fn_mipi_elem_exec exec_elem[] = {
>   	NULL, /* reserved */
>   	mipi_exec_send_packet,
> @@ -232,13 +234,12 @@ static const char * const seq_name[] = {
>   	"MIPI_SEQ_DEASSERT_RESET"
>   };
>
> -static void generic_exec_sequence(struct intel_dsi *intel_dsi, char *sequence)
> +static void generic_exec_sequence(struct intel_dsi *intel_dsi, const u8 *data)
>   {
> -	u8 *data = sequence;
>   	fn_mipi_elem_exec mipi_elem_exec;
>   	int index;
>
> -	if (!sequence)
> +	if (!data)
>   		return;
>
>   	DRM_DEBUG_DRIVER("Starting MIPI sequence - %s\n", seq_name[*data]);
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks
  2015-01-16 12:27 [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks Jani Nikula
                   ` (11 preceding siblings ...)
  2015-01-16 12:27 ` [RFC PATCH 12/12] drm/i915/dsi: remove intel_dsi_cmd.c and the unused functions therein Jani Nikula
@ 2015-01-22 11:46 ` Shobhit Kumar
  2015-01-22 13:28   ` Jani Nikula
  12 siblings, 1 reply; 45+ messages in thread
From: Shobhit Kumar @ 2015-01-22 11:46 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx; +Cc: Shobhit Kumar, Thierry Reding

On 01/16/2015 05:57 PM, Jani Nikula wrote:
> This series ports our DSI code over to the drm_panel and
> mipi_dsi_host/mipi_dsi_device. There are some rough edges towards the
> end of the series, see commit message for patch 8 for details.
>
> Patches 1-6 are prep work, fairly independent

While I continue to review, quick test of patches show that till here it 
is fine(with minor fix for Patch 2), but from Patch 7 on wards things 
really don't work.

>
> Patch 7 ports the driver over to drm_panel
>
> Patches 8-10 port the driver over to mipi_dsi_host/device
>
> Patches 11-12 do some additional cleanup
>
> BR,
> Jani.
>
>
> Jani Nikula (12):
>    drm/i915/dsi: call dpi_send_cmd() for each dsi port at a higher level
>    drm/i915/dsi: set max return packet size for each dsi port
>    drm/i915/dsi: move wait_for_dsi_fifo_empty to intel_dsi.c
>    drm/i915/dsi: call wait_for_dsi_fifo_empty() for each dsi port
>    drm/i915/dsi: remove unnecessary dsi device callbacks
>    drm/i915/dsi: add some constness to vbt panel driver
>    drm/i915/dsi: switch to drm_panel interface
>    drm/i915/dsi: add drm mipi dsi host support
>    drm/i915/dsi: make the vbt panel driver use mipi_dsi_device for
>      transfers
>    drm/i915/dsi: remove old read/write functions in favor of new stuff
>    drm/i915/dsi: move dpi_send_cmd() to intel_dsi.c and make it static
>    drm/i915/dsi: remove intel_dsi_cmd.c and the unused functions therein
>
>   drivers/gpu/drm/i915/Kconfig               |   2 +
>   drivers/gpu/drm/i915/Makefile              |   1 -
>   drivers/gpu/drm/i915/intel_dsi.c           | 336 +++++++++++++++++-----
>   drivers/gpu/drm/i915/intel_dsi.h           |  69 ++---
>   drivers/gpu/drm/i915/intel_dsi_cmd.c       | 432 -----------------------------
>   drivers/gpu/drm/i915/intel_dsi_cmd.h       |  78 ------
>   drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 289 ++++++++++---------
>   7 files changed, 441 insertions(+), 766 deletions(-)
>   delete mode 100644 drivers/gpu/drm/i915/intel_dsi_cmd.c
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 02/12] drm/i915/dsi: set max return packet size for each dsi port
  2015-01-22 10:53   ` Shobhit Kumar
@ 2015-01-22 12:57     ` Jani Nikula
  0 siblings, 0 replies; 45+ messages in thread
From: Jani Nikula @ 2015-01-22 12:57 UTC (permalink / raw)
  To: Shobhit Kumar, intel-gfx; +Cc: Shobhit Kumar, Thierry Reding

On Thu, 22 Jan 2015, Shobhit Kumar <shobhit.kumar@linux.intel.com> wrote:
> On 01/16/2015 05:57 PM, Jani Nikula wrote:
>> This seems like the right thing to do. This also gets rid of a call to
>> intel_dsi_pipe_to_port() which we want to remove eventually.
>>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>>   drivers/gpu/drm/i915/intel_dsi.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
>> index 36b19c7e87b9..49e186bc080f 100644
>> --- a/drivers/gpu/drm/i915/intel_dsi.c
>> +++ b/drivers/gpu/drm/i915/intel_dsi.c
>> @@ -197,14 +197,14 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
>>   {
>>   	struct drm_device *dev = encoder->base.dev;
>>   	struct drm_i915_private *dev_priv = dev->dev_private;
>> -	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
>>   	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
>> -	enum port port = intel_dsi_pipe_to_port(intel_crtc->pipe);
>> +	enum port port;
>>
>>   	DRM_DEBUG_KMS("\n");
>>
>>   	if (is_cmd_mode(intel_dsi))
>> -		I915_WRITE(MIPI_MAX_RETURN_PKT_SIZE(port), 8 * 4);
>> +		for_each_dsi_port(port, intel_dsi->ports)
>> +			I915_WRITE(MIPI_MAX_RETURN_PKT_SIZE(port), 8 * 4);
>
> Using for_each_dsi_port() macro in this way will make the following else 
> below as "else" part for that "if" inside the macro, breaking the whole 
> logic. We should enclose the true part of is_cmd_mode check in braces

Auch, good catch. Thanks.

Jani.

>
>>   	else {
>>   		msleep(20); /* XXX */
>>   		for_each_dsi_port(port, intel_dsi->ports)
>>
>
> Regards
> Shobhit

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH v2] drm/i915/dsi: set max return packet size for each dsi port
  2015-01-16 12:27 ` [RFC PATCH 02/12] drm/i915/dsi: set max return packet size for each dsi port Jani Nikula
  2015-01-22 10:53   ` Shobhit Kumar
@ 2015-01-22 13:01   ` Jani Nikula
  2015-01-23  2:07     ` Shobhit Kumar
  1 sibling, 1 reply; 45+ messages in thread
From: Jani Nikula @ 2015-01-22 13:01 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula, Shobhit Kumar, Thierry Reding

This seems like the right thing to do. This also gets rid of a call to
intel_dsi_pipe_to_port() which we want to remove eventually.

v2: add braces to fix else logic (Shobhit)

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_dsi.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 4bb9886fa2cf..dac41046a0cc 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -197,15 +197,15 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
 {
 	struct drm_device *dev = encoder->base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
-	enum port port = intel_dsi_pipe_to_port(intel_crtc->pipe);
+	enum port port;
 
 	DRM_DEBUG_KMS("\n");
 
-	if (is_cmd_mode(intel_dsi))
-		I915_WRITE(MIPI_MAX_RETURN_PKT_SIZE(port), 8 * 4);
-	else {
+	if (is_cmd_mode(intel_dsi)) {
+		for_each_dsi_port(port, intel_dsi->ports)
+			I915_WRITE(MIPI_MAX_RETURN_PKT_SIZE(port), 8 * 4);
+	} else {
 		msleep(20); /* XXX */
 		for_each_dsi_port(port, intel_dsi->ports)
 			dpi_send_cmd(intel_dsi, TURN_ON, DPI_LP_MODE_EN, port);
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 05/12] drm/i915/dsi: remove unnecessary dsi device callbacks
  2015-01-22 11:23   ` Shobhit Kumar
@ 2015-01-22 13:23     ` Jani Nikula
  2015-01-23  9:44       ` Shobhit Kumar
  0 siblings, 1 reply; 45+ messages in thread
From: Jani Nikula @ 2015-01-22 13:23 UTC (permalink / raw)
  To: Shobhit Kumar, intel-gfx; +Cc: Shobhit Kumar, Thierry Reding

On Thu, 22 Jan 2015, Shobhit Kumar <shobhit.kumar@linux.intel.com> wrote:
> On 01/16/2015 05:57 PM, Jani Nikula wrote:
>> Remove all the trivial and/or dummy callbacks from intel dsi device
>> ops. Merge send_otp_cmds into panel_reset as they're called back to
>> back.
>>
>> This will be helpful for switching to use drm_panel for the
>> callbacks. If we ever need the additional callbacks, we should add them
>> to drm_panel funcs.
>>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>>   drivers/gpu/drm/i915/intel_dsi.c           | 32 ++-------------------
>>   drivers/gpu/drm/i915/intel_dsi.h           | 20 -------------
>>   drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 45 ++----------------------------
>>   3 files changed, 5 insertions(+), 92 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
>> index 9b0eaa9db845..fc218b7754b3 100644
>> --- a/drivers/gpu/drm/i915/intel_dsi.c
>> +++ b/drivers/gpu/drm/i915/intel_dsi.c
>> @@ -70,12 +70,6 @@ static void band_gap_reset(struct drm_i915_private *dev_priv)
>>   	mutex_unlock(&dev_priv->dpio_lock);
>>   }
>>
>> -static struct intel_dsi *intel_attached_dsi(struct drm_connector *connector)
>> -{
>> -	return container_of(intel_attached_encoder(connector),
>> -			    struct intel_dsi, base);
>> -}
>> -
>>   static inline bool is_vid_mode(struct intel_dsi *intel_dsi)
>>   {
>>   	return intel_dsi->operation_mode == INTEL_DSI_VIDEO_MODE;
>> @@ -99,7 +93,6 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>>   	struct intel_connector *intel_connector = intel_dsi->attached_connector;
>>   	struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
>>   	struct drm_display_mode *adjusted_mode = &config->adjusted_mode;
>> -	struct drm_display_mode *mode = &config->requested_mode;
>>
>>   	DRM_DEBUG_KMS("\n");
>>
>> @@ -109,10 +102,6 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>>   	/* DSI uses short packets for sync events, so clear mode flags for DSI */
>>   	adjusted_mode->flags = 0;
>>
>> -	if (intel_dsi->dev.dev_ops->mode_fixup)
>> -		return intel_dsi->dev.dev_ops->mode_fixup(&intel_dsi->dev,
>> -							  mode, adjusted_mode);
>> -
>
> There had been a instance where we had to drive different resolution 
> (lower) than the native one. Also in VBT there is a field to make this 
> generic at least from driver perspective to give the needed target 
> resolution. In case target resolution is same as native, nothing gets 
> changed, else mode_fixup function adjusts the mode accordingly keeping 
> timing as same and enabling scalar. Might not be useful in general, but 
> did find a use internally.

Can we just have the driver return the desired mode from .get_modes in
that case?

BR,
Jani.


>
> Either way
>
> Reviewed-By: Shobhit Kumar <shobhit.kumar@intel.com>
>
>>   	return true;
>>   }
>>
>> @@ -269,9 +258,6 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)
>>   	if (intel_dsi->dev.dev_ops->panel_reset)
>>   		intel_dsi->dev.dev_ops->panel_reset(&intel_dsi->dev);
>>
>> -	if (intel_dsi->dev.dev_ops->send_otp_cmds)
>> -		intel_dsi->dev.dev_ops->send_otp_cmds(&intel_dsi->dev);
>> -
>>   	for_each_dsi_port(port, intel_dsi->ports)
>>   		wait_for_dsi_fifo_empty(intel_dsi, port);
>>
>> @@ -484,7 +470,6 @@ intel_dsi_mode_valid(struct drm_connector *connector,
>>   {
>>   	struct intel_connector *intel_connector = to_intel_connector(connector);
>>   	struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
>> -	struct intel_dsi *intel_dsi = intel_attached_dsi(connector);
>>
>>   	DRM_DEBUG_KMS("\n");
>>
>> @@ -500,7 +485,7 @@ intel_dsi_mode_valid(struct drm_connector *connector,
>>   			return MODE_PANEL;
>>   	}
>>
>> -	return intel_dsi->dev.dev_ops->mode_valid(&intel_dsi->dev, mode);
>> +	return MODE_OK;
>>   }
>>
>>   /* return txclkesc cycles in terms of divider and duration in us */
>> @@ -749,20 +734,7 @@ static void intel_dsi_pre_pll_enable(struct intel_encoder *encoder)
>>   static enum drm_connector_status
>>   intel_dsi_detect(struct drm_connector *connector, bool force)
>>   {
>> -	struct intel_dsi *intel_dsi = intel_attached_dsi(connector);
>> -	struct intel_encoder *intel_encoder = &intel_dsi->base;
>> -	enum intel_display_power_domain power_domain;
>> -	enum drm_connector_status connector_status;
>> -	struct drm_i915_private *dev_priv = intel_encoder->base.dev->dev_private;
>> -
>> -	DRM_DEBUG_KMS("\n");
>> -	power_domain = intel_display_port_power_domain(intel_encoder);
>> -
>> -	intel_display_power_get(dev_priv, power_domain);
>> -	connector_status = intel_dsi->dev.dev_ops->detect(&intel_dsi->dev);
>> -	intel_display_power_put(dev_priv, power_domain);
>> -
>> -	return connector_status;
>> +	return connector_status_connected;
>>   }
>>
>>   static int intel_dsi_get_modes(struct drm_connector *connector)
>> diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h
>> index 2bb8c46c7889..22f87036a256 100644
>> --- a/drivers/gpu/drm/i915/intel_dsi.h
>> +++ b/drivers/gpu/drm/i915/intel_dsi.h
>> @@ -47,33 +47,13 @@ struct intel_dsi_dev_ops {
>>
>>   	void (*disable_panel_power)(struct intel_dsi_device *dsi);
>>
>> -	/* one time programmable commands if needed */
>> -	void (*send_otp_cmds)(struct intel_dsi_device *dsi);
>> -
>>   	/* This callback must be able to assume DSI commands can be sent */
>>   	void (*enable)(struct intel_dsi_device *dsi);
>>
>>   	/* This callback must be able to assume DSI commands can be sent */
>>   	void (*disable)(struct intel_dsi_device *dsi);
>>
>> -	int (*mode_valid)(struct intel_dsi_device *dsi,
>> -			  struct drm_display_mode *mode);
>> -
>> -	bool (*mode_fixup)(struct intel_dsi_device *dsi,
>> -			   const struct drm_display_mode *mode,
>> -			   struct drm_display_mode *adjusted_mode);
>> -
>> -	void (*mode_set)(struct intel_dsi_device *dsi,
>> -			 struct drm_display_mode *mode,
>> -			 struct drm_display_mode *adjusted_mode);
>> -
>> -	enum drm_connector_status (*detect)(struct intel_dsi_device *dsi);
>> -
>> -	bool (*get_hw_state)(struct intel_dsi_device *dev);
>> -
>>   	struct drm_display_mode *(*get_modes)(struct intel_dsi_device *dsi);
>> -
>> -	void (*destroy) (struct intel_dsi_device *dsi);
>>   };
>>
>>   struct intel_dsi {
>> diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
>> index 5493aef5a6a3..b0e7327a485f 100644
>> --- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
>> +++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
>> @@ -559,18 +559,6 @@ static bool generic_init(struct intel_dsi_device *dsi)
>>   	return true;
>>   }
>>
>> -static int generic_mode_valid(struct intel_dsi_device *dsi,
>> -		   struct drm_display_mode *mode)
>> -{
>> -	return MODE_OK;
>> -}
>> -
>> -static bool generic_mode_fixup(struct intel_dsi_device *dsi,
>> -		    const struct drm_display_mode *mode,
>> -		    struct drm_display_mode *adjusted_mode) {
>> -	return true;
>> -}
>> -
>>   static void generic_panel_reset(struct intel_dsi_device *dsi)
>>   {
>>   	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
>> @@ -580,26 +568,18 @@ static void generic_panel_reset(struct intel_dsi_device *dsi)
>>   	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_ASSERT_RESET];
>>
>>   	generic_exec_sequence(intel_dsi, sequence);
>> -}
>> -
>> -static void generic_disable_panel_power(struct intel_dsi_device *dsi)
>> -{
>> -	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
>> -	struct drm_device *dev = intel_dsi->base.base.dev;
>> -	struct drm_i915_private *dev_priv = dev->dev_private;
>> -
>> -	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET];
>>
>> +	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP];
>>   	generic_exec_sequence(intel_dsi, sequence);
>>   }
>>
>> -static void generic_send_otp_cmds(struct intel_dsi_device *dsi)
>> +static void generic_disable_panel_power(struct intel_dsi_device *dsi)
>>   {
>>   	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
>>   	struct drm_device *dev = intel_dsi->base.base.dev;
>>   	struct drm_i915_private *dev_priv = dev->dev_private;
>>
>> -	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP];
>> +	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET];
>>
>>   	generic_exec_sequence(intel_dsi, sequence);
>>   }
>> @@ -626,16 +606,6 @@ static void generic_disable(struct intel_dsi_device *dsi)
>>   	generic_exec_sequence(intel_dsi, sequence);
>>   }
>>
>> -static enum drm_connector_status generic_detect(struct intel_dsi_device *dsi)
>> -{
>> -	return connector_status_connected;
>> -}
>> -
>> -static bool generic_get_hw_state(struct intel_dsi_device *dev)
>> -{
>> -	return true;
>> -}
>> -
>>   static struct drm_display_mode *generic_get_modes(struct intel_dsi_device *dsi)
>>   {
>>   	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
>> @@ -646,20 +616,11 @@ static struct drm_display_mode *generic_get_modes(struct intel_dsi_device *dsi)
>>   	return dev_priv->vbt.lfp_lvds_vbt_mode;
>>   }
>>
>> -static void generic_destroy(struct intel_dsi_device *dsi) { }
>> -
>> -/* Callbacks. We might not need them all. */
>>   struct intel_dsi_dev_ops vbt_generic_dsi_display_ops = {
>>   	.init = generic_init,
>> -	.mode_valid = generic_mode_valid,
>> -	.mode_fixup = generic_mode_fixup,
>>   	.panel_reset = generic_panel_reset,
>>   	.disable_panel_power = generic_disable_panel_power,
>> -	.send_otp_cmds = generic_send_otp_cmds,
>>   	.enable = generic_enable,
>>   	.disable = generic_disable,
>> -	.detect = generic_detect,
>> -	.get_hw_state = generic_get_hw_state,
>>   	.get_modes = generic_get_modes,
>> -	.destroy = generic_destroy,
>>   };
>>
>
> Regards
> Shobhit
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks
  2015-01-22 11:46 ` [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks Shobhit Kumar
@ 2015-01-22 13:28   ` Jani Nikula
  2015-01-23  2:13     ` Shobhit Kumar
  0 siblings, 1 reply; 45+ messages in thread
From: Jani Nikula @ 2015-01-22 13:28 UTC (permalink / raw)
  To: Shobhit Kumar, intel-gfx; +Cc: Shobhit Kumar, Thierry Reding

On Thu, 22 Jan 2015, Shobhit Kumar <shobhit.kumar@linux.intel.com> wrote:
> On 01/16/2015 05:57 PM, Jani Nikula wrote:
>> This series ports our DSI code over to the drm_panel and
>> mipi_dsi_host/mipi_dsi_device. There are some rough edges towards the
>> end of the series, see commit message for patch 8 for details.
>>
>> Patches 1-6 are prep work, fairly independent
>
> While I continue to review, quick test of patches show that till here it 
> is fine(with minor fix for Patch 2), but from Patch 7 on wards things 
> really don't work.

Okay, thanks for the review so far and trying it out.

What breaks down with patch 7? Which device are you trying this on?

BR,
Jani.


>
>>
>> Patch 7 ports the driver over to drm_panel
>>
>> Patches 8-10 port the driver over to mipi_dsi_host/device
>>
>> Patches 11-12 do some additional cleanup
>>
>> BR,
>> Jani.
>>
>>
>> Jani Nikula (12):
>>    drm/i915/dsi: call dpi_send_cmd() for each dsi port at a higher level
>>    drm/i915/dsi: set max return packet size for each dsi port
>>    drm/i915/dsi: move wait_for_dsi_fifo_empty to intel_dsi.c
>>    drm/i915/dsi: call wait_for_dsi_fifo_empty() for each dsi port
>>    drm/i915/dsi: remove unnecessary dsi device callbacks
>>    drm/i915/dsi: add some constness to vbt panel driver
>>    drm/i915/dsi: switch to drm_panel interface
>>    drm/i915/dsi: add drm mipi dsi host support
>>    drm/i915/dsi: make the vbt panel driver use mipi_dsi_device for
>>      transfers
>>    drm/i915/dsi: remove old read/write functions in favor of new stuff
>>    drm/i915/dsi: move dpi_send_cmd() to intel_dsi.c and make it static
>>    drm/i915/dsi: remove intel_dsi_cmd.c and the unused functions therein
>>
>>   drivers/gpu/drm/i915/Kconfig               |   2 +
>>   drivers/gpu/drm/i915/Makefile              |   1 -
>>   drivers/gpu/drm/i915/intel_dsi.c           | 336 +++++++++++++++++-----
>>   drivers/gpu/drm/i915/intel_dsi.h           |  69 ++---
>>   drivers/gpu/drm/i915/intel_dsi_cmd.c       | 432 -----------------------------
>>   drivers/gpu/drm/i915/intel_dsi_cmd.h       |  78 ------
>>   drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 289 ++++++++++---------
>>   7 files changed, 441 insertions(+), 766 deletions(-)
>>   delete mode 100644 drivers/gpu/drm/i915/intel_dsi_cmd.c
>>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v2] drm/i915/dsi: set max return packet size for each dsi port
  2015-01-22 13:01   ` [PATCH v2] " Jani Nikula
@ 2015-01-23  2:07     ` Shobhit Kumar
  0 siblings, 0 replies; 45+ messages in thread
From: Shobhit Kumar @ 2015-01-23  2:07 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx; +Cc: Shobhit Kumar, Thierry Reding

On 01/22/2015 06:31 PM, Jani Nikula wrote:
> This seems like the right thing to do. This also gets rid of a call to
> intel_dsi_pipe_to_port() which we want to remove eventually.
>
> v2: add braces to fix else logic (Shobhit)
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_dsi.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index 4bb9886fa2cf..dac41046a0cc 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -197,15 +197,15 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
>   {
>   	struct drm_device *dev = encoder->base.dev;
>   	struct drm_i915_private *dev_priv = dev->dev_private;
> -	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
>   	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
> -	enum port port = intel_dsi_pipe_to_port(intel_crtc->pipe);
> +	enum port port;
>
>   	DRM_DEBUG_KMS("\n");
>
> -	if (is_cmd_mode(intel_dsi))
> -		I915_WRITE(MIPI_MAX_RETURN_PKT_SIZE(port), 8 * 4);
> -	else {
> +	if (is_cmd_mode(intel_dsi)) {
> +		for_each_dsi_port(port, intel_dsi->ports)
> +			I915_WRITE(MIPI_MAX_RETURN_PKT_SIZE(port), 8 * 4);
> +	} else {
>   		msleep(20); /* XXX */
>   		for_each_dsi_port(port, intel_dsi->ports)
>   			dpi_send_cmd(intel_dsi, TURN_ON, DPI_LP_MODE_EN, port);
>

Reviewed-By: Shobhit Kumar <shobhit.kumar@intel.com>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks
  2015-01-22 13:28   ` Jani Nikula
@ 2015-01-23  2:13     ` Shobhit Kumar
  2015-01-23 12:30       ` Shobhit Kumar
  0 siblings, 1 reply; 45+ messages in thread
From: Shobhit Kumar @ 2015-01-23  2:13 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx; +Cc: Shobhit Kumar, Thierry Reding

On 01/22/2015 06:58 PM, Jani Nikula wrote:
> On Thu, 22 Jan 2015, Shobhit Kumar <shobhit.kumar@linux.intel.com> wrote:
>> On 01/16/2015 05:57 PM, Jani Nikula wrote:
>>> This series ports our DSI code over to the drm_panel and
>>> mipi_dsi_host/mipi_dsi_device. There are some rough edges towards the
>>> end of the series, see commit message for patch 8 for details.
>>>
>>> Patches 1-6 are prep work, fairly independent
>>
>> While I continue to review, quick test of patches show that till here it
>> is fine(with minor fix for Patch 2), but from Patch 7 on wards things
>> really don't work.
>
> Okay, thanks for the review so far and trying it out.
>
> What breaks down with patch 7? Which device are you trying this on?

It just hangs during bootup console. Guessing there is some kernel panic 
somewhere but the Asus T100 on which I am trying does not have serial to 
get logs. Will try to debug today.

Regards
Shobhit

>
> BR,
> Jani.
>
>
>>
>>>
>>> Patch 7 ports the driver over to drm_panel
>>>
>>> Patches 8-10 port the driver over to mipi_dsi_host/device
>>>
>>> Patches 11-12 do some additional cleanup
>>>
>>> BR,
>>> Jani.
>>>
>>>
>>> Jani Nikula (12):
>>>     drm/i915/dsi: call dpi_send_cmd() for each dsi port at a higher level
>>>     drm/i915/dsi: set max return packet size for each dsi port
>>>     drm/i915/dsi: move wait_for_dsi_fifo_empty to intel_dsi.c
>>>     drm/i915/dsi: call wait_for_dsi_fifo_empty() for each dsi port
>>>     drm/i915/dsi: remove unnecessary dsi device callbacks
>>>     drm/i915/dsi: add some constness to vbt panel driver
>>>     drm/i915/dsi: switch to drm_panel interface
>>>     drm/i915/dsi: add drm mipi dsi host support
>>>     drm/i915/dsi: make the vbt panel driver use mipi_dsi_device for
>>>       transfers
>>>     drm/i915/dsi: remove old read/write functions in favor of new stuff
>>>     drm/i915/dsi: move dpi_send_cmd() to intel_dsi.c and make it static
>>>     drm/i915/dsi: remove intel_dsi_cmd.c and the unused functions therein
>>>
>>>    drivers/gpu/drm/i915/Kconfig               |   2 +
>>>    drivers/gpu/drm/i915/Makefile              |   1 -
>>>    drivers/gpu/drm/i915/intel_dsi.c           | 336 +++++++++++++++++-----
>>>    drivers/gpu/drm/i915/intel_dsi.h           |  69 ++---
>>>    drivers/gpu/drm/i915/intel_dsi_cmd.c       | 432 -----------------------------
>>>    drivers/gpu/drm/i915/intel_dsi_cmd.h       |  78 ------
>>>    drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 289 ++++++++++---------
>>>    7 files changed, 441 insertions(+), 766 deletions(-)
>>>    delete mode 100644 drivers/gpu/drm/i915/intel_dsi_cmd.c
>>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 05/12] drm/i915/dsi: remove unnecessary dsi device callbacks
  2015-01-22 13:23     ` Jani Nikula
@ 2015-01-23  9:44       ` Shobhit Kumar
  2015-01-23 15:22         ` Daniel Vetter
  0 siblings, 1 reply; 45+ messages in thread
From: Shobhit Kumar @ 2015-01-23  9:44 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx; +Cc: Shobhit Kumar, Thierry Reding

On 01/22/2015 06:53 PM, Jani Nikula wrote:
> On Thu, 22 Jan 2015, Shobhit Kumar <shobhit.kumar@linux.intel.com> wrote:
>> On 01/16/2015 05:57 PM, Jani Nikula wrote:
>>> Remove all the trivial and/or dummy callbacks from intel dsi device
>>> ops. Merge send_otp_cmds into panel_reset as they're called back to
>>> back.
>>>
>>> This will be helpful for switching to use drm_panel for the
>>> callbacks. If we ever need the additional callbacks, we should add them
>>> to drm_panel funcs.
>>>
>>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>>> ---
>>>    drivers/gpu/drm/i915/intel_dsi.c           | 32 ++-------------------
>>>    drivers/gpu/drm/i915/intel_dsi.h           | 20 -------------
>>>    drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 45 ++----------------------------
>>>    3 files changed, 5 insertions(+), 92 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
>>> index 9b0eaa9db845..fc218b7754b3 100644
>>> --- a/drivers/gpu/drm/i915/intel_dsi.c
>>> +++ b/drivers/gpu/drm/i915/intel_dsi.c
>>> @@ -70,12 +70,6 @@ static void band_gap_reset(struct drm_i915_private *dev_priv)
>>>    	mutex_unlock(&dev_priv->dpio_lock);
>>>    }
>>>
>>> -static struct intel_dsi *intel_attached_dsi(struct drm_connector *connector)
>>> -{
>>> -	return container_of(intel_attached_encoder(connector),
>>> -			    struct intel_dsi, base);
>>> -}
>>> -
>>>    static inline bool is_vid_mode(struct intel_dsi *intel_dsi)
>>>    {
>>>    	return intel_dsi->operation_mode == INTEL_DSI_VIDEO_MODE;
>>> @@ -99,7 +93,6 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>>>    	struct intel_connector *intel_connector = intel_dsi->attached_connector;
>>>    	struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
>>>    	struct drm_display_mode *adjusted_mode = &config->adjusted_mode;
>>> -	struct drm_display_mode *mode = &config->requested_mode;
>>>
>>>    	DRM_DEBUG_KMS("\n");
>>>
>>> @@ -109,10 +102,6 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>>>    	/* DSI uses short packets for sync events, so clear mode flags for DSI */
>>>    	adjusted_mode->flags = 0;
>>>
>>> -	if (intel_dsi->dev.dev_ops->mode_fixup)
>>> -		return intel_dsi->dev.dev_ops->mode_fixup(&intel_dsi->dev,
>>> -							  mode, adjusted_mode);
>>> -
>>
>> There had been a instance where we had to drive different resolution
>> (lower) than the native one. Also in VBT there is a field to make this
>> generic at least from driver perspective to give the needed target
>> resolution. In case target resolution is same as native, nothing gets
>> changed, else mode_fixup function adjusts the mode accordingly keeping
>> timing as same and enabling scalar. Might not be useful in general, but
>> did find a use internally.
>
> Can we just have the driver return the desired mode from .get_modes in
> that case?

Okay, I think I did not explain correctly. Get modes is modified to give 
the needed target mode only so that userspace creates buffer of the 
needed resolution, but in fixup which is called at modeset, we correct 
the adjusted_mode back to have native resolutions so that modeset is 
correctly done. if we do not do like this, during modeset resolutions 
will be wrong as per the timings.

Regards
Shobhit

>
> BR,
> Jani.
>
>
>>
>> Either way
>>
>> Reviewed-By: Shobhit Kumar <shobhit.kumar@intel.com>
>>
>>>    	return true;
>>>    }
>>>
>>> @@ -269,9 +258,6 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)
>>>    	if (intel_dsi->dev.dev_ops->panel_reset)
>>>    		intel_dsi->dev.dev_ops->panel_reset(&intel_dsi->dev);
>>>
>>> -	if (intel_dsi->dev.dev_ops->send_otp_cmds)
>>> -		intel_dsi->dev.dev_ops->send_otp_cmds(&intel_dsi->dev);
>>> -
>>>    	for_each_dsi_port(port, intel_dsi->ports)
>>>    		wait_for_dsi_fifo_empty(intel_dsi, port);
>>>
>>> @@ -484,7 +470,6 @@ intel_dsi_mode_valid(struct drm_connector *connector,
>>>    {
>>>    	struct intel_connector *intel_connector = to_intel_connector(connector);
>>>    	struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
>>> -	struct intel_dsi *intel_dsi = intel_attached_dsi(connector);
>>>
>>>    	DRM_DEBUG_KMS("\n");
>>>
>>> @@ -500,7 +485,7 @@ intel_dsi_mode_valid(struct drm_connector *connector,
>>>    			return MODE_PANEL;
>>>    	}
>>>
>>> -	return intel_dsi->dev.dev_ops->mode_valid(&intel_dsi->dev, mode);
>>> +	return MODE_OK;
>>>    }
>>>
>>>    /* return txclkesc cycles in terms of divider and duration in us */
>>> @@ -749,20 +734,7 @@ static void intel_dsi_pre_pll_enable(struct intel_encoder *encoder)
>>>    static enum drm_connector_status
>>>    intel_dsi_detect(struct drm_connector *connector, bool force)
>>>    {
>>> -	struct intel_dsi *intel_dsi = intel_attached_dsi(connector);
>>> -	struct intel_encoder *intel_encoder = &intel_dsi->base;
>>> -	enum intel_display_power_domain power_domain;
>>> -	enum drm_connector_status connector_status;
>>> -	struct drm_i915_private *dev_priv = intel_encoder->base.dev->dev_private;
>>> -
>>> -	DRM_DEBUG_KMS("\n");
>>> -	power_domain = intel_display_port_power_domain(intel_encoder);
>>> -
>>> -	intel_display_power_get(dev_priv, power_domain);
>>> -	connector_status = intel_dsi->dev.dev_ops->detect(&intel_dsi->dev);
>>> -	intel_display_power_put(dev_priv, power_domain);
>>> -
>>> -	return connector_status;
>>> +	return connector_status_connected;
>>>    }
>>>
>>>    static int intel_dsi_get_modes(struct drm_connector *connector)
>>> diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h
>>> index 2bb8c46c7889..22f87036a256 100644
>>> --- a/drivers/gpu/drm/i915/intel_dsi.h
>>> +++ b/drivers/gpu/drm/i915/intel_dsi.h
>>> @@ -47,33 +47,13 @@ struct intel_dsi_dev_ops {
>>>
>>>    	void (*disable_panel_power)(struct intel_dsi_device *dsi);
>>>
>>> -	/* one time programmable commands if needed */
>>> -	void (*send_otp_cmds)(struct intel_dsi_device *dsi);
>>> -
>>>    	/* This callback must be able to assume DSI commands can be sent */
>>>    	void (*enable)(struct intel_dsi_device *dsi);
>>>
>>>    	/* This callback must be able to assume DSI commands can be sent */
>>>    	void (*disable)(struct intel_dsi_device *dsi);
>>>
>>> -	int (*mode_valid)(struct intel_dsi_device *dsi,
>>> -			  struct drm_display_mode *mode);
>>> -
>>> -	bool (*mode_fixup)(struct intel_dsi_device *dsi,
>>> -			   const struct drm_display_mode *mode,
>>> -			   struct drm_display_mode *adjusted_mode);
>>> -
>>> -	void (*mode_set)(struct intel_dsi_device *dsi,
>>> -			 struct drm_display_mode *mode,
>>> -			 struct drm_display_mode *adjusted_mode);
>>> -
>>> -	enum drm_connector_status (*detect)(struct intel_dsi_device *dsi);
>>> -
>>> -	bool (*get_hw_state)(struct intel_dsi_device *dev);
>>> -
>>>    	struct drm_display_mode *(*get_modes)(struct intel_dsi_device *dsi);
>>> -
>>> -	void (*destroy) (struct intel_dsi_device *dsi);
>>>    };
>>>
>>>    struct intel_dsi {
>>> diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
>>> index 5493aef5a6a3..b0e7327a485f 100644
>>> --- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
>>> +++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
>>> @@ -559,18 +559,6 @@ static bool generic_init(struct intel_dsi_device *dsi)
>>>    	return true;
>>>    }
>>>
>>> -static int generic_mode_valid(struct intel_dsi_device *dsi,
>>> -		   struct drm_display_mode *mode)
>>> -{
>>> -	return MODE_OK;
>>> -}
>>> -
>>> -static bool generic_mode_fixup(struct intel_dsi_device *dsi,
>>> -		    const struct drm_display_mode *mode,
>>> -		    struct drm_display_mode *adjusted_mode) {
>>> -	return true;
>>> -}
>>> -
>>>    static void generic_panel_reset(struct intel_dsi_device *dsi)
>>>    {
>>>    	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
>>> @@ -580,26 +568,18 @@ static void generic_panel_reset(struct intel_dsi_device *dsi)
>>>    	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_ASSERT_RESET];
>>>
>>>    	generic_exec_sequence(intel_dsi, sequence);
>>> -}
>>> -
>>> -static void generic_disable_panel_power(struct intel_dsi_device *dsi)
>>> -{
>>> -	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
>>> -	struct drm_device *dev = intel_dsi->base.base.dev;
>>> -	struct drm_i915_private *dev_priv = dev->dev_private;
>>> -
>>> -	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET];
>>>
>>> +	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP];
>>>    	generic_exec_sequence(intel_dsi, sequence);
>>>    }
>>>
>>> -static void generic_send_otp_cmds(struct intel_dsi_device *dsi)
>>> +static void generic_disable_panel_power(struct intel_dsi_device *dsi)
>>>    {
>>>    	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
>>>    	struct drm_device *dev = intel_dsi->base.base.dev;
>>>    	struct drm_i915_private *dev_priv = dev->dev_private;
>>>
>>> -	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP];
>>> +	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET];
>>>
>>>    	generic_exec_sequence(intel_dsi, sequence);
>>>    }
>>> @@ -626,16 +606,6 @@ static void generic_disable(struct intel_dsi_device *dsi)
>>>    	generic_exec_sequence(intel_dsi, sequence);
>>>    }
>>>
>>> -static enum drm_connector_status generic_detect(struct intel_dsi_device *dsi)
>>> -{
>>> -	return connector_status_connected;
>>> -}
>>> -
>>> -static bool generic_get_hw_state(struct intel_dsi_device *dev)
>>> -{
>>> -	return true;
>>> -}
>>> -
>>>    static struct drm_display_mode *generic_get_modes(struct intel_dsi_device *dsi)
>>>    {
>>>    	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
>>> @@ -646,20 +616,11 @@ static struct drm_display_mode *generic_get_modes(struct intel_dsi_device *dsi)
>>>    	return dev_priv->vbt.lfp_lvds_vbt_mode;
>>>    }
>>>
>>> -static void generic_destroy(struct intel_dsi_device *dsi) { }
>>> -
>>> -/* Callbacks. We might not need them all. */
>>>    struct intel_dsi_dev_ops vbt_generic_dsi_display_ops = {
>>>    	.init = generic_init,
>>> -	.mode_valid = generic_mode_valid,
>>> -	.mode_fixup = generic_mode_fixup,
>>>    	.panel_reset = generic_panel_reset,
>>>    	.disable_panel_power = generic_disable_panel_power,
>>> -	.send_otp_cmds = generic_send_otp_cmds,
>>>    	.enable = generic_enable,
>>>    	.disable = generic_disable,
>>> -	.detect = generic_detect,
>>> -	.get_hw_state = generic_get_hw_state,
>>>    	.get_modes = generic_get_modes,
>>> -	.destroy = generic_destroy,
>>>    };
>>>
>>
>> Regards
>> Shobhit
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 07/12] drm/i915/dsi: switch to drm_panel interface
  2015-01-16 12:27 ` [RFC PATCH 07/12] drm/i915/dsi: switch to drm_panel interface Jani Nikula
@ 2015-01-23 10:57   ` Shobhit Kumar
  2015-01-23 15:31     ` Daniel Vetter
  2015-01-23 13:30   ` [PATCH v2] " Jani Nikula
  1 sibling, 1 reply; 45+ messages in thread
From: Shobhit Kumar @ 2015-01-23 10:57 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx; +Cc: Shobhit Kumar, Thierry Reding

On 01/16/2015 05:57 PM, Jani Nikula wrote:
> Replace intel_dsi_device and intel_dsi_dev_ops with drm_panel and
> drm_panel_funcs. They are adequate for what we have now, and if we end
> up needing more than this we should improve drm_panel. This will keep us
> better aligned with the drm core infrastructure.
>
> The panel driver initialization changes a bit. It still remains hideous,
> but fixing that is beyond the scope here.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>   drivers/gpu/drm/i915/Kconfig               |   1 +
>   drivers/gpu/drm/i915/intel_dsi.c           |  68 +++++++----
>   drivers/gpu/drm/i915/intel_dsi.h           |  27 +----
>   drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 179 ++++++++++++++++++-----------
>   4 files changed, 156 insertions(+), 119 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig
> index 4e39ab34eb1c..da196cd07263 100644
> --- a/drivers/gpu/drm/i915/Kconfig
> +++ b/drivers/gpu/drm/i915/Kconfig
> @@ -11,6 +11,7 @@ config DRM_I915
>   	select SHMEM
>   	select TMPFS
>   	select DRM_KMS_HELPER
> +	select DRM_PANEL
>   	# i915 depends on ACPI_VIDEO when ACPI is enabled
>   	# but for select to work, need to select ACPI_VIDEO's dependencies, ick
>   	select BACKLIGHT_LCD_SUPPORT if ACPI
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index fc218b7754b3..19a9955eab0e 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -27,18 +27,20 @@
>   #include <drm/drm_crtc.h>
>   #include <drm/drm_edid.h>
>   #include <drm/i915_drm.h>
> +#include <drm/drm_panel.h>
>   #include <linux/slab.h>
>   #include "i915_drv.h"
>   #include "intel_drv.h"
>   #include "intel_dsi.h"
>   #include "intel_dsi_cmd.h"
>
> -/* the sub-encoders aka panel drivers */
> -static const struct intel_dsi_device intel_dsi_devices[] = {
> +static const struct {
> +	u16 panel_id;
> +	struct drm_panel * (*init)(struct intel_dsi *intel_dsi, u16 panel_id);
> +} intel_dsi_drivers[] = {
>   	{
>   		.panel_id = MIPI_DSI_GENERIC_PANEL_ID,
> -		.name = "vbt-generic-dsi-vid-mode-display",
> -		.dev_ops = &vbt_generic_dsi_display_ops,
> +		.init = vbt_panel_init,
>   	},
>   };
>
> @@ -214,8 +216,7 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
>   			dpi_send_cmd(intel_dsi, TURN_ON, DPI_LP_MODE_EN, port);
>   		msleep(100);
>
> -		if (intel_dsi->dev.dev_ops->enable)
> -			intel_dsi->dev.dev_ops->enable(&intel_dsi->dev);
> +		drm_panel_enable(intel_dsi->panel);
>
>   		for_each_dsi_port(port, intel_dsi->ports)
>   			wait_for_dsi_fifo_empty(intel_dsi, port);
> @@ -255,8 +256,7 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)
>
>   	msleep(intel_dsi->panel_on_delay);
>
> -	if (intel_dsi->dev.dev_ops->panel_reset)
> -		intel_dsi->dev.dev_ops->panel_reset(&intel_dsi->dev);
> +	drm_panel_prepare(intel_dsi->panel);
>
>   	for_each_dsi_port(port, intel_dsi->ports)
>   		wait_for_dsi_fifo_empty(intel_dsi, port);
> @@ -329,8 +329,7 @@ static void intel_dsi_disable(struct intel_encoder *encoder)
>   	}
>   	/* if disable packets are sent before sending shutdown packet then in
>   	 * some next enable sequence send turn on packet error is observed */
> -	if (intel_dsi->dev.dev_ops->disable)
> -		intel_dsi->dev.dev_ops->disable(&intel_dsi->dev);
> +	drm_panel_disable(intel_dsi->panel);
>
>   	for_each_dsi_port(port, intel_dsi->ports)
>   		wait_for_dsi_fifo_empty(intel_dsi, port);
> @@ -395,8 +394,7 @@ static void intel_dsi_post_disable(struct intel_encoder *encoder)
>   	val &= ~DPOUNIT_CLOCK_GATE_DISABLE;
>   	I915_WRITE(DSPCLK_GATE_D, val);
>
> -	if (intel_dsi->dev.dev_ops->disable_panel_power)
> -		intel_dsi->dev.dev_ops->disable_panel_power(&intel_dsi->dev);
> +	drm_panel_unprepare(intel_dsi->panel);
>
>   	msleep(intel_dsi->panel_off_delay);
>   	msleep(intel_dsi->panel_pwr_cycle_delay);
> @@ -760,7 +758,7 @@ static int intel_dsi_get_modes(struct drm_connector *connector)
>   	return 1;
>   }
>
> -static void intel_dsi_destroy(struct drm_connector *connector)
> +static void intel_dsi_connector_destroy(struct drm_connector *connector)
>   {
>   	struct intel_connector *intel_connector = to_intel_connector(connector);
>
> @@ -770,8 +768,20 @@ static void intel_dsi_destroy(struct drm_connector *connector)
>   	kfree(connector);
>   }
>
> +static void intel_dsi_encoder_destroy(struct drm_encoder *encoder)
> +{
> +	struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
> +
> +	if (intel_dsi->panel) {
> +		drm_panel_detach(intel_dsi->panel);
> +		/* XXX: Logically this call belongs in the panel driver. */
> +		drm_panel_remove(intel_dsi->panel);
> +	}
> +	intel_encoder_destroy(encoder);
> +}
> +
>   static const struct drm_encoder_funcs intel_dsi_funcs = {
> -	.destroy = intel_encoder_destroy,
> +	.destroy = intel_dsi_encoder_destroy,
>   };
>
>   static const struct drm_connector_helper_funcs intel_dsi_connector_helper_funcs = {
> @@ -783,7 +793,7 @@ static const struct drm_connector_helper_funcs intel_dsi_connector_helper_funcs
>   static const struct drm_connector_funcs intel_dsi_connector_funcs = {
>   	.dpms = intel_connector_dpms,
>   	.detect = intel_dsi_detect,
> -	.destroy = intel_dsi_destroy,
> +	.destroy = intel_dsi_connector_destroy,
>   	.fill_modes = drm_helper_probe_single_connector_modes,
>   };
>
> @@ -794,9 +804,8 @@ void intel_dsi_init(struct drm_device *dev)
>   	struct drm_encoder *encoder;
>   	struct intel_connector *intel_connector;
>   	struct drm_connector *connector;
> -	struct drm_display_mode *fixed_mode = NULL;
> +	struct drm_display_mode *scan, *fixed_mode = NULL;
>   	struct drm_i915_private *dev_priv = dev->dev_private;
> -	const struct intel_dsi_device *dsi;
>   	unsigned int i;
>
>   	DRM_DEBUG_KMS("\n");
> @@ -853,15 +862,14 @@ void intel_dsi_init(struct drm_device *dev)
>   		intel_dsi->ports = (1 << PORT_C);
>   	}
>
> -	for (i = 0; i < ARRAY_SIZE(intel_dsi_devices); i++) {
> -		dsi = &intel_dsi_devices[i];
> -		intel_dsi->dev = *dsi;
> -
> -		if (dsi->dev_ops->init(&intel_dsi->dev))
> +	for (i = 0; i < ARRAY_SIZE(intel_dsi_drivers); i++) {
> +		intel_dsi->panel = intel_dsi_drivers[i].init(intel_dsi,
> +							     intel_dsi_drivers[i].panel_id);
> +		if (intel_dsi->panel)
>   			break;
>   	}
>
> -	if (i == ARRAY_SIZE(intel_dsi_devices)) {
> +	if (!intel_dsi->panel) {
>   		DRM_DEBUG_KMS("no device found\n");
>   		goto err;
>   	}
> @@ -881,13 +889,23 @@ void intel_dsi_init(struct drm_device *dev)
>
>   	drm_connector_register(connector);
>
> -	fixed_mode = dsi->dev_ops->get_modes(&intel_dsi->dev);
> +	drm_panel_attach(intel_dsi->panel, connector);
> +	drm_panel_get_modes(intel_dsi->panel);

Should be inside the config mutex_lock below.

> +
> +	mutex_lock(&dev->mode_config.mutex);
> +	list_for_each_entry(scan, &connector->probed_modes, head) {
> +		if ((scan->type & DRM_MODE_TYPE_PREFERRED)) {
> +			fixed_mode = drm_mode_duplicate(dev, scan);
> +			break;
> +		}
> +	}
> +	mutex_unlock(&dev->mode_config.mutex);
> +
>   	if (!fixed_mode) {
>   		DRM_DEBUG_KMS("no fixed mode\n");
>   		goto err;
>   	}
>
> -	fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
>   	intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
>
>   	return;
> diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h
> index 22f87036a256..fc0b2b8d90f1 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.h
> +++ b/drivers/gpu/drm/i915/intel_dsi.h
> @@ -33,33 +33,10 @@
>   #define DSI_DUAL_LINK_FRONT_BACK	1
>   #define DSI_DUAL_LINK_PIXEL_ALT		2
>
> -struct intel_dsi_device {
> -	unsigned int panel_id;
> -	const char *name;
> -	const struct intel_dsi_dev_ops *dev_ops;
> -	void *dev_priv;
> -};
> -
> -struct intel_dsi_dev_ops {
> -	bool (*init)(struct intel_dsi_device *dsi);
> -
> -	void (*panel_reset)(struct intel_dsi_device *dsi);
> -
> -	void (*disable_panel_power)(struct intel_dsi_device *dsi);
> -
> -	/* This callback must be able to assume DSI commands can be sent */
> -	void (*enable)(struct intel_dsi_device *dsi);
> -
> -	/* This callback must be able to assume DSI commands can be sent */
> -	void (*disable)(struct intel_dsi_device *dsi);
> -
> -	struct drm_display_mode *(*get_modes)(struct intel_dsi_device *dsi);
> -};
> -
>   struct intel_dsi {
>   	struct intel_encoder base;
>
> -	struct intel_dsi_device dev;
> +	struct drm_panel *panel;
>
>   	struct intel_connector *attached_connector;
>
> @@ -130,6 +107,6 @@ extern void vlv_enable_dsi_pll(struct intel_encoder *encoder);
>   extern void vlv_disable_dsi_pll(struct intel_encoder *encoder);
>   extern u32 vlv_get_dsi_pclk(struct intel_encoder *encoder, int pipe_bpp);
>
> -extern struct intel_dsi_dev_ops vbt_generic_dsi_display_ops;
> +struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id);
>
>   #endif /* _INTEL_DSI_H */
> diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> index 561ec2981dfd..204f54df8fe1 100644
> --- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> +++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> @@ -28,6 +28,7 @@
>   #include <drm/drm_crtc.h>
>   #include <drm/drm_edid.h>
>   #include <drm/i915_drm.h>
> +#include <drm/drm_panel.h>
>   #include <linux/slab.h>
>   #include <video/mipi_display.h>
>   #include <asm/intel-mid.h>
> @@ -37,6 +38,16 @@
>   #include "intel_dsi.h"
>   #include "intel_dsi_cmd.h"
>
> +struct vbt_panel {
> +	struct drm_panel panel;
> +	struct intel_dsi *intel_dsi;
> +};
> +
> +static inline struct vbt_panel *to_vbt_panel(struct drm_panel *panel)
> +{
> +	return container_of(panel, struct vbt_panel, panel);
> +}
> +
>   #define MIPI_TRANSFER_MODE_SHIFT	0
>   #define MIPI_VIRTUAL_CHANNEL_SHIFT	1
>   #define MIPI_PORT_SHIFT			3
> @@ -272,14 +283,103 @@ static void generic_exec_sequence(struct intel_dsi *intel_dsi, const u8 *data)
>   	}
>   }
>
> -static bool generic_init(struct intel_dsi_device *dsi)
> +static int vbt_panel_prepare(struct drm_panel *panel)
> +{
> +	struct vbt_panel *vbt_panel = to_vbt_panel(panel);
> +	struct intel_dsi *intel_dsi = vbt_panel->intel_dsi;
> +	struct drm_device *dev = intel_dsi->base.base.dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	const u8 *sequence;
> +
> +	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_ASSERT_RESET];
> +	generic_exec_sequence(intel_dsi, sequence);
> +
> +	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP];
> +	generic_exec_sequence(intel_dsi, sequence);
> +
> +	return 0;
> +}
> +
> +static int vbt_panel_unprepare(struct drm_panel *panel)
> +{
> +	struct vbt_panel *vbt_panel = to_vbt_panel(panel);
> +	struct intel_dsi *intel_dsi = vbt_panel->intel_dsi;
> +	struct drm_device *dev = intel_dsi->base.base.dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	const u8 *sequence;
> +
> +	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET];
> +	generic_exec_sequence(intel_dsi, sequence);
> +
> +	return 0;
> +}
> +
> +static int vbt_panel_enable(struct drm_panel *panel)
> +{
> +	struct vbt_panel *vbt_panel = to_vbt_panel(panel);
> +	struct intel_dsi *intel_dsi = vbt_panel->intel_dsi;
> +	struct drm_device *dev = intel_dsi->base.base.dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	const u8 *sequence;
> +
> +	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DISPLAY_ON];
> +	generic_exec_sequence(intel_dsi, sequence);
> +
> +	return 0;
> +}
> +
> +static int vbt_panel_disable(struct drm_panel *panel)
> +{
> +	struct vbt_panel *vbt_panel = to_vbt_panel(panel);
> +	struct intel_dsi *intel_dsi = vbt_panel->intel_dsi;
> +	struct drm_device *dev = intel_dsi->base.base.dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	const u8 *sequence;
> +
> +	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DISPLAY_OFF];
> +	generic_exec_sequence(intel_dsi, sequence);
> +
> +	return 0;
> +}
> +
> +static int vbt_panel_get_modes(struct drm_panel *panel)
> +{
> +	struct vbt_panel *vbt_panel = to_vbt_panel(panel);
> +	struct intel_dsi *intel_dsi = vbt_panel->intel_dsi;
> +	struct drm_device *dev = intel_dsi->base.base.dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	struct drm_display_mode *mode;
> +
> +	if (!panel->connector)
> +		return 0;
> +
> +	mode = drm_mode_duplicate(dev, dev_priv->vbt.lfp_lvds_vbt_mode);
> +	if (!mode)
> +		return 0;
> +
> +	mode->type |= DRM_MODE_TYPE_PREFERRED;
> +
> +	drm_mode_probed_add(panel->connector, mode);
> +
> +	return 1;
> +}
> +
> +static const struct drm_panel_funcs vbt_panel_funcs = {
> +	.disable = vbt_panel_disable,
> +	.unprepare = vbt_panel_unprepare,
> +	.prepare = vbt_panel_prepare,
> +	.enable = vbt_panel_enable,
> +	.get_modes = vbt_panel_get_modes,
> +};
> +
> +struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
>   {
> -	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
>   	struct drm_device *dev = intel_dsi->base.base.dev;
>   	struct drm_i915_private *dev_priv = dev->dev_private;
>   	struct mipi_config *mipi_config = dev_priv->vbt.dsi.config;
>   	struct mipi_pps_data *pps = dev_priv->vbt.dsi.pps;
>   	struct drm_display_mode *mode = dev_priv->vbt.lfp_lvds_vbt_mode;
> +	struct vbt_panel *vbt_panel;
>   	u32 bits_per_pixel = 24;
>   	u32 tlpx_ns, extra_byte_count, bitrate, tlpx_ui;
>   	u32 ui_num, ui_den;
> @@ -346,7 +446,7 @@ static bool generic_init(struct intel_dsi_device *dsi)
>   			if (mipi_config->target_burst_mode_freq <
>   								computed_ddr) {
>   				DRM_ERROR("Burst mode freq is less than computed\n");
> -				return false;
> +				return NULL;
>   			}
>
>   			burst_mode_ratio = DIV_ROUND_UP(
> @@ -356,7 +456,7 @@ static bool generic_init(struct intel_dsi_device *dsi)
>   			pclk = DIV_ROUND_UP(pclk * burst_mode_ratio, 100);
>   		} else {
>   			DRM_ERROR("Burst mode target is not set\n");
> -			return false;
> +			return NULL;
>   		}
>   	} else
>   		burst_mode_ratio = 100;
> @@ -557,71 +657,12 @@ static bool generic_init(struct intel_dsi_device *dsi)
>   	intel_dsi->panel_off_delay = pps->panel_off_delay / 10;
>   	intel_dsi->panel_pwr_cycle_delay = pps->panel_power_cycle_delay / 10;
>
> -	return true;
> -}
> -
> -static void generic_panel_reset(struct intel_dsi_device *dsi)
> -{
> -	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
> -	struct drm_device *dev = intel_dsi->base.base.dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -
> -	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_ASSERT_RESET];
> -
> -	generic_exec_sequence(intel_dsi, sequence);
> -
> -	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP];
> -	generic_exec_sequence(intel_dsi, sequence);
> -}
> -
> -static void generic_disable_panel_power(struct intel_dsi_device *dsi)
> -{
> -	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
> -	struct drm_device *dev = intel_dsi->base.base.dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -
> -	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET];
> -
> -	generic_exec_sequence(intel_dsi, sequence);
> -}
> -
> -static void generic_enable(struct intel_dsi_device *dsi)
> -{
> -	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
> -	struct drm_device *dev = intel_dsi->base.base.dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> +	/* This is cheating a bit with the cleanup. */
> +	vbt_panel = devm_kzalloc(dev->dev, sizeof(*vbt_panel), GFP_KERNEL);
>
> -	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DISPLAY_ON];
> +	drm_panel_init(&vbt_panel->panel);
> +	vbt_panel->panel.funcs = &vbt_panel_funcs;
> +	drm_panel_add(&vbt_panel->panel);
>
> -	generic_exec_sequence(intel_dsi, sequence);
> +	return &vbt_panel->panel;

You just missed vbt_panel->intel_dsi = intel_dsi; before returning

Regards
Shobhit

>   }
> -
> -static void generic_disable(struct intel_dsi_device *dsi)
> -{
> -	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
> -	struct drm_device *dev = intel_dsi->base.base.dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -
> -	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DISPLAY_OFF];
> -
> -	generic_exec_sequence(intel_dsi, sequence);
> -}
> -
> -static struct drm_display_mode *generic_get_modes(struct intel_dsi_device *dsi)
> -{
> -	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
> -	struct drm_device *dev = intel_dsi->base.base.dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -
> -	dev_priv->vbt.lfp_lvds_vbt_mode->type |= DRM_MODE_TYPE_PREFERRED;
> -	return dev_priv->vbt.lfp_lvds_vbt_mode;
> -}
> -
> -struct intel_dsi_dev_ops vbt_generic_dsi_display_ops = {
> -	.init = generic_init,
> -	.panel_reset = generic_panel_reset,
> -	.disable_panel_power = generic_disable_panel_power,
> -	.enable = generic_enable,
> -	.disable = generic_disable,
> -	.get_modes = generic_get_modes,
> -};
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 08/12] drm/i915/dsi: add drm mipi dsi host support
  2015-01-16 12:27 ` [RFC PATCH 08/12] drm/i915/dsi: add drm mipi dsi host support Jani Nikula
@ 2015-01-23 12:21   ` Shobhit Kumar
  0 siblings, 0 replies; 45+ messages in thread
From: Shobhit Kumar @ 2015-01-23 12:21 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx; +Cc: Shobhit Kumar, Thierry Reding

On 01/16/2015 05:57 PM, Jani Nikula wrote:
> Add basic support for using the drm mipi dsi framework for DSI. We don't
> use device tree which is pretty much required by mipi_dsi_host_register
> and friends, and we don't have the kind of device model the functions
> expect either. So we cheat and use it as a library to abstract what we
> need: a nice, clean interface for DSI transfers. This means we will have
> to be careful with what functions we call, as the driver model devices
> in mipi_dsi_host and mipi_dsi_device will *not* be initialized.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Looks good.

Reviewed-By: Shobhit Kumar <shobhit.kumar@intel.com>

> ---
>   drivers/gpu/drm/i915/Kconfig               |   1 +
>   drivers/gpu/drm/i915/intel_dsi.c           | 162 ++++++++++++++++++++++++++++-
>   drivers/gpu/drm/i915/intel_dsi.h           |  18 ++++
>   drivers/gpu/drm/i915/intel_dsi_panel_vbt.c |   3 -
>   4 files changed, 180 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig
> index da196cd07263..74acca9bcd9d 100644
> --- a/drivers/gpu/drm/i915/Kconfig
> +++ b/drivers/gpu/drm/i915/Kconfig
> @@ -12,6 +12,7 @@ config DRM_I915
>   	select TMPFS
>   	select DRM_KMS_HELPER
>   	select DRM_PANEL
> +	select DRM_MIPI_DSI
>   	# i915 depends on ACPI_VIDEO when ACPI is enabled
>   	# but for select to work, need to select ACPI_VIDEO's dependencies, ick
>   	select BACKLIGHT_LCD_SUPPORT if ACPI
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index 19a9955eab0e..5cfa3431785a 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -28,6 +28,7 @@
>   #include <drm/drm_edid.h>
>   #include <drm/i915_drm.h>
>   #include <drm/drm_panel.h>
> +#include <drm/drm_mipi_dsi.h>
>   #include <linux/slab.h>
>   #include "i915_drv.h"
>   #include "intel_drv.h"
> @@ -58,6 +59,149 @@ static void wait_for_dsi_fifo_empty(struct intel_dsi *intel_dsi, enum port port)
>   		DRM_ERROR("DPI FIFOs are not empty\n");
>   }
>
> +static void write_data(struct drm_i915_private *dev_priv, u32 reg,
> +		       const u8 *data, u32 len)
> +{
> +	u32 i, j;
> +
> +	for (i = 0; i < len; i += 4) {
> +		u32 val = 0;
> +
> +		for (j = 0; j < min_t(u32, len - i, 4); j++)
> +			val |= *data++ << 8 * j;
> +
> +		I915_WRITE(reg, val);
> +	}
> +}
> +
> +static void read_data(struct drm_i915_private *dev_priv, u32 reg,
> +		      u8 *data, u32 len)
> +{
> +	u32 i, j;
> +
> +	for (i = 0; i < len; i += 4) {
> +		u32 val = I915_READ(reg);
> +
> +		for (j = 0; j < min_t(u32, len - i, 4); j++)
> +			*data++ = val >> 8 * j;
> +	}
> +}
> +
> +static ssize_t intel_dsi_host_transfer(struct mipi_dsi_host *host,
> +				       const struct mipi_dsi_msg *msg)
> +{
> +	struct intel_dsi_host *intel_dsi_host = to_intel_dsi_host(host);
> +	struct drm_device *dev = intel_dsi_host->intel_dsi->base.base.dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	enum port port = intel_dsi_host->port;
> +	struct mipi_dsi_packet packet;
> +	ssize_t ret;
> +	const u8 *header, *data;
> +	u32 data_reg, data_mask, ctrl_reg, ctrl_mask;
> +
> +	ret = mipi_dsi_create_packet(&packet, msg);
> +	if (ret < 0)
> +		return ret;
> +
> +	header = packet.header;
> +	data = packet.payload;
> +
> +	if (msg->flags & MIPI_DSI_MSG_USE_LPM) {
> +		data_reg = MIPI_LP_GEN_DATA(port);
> +		data_mask = LP_DATA_FIFO_FULL;
> +		ctrl_reg = MIPI_LP_GEN_CTRL(port);
> +		ctrl_mask = LP_CTRL_FIFO_FULL;
> +	} else {
> +		data_reg = MIPI_HS_GEN_DATA(port);
> +		data_mask = HS_DATA_FIFO_FULL;
> +		ctrl_reg = MIPI_HS_GEN_CTRL(port);
> +		ctrl_mask = HS_CTRL_FIFO_FULL;
> +	}
> +
> +	/* note: this is never true for reads */
> +	if (packet.payload_length) {
> +
> +		if (wait_for((I915_READ(MIPI_GEN_FIFO_STAT(port)) & data_mask) == 0, 50))
> +			DRM_ERROR("Timeout waiting for HS/LP DATA FIFO !full\n");
> +
> +		write_data(dev_priv, data_reg, packet.payload,
> +			   packet.payload_length);
> +	}
> +
> +	if (msg->rx_len) {
> +		I915_WRITE(MIPI_INTR_STAT(port), GEN_READ_DATA_AVAIL);
> +	}
> +
> +	if (wait_for((I915_READ(MIPI_GEN_FIFO_STAT(port)) & ctrl_mask) == 0, 50)) {
> +		DRM_ERROR("Timeout waiting for HS/LP CTRL FIFO !full\n");
> +	}
> +
> +	I915_WRITE(ctrl_reg, header[2] << 16 | header[1] << 8 | header[0]);
> +
> +	/* ->rx_len is set only for reads */
> +	if (msg->rx_len) {
> +		data_mask = GEN_READ_DATA_AVAIL;
> +		if (wait_for((I915_READ(MIPI_INTR_STAT(port)) & data_mask) == data_mask, 50))
> +			DRM_ERROR("Timeout waiting for read data.\n");
> +
> +		read_data(dev_priv, data_reg, msg->rx_buf, msg->rx_len);
> +	}
> +
> +	/* XXX: fix for reads and writes */
> +	return 4 + packet.payload_length;
> +}
> +
> +static int intel_dsi_host_attach(struct mipi_dsi_host *host,
> +				 struct mipi_dsi_device *dsi)
> +{
> +	return 0;
> +}
> +
> +static int intel_dsi_host_detach(struct mipi_dsi_host *host,
> +				 struct mipi_dsi_device *dsi)
> +{
> +	return 0;
> +}
> +
> +static const struct mipi_dsi_host_ops intel_dsi_host_ops = {
> +	.attach = intel_dsi_host_attach,
> +	.detach = intel_dsi_host_detach,
> +	.transfer = intel_dsi_host_transfer,
> +};
> +
> +static struct intel_dsi_host *intel_dsi_host_init(struct intel_dsi *intel_dsi,
> +						  enum port port)
> +{
> +	struct intel_dsi_host *host;
> +	struct mipi_dsi_device *device;
> +
> +	host = kzalloc(sizeof(*host), GFP_KERNEL);
> +	if (!host)
> +		return NULL;
> +
> +	host->base.ops = &intel_dsi_host_ops;
> +	host->intel_dsi = intel_dsi;
> +	host->port = port;
> +
> +	/*
> +	 * We should call mipi_dsi_host_register(&host->base) here, but we don't
> +	 * have a host->dev, and we don't have OF stuff either. So just use the
> +	 * dsi framework as a library and hope for the best. Create the dsi
> +	 * devices by ourselves here too. Need to be careful though, because we
> +	 * don't initialize any of the driver model devices here.
> +	 */
> +	device = kzalloc(sizeof(*device), GFP_KERNEL);
> +	if (!device) {
> +		kfree(host);
> +		return NULL;
> +	}
> +
> +	device->host = &host->base;
> +	host->device = device;
> +
> +	return host;
> +}
> +
>   static void band_gap_reset(struct drm_i915_private *dev_priv)
>   {
>   	mutex_lock(&dev_priv->dpio_lock);
> @@ -806,6 +950,7 @@ void intel_dsi_init(struct drm_device *dev)
>   	struct drm_connector *connector;
>   	struct drm_display_mode *scan, *fixed_mode = NULL;
>   	struct drm_i915_private *dev_priv = dev->dev_private;
> +	enum port port;
>   	unsigned int i;
>
>   	DRM_DEBUG_KMS("\n");
> @@ -854,7 +999,11 @@ void intel_dsi_init(struct drm_device *dev)
>   	intel_connector->unregister = intel_connector_unregister;
>
>   	/* Pipe A maps to MIPI DSI port A, pipe B maps to MIPI DSI port C */
> -	if (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA) {
> +	if (dev_priv->vbt.dsi.config->dual_link) {
> +		/* XXX: does dual link work on either pipe? */
> +		intel_encoder->crtc_mask = (1 << PIPE_A);
> +		intel_dsi->ports = ((1 << PORT_A) | (1 << PORT_C));
> +	} else if (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA) {
>   		intel_encoder->crtc_mask = (1 << PIPE_A);
>   		intel_dsi->ports = (1 << PORT_A);
>   	} else if (dev_priv->vbt.dsi.port == DVO_PORT_MIPIC) {
> @@ -862,6 +1011,17 @@ void intel_dsi_init(struct drm_device *dev)
>   		intel_dsi->ports = (1 << PORT_C);
>   	}
>
> +	/* Create a DSI host (and a device) for each port. */
> +	for_each_dsi_port(port, intel_dsi->ports) {
> +		struct intel_dsi_host *host;
> +
> +		host = intel_dsi_host_init(intel_dsi, port);
> +		if (!host)
> +			goto err;
> +
> +		intel_dsi->dsi_hosts[port] = host;
> +	}
> +
>   	for (i = 0; i < ARRAY_SIZE(intel_dsi_drivers); i++) {
>   		intel_dsi->panel = intel_dsi_drivers[i].init(intel_dsi,
>   							     intel_dsi_drivers[i].panel_id);
> diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h
> index fc0b2b8d90f1..2784ac442368 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.h
> +++ b/drivers/gpu/drm/i915/intel_dsi.h
> @@ -26,6 +26,7 @@
>
>   #include <drm/drmP.h>
>   #include <drm/drm_crtc.h>
> +#include <drm/drm_mipi_dsi.h>
>   #include "intel_drv.h"
>
>   /* Dual Link support */
> @@ -33,10 +34,13 @@
>   #define DSI_DUAL_LINK_FRONT_BACK	1
>   #define DSI_DUAL_LINK_PIXEL_ALT		2
>
> +struct intel_dsi_host;
> +
>   struct intel_dsi {
>   	struct intel_encoder base;
>
>   	struct drm_panel *panel;
> +	struct intel_dsi_host *dsi_hosts[I915_MAX_PORTS];
>
>   	struct intel_connector *attached_connector;
>
> @@ -94,6 +98,20 @@ struct intel_dsi {
>   	u16 panel_pwr_cycle_delay;
>   };
>
> +struct intel_dsi_host {
> +	struct mipi_dsi_host base;
> +	struct intel_dsi *intel_dsi;
> +	enum port port;
> +
> +	/* our little hack */
> +	struct mipi_dsi_device *device;
> +};
> +
> +static inline struct intel_dsi_host *to_intel_dsi_host(struct mipi_dsi_host *h)
> +{
> +	return container_of(h, struct intel_dsi_host, base);
> +}
> +
>   #define for_each_dsi_port(__port, __ports_mask) \
>   	for ((__port) = PORT_A; (__port) < I915_MAX_PORTS; (__port)++)	\
>   		if ((__ports_mask) & (1 << (__port)))
> diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> index 204f54df8fe1..e363c26a2b05 100644
> --- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> +++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> @@ -399,9 +399,6 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
>   	intel_dsi->dual_link = mipi_config->dual_link;
>   	intel_dsi->pixel_overlap = mipi_config->pixel_overlap;
>
> -	if (intel_dsi->dual_link)
> -		intel_dsi->ports = ((1 << PORT_A) | (1 << PORT_C));
> -
>   	if (intel_dsi->pixel_format == VID_MODE_FORMAT_RGB666)
>   		bits_per_pixel = 18;
>   	else if (intel_dsi->pixel_format == VID_MODE_FORMAT_RGB565)
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 09/12] drm/i915/dsi: make the vbt panel driver use mipi_dsi_device for transfers
  2015-01-16 12:27 ` [RFC PATCH 09/12] drm/i915/dsi: make the vbt panel driver use mipi_dsi_device for transfers Jani Nikula
@ 2015-01-23 12:24   ` Shobhit Kumar
  0 siblings, 0 replies; 45+ messages in thread
From: Shobhit Kumar @ 2015-01-23 12:24 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx; +Cc: Shobhit Kumar, Thierry Reding

On 01/16/2015 05:57 PM, Jani Nikula wrote:
> Use the drm core interfaces in preparation of removing our homebrew.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

All looks well on code review and tested also and everything works. I 
have ASUS T100 whose panel does not need actually the DCS write commands 
during OTP or enabling, so this patch won't get exercised. With that said-

Reviewed-By: Shobhit Kumar <shobhit.kumar@intel.com>

> ---
>   drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 52 +++++++++++++++++++-----------
>   1 file changed, 34 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> index e363c26a2b05..0b09e66f7e29 100644
> --- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> +++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> @@ -113,14 +113,18 @@ static inline enum port intel_dsi_seq_port_to_port(u8 port)
>   static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi,
>   				       const u8 *data)
>   {
> -	u8 type, byte, mode, vc, seq_port;
> +	struct mipi_dsi_device *dsi_device;
> +	u8 type, flags, seq_port;
>   	u16 len;
>   	enum port port;
>
> -	byte = *data++;
> -	mode = (byte >> MIPI_TRANSFER_MODE_SHIFT) & 0x1;
> -	vc = (byte >> MIPI_VIRTUAL_CHANNEL_SHIFT) & 0x3;
> -	seq_port = (byte >> MIPI_PORT_SHIFT) & 0x3;
> +	flags = *data++;
> +	type = *data++;
> +
> +	len = *((u16 *) data);
> +	data += 2;
> +
> +	seq_port = (flags >> MIPI_PORT_SHIFT) & 3;
>
>   	/* For DSI single link on Port A & C, the seq_port value which is
>   	 * parsed from Sequence Block#53 of VBT has been set to 0
> @@ -131,24 +135,29 @@ static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi,
>   		port = PORT_C;
>   	else
>   		port = intel_dsi_seq_port_to_port(seq_port);
> -	/* LP or HS mode */
> -	intel_dsi->hs = mode;
>
> -	/* get packet type and increment the pointer */
> -	type = *data++;
> +	dsi_device = intel_dsi->dsi_hosts[port]->device;
> +	if (!dsi_device) {
> +		DRM_DEBUG_KMS("no dsi device for port %c\n", port_name(port));
> +		goto out;
> +	}
>
> -	len = *((u16 *) data);
> -	data += 2;
> +	if ((flags >> MIPI_TRANSFER_MODE_SHIFT) & 1)
> +		dsi_device->mode_flags &= ~MIPI_DSI_MODE_LPM;
> +	else
> +		dsi_device->mode_flags |= MIPI_DSI_MODE_LPM;
> +
> +	dsi_device->channel = (flags >> MIPI_VIRTUAL_CHANNEL_SHIFT) & 3;
>
>   	switch (type) {
>   	case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
> -		dsi_vc_generic_write_0(intel_dsi, vc, port);
> +		mipi_dsi_generic_write(dsi_device, NULL, 0);
>   		break;
>   	case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
> -		dsi_vc_generic_write_1(intel_dsi, vc, *data, port);
> +		mipi_dsi_generic_write(dsi_device, data, 1);
>   		break;
>   	case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
> -		dsi_vc_generic_write_2(intel_dsi, vc, *data, *(data + 1), port);
> +		mipi_dsi_generic_write(dsi_device, data, 2);
>   		break;
>   	case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
>   	case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
> @@ -156,22 +165,23 @@ static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi,
>   		DRM_DEBUG_DRIVER("Generic Read not yet implemented or used\n");
>   		break;
>   	case MIPI_DSI_GENERIC_LONG_WRITE:
> -		dsi_vc_generic_write(intel_dsi, vc, data, len, port);
> +		mipi_dsi_generic_write(dsi_device, data, len);
>   		break;
>   	case MIPI_DSI_DCS_SHORT_WRITE:
> -		dsi_vc_dcs_write_0(intel_dsi, vc, *data, port);
> +		mipi_dsi_dcs_write_buffer(dsi_device, data, 1);
>   		break;
>   	case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
> -		dsi_vc_dcs_write_1(intel_dsi, vc, *data, *(data + 1), port);
> +		mipi_dsi_dcs_write_buffer(dsi_device, data, 2);
>   		break;
>   	case MIPI_DSI_DCS_READ:
>   		DRM_DEBUG_DRIVER("DCS Read not yet implemented or used\n");
>   		break;
>   	case MIPI_DSI_DCS_LONG_WRITE:
> -		dsi_vc_dcs_write(intel_dsi, vc, data, len, port);
> +		mipi_dsi_dcs_write_buffer(dsi_device, data, len);
>   		break;
>   	}
>
> +out:
>   	data += len;
>
>   	return data;
> @@ -389,6 +399,7 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
>   	u32 lp_to_hs_switch, hs_to_lp_switch;
>   	u32 pclk, computed_ddr;
>   	u16 burst_mode_ratio;
> +	enum port port;
>
>   	DRM_DEBUG_KMS("\n");
>
> @@ -661,5 +672,10 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
>   	vbt_panel->panel.funcs = &vbt_panel_funcs;
>   	drm_panel_add(&vbt_panel->panel);
>
> +	/* a regular driver would get the device in probe */
> +	for_each_dsi_port(port, intel_dsi->ports) {
> +		mipi_dsi_attach(intel_dsi->dsi_hosts[port]->device);
> +	}
> +
>   	return &vbt_panel->panel;
>   }
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 10/12] drm/i915/dsi: remove old read/write functions in favor of new stuff
  2015-01-16 12:27 ` [RFC PATCH 10/12] drm/i915/dsi: remove old read/write functions in favor of new stuff Jani Nikula
@ 2015-01-23 12:25   ` Shobhit Kumar
  0 siblings, 0 replies; 45+ messages in thread
From: Shobhit Kumar @ 2015-01-23 12:25 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx; +Cc: Shobhit Kumar, Thierry Reding

On 01/16/2015 05:57 PM, Jani Nikula wrote:
> All of these are replaced by the drm core mipi dsi functions.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-By: Shobhit Kumar <shobhit.kumar@intel.com>

> ---
>   drivers/gpu/drm/i915/intel_dsi_cmd.c | 259 -----------------------------------
>   drivers/gpu/drm/i915/intel_dsi_cmd.h |  72 ----------
>   2 files changed, 331 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.c b/drivers/gpu/drm/i915/intel_dsi_cmd.c
> index 17b892a365ee..6baaa374fc89 100644
> --- a/drivers/gpu/drm/i915/intel_dsi_cmd.c
> +++ b/drivers/gpu/drm/i915/intel_dsi_cmd.c
> @@ -96,11 +96,6 @@ static void print_stat(struct intel_dsi *intel_dsi, enum port port)
>   #undef STAT_BIT
>   }
>
> -enum dsi_type {
> -	DSI_DCS,
> -	DSI_GENERIC,
> -};
> -
>   /* enable or disable command mode hs transmissions */
>   void dsi_hs_mode_enable(struct intel_dsi *intel_dsi, bool enable,
>   						enum port port)
> @@ -121,260 +116,6 @@ void dsi_hs_mode_enable(struct intel_dsi *intel_dsi, bool enable,
>   	intel_dsi->hs = enable;
>   }
>
> -static int dsi_vc_send_short(struct intel_dsi *intel_dsi, int channel,
> -			     u8 data_type, u16 data, enum port port)
> -{
> -	struct drm_encoder *encoder = &intel_dsi->base.base;
> -	struct drm_device *dev = encoder->dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -	u32 ctrl_reg;
> -	u32 ctrl;
> -	u32 mask;
> -
> -	DRM_DEBUG_KMS("channel %d, data_type %d, data %04x\n",
> -		      channel, data_type, data);
> -
> -	if (intel_dsi->hs) {
> -		ctrl_reg = MIPI_HS_GEN_CTRL(port);
> -		mask = HS_CTRL_FIFO_FULL;
> -	} else {
> -		ctrl_reg = MIPI_LP_GEN_CTRL(port);
> -		mask = LP_CTRL_FIFO_FULL;
> -	}
> -
> -	if (wait_for((I915_READ(MIPI_GEN_FIFO_STAT(port)) & mask) == 0, 50)) {
> -		DRM_ERROR("Timeout waiting for HS/LP CTRL FIFO !full\n");
> -		print_stat(intel_dsi, port);
> -	}
> -
> -	/*
> -	 * Note: This function is also used for long packets, with length passed
> -	 * as data, since SHORT_PACKET_PARAM_SHIFT ==
> -	 * LONG_PACKET_WORD_COUNT_SHIFT.
> -	 */
> -	ctrl = data << SHORT_PACKET_PARAM_SHIFT |
> -		channel << VIRTUAL_CHANNEL_SHIFT |
> -		data_type << DATA_TYPE_SHIFT;
> -
> -	I915_WRITE(ctrl_reg, ctrl);
> -
> -	return 0;
> -}
> -
> -static int dsi_vc_send_long(struct intel_dsi *intel_dsi, int channel,
> -		u8 data_type, const u8 *data, int len, enum port port)
> -{
> -	struct drm_encoder *encoder = &intel_dsi->base.base;
> -	struct drm_device *dev = encoder->dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -	u32 data_reg;
> -	int i, j, n;
> -	u32 mask;
> -
> -	DRM_DEBUG_KMS("channel %d, data_type %d, len %04x\n",
> -		      channel, data_type, len);
> -
> -	if (intel_dsi->hs) {
> -		data_reg = MIPI_HS_GEN_DATA(port);
> -		mask = HS_DATA_FIFO_FULL;
> -	} else {
> -		data_reg = MIPI_LP_GEN_DATA(port);
> -		mask = LP_DATA_FIFO_FULL;
> -	}
> -
> -	if (wait_for((I915_READ(MIPI_GEN_FIFO_STAT(port)) & mask) == 0, 50))
> -		DRM_ERROR("Timeout waiting for HS/LP DATA FIFO !full\n");
> -
> -	for (i = 0; i < len; i += n) {
> -		u32 val = 0;
> -		n = min_t(int, len - i, 4);
> -
> -		for (j = 0; j < n; j++)
> -			val |= *data++ << 8 * j;
> -
> -		I915_WRITE(data_reg, val);
> -		/* XXX: check for data fifo full, once that is set, write 4
> -		 * dwords, then wait for not set, then continue. */
> -	}
> -
> -	return dsi_vc_send_short(intel_dsi, channel, data_type, len, port);
> -}
> -
> -static int dsi_vc_write_common(struct intel_dsi *intel_dsi,
> -			       int channel, const u8 *data, int len,
> -			       enum dsi_type type, enum port port)
> -{
> -	int ret;
> -
> -	if (len == 0) {
> -		BUG_ON(type == DSI_GENERIC);
> -		ret = dsi_vc_send_short(intel_dsi, channel,
> -					MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM,
> -					0, port);
> -	} else if (len == 1) {
> -		ret = dsi_vc_send_short(intel_dsi, channel,
> -					type == DSI_GENERIC ?
> -					MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM :
> -					MIPI_DSI_DCS_SHORT_WRITE, data[0],
> -					port);
> -	} else if (len == 2) {
> -		ret = dsi_vc_send_short(intel_dsi, channel,
> -					type == DSI_GENERIC ?
> -					MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM :
> -					MIPI_DSI_DCS_SHORT_WRITE_PARAM,
> -					(data[1] << 8) | data[0], port);
> -	} else {
> -		ret = dsi_vc_send_long(intel_dsi, channel,
> -					type == DSI_GENERIC ?
> -					MIPI_DSI_GENERIC_LONG_WRITE :
> -					MIPI_DSI_DCS_LONG_WRITE, data, len,
> -					port);
> -	}
> -
> -	return ret;
> -}
> -
> -int dsi_vc_dcs_write(struct intel_dsi *intel_dsi, int channel,
> -		     const u8 *data, int len, enum port port)
> -{
> -	return dsi_vc_write_common(intel_dsi, channel, data, len, DSI_DCS,
> -									port);
> -}
> -
> -int dsi_vc_generic_write(struct intel_dsi *intel_dsi, int channel,
> -			 const u8 *data, int len, enum port port)
> -{
> -	return dsi_vc_write_common(intel_dsi, channel, data, len, DSI_GENERIC,
> -									port);
> -}
> -
> -static int dsi_vc_dcs_send_read_request(struct intel_dsi *intel_dsi,
> -				int channel, u8 dcs_cmd, enum port port)
> -{
> -	return dsi_vc_send_short(intel_dsi, channel, MIPI_DSI_DCS_READ,
> -				 dcs_cmd, port);
> -}
> -
> -static int dsi_vc_generic_send_read_request(struct intel_dsi *intel_dsi,
> -					    int channel, u8 *reqdata,
> -					    int reqlen, enum port port)
> -{
> -	u16 data;
> -	u8 data_type;
> -
> -	switch (reqlen) {
> -	case 0:
> -		data_type = MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM;
> -		data = 0;
> -		break;
> -	case 1:
> -		data_type = MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM;
> -		data = reqdata[0];
> -		break;
> -	case 2:
> -		data_type = MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM;
> -		data = (reqdata[1] << 8) | reqdata[0];
> -		break;
> -	default:
> -		BUG();
> -	}
> -
> -	return dsi_vc_send_short(intel_dsi, channel, data_type, data, port);
> -}
> -
> -static int dsi_read_data_return(struct intel_dsi *intel_dsi,
> -				u8 *buf, int buflen, enum port port)
> -{
> -	struct drm_encoder *encoder = &intel_dsi->base.base;
> -	struct drm_device *dev = encoder->dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -	int i, len = 0;
> -	u32 data_reg, val;
> -
> -	if (intel_dsi->hs) {
> -		data_reg = MIPI_HS_GEN_DATA(port);
> -	} else {
> -		data_reg = MIPI_LP_GEN_DATA(port);
> -	}
> -
> -	while (len < buflen) {
> -		val = I915_READ(data_reg);
> -		for (i = 0; i < 4 && len < buflen; i++, len++)
> -			buf[len] = val >> 8 * i;
> -	}
> -
> -	return len;
> -}
> -
> -int dsi_vc_dcs_read(struct intel_dsi *intel_dsi, int channel, u8 dcs_cmd,
> -		    u8 *buf, int buflen, enum port port)
> -{
> -	struct drm_encoder *encoder = &intel_dsi->base.base;
> -	struct drm_device *dev = encoder->dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -	u32 mask;
> -	int ret;
> -
> -	/*
> -	 * XXX: should issue multiple read requests and reads if request is
> -	 * longer than MIPI_MAX_RETURN_PKT_SIZE
> -	 */
> -
> -	I915_WRITE(MIPI_INTR_STAT(port), GEN_READ_DATA_AVAIL);
> -
> -	ret = dsi_vc_dcs_send_read_request(intel_dsi, channel, dcs_cmd, port);
> -	if (ret)
> -		return ret;
> -
> -	mask = GEN_READ_DATA_AVAIL;
> -	if (wait_for((I915_READ(MIPI_INTR_STAT(port)) & mask) == mask, 50))
> -		DRM_ERROR("Timeout waiting for read data.\n");
> -
> -	ret = dsi_read_data_return(intel_dsi, buf, buflen, port);
> -	if (ret < 0)
> -		return ret;
> -
> -	if (ret != buflen)
> -		return -EIO;
> -
> -	return 0;
> -}
> -
> -int dsi_vc_generic_read(struct intel_dsi *intel_dsi, int channel,
> -		u8 *reqdata, int reqlen, u8 *buf, int buflen, enum port port)
> -{
> -	struct drm_encoder *encoder = &intel_dsi->base.base;
> -	struct drm_device *dev = encoder->dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -	u32 mask;
> -	int ret;
> -
> -	/*
> -	 * XXX: should issue multiple read requests and reads if request is
> -	 * longer than MIPI_MAX_RETURN_PKT_SIZE
> -	 */
> -
> -	I915_WRITE(MIPI_INTR_STAT(port), GEN_READ_DATA_AVAIL);
> -
> -	ret = dsi_vc_generic_send_read_request(intel_dsi, channel, reqdata,
> -					       reqlen, port);
> -	if (ret)
> -		return ret;
> -
> -	mask = GEN_READ_DATA_AVAIL;
> -	if (wait_for((I915_READ(MIPI_INTR_STAT(port)) & mask) == mask, 50))
> -		DRM_ERROR("Timeout waiting for read data.\n");
> -
> -	ret = dsi_read_data_return(intel_dsi, buf, buflen, port);
> -	if (ret < 0)
> -		return ret;
> -
> -	if (ret != buflen)
> -		return -EIO;
> -
> -	return 0;
> -}
> -
>   /*
>    * send a video mode command
>    *
> diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.h b/drivers/gpu/drm/i915/intel_dsi_cmd.h
> index 70f24666a1f9..9a28ff58a92b 100644
> --- a/drivers/gpu/drm/i915/intel_dsi_cmd.h
> +++ b/drivers/gpu/drm/i915/intel_dsi_cmd.h
> @@ -39,78 +39,6 @@
>   void dsi_hs_mode_enable(struct intel_dsi *intel_dsi, bool enable,
>   						enum port port);
>
> -int dsi_vc_dcs_write(struct intel_dsi *intel_dsi, int channel,
> -		     const u8 *data, int len, enum port port);
> -
> -int dsi_vc_generic_write(struct intel_dsi *intel_dsi, int channel,
> -			 const u8 *data, int len, enum port port);
> -
> -int dsi_vc_dcs_read(struct intel_dsi *intel_dsi, int channel, u8 dcs_cmd,
> -		    u8 *buf, int buflen, enum port port);
> -
> -int dsi_vc_generic_read(struct intel_dsi *intel_dsi, int channel,
> -		u8 *reqdata, int reqlen, u8 *buf, int buflen, enum port port);
> -
>   int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs, enum port port);
>
> -/* XXX: questionable write helpers */
> -static inline int dsi_vc_dcs_write_0(struct intel_dsi *intel_dsi,
> -				     int channel, u8 dcs_cmd, enum port port)
> -{
> -	return dsi_vc_dcs_write(intel_dsi, channel, &dcs_cmd, 1, port);
> -}
> -
> -static inline int dsi_vc_dcs_write_1(struct intel_dsi *intel_dsi,
> -			int channel, u8 dcs_cmd, u8 param, enum port port)
> -{
> -	u8 buf[2] = { dcs_cmd, param };
> -	return dsi_vc_dcs_write(intel_dsi, channel, buf, 2, port);
> -}
> -
> -static inline int dsi_vc_generic_write_0(struct intel_dsi *intel_dsi,
> -					 int channel, enum port port)
> -{
> -	return dsi_vc_generic_write(intel_dsi, channel, NULL, 0, port);
> -}
> -
> -static inline int dsi_vc_generic_write_1(struct intel_dsi *intel_dsi,
> -					 int channel, u8 param, enum port port)
> -{
> -	return dsi_vc_generic_write(intel_dsi, channel, &param, 1, port);
> -}
> -
> -static inline int dsi_vc_generic_write_2(struct intel_dsi *intel_dsi,
> -			int channel, u8 param1, u8 param2, enum port port)
> -{
> -	u8 buf[2] = { param1, param2 };
> -	return dsi_vc_generic_write(intel_dsi, channel, buf, 2, port);
> -}
> -
> -/* XXX: questionable read helpers */
> -static inline int dsi_vc_generic_read_0(struct intel_dsi *intel_dsi,
> -			int channel, u8 *buf, int buflen, enum port port)
> -{
> -	return dsi_vc_generic_read(intel_dsi, channel, NULL, 0, buf, buflen,
> -									port);
> -}
> -
> -static inline int dsi_vc_generic_read_1(struct intel_dsi *intel_dsi,
> -					int channel, u8 param, u8 *buf,
> -					int buflen, enum port port)
> -{
> -	return dsi_vc_generic_read(intel_dsi, channel, &param, 1, buf, buflen,
> -									port);
> -}
> -
> -static inline int dsi_vc_generic_read_2(struct intel_dsi *intel_dsi,
> -					int channel, u8 param1, u8 param2,
> -					u8 *buf, int buflen, enum port port)
> -{
> -	u8 req[2] = { param1, param2 };
> -
> -	return dsi_vc_generic_read(intel_dsi, channel, req, 2, buf, buflen,
> -									port);
> -}
> -
> -
>   #endif /* _INTEL_DSI_DSI_H */
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 11/12] drm/i915/dsi: move dpi_send_cmd() to intel_dsi.c and make it static
  2015-01-16 12:27 ` [RFC PATCH 11/12] drm/i915/dsi: move dpi_send_cmd() to intel_dsi.c and make it static Jani Nikula
@ 2015-01-23 12:27   ` Shobhit Kumar
  0 siblings, 0 replies; 45+ messages in thread
From: Shobhit Kumar @ 2015-01-23 12:27 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx; +Cc: Shobhit Kumar, Thierry Reding

On 01/16/2015 05:57 PM, Jani Nikula wrote:
> No functional changes.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-By: Shobhit Kumar <shobhit.kumar@intel.com>

> ---
>   drivers/gpu/drm/i915/intel_dsi.c     | 39 ++++++++++++++++++++++++++++++++++--
>   drivers/gpu/drm/i915/intel_dsi_cmd.c | 34 -------------------------------
>   drivers/gpu/drm/i915/intel_dsi_cmd.h |  5 -----
>   3 files changed, 37 insertions(+), 41 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index 5cfa3431785a..791d90b4c047 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -202,6 +202,41 @@ static struct intel_dsi_host *intel_dsi_host_init(struct intel_dsi *intel_dsi,
>   	return host;
>   }
>
> +/*
> + * send a video mode command
> + *
> + * XXX: commands with data in MIPI_DPI_DATA?
> + */
> +static int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs,
> +			enum port port)
> +{
> +	struct drm_encoder *encoder = &intel_dsi->base.base;
> +	struct drm_device *dev = encoder->dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	u32 mask;
> +
> +	/* XXX: pipe, hs */
> +	if (hs)
> +		cmd &= ~DPI_LP_MODE;
> +	else
> +		cmd |= DPI_LP_MODE;
> +
> +	/* clear bit */
> +	I915_WRITE(MIPI_INTR_STAT(port), SPL_PKT_SENT_INTERRUPT);
> +
> +	/* XXX: old code skips write if control unchanged */
> +	if (cmd == I915_READ(MIPI_DPI_CONTROL(port)))
> +		DRM_ERROR("Same special packet %02x twice in a row.\n", cmd);
> +
> +	I915_WRITE(MIPI_DPI_CONTROL(port), cmd);
> +
> +	mask = SPL_PKT_SENT_INTERRUPT;
> +	if (wait_for((I915_READ(MIPI_INTR_STAT(port)) & mask) == mask, 100))
> +		DRM_ERROR("Video mode command 0x%08x send failed.\n", cmd);
> +
> +	return 0;
> +}
> +
>   static void band_gap_reset(struct drm_i915_private *dev_priv)
>   {
>   	mutex_lock(&dev_priv->dpio_lock);
> @@ -357,7 +392,7 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
>   	else {
>   		msleep(20); /* XXX */
>   		for_each_dsi_port(port, intel_dsi->ports)
> -			dpi_send_cmd(intel_dsi, TURN_ON, DPI_LP_MODE_EN, port);
> +			dpi_send_cmd(intel_dsi, TURN_ON, false, port);
>   		msleep(100);
>
>   		drm_panel_enable(intel_dsi->panel);
> @@ -430,7 +465,7 @@ static void intel_dsi_pre_disable(struct intel_encoder *encoder)
>   	if (is_vid_mode(intel_dsi)) {
>   		/* Send Shutdown command to the panel in LP mode */
>   		for_each_dsi_port(port, intel_dsi->ports)
> -			dpi_send_cmd(intel_dsi, SHUTDOWN, DPI_LP_MODE_EN, port);
> +			dpi_send_cmd(intel_dsi, SHUTDOWN, false, port);
>   		msleep(10);
>   	}
>   }
> diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.c b/drivers/gpu/drm/i915/intel_dsi_cmd.c
> index 6baaa374fc89..acdc5da7b46f 100644
> --- a/drivers/gpu/drm/i915/intel_dsi_cmd.c
> +++ b/drivers/gpu/drm/i915/intel_dsi_cmd.c
> @@ -115,37 +115,3 @@ void dsi_hs_mode_enable(struct intel_dsi *intel_dsi, bool enable,
>
>   	intel_dsi->hs = enable;
>   }
> -
> -/*
> - * send a video mode command
> - *
> - * XXX: commands with data in MIPI_DPI_DATA?
> - */
> -int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs, enum port port)
> -{
> -	struct drm_encoder *encoder = &intel_dsi->base.base;
> -	struct drm_device *dev = encoder->dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -	u32 mask;
> -
> -	/* XXX: pipe, hs */
> -	if (hs)
> -		cmd &= ~DPI_LP_MODE;
> -	else
> -		cmd |= DPI_LP_MODE;
> -
> -	/* clear bit */
> -	I915_WRITE(MIPI_INTR_STAT(port), SPL_PKT_SENT_INTERRUPT);
> -
> -	/* XXX: old code skips write if control unchanged */
> -	if (cmd == I915_READ(MIPI_DPI_CONTROL(port)))
> -		DRM_ERROR("Same special packet %02x twice in a row.\n", cmd);
> -
> -	I915_WRITE(MIPI_DPI_CONTROL(port), cmd);
> -
> -	mask = SPL_PKT_SENT_INTERRUPT;
> -	if (wait_for((I915_READ(MIPI_INTR_STAT(port)) & mask) == mask, 100))
> -		DRM_ERROR("Video mode command 0x%08x send failed.\n", cmd);
> -
> -	return 0;
> -}
> diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.h b/drivers/gpu/drm/i915/intel_dsi_cmd.h
> index 9a28ff58a92b..886779030f1a 100644
> --- a/drivers/gpu/drm/i915/intel_dsi_cmd.h
> +++ b/drivers/gpu/drm/i915/intel_dsi_cmd.h
> @@ -33,12 +33,7 @@
>   #include "intel_drv.h"
>   #include "intel_dsi.h"
>
> -#define DPI_LP_MODE_EN	false
> -#define DPI_HS_MODE_EN	true
> -
>   void dsi_hs_mode_enable(struct intel_dsi *intel_dsi, bool enable,
>   						enum port port);
>
> -int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs, enum port port);
> -
>   #endif /* _INTEL_DSI_DSI_H */
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 12/12] drm/i915/dsi: remove intel_dsi_cmd.c and the unused functions therein
  2015-01-16 12:27 ` [RFC PATCH 12/12] drm/i915/dsi: remove intel_dsi_cmd.c and the unused functions therein Jani Nikula
@ 2015-01-23 12:28   ` Shobhit Kumar
  2015-01-29 16:04     ` Daniel Vetter
  0 siblings, 1 reply; 45+ messages in thread
From: Shobhit Kumar @ 2015-01-23 12:28 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx; +Cc: Shobhit Kumar, Thierry Reding

On 01/16/2015 05:57 PM, Jani Nikula wrote:
> The removed functions can be resurrected in intel_dsi.c as need arises.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-By: Shobhit Kumar <shobhit.kumar@intel.com>

> ---
>   drivers/gpu/drm/i915/Makefile              |   1 -
>   drivers/gpu/drm/i915/intel_dsi.c           |   1 -
>   drivers/gpu/drm/i915/intel_dsi_cmd.c       | 117 -----------------------------
>   drivers/gpu/drm/i915/intel_dsi_panel_vbt.c |   1 -
>   4 files changed, 120 deletions(-)
>   delete mode 100644 drivers/gpu/drm/i915/intel_dsi_cmd.c
>
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index 16e3dc350274..63afe63bf0e4 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -71,7 +71,6 @@ i915-y += dvo_ch7017.o \
>   	  intel_ddi.o \
>   	  intel_dp.o \
>   	  intel_dp_mst.o \
> -	  intel_dsi_cmd.o \
>   	  intel_dsi.o \
>   	  intel_dsi_pll.o \
>   	  intel_dsi_panel_vbt.o \
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index 791d90b4c047..02ae5e583b27 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -33,7 +33,6 @@
>   #include "i915_drv.h"
>   #include "intel_drv.h"
>   #include "intel_dsi.h"
> -#include "intel_dsi_cmd.h"
>
>   static const struct {
>   	u16 panel_id;
> diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.c b/drivers/gpu/drm/i915/intel_dsi_cmd.c
> deleted file mode 100644
> index acdc5da7b46f..000000000000
> --- a/drivers/gpu/drm/i915/intel_dsi_cmd.c
> +++ /dev/null
> @@ -1,117 +0,0 @@
> -/*
> - * 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@intel.com>
> - */
> -
> -#include <linux/export.h>
> -#include <drm/drmP.h>
> -#include <drm/drm_crtc.h>
> -#include <video/mipi_display.h>
> -#include "i915_drv.h"
> -#include "intel_drv.h"
> -#include "intel_dsi.h"
> -#include "intel_dsi_cmd.h"
> -
> -/*
> - * XXX: MIPI_DATA_ADDRESS, MIPI_DATA_LENGTH, MIPI_COMMAND_LENGTH, and
> - * MIPI_COMMAND_ADDRESS registers.
> - *
> - * Apparently these registers provide a MIPI adapter level way to send (lots of)
> - * commands and data to the receiver, without having to write the commands and
> - * data to MIPI_{HS,LP}_GEN_{CTRL,DATA} registers word by word.
> - *
> - * Presumably for anything other than MIPI_DCS_WRITE_MEMORY_START and
> - * MIPI_DCS_WRITE_MEMORY_CONTINUE (which are used to update the external
> - * framebuffer in command mode displays) these are just an optimization that can
> - * come later.
> - *
> - * For memory writes, these should probably be used for performance.
> - */
> -
> -static void print_stat(struct intel_dsi *intel_dsi, enum port port)
> -{
> -	struct drm_encoder *encoder = &intel_dsi->base.base;
> -	struct drm_device *dev = encoder->dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -	u32 val;
> -
> -	val = I915_READ(MIPI_INTR_STAT(port));
> -
> -#define STAT_BIT(val, bit) (val) & (bit) ? " " #bit : ""
> -	DRM_DEBUG_KMS("MIPI_INTR_STAT(%c) = %08x"
> -		      "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
> -		      "\n", port_name(port), val,
> -		      STAT_BIT(val, TEARING_EFFECT),
> -		      STAT_BIT(val, SPL_PKT_SENT_INTERRUPT),
> -		      STAT_BIT(val, GEN_READ_DATA_AVAIL),
> -		      STAT_BIT(val, LP_GENERIC_WR_FIFO_FULL),
> -		      STAT_BIT(val, HS_GENERIC_WR_FIFO_FULL),
> -		      STAT_BIT(val, RX_PROT_VIOLATION),
> -		      STAT_BIT(val, RX_INVALID_TX_LENGTH),
> -		      STAT_BIT(val, ACK_WITH_NO_ERROR),
> -		      STAT_BIT(val, TURN_AROUND_ACK_TIMEOUT),
> -		      STAT_BIT(val, LP_RX_TIMEOUT),
> -		      STAT_BIT(val, HS_TX_TIMEOUT),
> -		      STAT_BIT(val, DPI_FIFO_UNDERRUN),
> -		      STAT_BIT(val, LOW_CONTENTION),
> -		      STAT_BIT(val, HIGH_CONTENTION),
> -		      STAT_BIT(val, TXDSI_VC_ID_INVALID),
> -		      STAT_BIT(val, TXDSI_DATA_TYPE_NOT_RECOGNISED),
> -		      STAT_BIT(val, TXCHECKSUM_ERROR),
> -		      STAT_BIT(val, TXECC_MULTIBIT_ERROR),
> -		      STAT_BIT(val, TXECC_SINGLE_BIT_ERROR),
> -		      STAT_BIT(val, TXFALSE_CONTROL_ERROR),
> -		      STAT_BIT(val, RXDSI_VC_ID_INVALID),
> -		      STAT_BIT(val, RXDSI_DATA_TYPE_NOT_REGOGNISED),
> -		      STAT_BIT(val, RXCHECKSUM_ERROR),
> -		      STAT_BIT(val, RXECC_MULTIBIT_ERROR),
> -		      STAT_BIT(val, RXECC_SINGLE_BIT_ERROR),
> -		      STAT_BIT(val, RXFALSE_CONTROL_ERROR),
> -		      STAT_BIT(val, RXHS_RECEIVE_TIMEOUT_ERROR),
> -		      STAT_BIT(val, RX_LP_TX_SYNC_ERROR),
> -		      STAT_BIT(val, RXEXCAPE_MODE_ENTRY_ERROR),
> -		      STAT_BIT(val, RXEOT_SYNC_ERROR),
> -		      STAT_BIT(val, RXSOT_SYNC_ERROR),
> -		      STAT_BIT(val, RXSOT_ERROR));
> -#undef STAT_BIT
> -}
> -
> -/* enable or disable command mode hs transmissions */
> -void dsi_hs_mode_enable(struct intel_dsi *intel_dsi, bool enable,
> -						enum port port)
> -{
> -	struct drm_encoder *encoder = &intel_dsi->base.base;
> -	struct drm_device *dev = encoder->dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -	u32 temp;
> -	u32 mask = DBI_FIFO_EMPTY;
> -
> -	if (wait_for((I915_READ(MIPI_GEN_FIFO_STAT(port)) & mask) == mask, 50))
> -		DRM_ERROR("Timeout waiting for DBI FIFO empty\n");
> -
> -	temp = I915_READ(MIPI_HS_LP_DBI_ENABLE(port));
> -	temp &= DBI_HS_LP_MODE_MASK;
> -	I915_WRITE(MIPI_HS_LP_DBI_ENABLE(port), enable ? DBI_HS_MODE : DBI_LP_MODE);
> -
> -	intel_dsi->hs = enable;
> -}
> diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> index 0b09e66f7e29..c3eec66f5076 100644
> --- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> +++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> @@ -36,7 +36,6 @@
>   #include "i915_drv.h"
>   #include "intel_drv.h"
>   #include "intel_dsi.h"
> -#include "intel_dsi_cmd.h"
>
>   struct vbt_panel {
>   	struct drm_panel panel;
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks
  2015-01-23  2:13     ` Shobhit Kumar
@ 2015-01-23 12:30       ` Shobhit Kumar
  0 siblings, 0 replies; 45+ messages in thread
From: Shobhit Kumar @ 2015-01-23 12:30 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx; +Cc: Shobhit Kumar, Thierry Reding

On 01/23/2015 07:43 AM, Shobhit Kumar wrote:
> On 01/22/2015 06:58 PM, Jani Nikula wrote:
>> On Thu, 22 Jan 2015, Shobhit Kumar <shobhit.kumar@linux.intel.com> wrote:
>>> On 01/16/2015 05:57 PM, Jani Nikula wrote:
>>>> This series ports our DSI code over to the drm_panel and
>>>> mipi_dsi_host/mipi_dsi_device. There are some rough edges towards the
>>>> end of the series, see commit message for patch 8 for details.
>>>>
>>>> Patches 1-6 are prep work, fairly independent
>>>
>>> While I continue to review, quick test of patches show that till here it
>>> is fine(with minor fix for Patch 2), but from Patch 7 on wards things
>>> really don't work.
>>
>> Okay, thanks for the review so far and trying it out.
>>
>> What breaks down with patch 7? Which device are you trying this on?
>
> It just hangs during bootup console. Guessing there is some kernel panic
> somewhere but the Asus T100 on which I am trying does not have serial to
> get logs. Will try to debug today.
>

Okay with the issues fixed in patch 7, all works well so once you fix 
all those in your patch -

Tested-by Shobhit kumar <shobhit.kumar@intel.com>

> Regards
> Shobhit
>
>>
>> BR,
>> Jani.
>>
>>
>>>
>>>>
>>>> Patch 7 ports the driver over to drm_panel
>>>>
>>>> Patches 8-10 port the driver over to mipi_dsi_host/device
>>>>
>>>> Patches 11-12 do some additional cleanup
>>>>
>>>> BR,
>>>> Jani.
>>>>
>>>>
>>>> Jani Nikula (12):
>>>>     drm/i915/dsi: call dpi_send_cmd() for each dsi port at a higher
>>>> level
>>>>     drm/i915/dsi: set max return packet size for each dsi port
>>>>     drm/i915/dsi: move wait_for_dsi_fifo_empty to intel_dsi.c
>>>>     drm/i915/dsi: call wait_for_dsi_fifo_empty() for each dsi port
>>>>     drm/i915/dsi: remove unnecessary dsi device callbacks
>>>>     drm/i915/dsi: add some constness to vbt panel driver
>>>>     drm/i915/dsi: switch to drm_panel interface
>>>>     drm/i915/dsi: add drm mipi dsi host support
>>>>     drm/i915/dsi: make the vbt panel driver use mipi_dsi_device for
>>>>       transfers
>>>>     drm/i915/dsi: remove old read/write functions in favor of new stuff
>>>>     drm/i915/dsi: move dpi_send_cmd() to intel_dsi.c and make it static
>>>>     drm/i915/dsi: remove intel_dsi_cmd.c and the unused functions
>>>> therein
>>>>
>>>>    drivers/gpu/drm/i915/Kconfig               |   2 +
>>>>    drivers/gpu/drm/i915/Makefile              |   1 -
>>>>    drivers/gpu/drm/i915/intel_dsi.c           | 336
>>>> +++++++++++++++++-----
>>>>    drivers/gpu/drm/i915/intel_dsi.h           |  69 ++---
>>>>    drivers/gpu/drm/i915/intel_dsi_cmd.c       | 432
>>>> -----------------------------
>>>>    drivers/gpu/drm/i915/intel_dsi_cmd.h       |  78 ------
>>>>    drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 289 ++++++++++---------
>>>>    7 files changed, 441 insertions(+), 766 deletions(-)
>>>>    delete mode 100644 drivers/gpu/drm/i915/intel_dsi_cmd.c
>>>>
>>> _______________________________________________
>>> Intel-gfx mailing list
>>> Intel-gfx@lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH v2] drm/i915/dsi: switch to drm_panel interface
  2015-01-16 12:27 ` [RFC PATCH 07/12] drm/i915/dsi: switch to drm_panel interface Jani Nikula
  2015-01-23 10:57   ` Shobhit Kumar
@ 2015-01-23 13:30   ` Jani Nikula
  2015-01-29  4:52     ` Shobhit Kumar
  1 sibling, 1 reply; 45+ messages in thread
From: Jani Nikula @ 2015-01-23 13:30 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula, Shobhit Kumar, Thierry Reding

Replace intel_dsi_device and intel_dsi_dev_ops with drm_panel and
drm_panel_funcs. They are adequate for what we have now, and if we end
up needing more than this we should improve drm_panel. This will keep us
better aligned with the drm core infrastructure.

The panel driver initialization changes a bit. It still remains hideous,
but fixing that is beyond the scope here.

v2: extend mode config mutex to cover drm_panel_get_modes (Shobhit)
    vbt_panel->intel_dsi = intel_dsi in vbt panel init (Shobhit)

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/Kconfig               |   1 +
 drivers/gpu/drm/i915/intel_dsi.c           |  68 +++++++----
 drivers/gpu/drm/i915/intel_dsi.h           |  27 +----
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 180 ++++++++++++++++++-----------
 4 files changed, 157 insertions(+), 119 deletions(-)

diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig
index 4e39ab34eb1c..da196cd07263 100644
--- a/drivers/gpu/drm/i915/Kconfig
+++ b/drivers/gpu/drm/i915/Kconfig
@@ -11,6 +11,7 @@ config DRM_I915
 	select SHMEM
 	select TMPFS
 	select DRM_KMS_HELPER
+	select DRM_PANEL
 	# i915 depends on ACPI_VIDEO when ACPI is enabled
 	# but for select to work, need to select ACPI_VIDEO's dependencies, ick
 	select BACKLIGHT_LCD_SUPPORT if ACPI
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index c56c4150fc13..52c5fabe284a 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -27,18 +27,20 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_edid.h>
 #include <drm/i915_drm.h>
+#include <drm/drm_panel.h>
 #include <linux/slab.h>
 #include "i915_drv.h"
 #include "intel_drv.h"
 #include "intel_dsi.h"
 #include "intel_dsi_cmd.h"
 
-/* the sub-encoders aka panel drivers */
-static const struct intel_dsi_device intel_dsi_devices[] = {
+static const struct {
+	u16 panel_id;
+	struct drm_panel * (*init)(struct intel_dsi *intel_dsi, u16 panel_id);
+} intel_dsi_drivers[] = {
 	{
 		.panel_id = MIPI_DSI_GENERIC_PANEL_ID,
-		.name = "vbt-generic-dsi-vid-mode-display",
-		.dev_ops = &vbt_generic_dsi_display_ops,
+		.init = vbt_panel_init,
 	},
 };
 
@@ -214,8 +216,7 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
 			dpi_send_cmd(intel_dsi, TURN_ON, DPI_LP_MODE_EN, port);
 		msleep(100);
 
-		if (intel_dsi->dev.dev_ops->enable)
-			intel_dsi->dev.dev_ops->enable(&intel_dsi->dev);
+		drm_panel_enable(intel_dsi->panel);
 
 		for_each_dsi_port(port, intel_dsi->ports)
 			wait_for_dsi_fifo_empty(intel_dsi, port);
@@ -255,8 +256,7 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)
 
 	msleep(intel_dsi->panel_on_delay);
 
-	if (intel_dsi->dev.dev_ops->panel_reset)
-		intel_dsi->dev.dev_ops->panel_reset(&intel_dsi->dev);
+	drm_panel_prepare(intel_dsi->panel);
 
 	for_each_dsi_port(port, intel_dsi->ports)
 		wait_for_dsi_fifo_empty(intel_dsi, port);
@@ -329,8 +329,7 @@ static void intel_dsi_disable(struct intel_encoder *encoder)
 	}
 	/* if disable packets are sent before sending shutdown packet then in
 	 * some next enable sequence send turn on packet error is observed */
-	if (intel_dsi->dev.dev_ops->disable)
-		intel_dsi->dev.dev_ops->disable(&intel_dsi->dev);
+	drm_panel_disable(intel_dsi->panel);
 
 	for_each_dsi_port(port, intel_dsi->ports)
 		wait_for_dsi_fifo_empty(intel_dsi, port);
@@ -395,8 +394,7 @@ static void intel_dsi_post_disable(struct intel_encoder *encoder)
 	val &= ~DPOUNIT_CLOCK_GATE_DISABLE;
 	I915_WRITE(DSPCLK_GATE_D, val);
 
-	if (intel_dsi->dev.dev_ops->disable_panel_power)
-		intel_dsi->dev.dev_ops->disable_panel_power(&intel_dsi->dev);
+	drm_panel_unprepare(intel_dsi->panel);
 
 	msleep(intel_dsi->panel_off_delay);
 	msleep(intel_dsi->panel_pwr_cycle_delay);
@@ -760,7 +758,7 @@ static int intel_dsi_get_modes(struct drm_connector *connector)
 	return 1;
 }
 
-static void intel_dsi_destroy(struct drm_connector *connector)
+static void intel_dsi_connector_destroy(struct drm_connector *connector)
 {
 	struct intel_connector *intel_connector = to_intel_connector(connector);
 
@@ -770,8 +768,20 @@ static void intel_dsi_destroy(struct drm_connector *connector)
 	kfree(connector);
 }
 
+static void intel_dsi_encoder_destroy(struct drm_encoder *encoder)
+{
+	struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
+
+	if (intel_dsi->panel) {
+		drm_panel_detach(intel_dsi->panel);
+		/* XXX: Logically this call belongs in the panel driver. */
+		drm_panel_remove(intel_dsi->panel);
+	}
+	intel_encoder_destroy(encoder);
+}
+
 static const struct drm_encoder_funcs intel_dsi_funcs = {
-	.destroy = intel_encoder_destroy,
+	.destroy = intel_dsi_encoder_destroy,
 };
 
 static const struct drm_connector_helper_funcs intel_dsi_connector_helper_funcs = {
@@ -783,7 +793,7 @@ static const struct drm_connector_helper_funcs intel_dsi_connector_helper_funcs
 static const struct drm_connector_funcs intel_dsi_connector_funcs = {
 	.dpms = intel_connector_dpms,
 	.detect = intel_dsi_detect,
-	.destroy = intel_dsi_destroy,
+	.destroy = intel_dsi_connector_destroy,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 };
 
@@ -794,9 +804,8 @@ void intel_dsi_init(struct drm_device *dev)
 	struct drm_encoder *encoder;
 	struct intel_connector *intel_connector;
 	struct drm_connector *connector;
-	struct drm_display_mode *fixed_mode = NULL;
+	struct drm_display_mode *scan, *fixed_mode = NULL;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	const struct intel_dsi_device *dsi;
 	unsigned int i;
 
 	DRM_DEBUG_KMS("\n");
@@ -853,15 +862,14 @@ void intel_dsi_init(struct drm_device *dev)
 		intel_dsi->ports = (1 << PORT_C);
 	}
 
-	for (i = 0; i < ARRAY_SIZE(intel_dsi_devices); i++) {
-		dsi = &intel_dsi_devices[i];
-		intel_dsi->dev = *dsi;
-
-		if (dsi->dev_ops->init(&intel_dsi->dev))
+	for (i = 0; i < ARRAY_SIZE(intel_dsi_drivers); i++) {
+		intel_dsi->panel = intel_dsi_drivers[i].init(intel_dsi,
+							     intel_dsi_drivers[i].panel_id);
+		if (intel_dsi->panel)
 			break;
 	}
 
-	if (i == ARRAY_SIZE(intel_dsi_devices)) {
+	if (!intel_dsi->panel) {
 		DRM_DEBUG_KMS("no device found\n");
 		goto err;
 	}
@@ -881,13 +889,23 @@ void intel_dsi_init(struct drm_device *dev)
 
 	drm_connector_register(connector);
 
-	fixed_mode = dsi->dev_ops->get_modes(&intel_dsi->dev);
+	drm_panel_attach(intel_dsi->panel, connector);
+
+	mutex_lock(&dev->mode_config.mutex);
+	drm_panel_get_modes(intel_dsi->panel);
+	list_for_each_entry(scan, &connector->probed_modes, head) {
+		if ((scan->type & DRM_MODE_TYPE_PREFERRED)) {
+			fixed_mode = drm_mode_duplicate(dev, scan);
+			break;
+		}
+	}
+	mutex_unlock(&dev->mode_config.mutex);
+
 	if (!fixed_mode) {
 		DRM_DEBUG_KMS("no fixed mode\n");
 		goto err;
 	}
 
-	fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
 	intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
 
 	return;
diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h
index 22f87036a256..fc0b2b8d90f1 100644
--- a/drivers/gpu/drm/i915/intel_dsi.h
+++ b/drivers/gpu/drm/i915/intel_dsi.h
@@ -33,33 +33,10 @@
 #define DSI_DUAL_LINK_FRONT_BACK	1
 #define DSI_DUAL_LINK_PIXEL_ALT		2
 
-struct intel_dsi_device {
-	unsigned int panel_id;
-	const char *name;
-	const struct intel_dsi_dev_ops *dev_ops;
-	void *dev_priv;
-};
-
-struct intel_dsi_dev_ops {
-	bool (*init)(struct intel_dsi_device *dsi);
-
-	void (*panel_reset)(struct intel_dsi_device *dsi);
-
-	void (*disable_panel_power)(struct intel_dsi_device *dsi);
-
-	/* This callback must be able to assume DSI commands can be sent */
-	void (*enable)(struct intel_dsi_device *dsi);
-
-	/* This callback must be able to assume DSI commands can be sent */
-	void (*disable)(struct intel_dsi_device *dsi);
-
-	struct drm_display_mode *(*get_modes)(struct intel_dsi_device *dsi);
-};
-
 struct intel_dsi {
 	struct intel_encoder base;
 
-	struct intel_dsi_device dev;
+	struct drm_panel *panel;
 
 	struct intel_connector *attached_connector;
 
@@ -130,6 +107,6 @@ extern void vlv_enable_dsi_pll(struct intel_encoder *encoder);
 extern void vlv_disable_dsi_pll(struct intel_encoder *encoder);
 extern u32 vlv_get_dsi_pclk(struct intel_encoder *encoder, int pipe_bpp);
 
-extern struct intel_dsi_dev_ops vbt_generic_dsi_display_ops;
+struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id);
 
 #endif /* _INTEL_DSI_H */
diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
index 561ec2981dfd..ac7a24dcf7f7 100644
--- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
+++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
@@ -28,6 +28,7 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_edid.h>
 #include <drm/i915_drm.h>
+#include <drm/drm_panel.h>
 #include <linux/slab.h>
 #include <video/mipi_display.h>
 #include <asm/intel-mid.h>
@@ -37,6 +38,16 @@
 #include "intel_dsi.h"
 #include "intel_dsi_cmd.h"
 
+struct vbt_panel {
+	struct drm_panel panel;
+	struct intel_dsi *intel_dsi;
+};
+
+static inline struct vbt_panel *to_vbt_panel(struct drm_panel *panel)
+{
+	return container_of(panel, struct vbt_panel, panel);
+}
+
 #define MIPI_TRANSFER_MODE_SHIFT	0
 #define MIPI_VIRTUAL_CHANNEL_SHIFT	1
 #define MIPI_PORT_SHIFT			3
@@ -272,14 +283,103 @@ static void generic_exec_sequence(struct intel_dsi *intel_dsi, const u8 *data)
 	}
 }
 
-static bool generic_init(struct intel_dsi_device *dsi)
+static int vbt_panel_prepare(struct drm_panel *panel)
+{
+	struct vbt_panel *vbt_panel = to_vbt_panel(panel);
+	struct intel_dsi *intel_dsi = vbt_panel->intel_dsi;
+	struct drm_device *dev = intel_dsi->base.base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	const u8 *sequence;
+
+	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_ASSERT_RESET];
+	generic_exec_sequence(intel_dsi, sequence);
+
+	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP];
+	generic_exec_sequence(intel_dsi, sequence);
+
+	return 0;
+}
+
+static int vbt_panel_unprepare(struct drm_panel *panel)
+{
+	struct vbt_panel *vbt_panel = to_vbt_panel(panel);
+	struct intel_dsi *intel_dsi = vbt_panel->intel_dsi;
+	struct drm_device *dev = intel_dsi->base.base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	const u8 *sequence;
+
+	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET];
+	generic_exec_sequence(intel_dsi, sequence);
+
+	return 0;
+}
+
+static int vbt_panel_enable(struct drm_panel *panel)
+{
+	struct vbt_panel *vbt_panel = to_vbt_panel(panel);
+	struct intel_dsi *intel_dsi = vbt_panel->intel_dsi;
+	struct drm_device *dev = intel_dsi->base.base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	const u8 *sequence;
+
+	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DISPLAY_ON];
+	generic_exec_sequence(intel_dsi, sequence);
+
+	return 0;
+}
+
+static int vbt_panel_disable(struct drm_panel *panel)
+{
+	struct vbt_panel *vbt_panel = to_vbt_panel(panel);
+	struct intel_dsi *intel_dsi = vbt_panel->intel_dsi;
+	struct drm_device *dev = intel_dsi->base.base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	const u8 *sequence;
+
+	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DISPLAY_OFF];
+	generic_exec_sequence(intel_dsi, sequence);
+
+	return 0;
+}
+
+static int vbt_panel_get_modes(struct drm_panel *panel)
+{
+	struct vbt_panel *vbt_panel = to_vbt_panel(panel);
+	struct intel_dsi *intel_dsi = vbt_panel->intel_dsi;
+	struct drm_device *dev = intel_dsi->base.base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_display_mode *mode;
+
+	if (!panel->connector)
+		return 0;
+
+	mode = drm_mode_duplicate(dev, dev_priv->vbt.lfp_lvds_vbt_mode);
+	if (!mode)
+		return 0;
+
+	mode->type |= DRM_MODE_TYPE_PREFERRED;
+
+	drm_mode_probed_add(panel->connector, mode);
+
+	return 1;
+}
+
+static const struct drm_panel_funcs vbt_panel_funcs = {
+	.disable = vbt_panel_disable,
+	.unprepare = vbt_panel_unprepare,
+	.prepare = vbt_panel_prepare,
+	.enable = vbt_panel_enable,
+	.get_modes = vbt_panel_get_modes,
+};
+
+struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
 {
-	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
 	struct drm_device *dev = intel_dsi->base.base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct mipi_config *mipi_config = dev_priv->vbt.dsi.config;
 	struct mipi_pps_data *pps = dev_priv->vbt.dsi.pps;
 	struct drm_display_mode *mode = dev_priv->vbt.lfp_lvds_vbt_mode;
+	struct vbt_panel *vbt_panel;
 	u32 bits_per_pixel = 24;
 	u32 tlpx_ns, extra_byte_count, bitrate, tlpx_ui;
 	u32 ui_num, ui_den;
@@ -346,7 +446,7 @@ static bool generic_init(struct intel_dsi_device *dsi)
 			if (mipi_config->target_burst_mode_freq <
 								computed_ddr) {
 				DRM_ERROR("Burst mode freq is less than computed\n");
-				return false;
+				return NULL;
 			}
 
 			burst_mode_ratio = DIV_ROUND_UP(
@@ -356,7 +456,7 @@ static bool generic_init(struct intel_dsi_device *dsi)
 			pclk = DIV_ROUND_UP(pclk * burst_mode_ratio, 100);
 		} else {
 			DRM_ERROR("Burst mode target is not set\n");
-			return false;
+			return NULL;
 		}
 	} else
 		burst_mode_ratio = 100;
@@ -557,71 +657,13 @@ static bool generic_init(struct intel_dsi_device *dsi)
 	intel_dsi->panel_off_delay = pps->panel_off_delay / 10;
 	intel_dsi->panel_pwr_cycle_delay = pps->panel_power_cycle_delay / 10;
 
-	return true;
-}
-
-static void generic_panel_reset(struct intel_dsi_device *dsi)
-{
-	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
-	struct drm_device *dev = intel_dsi->base.base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-
-	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_ASSERT_RESET];
-
-	generic_exec_sequence(intel_dsi, sequence);
-
-	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP];
-	generic_exec_sequence(intel_dsi, sequence);
-}
-
-static void generic_disable_panel_power(struct intel_dsi_device *dsi)
-{
-	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
-	struct drm_device *dev = intel_dsi->base.base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-
-	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET];
-
-	generic_exec_sequence(intel_dsi, sequence);
-}
-
-static void generic_enable(struct intel_dsi_device *dsi)
-{
-	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
-	struct drm_device *dev = intel_dsi->base.base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	/* This is cheating a bit with the cleanup. */
+	vbt_panel = devm_kzalloc(dev->dev, sizeof(*vbt_panel), GFP_KERNEL);
 
-	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DISPLAY_ON];
+	vbt_panel->intel_dsi = intel_dsi;
+	drm_panel_init(&vbt_panel->panel);
+	vbt_panel->panel.funcs = &vbt_panel_funcs;
+	drm_panel_add(&vbt_panel->panel);
 
-	generic_exec_sequence(intel_dsi, sequence);
+	return &vbt_panel->panel;
 }
-
-static void generic_disable(struct intel_dsi_device *dsi)
-{
-	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
-	struct drm_device *dev = intel_dsi->base.base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-
-	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DISPLAY_OFF];
-
-	generic_exec_sequence(intel_dsi, sequence);
-}
-
-static struct drm_display_mode *generic_get_modes(struct intel_dsi_device *dsi)
-{
-	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
-	struct drm_device *dev = intel_dsi->base.base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-
-	dev_priv->vbt.lfp_lvds_vbt_mode->type |= DRM_MODE_TYPE_PREFERRED;
-	return dev_priv->vbt.lfp_lvds_vbt_mode;
-}
-
-struct intel_dsi_dev_ops vbt_generic_dsi_display_ops = {
-	.init = generic_init,
-	.panel_reset = generic_panel_reset,
-	.disable_panel_power = generic_disable_panel_power,
-	.enable = generic_enable,
-	.disable = generic_disable,
-	.get_modes = generic_get_modes,
-};
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 05/12] drm/i915/dsi: remove unnecessary dsi device callbacks
  2015-01-23  9:44       ` Shobhit Kumar
@ 2015-01-23 15:22         ` Daniel Vetter
  2015-01-27  8:41           ` Shobhit Kumar
  0 siblings, 1 reply; 45+ messages in thread
From: Daniel Vetter @ 2015-01-23 15:22 UTC (permalink / raw)
  To: Shobhit Kumar; +Cc: Jani Nikula, Shobhit Kumar, intel-gfx, Thierry Reding

On Fri, Jan 23, 2015 at 03:14:41PM +0530, Shobhit Kumar wrote:
> On 01/22/2015 06:53 PM, Jani Nikula wrote:
> >On Thu, 22 Jan 2015, Shobhit Kumar <shobhit.kumar@linux.intel.com> wrote:
> >>There had been a instance where we had to drive different resolution
> >>(lower) than the native one. Also in VBT there is a field to make this
> >>generic at least from driver perspective to give the needed target
> >>resolution. In case target resolution is same as native, nothing gets
> >>changed, else mode_fixup function adjusts the mode accordingly keeping
> >>timing as same and enabling scalar. Might not be useful in general, but
> >>did find a use internally.
> >
> >Can we just have the driver return the desired mode from .get_modes in
> >that case?
> 
> Okay, I think I did not explain correctly. Get modes is modified to give the
> needed target mode only so that userspace creates buffer of the needed
> resolution, but in fixup which is called at modeset, we correct the
> adjusted_mode back to have native resolutions so that modeset is correctly
> done. if we do not do like this, during modeset resolutions will be wrong as
> per the timings.

I'm confused. Can you please give an example in real numbers about the
different resolution and how it's all fixed up in hw?

E.g. 800x600 framebuffer -> pfit -> 1024x756 panel,

get_modes gives 800x600, adjusted mode corrects to 1024x756. And please
mention what vbt has to do in all this too.

I think I need an example since I can't figure out what exactly your
describing ...

Thanks, Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 07/12] drm/i915/dsi: switch to drm_panel interface
  2015-01-23 10:57   ` Shobhit Kumar
@ 2015-01-23 15:31     ` Daniel Vetter
  2015-01-27  8:52       ` Shobhit Kumar
  0 siblings, 1 reply; 45+ messages in thread
From: Daniel Vetter @ 2015-01-23 15:31 UTC (permalink / raw)
  To: Shobhit Kumar; +Cc: Jani Nikula, Shobhit Kumar, intel-gfx, Thierry Reding

On Fri, Jan 23, 2015 at 04:27:46PM +0530, Shobhit Kumar wrote:
> On 01/16/2015 05:57 PM, Jani Nikula wrote:
> >@@ -881,13 +889,23 @@ void intel_dsi_init(struct drm_device *dev)
> >
> >  	drm_connector_register(connector);
> >
> >-	fixed_mode = dsi->dev_ops->get_modes(&intel_dsi->dev);
> >+	drm_panel_attach(intel_dsi->panel, connector);
> >+	drm_panel_get_modes(intel_dsi->panel);
> 
> Should be inside the config mutex_lock below.

Why?

> >+
> >+	mutex_lock(&dev->mode_config.mutex);
> >+	list_for_each_entry(scan, &connector->probed_modes, head) {
> >+		if ((scan->type & DRM_MODE_TYPE_PREFERRED)) {
> >+			fixed_mode = drm_mode_duplicate(dev, scan);
> >+			break;
> >+		}
> >+	}
> >+	mutex_unlock(&dev->mode_config.mutex);

Generally this is single-threaded init code, no one else can touch it.
Which means you also never ever need locks. We tend to occasionally
sprinkle them around to satisfy general locking checks which are correct
at runtime. But at least in tricky cases that means we also stick a
comment next to them (see e.g. the various places in i915_irq.c).

Merged up to the previous patch, thanks a lot.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 05/12] drm/i915/dsi: remove unnecessary dsi device callbacks
  2015-01-23 15:22         ` Daniel Vetter
@ 2015-01-27  8:41           ` Shobhit Kumar
  2015-01-27 13:09             ` Daniel Vetter
  0 siblings, 1 reply; 45+ messages in thread
From: Shobhit Kumar @ 2015-01-27  8:41 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Jani Nikula, Shobhit Kumar, intel-gfx, Thierry Reding

On 01/23/2015 08:52 PM, Daniel Vetter wrote:
> On Fri, Jan 23, 2015 at 03:14:41PM +0530, Shobhit Kumar wrote:
>> On 01/22/2015 06:53 PM, Jani Nikula wrote:
>>> On Thu, 22 Jan 2015, Shobhit Kumar <shobhit.kumar@linux.intel.com> wrote:
>>>> There had been a instance where we had to drive different resolution
>>>> (lower) than the native one. Also in VBT there is a field to make this
>>>> generic at least from driver perspective to give the needed target
>>>> resolution. In case target resolution is same as native, nothing gets
>>>> changed, else mode_fixup function adjusts the mode accordingly keeping
>>>> timing as same and enabling scalar. Might not be useful in general, but
>>>> did find a use internally.
>>>
>>> Can we just have the driver return the desired mode from .get_modes in
>>> that case?
>>
>> Okay, I think I did not explain correctly. Get modes is modified to give the
>> needed target mode only so that userspace creates buffer of the needed
>> resolution, but in fixup which is called at modeset, we correct the
>> adjusted_mode back to have native resolutions so that modeset is correctly
>> done. if we do not do like this, during modeset resolutions will be wrong as
>> per the timings.
>
> I'm confused. Can you please give an example in real numbers about the
> different resolution and how it's all fixed up in hw?
>
> E.g. 800x600 framebuffer -> pfit -> 1024x756 panel,
>
> get_modes gives 800x600, adjusted mode corrects to 1024x756. And please

We had a 19x12 DSI panel which we needed to drive at 12x8 due to lack of 
12x8 panels for testing purposes. So get_modes returned 12x8 so that 
user space gave 12x8 FBs, and internally in mode_fixup we adjusted 
correctly for the 19x12 panel timings and enabled pfit

> mention what vbt has to do in all this too.

VBT allows to avoid panel specific and build specific hard coding in the 
code, which should work as is for normal 19x12 usage as well. Block #42 
panel xres and yres are used to indicate this lower needed resolution 
when different from panel_fixed_mode.

Regards
Shobhit

>
> I think I need an example since I can't figure out what exactly your
> describing ...
>
> Thanks, Daniel
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 07/12] drm/i915/dsi: switch to drm_panel interface
  2015-01-23 15:31     ` Daniel Vetter
@ 2015-01-27  8:52       ` Shobhit Kumar
  0 siblings, 0 replies; 45+ messages in thread
From: Shobhit Kumar @ 2015-01-27  8:52 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Jani Nikula, Shobhit Kumar, intel-gfx, Thierry Reding

On 01/23/2015 09:01 PM, Daniel Vetter wrote:
> On Fri, Jan 23, 2015 at 04:27:46PM +0530, Shobhit Kumar wrote:
>> On 01/16/2015 05:57 PM, Jani Nikula wrote:
>>> @@ -881,13 +889,23 @@ void intel_dsi_init(struct drm_device *dev)
>>>
>>>   	drm_connector_register(connector);
>>>
>>> -	fixed_mode = dsi->dev_ops->get_modes(&intel_dsi->dev);
>>> +	drm_panel_attach(intel_dsi->panel, connector);
>>> +	drm_panel_get_modes(intel_dsi->panel);
>>
>> Should be inside the config mutex_lock below.
>
> Why?

Because usually the drm_mode_probed_add gets called in the drm flow with 
correct locking, but in this case calling get_modes here results in 
drm_mode_probed_add being called which expects the lock to be taken. 
Else we will see a big WARN dump. I agree with your comment below but 
this was mainly to avoid the warning dump.

>
>>> +
>>> +	mutex_lock(&dev->mode_config.mutex);
>>> +	list_for_each_entry(scan, &connector->probed_modes, head) {
>>> +		if ((scan->type & DRM_MODE_TYPE_PREFERRED)) {
>>> +			fixed_mode = drm_mode_duplicate(dev, scan);
>>> +			break;
>>> +		}
>>> +	}
>>> +	mutex_unlock(&dev->mode_config.mutex);
>
> Generally this is single-threaded init code, no one else can touch it.
> Which means you also never ever need locks. We tend to occasionally
> sprinkle them around to satisfy general locking checks which are correct
> at runtime. But at least in tricky cases that means we also stick a
> comment next to them (see e.g. the various places in i915_irq.c).
>
> Merged up to the previous patch, thanks a lot.
> -Daniel
>

Regards
Shobhit
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 05/12] drm/i915/dsi: remove unnecessary dsi device callbacks
  2015-01-27  8:41           ` Shobhit Kumar
@ 2015-01-27 13:09             ` Daniel Vetter
  2015-01-27 13:13               ` Chris Wilson
  0 siblings, 1 reply; 45+ messages in thread
From: Daniel Vetter @ 2015-01-27 13:09 UTC (permalink / raw)
  To: Shobhit Kumar; +Cc: Jani Nikula, Shobhit Kumar, intel-gfx, Thierry Reding

On Tue, Jan 27, 2015 at 02:11:18PM +0530, Shobhit Kumar wrote:
> On 01/23/2015 08:52 PM, Daniel Vetter wrote:
> >On Fri, Jan 23, 2015 at 03:14:41PM +0530, Shobhit Kumar wrote:
> >>On 01/22/2015 06:53 PM, Jani Nikula wrote:
> >>>On Thu, 22 Jan 2015, Shobhit Kumar <shobhit.kumar@linux.intel.com> wrote:
> >>>>There had been a instance where we had to drive different resolution
> >>>>(lower) than the native one. Also in VBT there is a field to make this
> >>>>generic at least from driver perspective to give the needed target
> >>>>resolution. In case target resolution is same as native, nothing gets
> >>>>changed, else mode_fixup function adjusts the mode accordingly keeping
> >>>>timing as same and enabling scalar. Might not be useful in general, but
> >>>>did find a use internally.
> >>>
> >>>Can we just have the driver return the desired mode from .get_modes in
> >>>that case?
> >>
> >>Okay, I think I did not explain correctly. Get modes is modified to give the
> >>needed target mode only so that userspace creates buffer of the needed
> >>resolution, but in fixup which is called at modeset, we correct the
> >>adjusted_mode back to have native resolutions so that modeset is correctly
> >>done. if we do not do like this, during modeset resolutions will be wrong as
> >>per the timings.
> >
> >I'm confused. Can you please give an example in real numbers about the
> >different resolution and how it's all fixed up in hw?
> >
> >E.g. 800x600 framebuffer -> pfit -> 1024x756 panel,
> >
> >get_modes gives 800x600, adjusted mode corrects to 1024x756. And please
> 
> We had a 19x12 DSI panel which we needed to drive at 12x8 due to lack of
> 12x8 panels for testing purposes. So get_modes returned 12x8 so that user
> space gave 12x8 FBs, and internally in mode_fixup we adjusted correctly for
> the 19x12 panel timings and enabled pfit

Hm, is that a real use-case shipping to customers or just a hack for
development? In the later case I think we can just hardcode the edid for
edp ...
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 05/12] drm/i915/dsi: remove unnecessary dsi device callbacks
  2015-01-27 13:09             ` Daniel Vetter
@ 2015-01-27 13:13               ` Chris Wilson
  2015-01-28  5:08                 ` Shobhit Kumar
  0 siblings, 1 reply; 45+ messages in thread
From: Chris Wilson @ 2015-01-27 13:13 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Jani Nikula, Shobhit Kumar, intel-gfx, Thierry Reding

On Tue, Jan 27, 2015 at 02:09:21PM +0100, Daniel Vetter wrote:
> On Tue, Jan 27, 2015 at 02:11:18PM +0530, Shobhit Kumar wrote:
> > On 01/23/2015 08:52 PM, Daniel Vetter wrote:
> > >On Fri, Jan 23, 2015 at 03:14:41PM +0530, Shobhit Kumar wrote:
> > >>On 01/22/2015 06:53 PM, Jani Nikula wrote:
> > >>>On Thu, 22 Jan 2015, Shobhit Kumar <shobhit.kumar@linux.intel.com> wrote:
> > >>>>There had been a instance where we had to drive different resolution
> > >>>>(lower) than the native one. Also in VBT there is a field to make this
> > >>>>generic at least from driver perspective to give the needed target
> > >>>>resolution. In case target resolution is same as native, nothing gets
> > >>>>changed, else mode_fixup function adjusts the mode accordingly keeping
> > >>>>timing as same and enabling scalar. Might not be useful in general, but
> > >>>>did find a use internally.
> > >>>
> > >>>Can we just have the driver return the desired mode from .get_modes in
> > >>>that case?
> > >>
> > >>Okay, I think I did not explain correctly. Get modes is modified to give the
> > >>needed target mode only so that userspace creates buffer of the needed
> > >>resolution, but in fixup which is called at modeset, we correct the
> > >>adjusted_mode back to have native resolutions so that modeset is correctly
> > >>done. if we do not do like this, during modeset resolutions will be wrong as
> > >>per the timings.
> > >
> > >I'm confused. Can you please give an example in real numbers about the
> > >different resolution and how it's all fixed up in hw?
> > >
> > >E.g. 800x600 framebuffer -> pfit -> 1024x756 panel,
> > >
> > >get_modes gives 800x600, adjusted mode corrects to 1024x756. And please
> > 
> > We had a 19x12 DSI panel which we needed to drive at 12x8 due to lack of
> > 12x8 panels for testing purposes. So get_modes returned 12x8 so that user
> > space gave 12x8 FBs, and internally in mode_fixup we adjusted correctly for
> > the 19x12 panel timings and enabled pfit
> 
> Hm, is that a real use-case shipping to customers or just a hack for
> development? In the later case I think we can just hardcode the edid for
> edp ...

Also how is this different from userspace creating a 800x600 mode and
giving it to the kernel which then uses the pfitter to display it at
native resolution. That is how it works today. This should also be
possible with a video= parameter...
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 05/12] drm/i915/dsi: remove unnecessary dsi device callbacks
  2015-01-27 13:13               ` Chris Wilson
@ 2015-01-28  5:08                 ` Shobhit Kumar
  2015-01-28  9:17                   ` Daniel Vetter
  0 siblings, 1 reply; 45+ messages in thread
From: Shobhit Kumar @ 2015-01-28  5:08 UTC (permalink / raw)
  To: Chris Wilson, Daniel Vetter, Jani Nikula, Shobhit Kumar,
	intel-gfx, Thierry Reding

On 01/27/2015 06:43 PM, Chris Wilson wrote:
> On Tue, Jan 27, 2015 at 02:09:21PM +0100, Daniel Vetter wrote:
>> On Tue, Jan 27, 2015 at 02:11:18PM +0530, Shobhit Kumar wrote:
>>> On 01/23/2015 08:52 PM, Daniel Vetter wrote:
>>>> On Fri, Jan 23, 2015 at 03:14:41PM +0530, Shobhit Kumar wrote:
>>>>> On 01/22/2015 06:53 PM, Jani Nikula wrote:
>>>>>> On Thu, 22 Jan 2015, Shobhit Kumar <shobhit.kumar@linux.intel.com> wrote:
>>>>>>> There had been a instance where we had to drive different resolution
>>>>>>> (lower) than the native one. Also in VBT there is a field to make this
>>>>>>> generic at least from driver perspective to give the needed target
>>>>>>> resolution. In case target resolution is same as native, nothing gets
>>>>>>> changed, else mode_fixup function adjusts the mode accordingly keeping
>>>>>>> timing as same and enabling scalar. Might not be useful in general, but
>>>>>>> did find a use internally.
>>>>>>
>>>>>> Can we just have the driver return the desired mode from .get_modes in
>>>>>> that case?
>>>>>
>>>>> Okay, I think I did not explain correctly. Get modes is modified to give the
>>>>> needed target mode only so that userspace creates buffer of the needed
>>>>> resolution, but in fixup which is called at modeset, we correct the
>>>>> adjusted_mode back to have native resolutions so that modeset is correctly
>>>>> done. if we do not do like this, during modeset resolutions will be wrong as
>>>>> per the timings.
>>>>
>>>> I'm confused. Can you please give an example in real numbers about the
>>>> different resolution and how it's all fixed up in hw?
>>>>
>>>> E.g. 800x600 framebuffer -> pfit -> 1024x756 panel,
>>>>
>>>> get_modes gives 800x600, adjusted mode corrects to 1024x756. And please
>>>
>>> We had a 19x12 DSI panel which we needed to drive at 12x8 due to lack of
>>> 12x8 panels for testing purposes. So get_modes returned 12x8 so that user
>>> space gave 12x8 FBs, and internally in mode_fixup we adjusted correctly for
>>> the 19x12 panel timings and enabled pfit
>>
>> Hm, is that a real use-case shipping to customers or just a hack for
>> development? In the later case I think we can just hardcode the edid for
>> edp ...
>
> Also how is this different from userspace creating a 800x600 mode and
> giving it to the kernel which then uses the pfitter to display it at
> native resolution. That is how it works today. This should also be
> possible with a video= parameter...

Its different in a way, that user space changes will need a new system 
build which is not allowed as per the requirements that we had and hence 
no hard coding in code anywhere as well.

As I said earlier also that this case might not be useful in general and 
I am okay to remove this callback.

Regards
Shobhit
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 05/12] drm/i915/dsi: remove unnecessary dsi device callbacks
  2015-01-28  5:08                 ` Shobhit Kumar
@ 2015-01-28  9:17                   ` Daniel Vetter
  0 siblings, 0 replies; 45+ messages in thread
From: Daniel Vetter @ 2015-01-28  9:17 UTC (permalink / raw)
  To: Shobhit Kumar; +Cc: Jani Nikula, Shobhit Kumar, intel-gfx, Thierry Reding

On Wed, Jan 28, 2015 at 10:38:45AM +0530, Shobhit Kumar wrote:
> On 01/27/2015 06:43 PM, Chris Wilson wrote:
> >On Tue, Jan 27, 2015 at 02:09:21PM +0100, Daniel Vetter wrote:
> >>On Tue, Jan 27, 2015 at 02:11:18PM +0530, Shobhit Kumar wrote:
> >>>On 01/23/2015 08:52 PM, Daniel Vetter wrote:
> >>>>On Fri, Jan 23, 2015 at 03:14:41PM +0530, Shobhit Kumar wrote:
> >>>>>On 01/22/2015 06:53 PM, Jani Nikula wrote:
> >>>>>>On Thu, 22 Jan 2015, Shobhit Kumar <shobhit.kumar@linux.intel.com> wrote:
> >>>>>>>There had been a instance where we had to drive different resolution
> >>>>>>>(lower) than the native one. Also in VBT there is a field to make this
> >>>>>>>generic at least from driver perspective to give the needed target
> >>>>>>>resolution. In case target resolution is same as native, nothing gets
> >>>>>>>changed, else mode_fixup function adjusts the mode accordingly keeping
> >>>>>>>timing as same and enabling scalar. Might not be useful in general, but
> >>>>>>>did find a use internally.
> >>>>>>
> >>>>>>Can we just have the driver return the desired mode from .get_modes in
> >>>>>>that case?
> >>>>>
> >>>>>Okay, I think I did not explain correctly. Get modes is modified to give the
> >>>>>needed target mode only so that userspace creates buffer of the needed
> >>>>>resolution, but in fixup which is called at modeset, we correct the
> >>>>>adjusted_mode back to have native resolutions so that modeset is correctly
> >>>>>done. if we do not do like this, during modeset resolutions will be wrong as
> >>>>>per the timings.
> >>>>
> >>>>I'm confused. Can you please give an example in real numbers about the
> >>>>different resolution and how it's all fixed up in hw?
> >>>>
> >>>>E.g. 800x600 framebuffer -> pfit -> 1024x756 panel,
> >>>>
> >>>>get_modes gives 800x600, adjusted mode corrects to 1024x756. And please
> >>>
> >>>We had a 19x12 DSI panel which we needed to drive at 12x8 due to lack of
> >>>12x8 panels for testing purposes. So get_modes returned 12x8 so that user
> >>>space gave 12x8 FBs, and internally in mode_fixup we adjusted correctly for
> >>>the 19x12 panel timings and enabled pfit
> >>
> >>Hm, is that a real use-case shipping to customers or just a hack for
> >>development? In the later case I think we can just hardcode the edid for
> >>edp ...
> >
> >Also how is this different from userspace creating a 800x600 mode and
> >giving it to the kernel which then uses the pfitter to display it at
> >native resolution. That is how it works today. This should also be
> >possible with a video= parameter...
> 
> Its different in a way, that user space changes will need a new system build
> which is not allowed as per the requirements that we had and hence no hard
> coding in code anywhere as well.
> 
> As I said earlier also that this case might not be useful in general and I
> am okay to remove this callback.

Yeah I think if rebuilding vbt for testing is ok, but rebuilding the
kernel isn't then that just smells like needless red tape. I'll reconsider
as soon as we need this for shipping systems of course.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v2] drm/i915/dsi: switch to drm_panel interface
  2015-01-23 13:30   ` [PATCH v2] " Jani Nikula
@ 2015-01-29  4:52     ` Shobhit Kumar
  0 siblings, 0 replies; 45+ messages in thread
From: Shobhit Kumar @ 2015-01-29  4:52 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx; +Cc: Shobhit Kumar, Thierry Reding

On 01/23/2015 07:00 PM, Jani Nikula wrote:
> Replace intel_dsi_device and intel_dsi_dev_ops with drm_panel and
> drm_panel_funcs. They are adequate for what we have now, and if we end
> up needing more than this we should improve drm_panel. This will keep us
> better aligned with the drm core infrastructure.
>
> The panel driver initialization changes a bit. It still remains hideous,
> but fixing that is beyond the scope here.
>
> v2: extend mode config mutex to cover drm_panel_get_modes (Shobhit)
>      vbt_panel->intel_dsi = intel_dsi in vbt panel init (Shobhit)
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-By: Shobhit Kumar <shobhit.kumar@intel.com>

> ---
>   drivers/gpu/drm/i915/Kconfig               |   1 +
>   drivers/gpu/drm/i915/intel_dsi.c           |  68 +++++++----
>   drivers/gpu/drm/i915/intel_dsi.h           |  27 +----
>   drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 180 ++++++++++++++++++-----------
>   4 files changed, 157 insertions(+), 119 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig
> index 4e39ab34eb1c..da196cd07263 100644
> --- a/drivers/gpu/drm/i915/Kconfig
> +++ b/drivers/gpu/drm/i915/Kconfig
> @@ -11,6 +11,7 @@ config DRM_I915
>   	select SHMEM
>   	select TMPFS
>   	select DRM_KMS_HELPER
> +	select DRM_PANEL
>   	# i915 depends on ACPI_VIDEO when ACPI is enabled
>   	# but for select to work, need to select ACPI_VIDEO's dependencies, ick
>   	select BACKLIGHT_LCD_SUPPORT if ACPI
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index c56c4150fc13..52c5fabe284a 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -27,18 +27,20 @@
>   #include <drm/drm_crtc.h>
>   #include <drm/drm_edid.h>
>   #include <drm/i915_drm.h>
> +#include <drm/drm_panel.h>
>   #include <linux/slab.h>
>   #include "i915_drv.h"
>   #include "intel_drv.h"
>   #include "intel_dsi.h"
>   #include "intel_dsi_cmd.h"
>
> -/* the sub-encoders aka panel drivers */
> -static const struct intel_dsi_device intel_dsi_devices[] = {
> +static const struct {
> +	u16 panel_id;
> +	struct drm_panel * (*init)(struct intel_dsi *intel_dsi, u16 panel_id);
> +} intel_dsi_drivers[] = {
>   	{
>   		.panel_id = MIPI_DSI_GENERIC_PANEL_ID,
> -		.name = "vbt-generic-dsi-vid-mode-display",
> -		.dev_ops = &vbt_generic_dsi_display_ops,
> +		.init = vbt_panel_init,
>   	},
>   };
>
> @@ -214,8 +216,7 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
>   			dpi_send_cmd(intel_dsi, TURN_ON, DPI_LP_MODE_EN, port);
>   		msleep(100);
>
> -		if (intel_dsi->dev.dev_ops->enable)
> -			intel_dsi->dev.dev_ops->enable(&intel_dsi->dev);
> +		drm_panel_enable(intel_dsi->panel);
>
>   		for_each_dsi_port(port, intel_dsi->ports)
>   			wait_for_dsi_fifo_empty(intel_dsi, port);
> @@ -255,8 +256,7 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)
>
>   	msleep(intel_dsi->panel_on_delay);
>
> -	if (intel_dsi->dev.dev_ops->panel_reset)
> -		intel_dsi->dev.dev_ops->panel_reset(&intel_dsi->dev);
> +	drm_panel_prepare(intel_dsi->panel);
>
>   	for_each_dsi_port(port, intel_dsi->ports)
>   		wait_for_dsi_fifo_empty(intel_dsi, port);
> @@ -329,8 +329,7 @@ static void intel_dsi_disable(struct intel_encoder *encoder)
>   	}
>   	/* if disable packets are sent before sending shutdown packet then in
>   	 * some next enable sequence send turn on packet error is observed */
> -	if (intel_dsi->dev.dev_ops->disable)
> -		intel_dsi->dev.dev_ops->disable(&intel_dsi->dev);
> +	drm_panel_disable(intel_dsi->panel);
>
>   	for_each_dsi_port(port, intel_dsi->ports)
>   		wait_for_dsi_fifo_empty(intel_dsi, port);
> @@ -395,8 +394,7 @@ static void intel_dsi_post_disable(struct intel_encoder *encoder)
>   	val &= ~DPOUNIT_CLOCK_GATE_DISABLE;
>   	I915_WRITE(DSPCLK_GATE_D, val);
>
> -	if (intel_dsi->dev.dev_ops->disable_panel_power)
> -		intel_dsi->dev.dev_ops->disable_panel_power(&intel_dsi->dev);
> +	drm_panel_unprepare(intel_dsi->panel);
>
>   	msleep(intel_dsi->panel_off_delay);
>   	msleep(intel_dsi->panel_pwr_cycle_delay);
> @@ -760,7 +758,7 @@ static int intel_dsi_get_modes(struct drm_connector *connector)
>   	return 1;
>   }
>
> -static void intel_dsi_destroy(struct drm_connector *connector)
> +static void intel_dsi_connector_destroy(struct drm_connector *connector)
>   {
>   	struct intel_connector *intel_connector = to_intel_connector(connector);
>
> @@ -770,8 +768,20 @@ static void intel_dsi_destroy(struct drm_connector *connector)
>   	kfree(connector);
>   }
>
> +static void intel_dsi_encoder_destroy(struct drm_encoder *encoder)
> +{
> +	struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
> +
> +	if (intel_dsi->panel) {
> +		drm_panel_detach(intel_dsi->panel);
> +		/* XXX: Logically this call belongs in the panel driver. */
> +		drm_panel_remove(intel_dsi->panel);
> +	}
> +	intel_encoder_destroy(encoder);
> +}
> +
>   static const struct drm_encoder_funcs intel_dsi_funcs = {
> -	.destroy = intel_encoder_destroy,
> +	.destroy = intel_dsi_encoder_destroy,
>   };
>
>   static const struct drm_connector_helper_funcs intel_dsi_connector_helper_funcs = {
> @@ -783,7 +793,7 @@ static const struct drm_connector_helper_funcs intel_dsi_connector_helper_funcs
>   static const struct drm_connector_funcs intel_dsi_connector_funcs = {
>   	.dpms = intel_connector_dpms,
>   	.detect = intel_dsi_detect,
> -	.destroy = intel_dsi_destroy,
> +	.destroy = intel_dsi_connector_destroy,
>   	.fill_modes = drm_helper_probe_single_connector_modes,
>   };
>
> @@ -794,9 +804,8 @@ void intel_dsi_init(struct drm_device *dev)
>   	struct drm_encoder *encoder;
>   	struct intel_connector *intel_connector;
>   	struct drm_connector *connector;
> -	struct drm_display_mode *fixed_mode = NULL;
> +	struct drm_display_mode *scan, *fixed_mode = NULL;
>   	struct drm_i915_private *dev_priv = dev->dev_private;
> -	const struct intel_dsi_device *dsi;
>   	unsigned int i;
>
>   	DRM_DEBUG_KMS("\n");
> @@ -853,15 +862,14 @@ void intel_dsi_init(struct drm_device *dev)
>   		intel_dsi->ports = (1 << PORT_C);
>   	}
>
> -	for (i = 0; i < ARRAY_SIZE(intel_dsi_devices); i++) {
> -		dsi = &intel_dsi_devices[i];
> -		intel_dsi->dev = *dsi;
> -
> -		if (dsi->dev_ops->init(&intel_dsi->dev))
> +	for (i = 0; i < ARRAY_SIZE(intel_dsi_drivers); i++) {
> +		intel_dsi->panel = intel_dsi_drivers[i].init(intel_dsi,
> +							     intel_dsi_drivers[i].panel_id);
> +		if (intel_dsi->panel)
>   			break;
>   	}
>
> -	if (i == ARRAY_SIZE(intel_dsi_devices)) {
> +	if (!intel_dsi->panel) {
>   		DRM_DEBUG_KMS("no device found\n");
>   		goto err;
>   	}
> @@ -881,13 +889,23 @@ void intel_dsi_init(struct drm_device *dev)
>
>   	drm_connector_register(connector);
>
> -	fixed_mode = dsi->dev_ops->get_modes(&intel_dsi->dev);
> +	drm_panel_attach(intel_dsi->panel, connector);
> +
> +	mutex_lock(&dev->mode_config.mutex);
> +	drm_panel_get_modes(intel_dsi->panel);
> +	list_for_each_entry(scan, &connector->probed_modes, head) {
> +		if ((scan->type & DRM_MODE_TYPE_PREFERRED)) {
> +			fixed_mode = drm_mode_duplicate(dev, scan);
> +			break;
> +		}
> +	}
> +	mutex_unlock(&dev->mode_config.mutex);
> +
>   	if (!fixed_mode) {
>   		DRM_DEBUG_KMS("no fixed mode\n");
>   		goto err;
>   	}
>
> -	fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
>   	intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
>
>   	return;
> diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h
> index 22f87036a256..fc0b2b8d90f1 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.h
> +++ b/drivers/gpu/drm/i915/intel_dsi.h
> @@ -33,33 +33,10 @@
>   #define DSI_DUAL_LINK_FRONT_BACK	1
>   #define DSI_DUAL_LINK_PIXEL_ALT		2
>
> -struct intel_dsi_device {
> -	unsigned int panel_id;
> -	const char *name;
> -	const struct intel_dsi_dev_ops *dev_ops;
> -	void *dev_priv;
> -};
> -
> -struct intel_dsi_dev_ops {
> -	bool (*init)(struct intel_dsi_device *dsi);
> -
> -	void (*panel_reset)(struct intel_dsi_device *dsi);
> -
> -	void (*disable_panel_power)(struct intel_dsi_device *dsi);
> -
> -	/* This callback must be able to assume DSI commands can be sent */
> -	void (*enable)(struct intel_dsi_device *dsi);
> -
> -	/* This callback must be able to assume DSI commands can be sent */
> -	void (*disable)(struct intel_dsi_device *dsi);
> -
> -	struct drm_display_mode *(*get_modes)(struct intel_dsi_device *dsi);
> -};
> -
>   struct intel_dsi {
>   	struct intel_encoder base;
>
> -	struct intel_dsi_device dev;
> +	struct drm_panel *panel;
>
>   	struct intel_connector *attached_connector;
>
> @@ -130,6 +107,6 @@ extern void vlv_enable_dsi_pll(struct intel_encoder *encoder);
>   extern void vlv_disable_dsi_pll(struct intel_encoder *encoder);
>   extern u32 vlv_get_dsi_pclk(struct intel_encoder *encoder, int pipe_bpp);
>
> -extern struct intel_dsi_dev_ops vbt_generic_dsi_display_ops;
> +struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id);
>
>   #endif /* _INTEL_DSI_H */
> diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> index 561ec2981dfd..ac7a24dcf7f7 100644
> --- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> +++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> @@ -28,6 +28,7 @@
>   #include <drm/drm_crtc.h>
>   #include <drm/drm_edid.h>
>   #include <drm/i915_drm.h>
> +#include <drm/drm_panel.h>
>   #include <linux/slab.h>
>   #include <video/mipi_display.h>
>   #include <asm/intel-mid.h>
> @@ -37,6 +38,16 @@
>   #include "intel_dsi.h"
>   #include "intel_dsi_cmd.h"
>
> +struct vbt_panel {
> +	struct drm_panel panel;
> +	struct intel_dsi *intel_dsi;
> +};
> +
> +static inline struct vbt_panel *to_vbt_panel(struct drm_panel *panel)
> +{
> +	return container_of(panel, struct vbt_panel, panel);
> +}
> +
>   #define MIPI_TRANSFER_MODE_SHIFT	0
>   #define MIPI_VIRTUAL_CHANNEL_SHIFT	1
>   #define MIPI_PORT_SHIFT			3
> @@ -272,14 +283,103 @@ static void generic_exec_sequence(struct intel_dsi *intel_dsi, const u8 *data)
>   	}
>   }
>
> -static bool generic_init(struct intel_dsi_device *dsi)
> +static int vbt_panel_prepare(struct drm_panel *panel)
> +{
> +	struct vbt_panel *vbt_panel = to_vbt_panel(panel);
> +	struct intel_dsi *intel_dsi = vbt_panel->intel_dsi;
> +	struct drm_device *dev = intel_dsi->base.base.dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	const u8 *sequence;
> +
> +	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_ASSERT_RESET];
> +	generic_exec_sequence(intel_dsi, sequence);
> +
> +	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP];
> +	generic_exec_sequence(intel_dsi, sequence);
> +
> +	return 0;
> +}
> +
> +static int vbt_panel_unprepare(struct drm_panel *panel)
> +{
> +	struct vbt_panel *vbt_panel = to_vbt_panel(panel);
> +	struct intel_dsi *intel_dsi = vbt_panel->intel_dsi;
> +	struct drm_device *dev = intel_dsi->base.base.dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	const u8 *sequence;
> +
> +	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET];
> +	generic_exec_sequence(intel_dsi, sequence);
> +
> +	return 0;
> +}
> +
> +static int vbt_panel_enable(struct drm_panel *panel)
> +{
> +	struct vbt_panel *vbt_panel = to_vbt_panel(panel);
> +	struct intel_dsi *intel_dsi = vbt_panel->intel_dsi;
> +	struct drm_device *dev = intel_dsi->base.base.dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	const u8 *sequence;
> +
> +	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DISPLAY_ON];
> +	generic_exec_sequence(intel_dsi, sequence);
> +
> +	return 0;
> +}
> +
> +static int vbt_panel_disable(struct drm_panel *panel)
> +{
> +	struct vbt_panel *vbt_panel = to_vbt_panel(panel);
> +	struct intel_dsi *intel_dsi = vbt_panel->intel_dsi;
> +	struct drm_device *dev = intel_dsi->base.base.dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	const u8 *sequence;
> +
> +	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DISPLAY_OFF];
> +	generic_exec_sequence(intel_dsi, sequence);
> +
> +	return 0;
> +}
> +
> +static int vbt_panel_get_modes(struct drm_panel *panel)
> +{
> +	struct vbt_panel *vbt_panel = to_vbt_panel(panel);
> +	struct intel_dsi *intel_dsi = vbt_panel->intel_dsi;
> +	struct drm_device *dev = intel_dsi->base.base.dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	struct drm_display_mode *mode;
> +
> +	if (!panel->connector)
> +		return 0;
> +
> +	mode = drm_mode_duplicate(dev, dev_priv->vbt.lfp_lvds_vbt_mode);
> +	if (!mode)
> +		return 0;
> +
> +	mode->type |= DRM_MODE_TYPE_PREFERRED;
> +
> +	drm_mode_probed_add(panel->connector, mode);
> +
> +	return 1;
> +}
> +
> +static const struct drm_panel_funcs vbt_panel_funcs = {
> +	.disable = vbt_panel_disable,
> +	.unprepare = vbt_panel_unprepare,
> +	.prepare = vbt_panel_prepare,
> +	.enable = vbt_panel_enable,
> +	.get_modes = vbt_panel_get_modes,
> +};
> +
> +struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
>   {
> -	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
>   	struct drm_device *dev = intel_dsi->base.base.dev;
>   	struct drm_i915_private *dev_priv = dev->dev_private;
>   	struct mipi_config *mipi_config = dev_priv->vbt.dsi.config;
>   	struct mipi_pps_data *pps = dev_priv->vbt.dsi.pps;
>   	struct drm_display_mode *mode = dev_priv->vbt.lfp_lvds_vbt_mode;
> +	struct vbt_panel *vbt_panel;
>   	u32 bits_per_pixel = 24;
>   	u32 tlpx_ns, extra_byte_count, bitrate, tlpx_ui;
>   	u32 ui_num, ui_den;
> @@ -346,7 +446,7 @@ static bool generic_init(struct intel_dsi_device *dsi)
>   			if (mipi_config->target_burst_mode_freq <
>   								computed_ddr) {
>   				DRM_ERROR("Burst mode freq is less than computed\n");
> -				return false;
> +				return NULL;
>   			}
>
>   			burst_mode_ratio = DIV_ROUND_UP(
> @@ -356,7 +456,7 @@ static bool generic_init(struct intel_dsi_device *dsi)
>   			pclk = DIV_ROUND_UP(pclk * burst_mode_ratio, 100);
>   		} else {
>   			DRM_ERROR("Burst mode target is not set\n");
> -			return false;
> +			return NULL;
>   		}
>   	} else
>   		burst_mode_ratio = 100;
> @@ -557,71 +657,13 @@ static bool generic_init(struct intel_dsi_device *dsi)
>   	intel_dsi->panel_off_delay = pps->panel_off_delay / 10;
>   	intel_dsi->panel_pwr_cycle_delay = pps->panel_power_cycle_delay / 10;
>
> -	return true;
> -}
> -
> -static void generic_panel_reset(struct intel_dsi_device *dsi)
> -{
> -	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
> -	struct drm_device *dev = intel_dsi->base.base.dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -
> -	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_ASSERT_RESET];
> -
> -	generic_exec_sequence(intel_dsi, sequence);
> -
> -	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP];
> -	generic_exec_sequence(intel_dsi, sequence);
> -}
> -
> -static void generic_disable_panel_power(struct intel_dsi_device *dsi)
> -{
> -	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
> -	struct drm_device *dev = intel_dsi->base.base.dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -
> -	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET];
> -
> -	generic_exec_sequence(intel_dsi, sequence);
> -}
> -
> -static void generic_enable(struct intel_dsi_device *dsi)
> -{
> -	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
> -	struct drm_device *dev = intel_dsi->base.base.dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> +	/* This is cheating a bit with the cleanup. */
> +	vbt_panel = devm_kzalloc(dev->dev, sizeof(*vbt_panel), GFP_KERNEL);
>
> -	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DISPLAY_ON];
> +	vbt_panel->intel_dsi = intel_dsi;
> +	drm_panel_init(&vbt_panel->panel);
> +	vbt_panel->panel.funcs = &vbt_panel_funcs;
> +	drm_panel_add(&vbt_panel->panel);
>
> -	generic_exec_sequence(intel_dsi, sequence);
> +	return &vbt_panel->panel;
>   }
> -
> -static void generic_disable(struct intel_dsi_device *dsi)
> -{
> -	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
> -	struct drm_device *dev = intel_dsi->base.base.dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -
> -	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DISPLAY_OFF];
> -
> -	generic_exec_sequence(intel_dsi, sequence);
> -}
> -
> -static struct drm_display_mode *generic_get_modes(struct intel_dsi_device *dsi)
> -{
> -	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
> -	struct drm_device *dev = intel_dsi->base.base.dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> -
> -	dev_priv->vbt.lfp_lvds_vbt_mode->type |= DRM_MODE_TYPE_PREFERRED;
> -	return dev_priv->vbt.lfp_lvds_vbt_mode;
> -}
> -
> -struct intel_dsi_dev_ops vbt_generic_dsi_display_ops = {
> -	.init = generic_init,
> -	.panel_reset = generic_panel_reset,
> -	.disable_panel_power = generic_disable_panel_power,
> -	.enable = generic_enable,
> -	.disable = generic_disable,
> -	.get_modes = generic_get_modes,
> -};
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [RFC PATCH 12/12] drm/i915/dsi: remove intel_dsi_cmd.c and the unused functions therein
  2015-01-23 12:28   ` Shobhit Kumar
@ 2015-01-29 16:04     ` Daniel Vetter
  0 siblings, 0 replies; 45+ messages in thread
From: Daniel Vetter @ 2015-01-29 16:04 UTC (permalink / raw)
  To: Shobhit Kumar; +Cc: Jani Nikula, Shobhit Kumar, intel-gfx, Thierry Reding

On Fri, Jan 23, 2015 at 05:58:43PM +0530, Shobhit Kumar wrote:
> On 01/16/2015 05:57 PM, Jani Nikula wrote:
> >The removed functions can be resurrected in intel_dsi.c as need arises.
> >
> >Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> 
> Reviewed-By: Shobhit Kumar <shobhit.kumar@intel.com>

Ok, merged all the remaining patches.

Thanks, Daniel
> 
> >---
> >  drivers/gpu/drm/i915/Makefile              |   1 -
> >  drivers/gpu/drm/i915/intel_dsi.c           |   1 -
> >  drivers/gpu/drm/i915/intel_dsi_cmd.c       | 117 -----------------------------
> >  drivers/gpu/drm/i915/intel_dsi_panel_vbt.c |   1 -
> >  4 files changed, 120 deletions(-)
> >  delete mode 100644 drivers/gpu/drm/i915/intel_dsi_cmd.c
> >
> >diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> >index 16e3dc350274..63afe63bf0e4 100644
> >--- a/drivers/gpu/drm/i915/Makefile
> >+++ b/drivers/gpu/drm/i915/Makefile
> >@@ -71,7 +71,6 @@ i915-y += dvo_ch7017.o \
> >  	  intel_ddi.o \
> >  	  intel_dp.o \
> >  	  intel_dp_mst.o \
> >-	  intel_dsi_cmd.o \
> >  	  intel_dsi.o \
> >  	  intel_dsi_pll.o \
> >  	  intel_dsi_panel_vbt.o \
> >diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> >index 791d90b4c047..02ae5e583b27 100644
> >--- a/drivers/gpu/drm/i915/intel_dsi.c
> >+++ b/drivers/gpu/drm/i915/intel_dsi.c
> >@@ -33,7 +33,6 @@
> >  #include "i915_drv.h"
> >  #include "intel_drv.h"
> >  #include "intel_dsi.h"
> >-#include "intel_dsi_cmd.h"
> >
> >  static const struct {
> >  	u16 panel_id;
> >diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.c b/drivers/gpu/drm/i915/intel_dsi_cmd.c
> >deleted file mode 100644
> >index acdc5da7b46f..000000000000
> >--- a/drivers/gpu/drm/i915/intel_dsi_cmd.c
> >+++ /dev/null
> >@@ -1,117 +0,0 @@
> >-/*
> >- * 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@intel.com>
> >- */
> >-
> >-#include <linux/export.h>
> >-#include <drm/drmP.h>
> >-#include <drm/drm_crtc.h>
> >-#include <video/mipi_display.h>
> >-#include "i915_drv.h"
> >-#include "intel_drv.h"
> >-#include "intel_dsi.h"
> >-#include "intel_dsi_cmd.h"
> >-
> >-/*
> >- * XXX: MIPI_DATA_ADDRESS, MIPI_DATA_LENGTH, MIPI_COMMAND_LENGTH, and
> >- * MIPI_COMMAND_ADDRESS registers.
> >- *
> >- * Apparently these registers provide a MIPI adapter level way to send (lots of)
> >- * commands and data to the receiver, without having to write the commands and
> >- * data to MIPI_{HS,LP}_GEN_{CTRL,DATA} registers word by word.
> >- *
> >- * Presumably for anything other than MIPI_DCS_WRITE_MEMORY_START and
> >- * MIPI_DCS_WRITE_MEMORY_CONTINUE (which are used to update the external
> >- * framebuffer in command mode displays) these are just an optimization that can
> >- * come later.
> >- *
> >- * For memory writes, these should probably be used for performance.
> >- */
> >-
> >-static void print_stat(struct intel_dsi *intel_dsi, enum port port)
> >-{
> >-	struct drm_encoder *encoder = &intel_dsi->base.base;
> >-	struct drm_device *dev = encoder->dev;
> >-	struct drm_i915_private *dev_priv = dev->dev_private;
> >-	u32 val;
> >-
> >-	val = I915_READ(MIPI_INTR_STAT(port));
> >-
> >-#define STAT_BIT(val, bit) (val) & (bit) ? " " #bit : ""
> >-	DRM_DEBUG_KMS("MIPI_INTR_STAT(%c) = %08x"
> >-		      "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
> >-		      "\n", port_name(port), val,
> >-		      STAT_BIT(val, TEARING_EFFECT),
> >-		      STAT_BIT(val, SPL_PKT_SENT_INTERRUPT),
> >-		      STAT_BIT(val, GEN_READ_DATA_AVAIL),
> >-		      STAT_BIT(val, LP_GENERIC_WR_FIFO_FULL),
> >-		      STAT_BIT(val, HS_GENERIC_WR_FIFO_FULL),
> >-		      STAT_BIT(val, RX_PROT_VIOLATION),
> >-		      STAT_BIT(val, RX_INVALID_TX_LENGTH),
> >-		      STAT_BIT(val, ACK_WITH_NO_ERROR),
> >-		      STAT_BIT(val, TURN_AROUND_ACK_TIMEOUT),
> >-		      STAT_BIT(val, LP_RX_TIMEOUT),
> >-		      STAT_BIT(val, HS_TX_TIMEOUT),
> >-		      STAT_BIT(val, DPI_FIFO_UNDERRUN),
> >-		      STAT_BIT(val, LOW_CONTENTION),
> >-		      STAT_BIT(val, HIGH_CONTENTION),
> >-		      STAT_BIT(val, TXDSI_VC_ID_INVALID),
> >-		      STAT_BIT(val, TXDSI_DATA_TYPE_NOT_RECOGNISED),
> >-		      STAT_BIT(val, TXCHECKSUM_ERROR),
> >-		      STAT_BIT(val, TXECC_MULTIBIT_ERROR),
> >-		      STAT_BIT(val, TXECC_SINGLE_BIT_ERROR),
> >-		      STAT_BIT(val, TXFALSE_CONTROL_ERROR),
> >-		      STAT_BIT(val, RXDSI_VC_ID_INVALID),
> >-		      STAT_BIT(val, RXDSI_DATA_TYPE_NOT_REGOGNISED),
> >-		      STAT_BIT(val, RXCHECKSUM_ERROR),
> >-		      STAT_BIT(val, RXECC_MULTIBIT_ERROR),
> >-		      STAT_BIT(val, RXECC_SINGLE_BIT_ERROR),
> >-		      STAT_BIT(val, RXFALSE_CONTROL_ERROR),
> >-		      STAT_BIT(val, RXHS_RECEIVE_TIMEOUT_ERROR),
> >-		      STAT_BIT(val, RX_LP_TX_SYNC_ERROR),
> >-		      STAT_BIT(val, RXEXCAPE_MODE_ENTRY_ERROR),
> >-		      STAT_BIT(val, RXEOT_SYNC_ERROR),
> >-		      STAT_BIT(val, RXSOT_SYNC_ERROR),
> >-		      STAT_BIT(val, RXSOT_ERROR));
> >-#undef STAT_BIT
> >-}
> >-
> >-/* enable or disable command mode hs transmissions */
> >-void dsi_hs_mode_enable(struct intel_dsi *intel_dsi, bool enable,
> >-						enum port port)
> >-{
> >-	struct drm_encoder *encoder = &intel_dsi->base.base;
> >-	struct drm_device *dev = encoder->dev;
> >-	struct drm_i915_private *dev_priv = dev->dev_private;
> >-	u32 temp;
> >-	u32 mask = DBI_FIFO_EMPTY;
> >-
> >-	if (wait_for((I915_READ(MIPI_GEN_FIFO_STAT(port)) & mask) == mask, 50))
> >-		DRM_ERROR("Timeout waiting for DBI FIFO empty\n");
> >-
> >-	temp = I915_READ(MIPI_HS_LP_DBI_ENABLE(port));
> >-	temp &= DBI_HS_LP_MODE_MASK;
> >-	I915_WRITE(MIPI_HS_LP_DBI_ENABLE(port), enable ? DBI_HS_MODE : DBI_LP_MODE);
> >-
> >-	intel_dsi->hs = enable;
> >-}
> >diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> >index 0b09e66f7e29..c3eec66f5076 100644
> >--- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> >+++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> >@@ -36,7 +36,6 @@
> >  #include "i915_drv.h"
> >  #include "intel_drv.h"
> >  #include "intel_dsi.h"
> >-#include "intel_dsi_cmd.h"
> >
> >  struct vbt_panel {
> >  	struct drm_panel panel;
> >
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2015-01-29 16:03 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-16 12:27 [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks Jani Nikula
2015-01-16 12:27 ` [RFC PATCH 01/12] drm/i915/dsi: call dpi_send_cmd() for each dsi port at a higher level Jani Nikula
2015-01-22  8:48   ` Shobhit Kumar
2015-01-16 12:27 ` [RFC PATCH 02/12] drm/i915/dsi: set max return packet size for each dsi port Jani Nikula
2015-01-22 10:53   ` Shobhit Kumar
2015-01-22 12:57     ` Jani Nikula
2015-01-22 13:01   ` [PATCH v2] " Jani Nikula
2015-01-23  2:07     ` Shobhit Kumar
2015-01-16 12:27 ` [RFC PATCH 03/12] drm/i915/dsi: move wait_for_dsi_fifo_empty to intel_dsi.c Jani Nikula
2015-01-22  9:01   ` Shobhit Kumar
2015-01-16 12:27 ` [RFC PATCH 04/12] drm/i915/dsi: call wait_for_dsi_fifo_empty() for each dsi port Jani Nikula
2015-01-22 10:55   ` Shobhit Kumar
2015-01-16 12:27 ` [RFC PATCH 05/12] drm/i915/dsi: remove unnecessary dsi device callbacks Jani Nikula
2015-01-22 11:23   ` Shobhit Kumar
2015-01-22 13:23     ` Jani Nikula
2015-01-23  9:44       ` Shobhit Kumar
2015-01-23 15:22         ` Daniel Vetter
2015-01-27  8:41           ` Shobhit Kumar
2015-01-27 13:09             ` Daniel Vetter
2015-01-27 13:13               ` Chris Wilson
2015-01-28  5:08                 ` Shobhit Kumar
2015-01-28  9:17                   ` Daniel Vetter
2015-01-16 12:27 ` [RFC PATCH 06/12] drm/i915/dsi: add some constness to vbt panel driver Jani Nikula
2015-01-22 11:25   ` Shobhit Kumar
2015-01-16 12:27 ` [RFC PATCH 07/12] drm/i915/dsi: switch to drm_panel interface Jani Nikula
2015-01-23 10:57   ` Shobhit Kumar
2015-01-23 15:31     ` Daniel Vetter
2015-01-27  8:52       ` Shobhit Kumar
2015-01-23 13:30   ` [PATCH v2] " Jani Nikula
2015-01-29  4:52     ` Shobhit Kumar
2015-01-16 12:27 ` [RFC PATCH 08/12] drm/i915/dsi: add drm mipi dsi host support Jani Nikula
2015-01-23 12:21   ` Shobhit Kumar
2015-01-16 12:27 ` [RFC PATCH 09/12] drm/i915/dsi: make the vbt panel driver use mipi_dsi_device for transfers Jani Nikula
2015-01-23 12:24   ` Shobhit Kumar
2015-01-16 12:27 ` [RFC PATCH 10/12] drm/i915/dsi: remove old read/write functions in favor of new stuff Jani Nikula
2015-01-23 12:25   ` Shobhit Kumar
2015-01-16 12:27 ` [RFC PATCH 11/12] drm/i915/dsi: move dpi_send_cmd() to intel_dsi.c and make it static Jani Nikula
2015-01-23 12:27   ` Shobhit Kumar
2015-01-16 12:27 ` [RFC PATCH 12/12] drm/i915/dsi: remove intel_dsi_cmd.c and the unused functions therein Jani Nikula
2015-01-23 12:28   ` Shobhit Kumar
2015-01-29 16:04     ` Daniel Vetter
2015-01-22 11:46 ` [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks Shobhit Kumar
2015-01-22 13:28   ` Jani Nikula
2015-01-23  2:13     ` Shobhit Kumar
2015-01-23 12:30       ` Shobhit Kumar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.