public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Damien Lespiau <damien.lespiau@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Attach a PSR property on eDP
Date: Sat, 14 Jun 2014 09:17:34 +0100	[thread overview]
Message-ID: <20140614081734.GC3160@strange.amr.corp.intel.com> (raw)
In-Reply-To: <1402691567-24531-1-git-send-email-chris@chris-wilson.co.uk>

On Fri, Jun 13, 2014 at 09:32:47PM +0100, Chris Wilson wrote:
> Let userspace know the status of Panel Self-Refresh by virtue of a
> property on the appropriate connector.
> 
> v2: Only attach the property if the driver is capable of PSR.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Can we have an updated property table in Documentation/DocBook/drm.tmpl
as well?

-- 
Damien

> ---
>  drivers/gpu/drm/i915/i915_drv.h    |  1 +
>  drivers/gpu/drm/i915/intel_dp.c    | 13 +++++++++++++
>  drivers/gpu/drm/i915/intel_drv.h   |  1 +
>  drivers/gpu/drm/i915/intel_modes.c | 29 +++++++++++++++++++++++++++++
>  4 files changed, 44 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index bdb419c48016..92561bdde201 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -642,6 +642,7 @@ struct i915_psr {
>  	bool enabled;
>  	bool active;
>  	struct delayed_work work;
> +	struct drm_property *property;
>  };
>  
>  enum intel_pch {
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index e3ad8a7c9fd0..51c0799ea83d 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1820,6 +1820,12 @@ static bool intel_edp_psr_match_conditions(struct intel_dp *intel_dp)
>  	return true;
>  }
>  
> +static void intel_edp_set_psr_property(struct intel_connector *connector, uint64_t val)
> +{
> +	drm_object_property_set_value(&connector->base.base,
> +				      to_i915(connector->base.dev)->psr.property, val);
> +}
> +
>  static void intel_edp_psr_do_enable(struct intel_dp *intel_dp)
>  {
>  	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
> @@ -1835,6 +1841,8 @@ static void intel_edp_psr_do_enable(struct intel_dp *intel_dp)
>  	/* Enable PSR on the host */
>  	intel_edp_psr_enable_source(intel_dp);
>  
> +	intel_edp_set_psr_property(intel_dp->attached_connector, 1);
> +
>  	dev_priv->psr.enabled = true;
>  	dev_priv->psr.active = true;
>  }
> @@ -1931,6 +1939,7 @@ void intel_edp_psr_inactivate(struct drm_device *dev)
>  			intel_dp = enc_to_intel_dp(&encoder->base);
>  			intel_crtc = to_intel_crtc(encoder->base.crtc);
>  
> +			intel_edp_set_psr_property(connector, 0);
>  			dev_priv->psr.active = false;
>  
>  			I915_WRITE(EDP_PSR_CTL(dev), I915_READ(EDP_PSR_CTL(dev))
> @@ -3349,6 +3358,8 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp)
>  			dev_priv->psr.sink_support = true;
>  			DRM_DEBUG_KMS("Detected EDP PSR Panel.\n");
>  		}
> +		intel_edp_set_psr_property(intel_dp->attached_connector,
> +					   dev_priv->psr.sink_support ? dev_priv->psr.active : -1);
>  	}
>  
>  	/* Training Pattern 3 support */
> @@ -3977,6 +3988,8 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
>  	intel_dp->color_range_auto = true;
>  
>  	if (is_edp(intel_dp)) {
> +		if (HAS_PSR(connector->dev))
> +			intel_attach_psr_property(connector);
>  		drm_mode_create_scaling_mode_property(connector->dev);
>  		drm_object_attach_property(
>  			&connector->base,
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index cfe140a74266..9c8524016e4b 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -905,6 +905,7 @@ int intel_connector_update_modes(struct drm_connector *connector,
>  int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter);
>  void intel_attach_force_audio_property(struct drm_connector *connector);
>  void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
> +void intel_attach_psr_property(struct drm_connector *connector);
>  
>  
>  /* intel_overlay.c */
> diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c
> index 0e860f39933d..6c14c97fa8df 100644
> --- a/drivers/gpu/drm/i915/intel_modes.c
> +++ b/drivers/gpu/drm/i915/intel_modes.c
> @@ -126,3 +126,32 @@ intel_attach_broadcast_rgb_property(struct drm_connector *connector)
>  
>  	drm_object_attach_property(&connector->base, prop, 0);
>  }
> +
> +static const struct drm_prop_enum_list psr_names[] = {
> +	{ -1, "Unsupported" },
> +	{  0, "Idle" },
> +	{  1, "Active" },
> +};
> +
> +void
> +intel_attach_psr_property(struct drm_connector *connector)
> +{
> +	struct drm_device *dev = connector->dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	struct drm_property *prop;
> +
> +	prop = dev_priv->psr.property;
> +	if (prop == NULL) {
> +		prop = drm_property_create_enum(dev,
> +						DRM_MODE_PROP_ENUM | DRM_MODE_PROP_IMMUTABLE,
> +						"Panel Self-Refresh",
> +						psr_names,
> +						ARRAY_SIZE(psr_names));
> +		if (prop == NULL)
> +			return;
> +
> +		dev_priv->psr.property = prop;
> +	}
> +
> +	drm_object_attach_property(&connector->base, prop, 0);
> +}
> -- 
> 2.0.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2014-06-14  8:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-13 20:28 [PATCH] drm/i915: Attach a PSR property on eDP Chris Wilson
2014-06-13 20:32 ` Chris Wilson
2014-06-13 23:39   ` Daniel Vetter
2014-06-13 23:45     ` Chris Wilson
2014-06-14  8:17   ` Damien Lespiau [this message]
2014-06-14  8:26     ` Chris Wilson
2014-06-14  8:48       ` Damien Lespiau
2014-06-14  8:39   ` Damien Lespiau
2014-06-14 12:28     ` Chris Wilson
2014-06-16  7:28   ` Chris Wilson
2014-06-16  7:32   ` Chris Wilson
  -- strict thread matches above, loose matches on Subject: below --
2015-03-25 20:11 Rodrigo Vivi
2015-03-25 20:31 ` Chris Wilson
2015-03-25 20:37   ` Vivi, Rodrigo
2015-03-26 14:12     ` chris
2015-03-26 19:22       ` Rodrigo Vivi
2015-03-26 21:04         ` Chris Wilson

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=20140614081734.GC3160@strange.amr.corp.intel.com \
    --to=damien.lespiau@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /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