Skip to content

Commit d7b0489

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 1a9bef1 commit d7b0489

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
@@ -2123,6 +2123,10 @@ static int cdns_mhdp_atomic_check(struct drm_bridge *bridge,
21232123
{
21242124
struct cdns_mhdp_device *mhdp = bridge_to_mhdp(bridge);
21252125
const struct drm_display_mode *mode = &crtc_state->adjusted_mode;
2126+
struct drm_connector_state *old_state, *new_state;
2127+
struct drm_atomic_state *state = crtc_state->state;
2128+
struct drm_connector *conn = mhdp->connector_ptr;
2129+
u64 old_cp, new_cp;
21262130

21272131
mutex_lock(&mhdp->link_mutex);
21282132

@@ -2142,6 +2146,25 @@ static int cdns_mhdp_atomic_check(struct drm_bridge *bridge,
21422146
if (mhdp->info)
21432147
bridge_state->input_bus_cfg.flags = *mhdp->info->input_bus_flags;
21442148

2149+
if (conn && mhdp->hdcp_supported) {
2150+
old_state = drm_atomic_get_old_connector_state(state, conn);
2151+
new_state = drm_atomic_get_new_connector_state(state, conn);
2152+
old_cp = old_state->content_protection;
2153+
new_cp = new_state->content_protection;
2154+
2155+
if (old_state->hdcp_content_type != new_state->hdcp_content_type &&
2156+
new_cp != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
2157+
new_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;
2158+
crtc_state = drm_atomic_get_new_crtc_state(state, new_state->crtc);
2159+
crtc_state->mode_changed = true;
2160+
}
2161+
2162+
if (!new_state->crtc) {
2163+
if (old_cp == DRM_MODE_CONTENT_PROTECTION_ENABLED)
2164+
new_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;
2165+
}
2166+
}
2167+
21452168
mutex_unlock(&mhdp->link_mutex);
21462169
return 0;
21472170
}

0 commit comments

Comments
 (0)