aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_dsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/intel_dsi.c')
-rw-r--r--drivers/gpu/drm/i915/intel_dsi.c40
1 files changed, 23 insertions, 17 deletions
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 670c29a7b5dd..5bd9e09ad3c5 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -184,7 +184,7 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)
184 184
185 /* update the hw state for DPLL */ 185 /* update the hw state for DPLL */
186 intel_crtc->config.dpll_hw_state.dpll = DPLL_INTEGRATED_CLOCK_VLV | 186 intel_crtc->config.dpll_hw_state.dpll = DPLL_INTEGRATED_CLOCK_VLV |
187 DPLL_REFA_CLK_ENABLE_VLV; 187 DPLL_REFA_CLK_ENABLE_VLV;
188 188
189 tmp = I915_READ(DSPCLK_GATE_D); 189 tmp = I915_READ(DSPCLK_GATE_D);
190 tmp |= DPOUNIT_CLOCK_GATE_DISABLE; 190 tmp |= DPOUNIT_CLOCK_GATE_DISABLE;
@@ -259,8 +259,8 @@ static void intel_dsi_disable(struct intel_encoder *encoder)
259 temp = I915_READ(MIPI_CTRL(pipe)); 259 temp = I915_READ(MIPI_CTRL(pipe));
260 temp &= ~ESCAPE_CLOCK_DIVIDER_MASK; 260 temp &= ~ESCAPE_CLOCK_DIVIDER_MASK;
261 I915_WRITE(MIPI_CTRL(pipe), temp | 261 I915_WRITE(MIPI_CTRL(pipe), temp |
262 intel_dsi->escape_clk_div << 262 intel_dsi->escape_clk_div <<
263 ESCAPE_CLOCK_DIVIDER_SHIFT); 263 ESCAPE_CLOCK_DIVIDER_SHIFT);
264 264
265 I915_WRITE(MIPI_EOT_DISABLE(pipe), CLOCKSTOP); 265 I915_WRITE(MIPI_EOT_DISABLE(pipe), CLOCKSTOP);
266 266
@@ -297,7 +297,7 @@ static void intel_dsi_clear_device_ready(struct intel_encoder *encoder)
297 usleep_range(2000, 2500); 297 usleep_range(2000, 2500);
298 298
299 if (wait_for(((I915_READ(MIPI_PORT_CTRL(pipe)) & AFE_LATCHOUT) 299 if (wait_for(((I915_READ(MIPI_PORT_CTRL(pipe)) & AFE_LATCHOUT)
300 == 0x00000), 30)) 300 == 0x00000), 30))
301 DRM_ERROR("DSI LP not going Low\n"); 301 DRM_ERROR("DSI LP not going Low\n");
302 302
303 val = I915_READ(MIPI_PORT_CTRL(pipe)); 303 val = I915_READ(MIPI_PORT_CTRL(pipe));
@@ -423,9 +423,11 @@ static u16 txclkesc(u32 divider, unsigned int us)
423} 423}
424 424
425/* return pixels in terms of txbyteclkhs */ 425/* return pixels in terms of txbyteclkhs */
426static u16 txbyteclkhs(u16 pixels, int bpp, int lane_count) 426static u16 txbyteclkhs(u16 pixels, int bpp, int lane_count,
427 u16 burst_mode_ratio)
427{ 428{
428 return DIV_ROUND_UP(DIV_ROUND_UP(pixels * bpp, 8), lane_count); 429 return DIV_ROUND_UP(DIV_ROUND_UP(pixels * bpp * burst_mode_ratio,
430 8 * 100), lane_count);
429} 431}
430 432
431static void set_dsi_timings(struct drm_encoder *encoder, 433static void set_dsi_timings(struct drm_encoder *encoder,
@@ -451,10 +453,12 @@ static void set_dsi_timings(struct drm_encoder *encoder,
451 vbp = mode->vtotal - mode->vsync_end; 453 vbp = mode->vtotal - mode->vsync_end;
452 454
453 /* horizontal values are in terms of high speed byte clock */ 455 /* horizontal values are in terms of high speed byte clock */
454 hactive = txbyteclkhs(hactive, bpp, lane_count); 456 hactive = txbyteclkhs(hactive, bpp, lane_count,
455 hfp = txbyteclkhs(hfp, bpp, lane_count); 457 intel_dsi->burst_mode_ratio);
456 hsync = txbyteclkhs(hsync, bpp, lane_count); 458 hfp = txbyteclkhs(hfp, bpp, lane_count, intel_dsi->burst_mode_ratio);
457 hbp = txbyteclkhs(hbp, bpp, lane_count); 459 hsync = txbyteclkhs(hsync, bpp, lane_count,
460 intel_dsi->burst_mode_ratio);
461 hbp = txbyteclkhs(hbp, bpp, lane_count, intel_dsi->burst_mode_ratio);
458 462
459 I915_WRITE(MIPI_HACTIVE_AREA_COUNT(pipe), hactive); 463 I915_WRITE(MIPI_HACTIVE_AREA_COUNT(pipe), hactive);
460 I915_WRITE(MIPI_HFP_COUNT(pipe), hfp); 464 I915_WRITE(MIPI_HFP_COUNT(pipe), hfp);
@@ -541,12 +545,14 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder)
541 intel_dsi->video_mode_format == VIDEO_MODE_BURST) { 545 intel_dsi->video_mode_format == VIDEO_MODE_BURST) {
542 I915_WRITE(MIPI_HS_TX_TIMEOUT(pipe), 546 I915_WRITE(MIPI_HS_TX_TIMEOUT(pipe),
543 txbyteclkhs(adjusted_mode->htotal, bpp, 547 txbyteclkhs(adjusted_mode->htotal, bpp,
544 intel_dsi->lane_count) + 1); 548 intel_dsi->lane_count,
549 intel_dsi->burst_mode_ratio) + 1);
545 } else { 550 } else {
546 I915_WRITE(MIPI_HS_TX_TIMEOUT(pipe), 551 I915_WRITE(MIPI_HS_TX_TIMEOUT(pipe),
547 txbyteclkhs(adjusted_mode->vtotal * 552 txbyteclkhs(adjusted_mode->vtotal *
548 adjusted_mode->htotal, 553 adjusted_mode->htotal,
549 bpp, intel_dsi->lane_count) + 1); 554 bpp, intel_dsi->lane_count,
555 intel_dsi->burst_mode_ratio) + 1);
550 } 556 }
551 I915_WRITE(MIPI_LP_RX_TIMEOUT(pipe), intel_dsi->lp_rx_timeout); 557 I915_WRITE(MIPI_LP_RX_TIMEOUT(pipe), intel_dsi->lp_rx_timeout);
552 I915_WRITE(MIPI_TURN_AROUND_TIMEOUT(pipe), intel_dsi->turn_arnd_val); 558 I915_WRITE(MIPI_TURN_AROUND_TIMEOUT(pipe), intel_dsi->turn_arnd_val);
@@ -576,7 +582,7 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder)
576 * XXX: write MIPI_STOP_STATE_STALL? 582 * XXX: write MIPI_STOP_STATE_STALL?
577 */ 583 */
578 I915_WRITE(MIPI_HIGH_LOW_SWITCH_COUNT(pipe), 584 I915_WRITE(MIPI_HIGH_LOW_SWITCH_COUNT(pipe),
579 intel_dsi->hs_to_lp_count); 585 intel_dsi->hs_to_lp_count);
580 586
581 /* XXX: low power clock equivalence in terms of byte clock. the number 587 /* XXX: low power clock equivalence in terms of byte clock. the number
582 * of byte clocks occupied in one low power clock. based on txbyteclkhs 588 * of byte clocks occupied in one low power clock. based on txbyteclkhs
@@ -601,10 +607,10 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder)
601 * 64 like 1366 x 768. Enable RANDOM resolution support for such 607 * 64 like 1366 x 768. Enable RANDOM resolution support for such
602 * panels by default */ 608 * panels by default */
603 I915_WRITE(MIPI_VIDEO_MODE_FORMAT(pipe), 609 I915_WRITE(MIPI_VIDEO_MODE_FORMAT(pipe),
604 intel_dsi->video_frmt_cfg_bits | 610 intel_dsi->video_frmt_cfg_bits |
605 intel_dsi->video_mode_format | 611 intel_dsi->video_mode_format |
606 IP_TG_CONFIG | 612 IP_TG_CONFIG |
607 RANDOM_DPI_DISPLAY_RESOLUTION); 613 RANDOM_DPI_DISPLAY_RESOLUTION);
608} 614}
609 615
610static void intel_dsi_pre_pll_enable(struct intel_encoder *encoder) 616static void intel_dsi_pre_pll_enable(struct intel_encoder *encoder)