Re: [PATCH] drm/amd/display: add HDCP caps debugfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2020-02-24 2:55 p.m., Bhawanpreet Lakha wrote:
> Add debugfs to get HDCP capability. This is also useful for
> kms_content_protection igt test.
> 
> Use:
> 	cat /sys/kernel/debug/dri/0/DP-1/hdcp_sink_capability
> 	cat /sys/kernel/debug/dri/0/HDMI-A-1/hdcp_sink_capability
> 
> Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@xxxxxxx>
> ---
>  .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 61 +++++++++++++++++++
>  1 file changed, 61 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> index ead5c05eec92..52982c8c871f 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> @@ -815,6 +815,44 @@ static int vrr_range_show(struct seq_file *m, void *data)
>  	return 0;
>  }
>  
> +#ifdef CONFIG_DRM_AMD_DC_HDCP
> +/*
> + * Returns the HDCP capability of the Display (1.4 for now).
> + *
> + * NOTE* Not all HDMI displays report their HDCP caps even when they are capable.
> + * Since its rare for a display to not be HDCP 1.4 capable, we set HDMI as always capable.
> + *
> + * Example usage: cat /sys/kernel/debug/dri/0/DP-1/hdcp_sink_capability
> + *		or cat /sys/kernel/debug/dri/0/HDMI-A-1/hdcp_sink_capability
> + */
> +static int hdcp_sink_capability_show(struct seq_file *m, void *data)
> +{
> +	struct drm_connector *connector = m->private;
> +	struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
> +	bool hdcp_cap, hdcp2_cap;
> +
> +	if (connector->status != connector_status_connected)
> +		return -ENODEV;
> +
> +	seq_printf(m, "%s:%d HDCP version: ", connector->name, connector->base.id);
> +
> +	hdcp_cap = dc_link_is_hdcp14(aconnector->dc_link);
> +	hdcp2_cap = dc_link_is_hdcp22(aconnector->dc_link);
> +
> +
> +	if (hdcp_cap)
> +		seq_printf(m, "%s ", "HDCP1.4");
> +	if (hdcp2_cap)
> +		seq_printf(m, "%s ", "HDCP2.2");
> +
> +	if (!hdcp_cap && !hdcp2_cap)
> +		seq_printf(m, "%s ", "None");
> +
> +	seq_puts(m, "\n");
> +
> +	return 0;
> +}
> +#endif
>  /* function description
>   *
>   * generic SDP message access for testing
> @@ -940,6 +978,9 @@ static ssize_t dp_dpcd_data_read(struct file *f, char __user *buf,
>  DEFINE_SHOW_ATTRIBUTE(dmub_tracebuffer);
>  DEFINE_SHOW_ATTRIBUTE(output_bpc);
>  DEFINE_SHOW_ATTRIBUTE(vrr_range);
> +#ifdef CONFIG_DRM_AMD_DC_HDCP
> +DEFINE_SHOW_ATTRIBUTE(hdcp_sink_capability);
> +#endif
>  
>  static const struct file_operations dp_link_settings_debugfs_fops = {
>  	.owner = THIS_MODULE,
> @@ -995,12 +1036,23 @@ static const struct {
>  		{"test_pattern", &dp_phy_test_pattern_fops},
>  		{"output_bpc", &output_bpc_fops},
>  		{"vrr_range", &vrr_range_fops},
> +#ifdef CONFIG_DRM_AMD_DC_HDCP
> +		{"hdcp_sink_capability", &hdcp_sink_capability_fops},
> +#endif
>  		{"sdp_message", &sdp_message_fops},
>  		{"aux_dpcd_address", &dp_dpcd_address_debugfs_fops},
>  		{"aux_dpcd_size", &dp_dpcd_size_debugfs_fops},
>  		{"aux_dpcd_data", &dp_dpcd_data_debugfs_fops}
>  };
>  
> +#ifdef CONFIG_DRM_AMD_DC_HDCP
> +static const struct {
> +	char *name;
> +	const struct file_operations *fops;
> +} hdmi_debugfs_entries[] = {
> +		{"hdcp_sink_capability", &hdcp_sink_capability_fops}
> +};
> +#endif
>  /*
>   * Force YUV420 output if available from the given mode
>   */
> @@ -1066,6 +1118,15 @@ void connector_debugfs_init(struct amdgpu_dm_connector *connector)
>  	debugfs_create_file_unsafe("force_yuv420_output", 0644, dir, connector,
>  				   &force_yuv420_output_fops);
>  
> +#ifdef CONFIG_DRM_AMD_DC_HDCP
> +	if (connector->base.connector_type == DRM_MODE_CONNECTOR_HDMIA) {

Your patch description mentions DP and HDMI but here you're only
creating it for HDMI. Should we create it for all HDCP-capable signal
types, i.e. DP and HDMI?

Harry

> +		for (i = 0; i < ARRAY_SIZE(hdmi_debugfs_entries); i++) {
> +			debugfs_create_file(hdmi_debugfs_entries[i].name,
> +					    0644, dir, connector,
> +					    hdmi_debugfs_entries[i].fops);
> +		}
> +	}
> +#endif
>  }
>  
>  /*
> 
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux