diff options
author | Jani Nikula <jani.nikula@intel.com> | 2015-01-16 07:27:16 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-01-27 03:51:11 -0500 |
commit | f03e4179cef145253eba87bbf037047e54e728dd (patch) | |
tree | ee034660842e4e86e673a004b58f018cd6031695 /drivers/gpu | |
parent | da2518f9262c89dd182894b29ba45e3d8c95f65c (diff) |
drm/i915/dsi: call dpi_send_cmd() for each dsi port at a higher level
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>
Reviewed-By: Shobhit Kumar <shobhit.kumar@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/i915/intel_dsi.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_dsi_cmd.c | 26 | ||||
-rw-r--r-- | 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 6620124eccc2..4bb9886fa2cf 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) | |||
207 | I915_WRITE(MIPI_MAX_RETURN_PKT_SIZE(port), 8 * 4); | 207 | I915_WRITE(MIPI_MAX_RETURN_PKT_SIZE(port), 8 * 4); |
208 | else { | 208 | else { |
209 | msleep(20); /* XXX */ | 209 | msleep(20); /* XXX */ |
210 | dpi_send_cmd(intel_dsi, TURN_ON, DPI_LP_MODE_EN); | 210 | for_each_dsi_port(port, intel_dsi->ports) |
211 | dpi_send_cmd(intel_dsi, TURN_ON, DPI_LP_MODE_EN, port); | ||
211 | msleep(100); | 212 | msleep(100); |
212 | 213 | ||
213 | if (intel_dsi->dev.dev_ops->enable) | 214 | if (intel_dsi->dev.dev_ops->enable) |
@@ -275,12 +276,14 @@ static void intel_dsi_enable_nop(struct intel_encoder *encoder) | |||
275 | static void intel_dsi_pre_disable(struct intel_encoder *encoder) | 276 | static void intel_dsi_pre_disable(struct intel_encoder *encoder) |
276 | { | 277 | { |
277 | struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base); | 278 | struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base); |
279 | enum port port; | ||
278 | 280 | ||
279 | DRM_DEBUG_KMS("\n"); | 281 | DRM_DEBUG_KMS("\n"); |
280 | 282 | ||
281 | if (is_vid_mode(intel_dsi)) { | 283 | if (is_vid_mode(intel_dsi)) { |
282 | /* Send Shutdown command to the panel in LP mode */ | 284 | /* Send Shutdown command to the panel in LP mode */ |
283 | dpi_send_cmd(intel_dsi, SHUTDOWN, DPI_LP_MODE_EN); | 285 | for_each_dsi_port(port, intel_dsi->ports) |
286 | dpi_send_cmd(intel_dsi, SHUTDOWN, DPI_LP_MODE_EN, port); | ||
284 | msleep(10); | 287 | msleep(10); |
285 | } | 288 | } |
286 | } | 289 | } |
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, | |||
380 | * | 380 | * |
381 | * XXX: commands with data in MIPI_DPI_DATA? | 381 | * XXX: commands with data in MIPI_DPI_DATA? |
382 | */ | 382 | */ |
383 | int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs) | 383 | int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs, enum port port) |
384 | { | 384 | { |
385 | struct drm_encoder *encoder = &intel_dsi->base.base; | 385 | struct drm_encoder *encoder = &intel_dsi->base.base; |
386 | struct drm_device *dev = encoder->dev; | 386 | struct drm_device *dev = encoder->dev; |
387 | struct drm_i915_private *dev_priv = dev->dev_private; | 387 | struct drm_i915_private *dev_priv = dev->dev_private; |
388 | enum port port; | ||
389 | u32 mask; | 388 | u32 mask; |
390 | 389 | ||
391 | /* XXX: pipe, hs */ | 390 | /* XXX: pipe, hs */ |
@@ -394,23 +393,18 @@ int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs) | |||
394 | else | 393 | else |
395 | cmd |= DPI_LP_MODE; | 394 | cmd |= DPI_LP_MODE; |
396 | 395 | ||
397 | for_each_dsi_port(port, intel_dsi->ports) { | 396 | /* clear bit */ |
398 | /* clear bit */ | 397 | I915_WRITE(MIPI_INTR_STAT(port), SPL_PKT_SENT_INTERRUPT); |
399 | I915_WRITE(MIPI_INTR_STAT(port), SPL_PKT_SENT_INTERRUPT); | ||
400 | 398 | ||
401 | /* XXX: old code skips write if control unchanged */ | 399 | /* XXX: old code skips write if control unchanged */ |
402 | if (cmd == I915_READ(MIPI_DPI_CONTROL(port))) | 400 | if (cmd == I915_READ(MIPI_DPI_CONTROL(port))) |
403 | DRM_ERROR("Same special packet %02x twice in a row.\n", | 401 | DRM_ERROR("Same special packet %02x twice in a row.\n", cmd); |
404 | cmd); | ||
405 | 402 | ||
406 | I915_WRITE(MIPI_DPI_CONTROL(port), cmd); | 403 | I915_WRITE(MIPI_DPI_CONTROL(port), cmd); |
407 | 404 | ||
408 | mask = SPL_PKT_SENT_INTERRUPT; | 405 | mask = SPL_PKT_SENT_INTERRUPT; |
409 | if (wait_for((I915_READ(MIPI_INTR_STAT(port)) & mask) == mask, | 406 | if (wait_for((I915_READ(MIPI_INTR_STAT(port)) & mask) == mask, 100)) |
410 | 100)) | 407 | DRM_ERROR("Video mode command 0x%08x send failed.\n", cmd); |
411 | DRM_ERROR("Video mode command 0x%08x send failed.\n", | ||
412 | cmd); | ||
413 | } | ||
414 | 408 | ||
415 | return 0; | 409 | return 0; |
416 | } | 410 | } |
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, | |||
51 | int dsi_vc_generic_read(struct intel_dsi *intel_dsi, int channel, | 51 | int dsi_vc_generic_read(struct intel_dsi *intel_dsi, int channel, |
52 | u8 *reqdata, int reqlen, u8 *buf, int buflen, enum port port); | 52 | u8 *reqdata, int reqlen, u8 *buf, int buflen, enum port port); |
53 | 53 | ||
54 | int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs); | 54 | int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs, enum port port); |
55 | void wait_for_dsi_fifo_empty(struct intel_dsi *intel_dsi); | 55 | void wait_for_dsi_fifo_empty(struct intel_dsi *intel_dsi); |
56 | 56 | ||
57 | /* XXX: questionable write helpers */ | 57 | /* XXX: questionable write helpers */ |