Skip to content

Commit 5b99dd1

Browse files
committed
drm/i915/hdcp: Create force_hdcp14 debug fs entry
Testing HDCP 1.4 becomes tough since the only way our code comes to HDCP 1.4 pathway is if the monitor only supports HDCP 1.4 which becomes tough to find sometimes. Setting this debug_fs entry will force use to use the HDCP 1.4 path so that more robust HDCP 1.4 testing can take place. --v2 -Move the code to intel_hdcp.c [Jani] -Remove useless debug logging [Jani] -Remove Force_HDCP from the debug file [Jani] --v3 -Remove leftover debug loggings [Jani] Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250213082541.3772212-1-suraj.kandpal@intel.com
1 parent 2ed653c commit 5b99dd1

File tree

2 files changed

+77
-1
lines changed

2 files changed

+77
-1
lines changed

drivers/gpu/drm/i915/display/intel_display_types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,8 @@ struct intel_hdcp {
496496
enum transcoder cpu_transcoder;
497497
/* Only used for DP MST stream encryption */
498498
enum transcoder stream_transcoder;
499+
/* Used to force HDCP 1.4 bypassing HDCP 2.x */
500+
bool force_hdcp14;
499501
};
500502

501503
struct intel_connector {

drivers/gpu/drm/i915/display/intel_hdcp.c

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2472,13 +2472,16 @@ static int _intel_hdcp_enable(struct intel_atomic_state *state,
24722472
* Considering that HDCP2.2 is more secure than HDCP1.4, If the setup
24732473
* is capable of HDCP2.2, it is preferred to use HDCP2.2.
24742474
*/
2475-
if (intel_hdcp2_get_capability(connector)) {
2475+
if (!hdcp->force_hdcp14 && intel_hdcp2_get_capability(connector)) {
24762476
ret = _intel_hdcp2_enable(state, connector);
24772477
if (!ret)
24782478
check_link_interval =
24792479
DRM_HDCP2_CHECK_PERIOD_MS;
24802480
}
24812481

2482+
if (hdcp->force_hdcp14)
2483+
drm_dbg_kms(display->drm, "Forcing HDCP 1.4\n");
2484+
24822485
/*
24832486
* When HDCP2.2 fails and Content Type is not Type1, HDCP1.4 will
24842487
* be attempted.
@@ -2806,6 +2809,75 @@ static int intel_hdcp_sink_capability_show(struct seq_file *m, void *data)
28062809
}
28072810
DEFINE_SHOW_ATTRIBUTE(intel_hdcp_sink_capability);
28082811

2812+
static ssize_t intel_hdcp_force_14_write(struct file *file,
2813+
const char __user *ubuf,
2814+
size_t len, loff_t *offp)
2815+
{
2816+
struct seq_file *m = file->private_data;
2817+
struct intel_connector *connector = m->private;
2818+
struct intel_hdcp *hdcp = &connector->hdcp;
2819+
bool force_hdcp14 = false;
2820+
int ret;
2821+
2822+
if (len == 0)
2823+
return 0;
2824+
2825+
ret = kstrtobool_from_user(ubuf, len, &force_hdcp14);
2826+
if (ret < 0)
2827+
return ret;
2828+
2829+
hdcp->force_hdcp14 = force_hdcp14;
2830+
*offp += len;
2831+
2832+
return len;
2833+
}
2834+
2835+
static int intel_hdcp_force_14_show(struct seq_file *m, void *data)
2836+
{
2837+
struct intel_connector *connector = m->private;
2838+
struct intel_display *display = to_intel_display(connector);
2839+
struct intel_encoder *encoder = intel_attached_encoder(connector);
2840+
struct intel_hdcp *hdcp = &connector->hdcp;
2841+
struct drm_crtc *crtc;
2842+
int ret;
2843+
2844+
if (!encoder)
2845+
return -ENODEV;
2846+
2847+
ret = drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
2848+
if (ret)
2849+
return ret;
2850+
2851+
crtc = connector->base.state->crtc;
2852+
if (connector->base.status != connector_status_connected || !crtc) {
2853+
ret = -ENODEV;
2854+
goto out;
2855+
}
2856+
2857+
seq_printf(m, "%s\n",
2858+
str_yes_no(hdcp->force_hdcp14));
2859+
out:
2860+
drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
2861+
2862+
return ret;
2863+
}
2864+
2865+
static int intel_hdcp_force_14_open(struct inode *inode,
2866+
struct file *file)
2867+
{
2868+
return single_open(file, intel_hdcp_force_14_show,
2869+
inode->i_private);
2870+
}
2871+
2872+
static const struct file_operations intel_hdcp_force_14_fops = {
2873+
.owner = THIS_MODULE,
2874+
.open = intel_hdcp_force_14_open,
2875+
.read = seq_read,
2876+
.llseek = seq_lseek,
2877+
.release = single_release,
2878+
.write = intel_hdcp_force_14_write
2879+
};
2880+
28092881
void intel_hdcp_connector_debugfs_add(struct intel_connector *connector)
28102882
{
28112883
struct dentry *root = connector->base.debugfs_entry;
@@ -2816,5 +2888,7 @@ void intel_hdcp_connector_debugfs_add(struct intel_connector *connector)
28162888
connector_type == DRM_MODE_CONNECTOR_HDMIB) {
28172889
debugfs_create_file("i915_hdcp_sink_capability", 0444, root,
28182890
connector, &intel_hdcp_sink_capability_fops);
2891+
debugfs_create_file("i915_force_hdcp14", 0644, root,
2892+
connector, &intel_hdcp_force_14_fops);
28192893
}
28202894
}

0 commit comments

Comments
 (0)