drm/i915/dsi: Ensure the HW is powered during HW state readout

The assumption when adding the intel_display_power_is_enabled() checks
was that if it returns success the power can't be turned off afterwards
during the HW access, which is guaranteed by modeset locks. This isn't
always true, so make sure we hold a dedicated reference for the time of
the access.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1455296121-4742-11-git-send-email-imre.deak@intel.com
(cherry picked from commit 3f3f42b887)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
Imre Deak 2016-02-12 18:55:19 +02:00 committed by Jani Nikula
parent b81b801f86
commit fe97fd7eb8

View File

@ -664,13 +664,16 @@ static bool intel_dsi_get_hw_state(struct intel_encoder *encoder,
struct drm_device *dev = encoder->base.dev; struct drm_device *dev = encoder->base.dev;
enum intel_display_power_domain power_domain; enum intel_display_power_domain power_domain;
enum port port; enum port port;
bool ret;
DRM_DEBUG_KMS("\n"); DRM_DEBUG_KMS("\n");
power_domain = intel_display_port_power_domain(encoder); power_domain = intel_display_port_power_domain(encoder);
if (!intel_display_power_is_enabled(dev_priv, power_domain)) if (!intel_display_power_get_if_enabled(dev_priv, power_domain))
return false; return false;
ret = false;
/* XXX: this only works for one DSI output */ /* XXX: this only works for one DSI output */
for_each_dsi_port(port, intel_dsi->ports) { for_each_dsi_port(port, intel_dsi->ports) {
i915_reg_t ctrl_reg = IS_BROXTON(dev) ? i915_reg_t ctrl_reg = IS_BROXTON(dev) ?
@ -691,12 +694,16 @@ static bool intel_dsi_get_hw_state(struct intel_encoder *encoder,
if (dpi_enabled || (func & CMD_MODE_DATA_WIDTH_MASK)) { if (dpi_enabled || (func & CMD_MODE_DATA_WIDTH_MASK)) {
if (I915_READ(MIPI_DEVICE_READY(port)) & DEVICE_READY) { if (I915_READ(MIPI_DEVICE_READY(port)) & DEVICE_READY) {
*pipe = port == PORT_A ? PIPE_A : PIPE_B; *pipe = port == PORT_A ? PIPE_A : PIPE_B;
return true; ret = true;
}
}
}
return false; goto out;
}
}
}
out:
intel_display_power_put(dev_priv, power_domain);
return ret;
} }
static void intel_dsi_get_config(struct intel_encoder *encoder, static void intel_dsi_get_config(struct intel_encoder *encoder,