On Wed, 5 Mar 2014 16:20:53 +0200 Imre Deak <imre.deak@xxxxxxxxx> 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. > > v2: > - get port power domain for HDMI too (Ville) > - get port power domain for the DP,HDMI audio detect handlers (Jesse) > - Leave the intel_runtime_pm_get/put in the DP detect function in place. > Instead of just removing them, these should be moved to the appropriate > power_well enable/disable handlers. We can do this after Paulo's > 'Merge PC8 with runtime PM, v2' patchset. > v3: > - rebased on latest -nightly > > Signed-off-by: Imre Deak <imre.deak@xxxxxxxxx> > --- > drivers/gpu/drm/i915/intel_crt.c | 22 ++++++++++++++++++++-- > drivers/gpu/drm/i915/intel_dp.c | 25 +++++++++++++++++++++++++ > drivers/gpu/drm/i915/intel_dsi.c | 13 ++++++++++++- > drivers/gpu/drm/i915/intel_hdmi.c | 29 ++++++++++++++++++++++++++--- > 4 files changed, 83 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c > index 4c1230c..4a9d097 100644 > --- a/drivers/gpu/drm/i915/intel_crt.c > +++ b/drivers/gpu/drm/i915/intel_crt.c > @@ -632,6 +632,8 @@ 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; > > @@ -641,6 +643,9 @@ 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); > + > 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 > @@ -684,7 +689,9 @@ intel_crt_detect(struct drm_connector *connector, bool force) > status = connector_status_unknown; > > out: > + intel_display_power_put(dev_priv, power_domain); > intel_runtime_pm_put(dev_priv); > + > return status; > } > > @@ -698,17 +705,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..3bc2fbc 100644 > --- a/drivers/gpu/drm/i915/intel_dp.c > +++ b/drivers/gpu/drm/i915/intel_dp.c > @@ -3224,10 +3224,14 @@ 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)); > > @@ -3258,21 +3262,32 @@ intel_dp_detect(struct drm_connector *connector, bool force) > status = connector_status_connected; > > out: > + intel_display_power_put(dev_priv, power_domain); > + > intel_runtime_pm_put(dev_priv); > + > 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; > > @@ -3293,15 +3308,25 @@ static bool > intel_dp_detect_audio(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 drm_device *dev = connector->dev; > + struct drm_i915_private *dev_priv = dev->dev_private; > + enum intel_display_power_domain power_domain; > struct edid *edid; > bool has_audio = false; > > + power_domain = intel_display_port_power_domain(intel_encoder); > + intel_display_power_get(dev_priv, power_domain); > + > edid = intel_dp_get_edid(connector, &intel_dp->adapter); > if (edid) { > has_audio = drm_detect_monitor_audio(edid); > kfree(edid); > } > > + intel_display_power_put(dev_priv, power_domain); > + > return has_audio; > } > > 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) > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c > index aa4641d..d0e2026 100644 > --- a/drivers/gpu/drm/i915/intel_hdmi.c > +++ b/drivers/gpu/drm/i915/intel_hdmi.c > @@ -909,11 +909,15 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) > struct intel_encoder *intel_encoder = &intel_dig_port->base; > struct drm_i915_private *dev_priv = dev->dev_private; > struct edid *edid; > + enum intel_display_power_domain power_domain; > enum drm_connector_status status = connector_status_disconnected; > > DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", > connector->base.id, drm_get_connector_name(connector)); > > + power_domain = intel_display_port_power_domain(intel_encoder); > + intel_display_power_get(dev_priv, power_domain); > + > intel_hdmi->has_hdmi_sink = false; > intel_hdmi->has_audio = false; > intel_hdmi->rgb_quant_range_selectable = false; > @@ -941,31 +945,48 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) > intel_encoder->type = INTEL_OUTPUT_HDMI; > } > > + intel_display_power_put(dev_priv, power_domain); > + > return status; > } > > static int intel_hdmi_get_modes(struct drm_connector *connector) > { > - struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); > + struct intel_encoder *intel_encoder = intel_attached_encoder(connector); > + struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&intel_encoder->base); > struct drm_i915_private *dev_priv = connector->dev->dev_private; > + enum intel_display_power_domain power_domain; > + int ret; > > /* We should parse the EDID data and find out if it's an HDMI sink so > * we can send audio to it. > */ > > - return intel_ddc_get_modes(connector, > + power_domain = intel_display_port_power_domain(intel_encoder); > + intel_display_power_get(dev_priv, power_domain); > + > + ret = intel_ddc_get_modes(connector, > intel_gmbus_get_adapter(dev_priv, > intel_hdmi->ddc_bus)); > + > + intel_display_power_put(dev_priv, power_domain); > + > + return ret; > } > > static bool > intel_hdmi_detect_audio(struct drm_connector *connector) > { > - struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); > + struct intel_encoder *intel_encoder = intel_attached_encoder(connector); > + struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&intel_encoder->base); > struct drm_i915_private *dev_priv = connector->dev->dev_private; > + enum intel_display_power_domain power_domain; > struct edid *edid; > bool has_audio = false; > > + power_domain = intel_display_port_power_domain(intel_encoder); > + intel_display_power_get(dev_priv, power_domain); > + > edid = drm_get_edid(connector, > intel_gmbus_get_adapter(dev_priv, > intel_hdmi->ddc_bus)); > @@ -975,6 +996,8 @@ intel_hdmi_detect_audio(struct drm_connector *connector) > kfree(edid); > } > > + intel_display_power_put(dev_priv, power_domain); > + > return has_audio; > } > Reviewed-by: Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx> -- Jesse Barnes, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx