All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Ramalingam C <ramalingam.c@intel.com>
Cc: daniel.vetter@ffwll.ch, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v5 3/4] drm/i915/debugfs: hdcp capability of a sink
Date: Tue, 23 Oct 2018 16:04:00 +0200	[thread overview]
Message-ID: <20181023140400.GW324@phenom.ffwll.local> (raw)
In-Reply-To: <1540286550-20399-4-git-send-email-ramalingam.c@intel.com>

On Tue, Oct 23, 2018 at 02:52:29PM +0530, Ramalingam C wrote:
> Add a debugfs entry for providing the hdcp capabilities of the sink
> connected to the HDCP capable connectors.
> 
> v2:
>   Squashed the sink's hdcp capability into this patch. [Daniel]
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>

Yeah lgtm. Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 29 +++++++++++++++++++++++++++++
>  drivers/gpu/drm/i915/intel_drv.h    |  7 +++++++
>  drivers/gpu/drm/i915/intel_hdcp.c   | 27 +++++++++++++++++++++------
>  drivers/gpu/drm/i915/intel_hdmi.c   | 16 +++++++++++++++-
>  4 files changed, 72 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 5f3c639522fa..6d09af66da0f 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -4946,6 +4946,28 @@ static int i915_panel_show(struct seq_file *m, void *data)
>  }
>  DEFINE_SHOW_ATTRIBUTE(i915_panel);
>  
> +static int i915_hdcp_sink_capability_show(struct seq_file *m, void *data)
> +{
> +	struct drm_connector *connector = m->private;
> +	struct intel_connector *intel_connector = to_intel_connector(connector);
> +
> +	if (connector->status != connector_status_connected)
> +		return -ENODEV;
> +
> +	/* HDCP is supported by connector */
> +	if (!intel_connector->hdcp_shim)
> +		return -EINVAL;
> +
> +	seq_printf(m, "%s:%d HDCP version: ", connector->name,
> +		   connector->base.id);
> +	seq_printf(m, "%s ", !intel_hdcp_capable(intel_connector) ?
> +		   "None" : "HDCP1.4");
> +	seq_puts(m, "\n");
> +
> +	return 0;
> +}
> +DEFINE_SHOW_ATTRIBUTE(i915_hdcp_sink_capability);
> +
>  /**
>   * i915_debugfs_connector_add - add i915 specific connector debugfs files
>   * @connector: pointer to a registered drm_connector
> @@ -4975,5 +4997,12 @@ int i915_debugfs_connector_add(struct drm_connector *connector)
>  				    connector, &i915_psr_sink_status_fops);
>  	}
>  
> +	if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort ||
> +	    connector->connector_type == DRM_MODE_CONNECTOR_HDMIA ||
> +	    connector->connector_type == DRM_MODE_CONNECTOR_HDMIB) {
> +		debugfs_create_file("i915_hdcp_sink_capability", S_IRUGO, root,
> +				    connector, &i915_hdcp_sink_capability_fops);
> +	}
> +
>  	return 0;
>  }
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index b2ca9f278b36..249bb9d1b5d0 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1296,6 +1296,12 @@ enc_to_dig_port(struct drm_encoder *encoder)
>  		return NULL;
>  }
>  
> +static inline struct intel_digital_port *
> +conn_to_dig_port(struct intel_connector *connector)
> +{
> +	return enc_to_dig_port(&intel_attached_encoder(&connector->base)->base);
> +}
> +
>  static inline struct intel_dp_mst_encoder *
>  enc_to_mst(struct drm_encoder *encoder)
>  {
> @@ -1956,6 +1962,7 @@ int intel_hdcp_enable(struct intel_connector *connector);
>  int intel_hdcp_disable(struct intel_connector *connector);
>  int intel_hdcp_check_link(struct intel_connector *connector);
>  bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port);
> +bool intel_hdcp_capable(struct intel_connector *connector);
>  
>  /* intel_psr.c */
>  #define CAN_PSR(dev_priv) (HAS_PSR(dev_priv) && dev_priv->psr.sink_support)
> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
> index 20908ff018e6..283b45636668 100644
> --- a/drivers/gpu/drm/i915/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
> @@ -51,6 +51,27 @@ int intel_hdcp_read_valid_bksv(struct intel_digital_port *intel_dig_port,
>  	return 0;
>  }
>  
> +/* Is HDCP1.4 capable on Platform and Sink */
> +bool intel_hdcp_capable(struct intel_connector *connector)
> +{
> +	struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector);
> +	const struct intel_hdcp_shim *shim = connector->hdcp_shim;
> +	bool capable = false;
> +	u8 bksv[5];
> +
> +	if (!shim)
> +		return capable;
> +
> +	if (shim->hdcp_capable) {
> +		shim->hdcp_capable(intel_dig_port, &capable);
> +	} else {
> +		if (!intel_hdcp_read_valid_bksv(intel_dig_port, shim, bksv))
> +			capable = true;
> +	}
> +
> +	return capable;
> +}
> +
>  static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port,
>  				    const struct intel_hdcp_shim *shim)
>  {
> @@ -632,12 +653,6 @@ static int intel_hdcp_auth(struct intel_digital_port *intel_dig_port,
>  	return 0;
>  }
>  
> -static
> -struct intel_digital_port *conn_to_dig_port(struct intel_connector *connector)
> -{
> -	return enc_to_dig_port(&intel_attached_encoder(&connector->base)->base);
> -}
> -
>  static int _intel_hdcp_disable(struct intel_connector *connector)
>  {
>  	struct drm_i915_private *dev_priv = connector->base.dev->dev_private;
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 89d5e3984452..72e8a73dfa1c 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -2072,6 +2072,20 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder,
>  	chv_phy_release_cl2_override(encoder);
>  }
>  
> +static int
> +intel_hdmi_connector_register(struct drm_connector *connector)
> +{
> +	int ret;
> +
> +	ret = intel_connector_register(connector);
> +	if (ret)
> +		return ret;
> +
> +	i915_debugfs_connector_add(connector);
> +
> +	return ret;
> +}
> +
>  static void intel_hdmi_destroy(struct drm_connector *connector)
>  {
>  	if (intel_attached_hdmi(connector)->cec_notifier)
> @@ -2086,7 +2100,7 @@ static const struct drm_connector_funcs intel_hdmi_connector_funcs = {
>  	.fill_modes = drm_helper_probe_single_connector_modes,
>  	.atomic_get_property = intel_digital_connector_atomic_get_property,
>  	.atomic_set_property = intel_digital_connector_atomic_set_property,
> -	.late_register = intel_connector_register,
> +	.late_register = intel_hdmi_connector_register,
>  	.early_unregister = intel_connector_unregister,
>  	.destroy = intel_hdmi_destroy,
>  	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> -- 
> 2.7.4
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-10-23 14:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-23  9:22 [PATCH v5 0/4] Enabling the IGT for HDCP1.4 Ramalingam C
2018-10-23  9:22 ` [PATCH v5 1/4] drm/i915: Pullout the bksv read and validation Ramalingam C
2018-10-23  9:22 ` [PATCH v5 2/4] drm/i915: hdcp_check_link only on CP_IRQ Ramalingam C
2018-10-23  9:22 ` [PATCH v5 3/4] drm/i915/debugfs: hdcp capability of a sink Ramalingam C
2018-10-23 14:04   ` Daniel Vetter [this message]
2018-10-23  9:22 ` [PATCH v5 4/4] drm/i915: Move the DDC/AUX failure msgs to debug log Ramalingam C
2018-10-23 10:41   ` [PATCH v6] " Ramalingam C
2018-10-23 14:05     ` Daniel Vetter
2018-10-24  7:34       ` Daniel Vetter
2018-10-23  9:37 ` ✗ Fi.CI.CHECKPATCH: warning for Enabling the IGT for HDCP1.4 (rev5) Patchwork
2018-10-23 10:02 ` ✗ Fi.CI.BAT: failure " Patchwork
2018-10-23 11:17 ` ✗ Fi.CI.CHECKPATCH: warning for Enabling the IGT for HDCP1.4 (rev6) Patchwork
2018-10-23 11:39 ` ✓ Fi.CI.BAT: success " Patchwork
2018-10-23 14:07 ` ✗ Fi.CI.IGT: failure " Patchwork

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=20181023140400.GW324@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ramalingam.c@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.