intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Dhinakaran Pandiyan <dhinakaran.pandiyan@gmail.com>
Cc: intel-gfx@lists.freedesktop.org,
	Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Subject: Re: [PATCH] drm/i915/psr: Split sink status into a separate debugfs node
Date: Thu, 12 Jul 2018 16:26:49 -0700	[thread overview]
Message-ID: <20180712232649.GK2208@intel.com> (raw)
In-Reply-To: <20180705003121.2478-1-dhinakaran.pandiyan@intel.com>

On Wed, Jul 04, 2018 at 05:31:21PM -0700, Dhinakaran Pandiyan wrote:
> This allows to read i915_edp_psr_status from tests without triggering
> any AUX communication. Take this opportunity to move this under the
> eDP-1 connector directory as the status we print is of the sink.
> 
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: José Roberto de Souza <jose.souza@intel.com>
> Suggested-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 69 +++++++++++++++++++++----------------
>  1 file changed, 39 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index f6142d78ede4..5069d5dedafe 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -2592,6 +2592,41 @@ static const struct file_operations i915_guc_log_relay_fops = {
>  	.release = i915_guc_log_relay_release,
>  };
>  
> +static int i915_psr_sink_status_show(struct seq_file *m, void *data)
> +{
> +	u8 val;
> +	static const char * const sink_status[] = {
> +		"inactive",
> +		"transition to active, capture and display",
> +		"active, display from RFB",
> +		"active, capture and display on sink device timings",
> +		"transition to inactive, capture and display, timing re-sync",
> +		"reserved",
> +		"reserved",
> +		"sink internal error",
> +	};
> +	struct drm_connector *connector = m->private;
> +	struct intel_dp *intel_dp =
> +		enc_to_intel_dp(&intel_attached_encoder(connector)->base);
> +
> +	if (connector->status != connector_status_connected)
> +		return -ENODEV;
> +
> +	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_PSR_STATUS, &val) == 1) {
> +		const char *str = "unknown";
> +
> +		val &= DP_PSR_SINK_STATE_MASK;
> +		if (val < ARRAY_SIZE(sink_status))
> +			str = sink_status[val];
> +		seq_printf(m, "Sink PSR status: 0x%x [%s]\n", val, str);
> +	} else {
> +		DRM_ERROR("dpcd read (at %u) failed\n", DP_PSR_STATUS);
> +	}
> +
> +	return 0;
> +}
> +DEFINE_SHOW_ATTRIBUTE(i915_psr_sink_status);
> +
>  static void
>  psr_source_status(struct drm_i915_private *dev_priv, struct seq_file *m)
>  {
> @@ -2643,26 +2678,6 @@ psr_source_status(struct drm_i915_private *dev_priv, struct seq_file *m)
>  	seq_printf(m, "Source PSR status: 0x%x [%s]\n", psr_status, "unknown");
>  }
>  
> -static const char *psr_sink_status(u8 val)
> -{
> -	static const char * const sink_status[] = {
> -		"inactive",
> -		"transition to active, capture and display",
> -		"active, display from RFB",
> -		"active, capture and display on sink device timings",
> -		"transition to inactive, capture and display, timing re-sync",
> -		"reserved",
> -		"reserved",
> -		"sink internal error"
> -	};
> -
> -	val &= DP_PSR_SINK_STATE_MASK;
> -	if (val < ARRAY_SIZE(sink_status))
> -		return sink_status[val];
> -
> -	return "unknown";
> -}
> -
>  static int i915_edp_psr_status(struct seq_file *m, void *data)
>  {
>  	struct drm_i915_private *dev_priv = node_to_i915(m->private);
> @@ -2706,15 +2721,6 @@ static int i915_edp_psr_status(struct seq_file *m, void *data)
>  	}
>  
>  	psr_source_status(dev_priv, m);
> -
> -	if (dev_priv->psr.enabled) {
> -		struct drm_dp_aux *aux = &dev_priv->psr.enabled->aux;
> -		u8 val;
> -
> -		if (drm_dp_dpcd_readb(aux, DP_PSR_STATUS, &val) == 1)
> -			seq_printf(m, "Sink PSR status: 0x%x [%s]\n", val,
> -				   psr_sink_status(val));
> -	}
>  	mutex_unlock(&dev_priv->psr.lock);
>  
>  	if (READ_ONCE(dev_priv->psr.debug)) {
> @@ -4971,9 +4977,12 @@ int i915_debugfs_connector_add(struct drm_connector *connector)
>  		debugfs_create_file("i915_dpcd", S_IRUGO, root,
>  				    connector, &i915_dpcd_fops);
>  
> -	if (connector->connector_type == DRM_MODE_CONNECTOR_eDP)
> +	if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
>  		debugfs_create_file("i915_panel_timings", S_IRUGO, root,
>  				    connector, &i915_panel_fops);
> +		debugfs_create_file("i915_psr_sink_status", S_IRUGO, root,
> +				     connector, &i915_psr_sink_status_fops);

my OCD on names here about i915_psr vs i915_edp_psr is still a real thing although
they are on different places ;)

We could probably remove "_edp" from the others, because psr is an edp only after all....

Anyways let's not block the progress here ;)


Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>



> +	}
>  
>  	return 0;
>  }
> -- 
> 2.14.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-07-12 23:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-05  0:31 [PATCH] drm/i915/psr: Split sink status into a separate debugfs node Dhinakaran Pandiyan
2018-07-05  0:37 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2018-07-05  0:55 ` ✓ Fi.CI.BAT: success " Patchwork
2018-07-05  4:54 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-07-05 21:04 ` [PATCH] " Rodrigo Vivi
2018-07-05 21:27   ` Dhinakaran Pandiyan
2018-07-05 21:37     ` Rodrigo Vivi
2018-07-05 22:42 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-07-06 13:43 ` ✓ Fi.CI.IGT: " Patchwork
2018-07-12 23:26 ` Rodrigo Vivi [this message]
2018-07-13  3:10   ` [PATCH] " Dhinakaran Pandiyan
2018-07-19  6:18 ` Chris Wilson
2018-07-19  7:18   ` Dhinakaran Pandiyan
2018-07-19  7:00     ` Rodrigo Vivi

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=20180712232649.GK2208@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=dhinakaran.pandiyan@gmail.com \
    --cc=dhinakaran.pandiyan@intel.com \
    --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;
as well as URLs for NNTP newsgroup(s).