On Tue, Feb 18, 2014 at 12:02:09AM +0200, Imre Deak wrote: > The connector detect and get_mode handlers need to access the port > specific HW blocks to read the EDID etc. Get/put the port power domains > around these handlers. > > Signed-off-by: Imre Deak <imre.deak@xxxxxxxxx> > --- > drivers/gpu/drm/i915/intel_crt.c | 42 ++++++++++++++++++++++++++++++++-------- > drivers/gpu/drm/i915/intel_dp.c | 16 ++++++++++++--- > drivers/gpu/drm/i915/intel_dsi.c | 13 ++++++++++++- And what about HDMI? > 3 files changed, 59 insertions(+), 12 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c > index 9864aa1..2a38429 100644 > --- a/drivers/gpu/drm/i915/intel_crt.c > +++ b/drivers/gpu/drm/i915/intel_crt.c > @@ -630,7 +630,10 @@ static enum drm_connector_status > intel_crt_detect(struct drm_connector *connector, bool force) > { > struct drm_device *dev = connector->dev; > + struct drm_i915_private *dev_priv = dev->dev_private; > struct intel_crt *crt = intel_attached_crt(connector); > + struct intel_encoder *intel_encoder = &crt->base; > + enum intel_display_power_domain power_domain; > enum drm_connector_status status; > struct intel_load_detect_pipe tmp; > > @@ -638,6 +641,11 @@ intel_crt_detect(struct drm_connector *connector, bool force) > connector->base.id, drm_get_connector_name(connector), > force); > > + power_domain = intel_display_port_power_domain(intel_encoder); > + intel_display_power_get(dev_priv, power_domain); > + > + status = connector_status_connected; > + > if (I915_HAS_HOTPLUG(dev)) { > /* We can not rely on the HPD pin always being correctly wired > * up, for example many KVM do not pass it through, and so > @@ -645,23 +653,27 @@ intel_crt_detect(struct drm_connector *connector, bool force) > */ > if (intel_crt_detect_hotplug(connector)) { > DRM_DEBUG_KMS("CRT detected via hotplug\n"); > - return connector_status_connected; > + goto out; > } else > DRM_DEBUG_KMS("CRT not detected via hotplug\n"); > } > > if (intel_crt_detect_ddc(connector)) > - return connector_status_connected; > + goto out; > > /* Load detection is broken on HPD capable machines. Whoever wants a > * broken monitor (without edid) to work behind a broken kvm (that fails > * to have the right resistors for HP detection) needs to fix this up. > * For now just bail out. */ > - if (I915_HAS_HOTPLUG(dev)) > - return connector_status_disconnected; > + if (I915_HAS_HOTPLUG(dev)) { > + status = connector_status_disconnected; > + goto out; > + } > > - if (!force) > - return connector->status; > + if (!force) { > + status = connector->status; > + goto out; > + } > > /* for pre-945g platforms use load detect */ > if (intel_get_load_detect_pipe(connector, NULL, &tmp)) { > @@ -673,6 +685,9 @@ intel_crt_detect(struct drm_connector *connector, bool force) > } else > status = connector_status_unknown; > > +out: > + intel_display_power_put(dev_priv, power_domain); > + > return status; > } > > @@ -686,17 +701,28 @@ static int intel_crt_get_modes(struct drm_connector *connector) > { > struct drm_device *dev = connector->dev; > struct drm_i915_private *dev_priv = dev->dev_private; > + struct intel_crt *crt = intel_attached_crt(connector); > + struct intel_encoder *intel_encoder = &crt->base; > + enum intel_display_power_domain power_domain; > int ret; > struct i2c_adapter *i2c; > > + power_domain = intel_display_port_power_domain(intel_encoder); > + intel_display_power_get(dev_priv, power_domain); > + > i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->vbt.crt_ddc_pin); > ret = intel_crt_ddc_get_modes(connector, i2c); > if (ret || !IS_G4X(dev)) > - return ret; > + goto out; > > /* Try to probe digital port for output in DVI-I -> VGA mode. */ > i2c = intel_gmbus_get_adapter(dev_priv, GMBUS_PORT_DPB); > - return intel_crt_ddc_get_modes(connector, i2c); > + ret = intel_crt_ddc_get_modes(connector, i2c); > + > +out: > + intel_display_power_put(dev_priv, power_domain); > + > + return ret; > } > > static int intel_crt_set_property(struct drm_connector *connector, > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c > index f53c95c..9c39425 100644 > --- a/drivers/gpu/drm/i915/intel_dp.c > +++ b/drivers/gpu/drm/i915/intel_dp.c > @@ -3224,9 +3224,11 @@ intel_dp_detect(struct drm_connector *connector, bool force) > struct drm_device *dev = connector->dev; > struct drm_i915_private *dev_priv = dev->dev_private; > enum drm_connector_status status; > + enum intel_display_power_domain power_domain; > struct edid *edid = NULL; > > - intel_runtime_pm_get(dev_priv); > + power_domain = intel_display_port_power_domain(intel_encoder); > + intel_display_power_get(dev_priv, power_domain); > > DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", > connector->base.id, drm_get_connector_name(connector)); > @@ -3256,23 +3258,31 @@ intel_dp_detect(struct drm_connector *connector, bool force) > if (intel_encoder->type != INTEL_OUTPUT_EDP) > intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT; > status = connector_status_connected; > - > out: > - intel_runtime_pm_put(dev_priv); > + intel_display_power_put(dev_priv, power_domain); > + > return status; > } > > static int intel_dp_get_modes(struct drm_connector *connector) > { > struct intel_dp *intel_dp = intel_attached_dp(connector); > + struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); > + struct intel_encoder *intel_encoder = &intel_dig_port->base; > struct intel_connector *intel_connector = to_intel_connector(connector); > struct drm_device *dev = connector->dev; > + struct drm_i915_private *dev_priv = dev->dev_private; > + enum intel_display_power_domain power_domain; > int ret; > > /* We should parse the EDID data and find out if it has an audio sink > */ > > + power_domain = intel_display_port_power_domain(intel_encoder); > + intel_display_power_get(dev_priv, power_domain); > + > ret = intel_dp_get_edid_modes(connector, &intel_dp->adapter); > + intel_display_power_put(dev_priv, power_domain); > if (ret) > return ret; > > diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c > index 3ee1db1..63b95bbd 100644 > --- a/drivers/gpu/drm/i915/intel_dsi.c > +++ b/drivers/gpu/drm/i915/intel_dsi.c > @@ -488,8 +488,19 @@ static enum drm_connector_status > intel_dsi_detect(struct drm_connector *connector, bool force) > { > struct intel_dsi *intel_dsi = intel_attached_dsi(connector); > + struct intel_encoder *intel_encoder = &intel_dsi->base; > + enum intel_display_power_domain power_domain; > + enum drm_connector_status connector_status; > + struct drm_i915_private *dev_priv = intel_encoder->base.dev->dev_private; > + > DRM_DEBUG_KMS("\n"); > - return intel_dsi->dev.dev_ops->detect(&intel_dsi->dev); > + power_domain = intel_display_port_power_domain(intel_encoder); > + > + intel_display_power_get(dev_priv, power_domain); > + connector_status = intel_dsi->dev.dev_ops->detect(&intel_dsi->dev); > + intel_display_power_put(dev_priv, power_domain); > + > + return connector_status; > } > > static int intel_dsi_get_modes(struct drm_connector *connector) > -- > 1.8.4 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@xxxxxxxxxxxxxxxxxxxxx > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx