summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJi Soo Shin <jisshin@google.com>2023-12-19 12:41:34 +0000
committerJi Soo Shin <jisshin@google.com>2024-01-19 14:48:23 +0000
commita58fa84d6dfff96777b7acae1d99e64d8e250b7a (patch)
tree79cf9537061641a9277fb8df44262169781d0b06
parentc9d6903081e9e7453797986bb48d7d7fb3578af0 (diff)
downloadsamsung-android-gs-shusky-5.15-android14-qpr3-beta.tar.gz
Bug: 303820069 Bug: 316869499 Bug: 320577683 Bug: 317854575 Change-Id: I29219338dc43f2ca6f3aa5a72188cbc4300ce336 Signed-off-by: Ji Soo Shin <jisshin@google.com>
-rw-r--r--auth-control.c53
-rw-r--r--auth13.c3
-rw-r--r--auth22.c6
-rw-r--r--exynos-hdcp-interface.h5
4 files changed, 53 insertions, 14 deletions
diff --git a/auth-control.c b/auth-control.c
index f1cd0fb..37bb48d 100644
--- a/auth-control.c
+++ b/auth-control.c
@@ -30,6 +30,13 @@ module_param(max_ver, ulong, 0664);
MODULE_PARM_DESC(max_ver,
"support up to specific hdcp version by setting max_ver=x");
+static unsigned long max_retry_count = 5;
+module_param(max_retry_count, ulong, 0664);
+MODULE_PARM_DESC(max_retry_count,
+ "set number of allowed retry times by setting max_retry_count=x");
+
+static uint32_t hdcp_auth_try_count = 0;
+
int hdcp_get_auth_state(void) {
return state;
}
@@ -50,7 +57,7 @@ static int run_hdcp2_auth(void) {
} else if (ret != -EAGAIN) {
return ret;
}
- hdcp_info("HDCP22 Retry...\n");
+ hdcp_info("HDCP22 Retry(%d)...\n", i);
}
return -EIO;
@@ -103,23 +110,45 @@ static void hdcp_worker(struct work_struct *work) {
}
void hdcp_dplink_handle_irq(void) {
- if (state == HDCP2_AUTH_PROGRESS || state == HDCP2_AUTH_DONE) {
- if (hdcp22_dplink_handle_irq() == -EAGAIN)
- schedule_delayed_work(&hdcp_dev->hdcp_work, 0);
- return;
+ int ret = 0;
+
+ switch (state) {
+ case HDCP2_AUTH_PROGRESS:
+ hdcp22_dplink_handle_irq();
+ break;
+ case HDCP2_AUTH_DONE:
+ ret = hdcp22_dplink_handle_irq();
+ break;
+ case HDCP1_AUTH_DONE:
+ ret = hdcp13_dplink_handle_irq();
+ break;
+ default:
+ hdcp_info("HDCP irq ignored during state(%d)\n", state);
}
- if (state == HDCP1_AUTH_DONE) {
- if (hdcp13_dplink_handle_irq() == -EAGAIN)
- schedule_delayed_work(&hdcp_dev->hdcp_work, 0);
- return;
+ if (ret == -EFAULT) {
+ if (hdcp_auth_try_count >= max_retry_count) {
+ hdcp_err("HDCP disabled until next physical re-connect"\
+ "tried %lu times\n", max_retry_count);
+ return;
+ }
+ hdcp_auth_try_count++;
}
+
+ if (ret == -EAGAIN || ret == -EFAULT)
+ schedule_delayed_work(&hdcp_dev->hdcp_work, 0);
}
EXPORT_SYMBOL_GPL(hdcp_dplink_handle_irq);
void hdcp_dplink_connect_state(enum dp_state dp_hdcp_state) {
hdcp_info("Displayport connect info (%d)\n", dp_hdcp_state);
+
+ if (dp_hdcp_state == DP_PHYSICAL_DISCONNECT) {
+ hdcp_auth_try_count = 0;
+ return;
+ }
+
hdcp_tee_connect_info((int)dp_hdcp_state);
if (dp_hdcp_state == DP_DISCONNECT) {
hdcp13_dplink_abort();
@@ -131,6 +160,12 @@ void hdcp_dplink_connect_state(enum dp_state dp_hdcp_state) {
return;
}
+ if (hdcp_auth_try_count >= max_retry_count) {
+ hdcp_err("HDCP disabled until next physical re-connect"\
+ "tried %lu times\n", max_retry_count);
+ return;
+ }
+ hdcp_auth_try_count++;
schedule_delayed_work(&hdcp_dev->hdcp_work,
msecs_to_jiffies(HDCP_SCHEDULE_DELAY_MSEC));
return;
diff --git a/auth13.c b/auth13.c
index ac41a96..d38e876 100644
--- a/auth13.c
+++ b/auth13.c
@@ -258,8 +258,9 @@ int hdcp13_dplink_handle_irq(void)
bstatus & DP_BSTATUS_REAUTH_REQ) {
hdcp_err("Resetting link and encryption\n");
hdcp_tee_disable_enc();
- return -EAGAIN;
+ return -EFAULT;
}
+ hdcp_err("unexpected BStatus(0x%x). ignore\n", bstatus);
return 0;
}
diff --git a/auth22.c b/auth22.c
index 874b349..c1802fc 100644
--- a/auth22.c
+++ b/auth22.c
@@ -170,12 +170,14 @@ int hdcp22_dplink_handle_irq(void) {
if (HDCP_2_2_DP_RXSTATUS_LINK_FAILED(rxstatus)) {
hdcp_info("integrity check fail.\n");
+ hdcp22_dplink_abort();
hdcp_tee_disable_enc();
- return 0;
+ return -EFAULT;
} else if (HDCP_2_2_DP_RXSTATUS_REAUTH_REQ(rxstatus)) {
hdcp_info("reauth requested.\n");
+ hdcp22_dplink_abort();
hdcp_tee_disable_enc();
- return -EAGAIN;
+ return -EFAULT;
} else if (HDCP_2_2_DP_RXSTATUS_PAIRING(rxstatus)) {
hdcp_info("pairing avaible\n");
lkd.pairing_ready = 1;
diff --git a/exynos-hdcp-interface.h b/exynos-hdcp-interface.h
index c2c630c..ed73f9f 100644
--- a/exynos-hdcp-interface.h
+++ b/exynos-hdcp-interface.h
@@ -13,8 +13,9 @@
/* Displayport */
enum dp_state {
- DP_DISCONNECT,
- DP_CONNECT,
+ DP_DISCONNECT, /* HPD off */
+ DP_CONNECT, /* HPD on */
+ DP_PHYSICAL_DISCONNECT,
};
void hdcp_dplink_connect_state(enum dp_state state);