public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 08/19] drm/i915: get port power domain in connector detect
Date: Wed, 19 Feb 2014 14:39:58 +0200	[thread overview]
Message-ID: <1392813598.19792.1.camel@intelbox> (raw)
In-Reply-To: <20140219123508.GD3852@intel.com>


[-- Attachment #1.1: Type: text/plain, Size: 8159 bytes --]

On Wed, 2014-02-19 at 14:35 +0200, Ville Syrjälä wrote:
> 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@intel.com>
> > ---
> >  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?

Good catch, I missed that one.

--Imre

> >  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@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2014-02-19 12:40 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-17 22:02 [PATCH 00/19] drm/i915: vlv power domains support Imre Deak
2014-02-17 22:02 ` [PATCH 01/19] drm/i915: use drm_i915_private everywhere in the power domain api Imre Deak
2014-02-20 19:16   ` Jesse Barnes
2014-02-17 22:02 ` [PATCH 02/19] drm/i915: fold in __intel_power_well_get/put functions Imre Deak
2014-02-20 19:17   ` Jesse Barnes
2014-02-20 19:44     ` Chris Wilson
2014-02-24 13:23   ` Paulo Zanoni
2014-02-24 14:07     ` Imre Deak
2014-02-17 22:02 ` [PATCH 03/19] drm/i915: move modeset_update_power_wells earlier Imre Deak
2014-02-20 19:18   ` Jesse Barnes
2014-02-17 22:02 ` [PATCH 04/19] drm/i915: move power domain macros to intel_pm.c Imre Deak
2014-02-20 19:21   ` Jesse Barnes
2014-02-24 13:38     ` Paulo Zanoni
2014-02-24 13:54       ` Imre Deak
2014-02-17 22:02 ` [PATCH 05/19] drm/i915: power domains: add power well ops Imre Deak
2014-02-20 19:26   ` Jesse Barnes
2014-02-24 11:42     ` Imre Deak
2014-02-17 22:02 ` [PATCH 06/19] drm/i915: remove power_well->always_on flag Imre Deak
2014-02-20 19:27   ` Jesse Barnes
2014-02-17 22:02 ` [PATCH 07/19] drm/i915: add port power domains Imre Deak
2014-02-20 19:31   ` Jesse Barnes
2014-02-24 11:52     ` Imre Deak
2014-03-05 10:11   ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 08/19] drm/i915: get port power domain in connector detect Imre Deak
2014-02-19 12:35   ` Ville Syrjälä
2014-02-19 12:39     ` Imre Deak [this message]
2014-02-20 19:33       ` Jesse Barnes
2014-02-24 11:56         ` Imre Deak
2014-03-05 10:15           ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 09/19] drm/i915: check port power domain when reading the encoder hw state Imre Deak
2014-02-20 19:36   ` Jesse Barnes
2014-02-24 12:53     ` Imre Deak
2014-03-05 10:21   ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 10/19] drm/i915: check pipe power domain when reading its " Imre Deak
2014-02-20 19:37   ` Jesse Barnes
2014-03-05 10:24     ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 11/19] drm/i915: vlv: keep first level vblank IRQs masked Imre Deak
2014-02-18 16:54   ` Ville Syrjälä
2014-02-17 22:02 ` [PATCH 12/19] drm/i915: sanitize PUNIT register macro definitions Imre Deak
2014-02-20 19:46   ` Jesse Barnes
2014-02-24 13:12     ` Imre Deak
2014-02-17 22:02 ` [PATCH 13/19] drm/i915: factor out reset_vblank_counter Imre Deak
2014-02-18 16:55   ` Ville Syrjälä
2014-02-17 22:02 ` [PATCH 14/19] drm/i915: switch order of power domain init wrt. irq install Imre Deak
2014-02-20 19:48   ` Jesse Barnes
2014-02-24 13:23     ` Imre Deak
2014-03-05 10:29       ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 15/19] drm/i915: use power domain api to check vga power state Imre Deak
2014-02-20 19:51   ` Jesse Barnes
2014-03-05 10:31     ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 16/19] drm/i915: sanity check power well sw state against hw state Imre Deak
2014-02-18 16:55   ` Ville Syrjälä
2014-02-18 17:37     ` Imre Deak
2014-02-18 17:59       ` Ville Syrjälä
2014-03-05 10:32         ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 17/19] drm/i915: vlv: factor out valleyview_display_irq_install Imre Deak
2014-02-20 19:56   ` Jesse Barnes
2014-02-24 13:34     ` Imre Deak
2014-02-17 22:02 ` [PATCH 18/19] drm/i915: move hsw power domain comment to its right place Imre Deak
2014-02-20 19:53   ` Jesse Barnes
2014-03-05 10:34     ` Daniel Vetter
2014-02-17 22:02 ` [PATCH 19/19] drm/i915: power domains: add vlv power wells Imre Deak
2014-02-19 12:29   ` Ville Syrjälä
2014-02-20 19:58     ` Jesse Barnes
2014-02-26 18:02       ` Imre Deak
2014-02-26 19:52         ` Jesse Barnes
2014-02-27 10:03           ` Imre Deak
2014-03-05 10:38           ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392813598.19792.1.camel@intelbox \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox