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

drm/i915: Software workaround for getting the HW status of DSI Port C on BYT

Due to hardware limitations on BYT, MIPI Port C DPI Enable bit
does not get set. To check whether DSI Port C was enabled in BIOS,
check the Pipe B enable bit for DSI Port C. In hardware, DSI Port C
is linked with Pipe B.

v2: Addressed review comments of Jani, Nikula
- Used platform checks for this software workaround for BYT

Signed-off-by: Gaurav K Singh <gaurav.k.singh@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

authored by

Gaurav K Singh and committed by
Daniel Vetter
c0beefd2 bf344e80

+17 -5
+17 -5
drivers/gpu/drm/i915/intel_dsi.c
··· 398 398 enum pipe *pipe) 399 399 { 400 400 struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; 401 + struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base); 402 + struct drm_device *dev = encoder->base.dev; 401 403 enum intel_display_power_domain power_domain; 402 - u32 port_ctl, func; 404 + u32 dpi_enabled, func; 403 405 enum port port; 404 406 405 407 DRM_DEBUG_KMS("\n"); ··· 411 409 return false; 412 410 413 411 /* XXX: this only works for one DSI output */ 414 - for_each_dsi_port(port, (1 << PORT_A) | (1 << PORT_C)) { 415 - port_ctl = I915_READ(MIPI_PORT_CTRL(port)); 412 + for_each_dsi_port(port, intel_dsi->ports) { 416 413 func = I915_READ(MIPI_DSI_FUNC_PRG(port)); 414 + dpi_enabled = I915_READ(MIPI_PORT_CTRL(port)) & 415 + DPI_ENABLE; 417 416 418 - if ((port_ctl & DPI_ENABLE) || (func & CMD_MODE_DATA_WIDTH_MASK)) { 417 + /* Due to some hardware limitations on BYT, MIPI Port C DPI 418 + * Enable bit does not get set. To check whether DSI Port C 419 + * was enabled in BIOS, check the Pipe B enable bit 420 + */ 421 + if (IS_VALLEYVIEW(dev) && !IS_CHERRYVIEW(dev) && 422 + (port == PORT_C)) 423 + dpi_enabled = I915_READ(PIPECONF(PIPE_B)) & 424 + PIPECONF_ENABLE; 425 + 426 + if (dpi_enabled || (func & CMD_MODE_DATA_WIDTH_MASK)) { 419 427 if (I915_READ(MIPI_DEVICE_READY(port)) & DEVICE_READY) { 420 - *pipe = port == PORT_A ? PIPE_A : PIPE_C; 428 + *pipe = port == PORT_A ? PIPE_A : PIPE_B; 421 429 return true; 422 430 } 423 431 }