summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhung Cheng <ahcheng@nvidia.com>2021-11-26 06:17:13 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2022-01-07 09:10:37 -0500
commitaead036da110062df01a7a4f92592e95f3970a18 (patch)
tree48b1dc71283fbbfb60abd8435bd2e66617d443a5
parent14b4a6ed4d7b0aa1f3fb340be01a47241401d4c2 (diff)
tegra: hdcp: update policy init value
Update hdcp policy init value based on availability of HDCP TA for L4T Bug 3167119 Change-Id: I81e4f02b20214fb23c94756804448fa0ae80246b Signed-off-by: Ahung Cheng <ahcheng@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2632879 Reviewed-by: Ilhan Gurel <igurel@nvidia.com> Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
-rw-r--r--drivers/video/tegra/dc/hdcp/dphdcp.c22
-rw-r--r--drivers/video/tegra/dc/hdcp/dphdcp.h3
-rw-r--r--drivers/video/tegra/dc/hdcp/hdmihdcp.c137
-rw-r--r--drivers/video/tegra/dc/hdcp/hdmihdcp.h3
4 files changed, 92 insertions, 73 deletions
diff --git a/drivers/video/tegra/dc/hdcp/dphdcp.c b/drivers/video/tegra/dc/hdcp/dphdcp.c
index 260a20018..b81e6b162 100644
--- a/drivers/video/tegra/dc/hdcp/dphdcp.c
+++ b/drivers/video/tegra/dc/hdcp/dphdcp.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * dphdcp.c: dp hdcp driver. 2 * dphdcp.c: dp hdcp driver.
3 * 3 *
4 * Copyright (c) 2015-2020, NVIDIA CORPORATION, All rights reserved. 4 * Copyright (c) 2015-2021, NVIDIA CORPORATION, All rights reserved.
5 * 5 *
6 * This software is licensed under the terms of the GNU General Public 6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and 7 * License version 2, as published by the Free Software Foundation, and
@@ -2196,7 +2196,27 @@ static int dphdcp_dev_open(struct inode *inode, struct file *filp)
2196 struct miscdevice *miscdev = filp->private_data; 2196 struct miscdevice *miscdev = filp->private_data;
2197 struct tegra_dphdcp *dphdcp = 2197 struct tegra_dphdcp *dphdcp =
2198 container_of(miscdev, struct tegra_dphdcp, miscdev); 2198 container_of(miscdev, struct tegra_dphdcp, miscdev);
2199#ifndef CONFIG_ANDROID
2200 int err = 0;
2201#endif
2199 filp->private_data = dphdcp; 2202 filp->private_data = dphdcp;
2203
2204/* enable policy only if HDCP TA is ready */
2205#ifndef CONFIG_ANDROID
2206 if (!dphdcp->policy_initialized) {
2207 dphdcp->policy_initialized = true;
2208
2209 err = te_open_trusted_session(HDCP_PORT_NAME, &dphdcp->ta_ctx);
2210 if (!err)
2211 tegra_dphdcp_set_policy(dphdcp,
2212 TEGRA_DC_HDCP_POLICY_ALWAYS_ON);
2213
2214 if (dphdcp->ta_ctx) {
2215 te_close_trusted_session(dphdcp->ta_ctx);
2216 dphdcp->ta_ctx = NULL;
2217 }
2218 }
2219#endif
2200 return 0; 2220 return 0;
2201} 2221}
2202 2222
diff --git a/drivers/video/tegra/dc/hdcp/dphdcp.h b/drivers/video/tegra/dc/hdcp/dphdcp.h
index 21ad10d3e..0293cfb73 100644
--- a/drivers/video/tegra/dc/hdcp/dphdcp.h
+++ b/drivers/video/tegra/dc/hdcp/dphdcp.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * dphdcp.h: dp hdcp driver. 2 * dphdcp.h: dp hdcp driver.
3 * 3 *
4 * Copyright (c) 2015-2019, NVIDIA CORPORATION, All rights reserved. 4 * Copyright (c) 2015-2021, NVIDIA CORPORATION, All rights reserved.
5 * 5 *
6 * This software is licensed under the terms of the GNU General Public 6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and 7 * License version 2, as published by the Free Software Foundation, and
@@ -75,6 +75,7 @@ struct tegra_dphdcp {
75 u8 hpd; 75 u8 hpd;
76 u8 repeater; 76 u8 repeater;
77 void *ta_ctx; 77 void *ta_ctx;
78 bool policy_initialized;
78}; 79};
79 80
80#ifdef CONFIG_DPHDCP 81#ifdef CONFIG_DPHDCP
diff --git a/drivers/video/tegra/dc/hdcp/hdmihdcp.c b/drivers/video/tegra/dc/hdcp/hdmihdcp.c
index 89dd5ef5a..97398e8bc 100644
--- a/drivers/video/tegra/dc/hdcp/hdmihdcp.c
+++ b/drivers/video/tegra/dc/hdcp/hdmihdcp.c
@@ -847,7 +847,6 @@ static int get_srm_signature(struct hdcp_context_t *hdcp_context,
847#else 847#else
848 err = te_launch_trusted_oper(pkt, PKT_SIZE, HDCP_CMD_GEN_CMAC, ta_ctx); 848 err = te_launch_trusted_oper(pkt, PKT_SIZE, HDCP_CMD_GEN_CMAC, ta_ctx);
849#endif 849#endif
850
851 if (err) 850 if (err)
852 nvhdcp_err("te launch operation failed with error %d\n", err); 851 nvhdcp_err("te launch operation failed with error %d\n", err);
853 return err; 852 return err;
@@ -1037,6 +1036,51 @@ static int get_repeater_info(struct tegra_nvhdcp *nvhdcp)
1037 return 0; 1036 return 0;
1038} 1037}
1039 1038
1039static int nvhdcp_te_open(struct tegra_nvhdcp *nvhdcp)
1040{
1041 int err = 0;
1042
1043#ifdef CONFIG_TRUSTED_LITTLE_KERNEL
1044 /* differentiate between TLK and trusty */
1045 if (te_is_secos_dev_enabled()) {
1046 err = te_open_trusted_session_tlk(hdcp_uuid, sizeof(hdcp_uuid),
1047 &session_id);
1048 } else {
1049 nvhdcp->ta_ctx = NULL;
1050 /* Open a trusted sesion with HDCP TA */
1051 err = te_open_trusted_session(HDCP_PORT_NAME, &nvhdcp->ta_ctx);
1052 }
1053#else
1054 nvhdcp->ta_ctx = NULL;
1055 /* Open a trusted sesion with HDCP TA */
1056 err = te_open_trusted_session(HDCP_PORT_NAME, &nvhdcp->ta_ctx);
1057#endif
1058 return err;
1059}
1060
1061static void nvhdcp_te_close(struct tegra_nvhdcp *nvhdcp)
1062{
1063#ifdef CONFIG_TRUSTED_LITTLE_KERNEL
1064 if (te_is_secos_dev_enabled()) {
1065 if (session_id) {
1066 te_close_trusted_session_tlk(session_id, hdcp_uuid,
1067 sizeof(hdcp_uuid));
1068 session_id = 0;
1069 }
1070 } else {
1071 if (nvhdcp->ta_ctx) {
1072 te_close_trusted_session(nvhdcp->ta_ctx);
1073 nvhdcp->ta_ctx = NULL;
1074 }
1075 }
1076#else
1077 if (nvhdcp->ta_ctx) {
1078 te_close_trusted_session(nvhdcp->ta_ctx);
1079 nvhdcp->ta_ctx = NULL;
1080 }
1081#endif
1082}
1083
1040static int nvhdcp_ake_init_send(struct tegra_nvhdcp *nvhdcp, u8 *buf) 1084static int nvhdcp_ake_init_send(struct tegra_nvhdcp *nvhdcp, u8 *buf)
1041{ 1085{
1042 int e; 1086 int e;
@@ -1286,22 +1330,7 @@ static int tsec_hdcp_authentication(struct tegra_nvhdcp *nvhdcp,
1286 if (err) 1330 if (err)
1287 goto exit; 1331 goto exit;
1288 1332
1289#ifdef CONFIG_TRUSTED_LITTLE_KERNEL 1333 err = nvhdcp_te_open(nvhdcp);
1290 /* differentiate between TLK and trusty */
1291 if (te_is_secos_dev_enabled()) {
1292 err = te_open_trusted_session_tlk(hdcp_uuid, sizeof(hdcp_uuid),
1293 &session_id);
1294 } else {
1295 nvhdcp->ta_ctx = NULL;
1296 /* Open a trusted sesion with HDCP TA */
1297 err = te_open_trusted_session(HDCP_PORT_NAME, &nvhdcp->ta_ctx);
1298 }
1299#else
1300 nvhdcp->ta_ctx = NULL;
1301 /* Open a trusted sesion with HDCP TA */
1302 err = te_open_trusted_session(HDCP_PORT_NAME, &nvhdcp->ta_ctx);
1303#endif
1304
1305 if (err) { 1334 if (err) {
1306 nvhdcp_err("Error opening trusted session\n"); 1335 nvhdcp_err("Error opening trusted session\n");
1307 goto exit; 1336 goto exit;
@@ -1476,27 +1505,7 @@ exit:
1476 if (err) 1505 if (err)
1477 nvhdcp_err("HDCP authentication failed with err %d\n", err); 1506 nvhdcp_err("HDCP authentication failed with err %d\n", err);
1478 kfree(pkt); 1507 kfree(pkt);
1479 1508 nvhdcp_te_close(nvhdcp);
1480#ifdef CONFIG_TRUSTED_LITTLE_KERNEL
1481 if (te_is_secos_dev_enabled()) {
1482 if (session_id) {
1483 te_close_trusted_session_tlk(session_id, hdcp_uuid,
1484 sizeof(hdcp_uuid));
1485 session_id = 0;
1486 }
1487 } else {
1488 if (nvhdcp->ta_ctx) {
1489 te_close_trusted_session(nvhdcp->ta_ctx);
1490 nvhdcp->ta_ctx = NULL;
1491 }
1492 }
1493#else
1494 if (nvhdcp->ta_ctx) {
1495 te_close_trusted_session(nvhdcp->ta_ctx);
1496 nvhdcp->ta_ctx = NULL;
1497 }
1498#endif
1499
1500 return err; 1509 return err;
1501} 1510}