]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amd/display: remove magic numbers in hdcp_ddc
authorWenjing Liu <Wenjing.Liu@amd.com>
Fri, 28 Feb 2020 17:16:07 +0000 (12:16 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 19 Mar 2020 04:03:04 +0000 (00:03 -0400)
[why]
DP doesn't have message id as the first byte of an hdcp message,
current hdcp psp unifies HDMI and DP message so that it is required
when reading DP HDCP messages in hdcp_ddc, a message id needs to be
added as the first byte of the HDCP message.
The id is currently assigned as a magic number which is not a good
coding practice.

[how]
Replace magic numbers with macro defined in hdcp headers.

Signed-off-by: Wenjing Liu <Wenjing.Liu@amd.com>
Reviewed-by: Ashley Thomas <Ashley.Thomas2@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c

index 816759d10cbc20aedd7aacb18e4657b512735180..bb5130f4228dba70b0574b2e45a1569483cbe0d6 100644 (file)
@@ -408,7 +408,7 @@ enum mod_hdcp_status mod_hdcp_read_ake_cert(struct mod_hdcp *hdcp)
        enum mod_hdcp_status status;
 
        if (is_dp_hdcp(hdcp)) {
-               hdcp->auth.msg.hdcp2.ake_cert[0] = 3;
+               hdcp->auth.msg.hdcp2.ake_cert[0] = HDCP_2_2_AKE_SEND_CERT;
                status = read(hdcp, MOD_HDCP_MESSAGE_ID_READ_AKE_SEND_CERT,
                                hdcp->auth.msg.hdcp2.ake_cert+1,
                                sizeof(hdcp->auth.msg.hdcp2.ake_cert)-1);
@@ -426,7 +426,7 @@ enum mod_hdcp_status mod_hdcp_read_h_prime(struct mod_hdcp *hdcp)
        enum mod_hdcp_status status;
 
        if (is_dp_hdcp(hdcp)) {
-               hdcp->auth.msg.hdcp2.ake_h_prime[0] = 7;
+               hdcp->auth.msg.hdcp2.ake_h_prime[0] = HDCP_2_2_AKE_SEND_HPRIME;
                status = read(hdcp, MOD_HDCP_MESSAGE_ID_READ_AKE_SEND_H_PRIME,
                                hdcp->auth.msg.hdcp2.ake_h_prime+1,
                                sizeof(hdcp->auth.msg.hdcp2.ake_h_prime)-1);
@@ -444,7 +444,7 @@ enum mod_hdcp_status mod_hdcp_read_pairing_info(struct mod_hdcp *hdcp)
        enum mod_hdcp_status status;
 
        if (is_dp_hdcp(hdcp)) {
-               hdcp->auth.msg.hdcp2.ake_pairing_info[0] = 8;
+               hdcp->auth.msg.hdcp2.ake_pairing_info[0] = HDCP_2_2_AKE_SEND_PAIRING_INFO;
                status = read(hdcp, MOD_HDCP_MESSAGE_ID_READ_AKE_SEND_PAIRING_INFO,
                                hdcp->auth.msg.hdcp2.ake_pairing_info+1,
                                sizeof(hdcp->auth.msg.hdcp2.ake_pairing_info)-1);
@@ -462,7 +462,7 @@ enum mod_hdcp_status mod_hdcp_read_l_prime(struct mod_hdcp *hdcp)
        enum mod_hdcp_status status;
 
        if (is_dp_hdcp(hdcp)) {
-               hdcp->auth.msg.hdcp2.lc_l_prime[0] = 10;
+               hdcp->auth.msg.hdcp2.lc_l_prime[0] = HDCP_2_2_LC_SEND_LPRIME;
                status = read(hdcp, MOD_HDCP_MESSAGE_ID_READ_LC_SEND_L_PRIME,
                                hdcp->auth.msg.hdcp2.lc_l_prime+1,
                                sizeof(hdcp->auth.msg.hdcp2.lc_l_prime)-1);
@@ -484,7 +484,7 @@ enum mod_hdcp_status mod_hdcp_read_rx_id_list(struct mod_hdcp *hdcp)
                uint32_t rx_id_list_size = 0;
                uint32_t bytes_read = 0;
 
-               hdcp->auth.msg.hdcp2.rx_id_list[0] = 12;
+               hdcp->auth.msg.hdcp2.rx_id_list[0] = HDCP_2_2_REP_SEND_RECVID_LIST;
                status = read(hdcp, MOD_HDCP_MESSAGE_ID_READ_REPEATER_AUTH_SEND_RECEIVERID_LIST,
                                                hdcp->auth.msg.hdcp2.rx_id_list+1,
                                                HDCP_MAX_AUX_TRANSACTION_SIZE);
@@ -511,7 +511,7 @@ enum mod_hdcp_status mod_hdcp_read_stream_ready(struct mod_hdcp *hdcp)
        enum mod_hdcp_status status;
 
        if (is_dp_hdcp(hdcp)) {
-               hdcp->auth.msg.hdcp2.repeater_auth_stream_ready[0] = 17;
+               hdcp->auth.msg.hdcp2.repeater_auth_stream_ready[0] = HDCP_2_2_REP_STREAM_READY;
                status = read(hdcp, MOD_HDCP_MESSAGE_ID_READ_REPEATER_AUTH_STREAM_READY,
                                hdcp->auth.msg.hdcp2.repeater_auth_stream_ready+1,
                                sizeof(hdcp->auth.msg.hdcp2.repeater_auth_stream_ready)-1);