Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915/icl: Configure DSI transcoders

This patch programs DSI operation mode, pixel format,
BGR info, link calibration etc for the DSI transcoder.
This patch also extract BGR info of the DSI panel from
VBT and save it inside struct intel_dsi which used for
configuring DSI transcoder.

v2: Rebase
v3: Use newly defined bitfields.

v4 by Jani:
- Use intel_dsi_bitrate()
- Make bgr_enabled bool
- Use 0 instead of 0x0
- Replace DRM_ERROR() with MISSING_CASE() on pixel format and video mode
- Use is_vid_mode()

Signed-off-by: Madhav Chauhan <madhav.chauhan@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/7de4e39a4b2a18e53a2b9d9cea5b5b4c9d6eeb34.1539613303.git.jani.nikula@intel.com

authored by

Madhav Chauhan and committed by
Jani Nikula
d364dc66 5ffce254

+90 -1
+86 -1
drivers/gpu/drm/i915/icl_dsi.c
··· 27 27 28 28 #include "intel_dsi.h" 29 29 30 - static enum transcoder __attribute__((unused)) dsi_port_to_transcoder(enum port port) 30 + static enum transcoder dsi_port_to_transcoder(enum port port) 31 31 { 32 32 if (port == PORT_A) 33 33 return TRANSCODER_DSI_0; ··· 340 340 } 341 341 } 342 342 343 + static void gen11_dsi_configure_transcoder(struct intel_encoder *encoder) 344 + { 345 + struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); 346 + struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base); 347 + u32 tmp; 348 + enum port port; 349 + enum transcoder dsi_trans; 350 + 351 + for_each_dsi_port(port, intel_dsi->ports) { 352 + dsi_trans = dsi_port_to_transcoder(port); 353 + tmp = I915_READ(DSI_TRANS_FUNC_CONF(dsi_trans)); 354 + 355 + if (intel_dsi->eotp_pkt) 356 + tmp &= ~EOTP_DISABLED; 357 + else 358 + tmp |= EOTP_DISABLED; 359 + 360 + /* enable link calibration if freq > 1.5Gbps */ 361 + if (intel_dsi_bitrate(intel_dsi) >= 1500 * 1000) { 362 + tmp &= ~LINK_CALIBRATION_MASK; 363 + tmp |= CALIBRATION_ENABLED_INITIAL_ONLY; 364 + } 365 + 366 + /* configure continuous clock */ 367 + tmp &= ~CONTINUOUS_CLK_MASK; 368 + if (intel_dsi->clock_stop) 369 + tmp |= CLK_ENTER_LP_AFTER_DATA; 370 + else 371 + tmp |= CLK_HS_CONTINUOUS; 372 + 373 + /* configure buffer threshold limit to minimum */ 374 + tmp &= ~PIX_BUF_THRESHOLD_MASK; 375 + tmp |= PIX_BUF_THRESHOLD_1_4; 376 + 377 + /* set virtual channel to '0' */ 378 + tmp &= ~PIX_VIRT_CHAN_MASK; 379 + tmp |= PIX_VIRT_CHAN(0); 380 + 381 + /* program BGR transmission */ 382 + if (intel_dsi->bgr_enabled) 383 + tmp |= BGR_TRANSMISSION; 384 + 385 + /* select pixel format */ 386 + tmp &= ~PIX_FMT_MASK; 387 + switch (intel_dsi->pixel_format) { 388 + default: 389 + MISSING_CASE(intel_dsi->pixel_format); 390 + /* fallthrough */ 391 + case MIPI_DSI_FMT_RGB565: 392 + tmp |= PIX_FMT_RGB565; 393 + break; 394 + case MIPI_DSI_FMT_RGB666_PACKED: 395 + tmp |= PIX_FMT_RGB666_PACKED; 396 + break; 397 + case MIPI_DSI_FMT_RGB666: 398 + tmp |= PIX_FMT_RGB666_LOOSE; 399 + break; 400 + case MIPI_DSI_FMT_RGB888: 401 + tmp |= PIX_FMT_RGB888; 402 + break; 403 + } 404 + 405 + /* program DSI operation mode */ 406 + if (is_vid_mode(intel_dsi)) { 407 + tmp &= ~OP_MODE_MASK; 408 + switch (intel_dsi->video_mode_format) { 409 + default: 410 + MISSING_CASE(intel_dsi->video_mode_format); 411 + /* fallthrough */ 412 + case VIDEO_MODE_NON_BURST_WITH_SYNC_EVENTS: 413 + tmp |= VIDEO_MODE_SYNC_EVENT; 414 + break; 415 + case VIDEO_MODE_NON_BURST_WITH_SYNC_PULSE: 416 + tmp |= VIDEO_MODE_SYNC_PULSE; 417 + break; 418 + } 419 + } 420 + 421 + I915_WRITE(DSI_TRANS_FUNC_CONF(dsi_trans), tmp); 422 + } 423 + } 424 + 343 425 static void gen11_dsi_enable_port_and_phy(struct intel_encoder *encoder) 344 426 { 345 427 /* step 4a: power up all lanes of the DDI used by DSI */ ··· 438 356 439 357 /* setup D-PHY timings */ 440 358 gen11_dsi_setup_dphy_timings(encoder); 359 + 360 + /* Step (4h, 4i, 4j, 4k): Configure transcoder */ 361 + gen11_dsi_configure_transcoder(encoder); 441 362 } 442 363 443 364 static void __attribute__((unused))
+3
drivers/gpu/drm/i915/intel_dsi.h
··· 81 81 u16 dcs_backlight_ports; 82 82 u16 dcs_cabc_ports; 83 83 84 + /* RGB or BGR */ 85 + bool bgr_enabled; 86 + 84 87 u8 pixel_overlap; 85 88 u32 port_bits; 86 89 u32 bw_timer;
+1
drivers/gpu/drm/i915/intel_dsi_vbt.c
··· 805 805 intel_dsi->bw_timer = mipi_config->dbi_bw_timer; 806 806 intel_dsi->video_frmt_cfg_bits = 807 807 mipi_config->bta_enabled ? DISABLE_VIDEO_BTA : 0; 808 + intel_dsi->bgr_enabled = mipi_config->rgb_flip; 808 809 809 810 /* Starting point, adjusted depending on dual link and burst mode */ 810 811 intel_dsi->pclk = mode->clock;