From 172ea1ed543aa9f35b39d1bb31754bcfe49bcfe9 Mon Sep 17 00:00:00 2001 From: Abhinav Kumar Date: Mon, 20 Nov 2017 21:49:04 -0800 Subject: [PATCH] drm/msm: disable HDCP before turning off timing engine As per the hardware programming sequence, HDCP authentication process must start after turning ON the timing engine and the authentication process should be stopped before turning OFF the timing engine. Implement this sequence during the HDMI turn OFF sequence. Also, make sure to wait for one frame before disabling the DDC while turning OFF the HDCP. This is required to make sure we receive the HDCP encryption disabled interrupt before disabling the HW. Change-Id: I3174f51fe1b6ab578db2d38caaf761444e6ebd8f Signed-off-by: Abhinav Kumar --- drivers/gpu/drm/msm/hdmi-staging/sde_hdmi_bridge.c | 6 +++--- drivers/gpu/drm/msm/hdmi-staging/sde_hdmi_hdcp2p2.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi-staging/sde_hdmi_bridge.c b/drivers/gpu/drm/msm/hdmi-staging/sde_hdmi_bridge.c index 0c143059b749..b8aa29c13edf 100644 --- a/drivers/gpu/drm/msm/hdmi-staging/sde_hdmi_bridge.c +++ b/drivers/gpu/drm/msm/hdmi-staging/sde_hdmi_bridge.c @@ -578,6 +578,9 @@ static void _sde_hdmi_bridge_disable(struct drm_bridge *bridge) display->sink_hdcp_ver = SDE_HDMI_HDCP_NONE; display->sink_hdcp22_support = false; + if (sde_hdmi_tx_is_hdcp_enabled(display)) + sde_hdmi_hdcp_off(display); + sde_hdmi_clear_hdr_info(bridge); mutex_unlock(&display->display_lock); } @@ -592,9 +595,6 @@ static void _sde_hdmi_bridge_post_disable(struct drm_bridge *bridge) sde_hdmi_notify_clients(display, display->connected); - if (sde_hdmi_tx_is_hdcp_enabled(display)) - sde_hdmi_hdcp_off(display); - sde_hdmi_audio_off(hdmi); DRM_DEBUG("power down"); diff --git a/drivers/gpu/drm/msm/hdmi-staging/sde_hdmi_hdcp2p2.c b/drivers/gpu/drm/msm/hdmi-staging/sde_hdmi_hdcp2p2.c index 51f5c8d8dde6..a4f47756ad9b 100644 --- a/drivers/gpu/drm/msm/hdmi-staging/sde_hdmi_hdcp2p2.c +++ b/drivers/gpu/drm/msm/hdmi-staging/sde_hdmi_hdcp2p2.c @@ -234,10 +234,16 @@ static void sde_hdmi_hdcp2p2_off(void *input) flush_kthread_worker(&ctrl->worker); - sde_hdmi_hdcp2p2_ddc_disable((void *)ctrl->init_data.cb_data); - cdata.context = input; sde_hdmi_hdcp2p2_wakeup(&cdata); + + /* There could be upto one frame delay + * between the time encryption disable is + * requested till the time we get encryption + * disabled interrupt + */ + msleep(20); + sde_hdmi_hdcp2p2_ddc_disable((void *)ctrl->init_data.cb_data); } static int sde_hdmi_hdcp2p2_authenticate(void *input)