aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/i915/intel_dsi.c39
-rw-r--r--drivers/gpu/drm/i915/intel_dsi_cmd.c34
-rw-r--r--drivers/gpu/drm/i915/intel_dsi_cmd.h5
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 803e87a5a22f..7a75aaf200e3 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -203,6 +203,41 @@ static struct intel_dsi_host *intel_dsi_host_init(struct intel_dsi *intel_dsi,
203 return host; 203 return host;
204} 204}
205 205
206/*
207 * send a video mode command
208 *
209 * XXX: commands with data in MIPI_DPI_DATA?
210 */
211static int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs,
212 enum port port)
213{
214 struct drm_encoder *encoder = &intel_dsi->base.base;
215 struct drm_device *dev = encoder->dev;
216 struct drm_i915_private *dev_priv = dev->dev_private;
217 u32 mask;
218
219 /* XXX: pipe, hs */
220 if (hs)
221 cmd &= ~DPI_LP_MODE;
222 else
223 cmd |= DPI_LP_MODE;
224
225 /* clear bit */
226 I915_WRITE(MIPI_INTR_STAT(port), SPL_PKT_SENT_INTERRUPT);
227
228 /* XXX: old code skips write if control unchanged */
229 if (cmd == I915_READ(MIPI_DPI_CONTROL(port)))
230 DRM_ERROR("Same special packet %02x twice in a row.\n", cmd);
231
232 I915_WRITE(MIPI_DPI_CONTROL(port), cmd);
233
234 mask = SPL_PKT_SENT_INTERRUPT;
235 if (wait_for((I915_READ(MIPI_INTR_STAT(port)) & mask) == mask, 100))
236 DRM_ERROR("Video mode command 0x%08x send failed.\n", cmd);
237
238 return 0;
239}
240
206static void band_gap_reset(struct drm_i915_private *dev_priv) 241static void band_gap_reset(struct drm_i915_private *dev_priv)
207{ 242{
208 mutex_lock(&dev_priv->dpio_lock); 243 mutex_lock(&dev_priv->dpio_lock);
@@ -358,7 +393,7 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
358 } else { 393 } else {
359 msleep(20); /* XXX */ 394 msleep(20); /* XXX */
360 for_each_dsi_port(port, intel_dsi->ports) 395 for_each_dsi_port(port, intel_dsi->ports)
361 dpi_send_cmd(intel_dsi, TURN_ON, DPI_LP_MODE_EN, port); 396 dpi_send_cmd(intel_dsi, TURN_ON, false, port);
362 msleep(100); 397 msleep(100);
363 398
364 drm_panel_enable(intel_dsi->panel); 399 drm_panel_enable(intel_dsi->panel);
@@ -431,7 +466,7 @@ static void intel_dsi_pre_disable(struct intel_encoder *encoder)
431 if (is_vid_mode(intel_dsi)) { 466 if (is_vid_mode(intel_dsi)) {
432 /* Send Shutdown command to the panel in LP mode */ 467 /* Send Shutdown command to the panel in LP mode */
433 for_each_dsi_port(port, intel_dsi->ports) 468 for_each_dsi_port(port, intel_dsi->ports)
434 dpi_send_cmd(intel_dsi, SHUTDOWN, DPI_LP_MODE_EN, port); 469 dpi_send_cmd(intel_dsi, SHUTDOWN, false, port);
435 msleep(10); 470 msleep(10);
436 } 471 }
437} 472}
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,
115 115
116 intel_dsi->hs = enable; 116 intel_dsi->hs = enable;
117} 117}
118
119/*
120 * send a video mode command
121 *
122 * XXX: commands with data in MIPI_DPI_DATA?
123 */
124int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs, enum port port)
125{
126 struct drm_encoder *encoder = &intel_dsi->base.base;
127 struct drm_device *dev = encoder->dev;
128 struct drm_i915_private *dev_priv = dev->dev_private;
129 u32 mask;
130
131 /* XXX: pipe, hs */
132 if (hs)
133 cmd &= ~DPI_LP_MODE;
134 else
135 cmd |= DPI_LP_MODE;
136
137 /* clear bit */
138 I915_WRITE(MIPI_INTR_STAT(port), SPL_PKT_SENT_INTERRUPT);
139
140 /* XXX: old code skips write if control unchanged */
141 if (cmd == I915_READ(MIPI_DPI_CONTROL(port)))
142 DRM_ERROR("Same special packet %02x twice in a row.\n", cmd);
143
144 I915_WRITE(MIPI_DPI_CONTROL(port), cmd);
145
146 mask = SPL_PKT_SENT_INTERRUPT;
147 if (wait_for((I915_READ(MIPI_INTR_STAT(port)) & mask) == mask, 100))
148 DRM_ERROR("Video mode command 0x%08x send failed.\n", cmd);
149
150 return 0;
151}
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 @@
33#include "intel_drv.h" 33#include "intel_drv.h"
34#include "intel_dsi.h" 34#include "intel_dsi.h"
35 35
36#define DPI_LP_MODE_EN false
37#define DPI_HS_MODE_EN true
38
39void dsi_hs_mode_enable(struct intel_dsi *intel_dsi, bool enable, 36void dsi_hs_mode_enable(struct intel_dsi *intel_dsi, bool enable,
40 enum port port); 37 enum port port);
41 38
42int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs, enum port port);
43
44#endif /* _INTEL_DSI_DSI_H */ 39#endif /* _INTEL_DSI_DSI_H */