Skip to content

Commit dc97ec8

Browse files
h-shenoygregkh
authored andcommitted
drm/bridge: cadence: cdns-mhdp8546-core: Handle HDCP state in bridge atomic check
[ Upstream commit 4a8edd6 ] Now that we have DRM_BRIDGE_ATTACH_NO_CONNECTOR framework, handle the HDCP state change in bridge atomic check as well to enable correct functioning for HDCP in both DRM_BRIDGE_ATTACH_NO_CONNECTOR and !DRM_BRIDGE_ATTACH_NO_CONNECTOR case. Without this patch, when using DRM_BRIDGE_ATTACH_NO_CONNECTOR flag, HDCP state changes would not be properly handled during atomic commits, potentially leading to HDCP authentication failures or incorrect protection status for content requiring HDCP encryption. Fixes: 6a3608e ("drm: bridge: cdns-mhdp8546: Enable HDCP") Signed-off-by: Harikrishna Shenoy <h-shenoy@ti.com> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Link: https://patch.msgid.link/20251209120332.3559893-4-h-shenoy@ti.com Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent b01a582 commit dc97ec8

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2196,6 +2196,10 @@ static int cdns_mhdp_atomic_check(struct drm_bridge *bridge,
21962196
{
21972197
struct cdns_mhdp_device *mhdp = bridge_to_mhdp(bridge);
21982198
const struct drm_display_mode *mode = &crtc_state->adjusted_mode;
2199+
struct drm_connector_state *old_state, *new_state;
2200+
struct drm_atomic_state *state = crtc_state->state;
2201+
struct drm_connector *conn = mhdp->connector_ptr;
2202+
u64 old_cp, new_cp;
21992203

22002204
mutex_lock(&mhdp->link_mutex);
22012205

@@ -2215,6 +2219,25 @@ static int cdns_mhdp_atomic_check(struct drm_bridge *bridge,
22152219
if (mhdp->info)
22162220
bridge_state->input_bus_cfg.flags = *mhdp->info->input_bus_flags;
22172221

2222+
if (conn && mhdp->hdcp_supported) {
2223+
old_state = drm_atomic_get_old_connector_state(state, conn);
2224+
new_state = drm_atomic_get_new_connector_state(state, conn);
2225+
old_cp = old_state->content_protection;
2226+
new_cp = new_state->content_protection;
2227+
2228+
if (old_state->hdcp_content_type != new_state->hdcp_content_type &&
2229+
new_cp != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
2230+
new_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;
2231+
crtc_state = drm_atomic_get_new_crtc_state(state, new_state->crtc);
2232+
crtc_state->mode_changed = true;
2233+
}
2234+
2235+
if (!new_state->crtc) {
2236+
if (old_cp == DRM_MODE_CONTENT_PROTECTION_ENABLED)
2237+
new_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;
2238+
}
2239+
}
2240+
22182241
mutex_unlock(&mhdp->link_mutex);
22192242
return 0;
22202243
}

0 commit comments

Comments
 (0)