From bd67e25c0d20765b93a17848fd5f5c455bac960c Mon Sep 17 00:00:00 2001 From: Ji Soo Shin Date: Tue, 14 Nov 2023 14:54:32 +0000 Subject: hdcp: update protection level to drm connector Bug: 307592398 Change-Id: Ie3a7c3f690db74c59dfcca449b8d19f2b5c5ab63 Signed-off-by: Ji Soo Shin --- dpcd.c | 8 ++++++-- dpcd.h | 5 +++++ teeif.c | 20 +++++++++++++++++--- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/dpcd.c b/dpcd.c index 0c29913..fc75bdc 100644 --- a/dpcd.c +++ b/dpcd.c @@ -19,10 +19,14 @@ #include "dpcd.h" #include "hdcp-log.h" -static void (*pdp_hdcp22_enable)(u32 en); +static void (*pdp_hdcp_update_cp)(u32 drm_cp_status); static int (*pdp_dpcd_read_for_hdcp22)(u32 address, u32 length, u8 *data); static int (*pdp_dpcd_write_for_hdcp22)(u32 address, u32 length, u8 *data); +void hdcp_dplink_update_cp(uint32_t drm_cp_status) { + pdp_hdcp_update_cp(drm_cp_status); +} + int hdcp_dplink_recv(uint32_t addr, uint8_t *data, uint32_t size) { return pdp_dpcd_read_for_hdcp22(addr, size, data); @@ -35,7 +39,7 @@ int hdcp_dplink_send(uint32_t addr, uint8_t *data, uint32_t size) void dp_register_func_for_hdcp22(void (*func0)(u32 en), int (*func1)(u32 address, u32 length, u8 *data), int (*func2)(u32 address, u32 length, u8 *data)) { - pdp_hdcp22_enable = func0; + pdp_hdcp_update_cp = func0; pdp_dpcd_read_for_hdcp22 = func1; pdp_dpcd_write_for_hdcp22 = func2; } diff --git a/dpcd.h b/dpcd.h index ccbdb12..fb8cacb 100644 --- a/dpcd.h +++ b/dpcd.h @@ -11,6 +11,11 @@ #ifndef __EXYNOS_HDCP_DPCD_H__ #define __EXYNOS_HDCP_DPCD_H__ +/* Used to update the current authentication status through uevent. + * pass in either DRM_MODE_CONTENT_PROTECTION_ENABLED or + * DRM_MODE_CONTENT_PROTECTION_DESIRED */ +void hdcp_dplink_update_cp(uint32_t drm_cp_status); + int hdcp_dplink_recv(uint32_t msg_name, uint8_t *data, uint32_t size); int hdcp_dplink_send(uint32_t msg_name, uint8_t *data, uint32_t size); diff --git a/teeif.c b/teeif.c index 4ed2a81..f439b02 100644 --- a/teeif.c +++ b/teeif.c @@ -16,7 +16,9 @@ #include #include #include +#include +#include "dpcd.h" #include "teeif.h" #include "hdcp-log.h" @@ -249,15 +251,27 @@ int hdcp_tee_send_cmd(uint32_t cmd) { } int hdcp_tee_enable_enc_22(void) { - return hdcp_tee_comm_xchg(HDCP_CMD_ENCRYPTION_SET, HDCP_V2_3, NULL, - NULL); + int ret = hdcp_tee_comm_xchg(HDCP_CMD_ENCRYPTION_SET, HDCP_V2_3, NULL, + NULL); + if (ret) + return ret; + + hdcp_dplink_update_cp(DRM_MODE_CONTENT_PROTECTION_ENABLED); + return 0; } int hdcp_tee_enable_enc_13(void) { - return hdcp_tee_comm_xchg(HDCP_CMD_ENCRYPTION_SET, HDCP_V1, NULL, NULL); + int ret = hdcp_tee_comm_xchg(HDCP_CMD_ENCRYPTION_SET, HDCP_V1, NULL, + NULL); + if (ret) + return ret; + + hdcp_dplink_update_cp(DRM_MODE_CONTENT_PROTECTION_ENABLED); + return 0; } int hdcp_tee_disable_enc(void) { + hdcp_dplink_update_cp(DRM_MODE_CONTENT_PROTECTION_DESIRED); return hdcp_tee_comm_xchg(HDCP_CMD_ENCRYPTION_SET, HDCP_NONE, NULL, NULL); } -- cgit v1.2.3