1*6a3608eaSParshuram Thombare /* SPDX-License-Identifier: GPL-2.0 */ 2*6a3608eaSParshuram Thombare /* 3*6a3608eaSParshuram Thombare * Cadence MHDP8546 DP bridge driver. 4*6a3608eaSParshuram Thombare * 5*6a3608eaSParshuram Thombare * Copyright (C) 2020 Cadence Design Systems, Inc. 6*6a3608eaSParshuram Thombare * 7*6a3608eaSParshuram Thombare */ 8*6a3608eaSParshuram Thombare 9*6a3608eaSParshuram Thombare #ifndef CDNS_MHDP8546_HDCP_H 10*6a3608eaSParshuram Thombare #define CDNS_MHDP8546_HDCP_H 11*6a3608eaSParshuram Thombare 12*6a3608eaSParshuram Thombare #include "cdns-mhdp8546-core.h" 13*6a3608eaSParshuram Thombare 14*6a3608eaSParshuram Thombare #define HDCP_MAX_RECEIVERS 32 15*6a3608eaSParshuram Thombare #define HDCP_RECEIVER_ID_SIZE_BYTES 5 16*6a3608eaSParshuram Thombare #define HDCP_STATUS_SIZE 0x5 17*6a3608eaSParshuram Thombare #define HDCP_PORT_STS_AUTH 0x1 18*6a3608eaSParshuram Thombare #define HDCP_PORT_STS_LAST_ERR_SHIFT 0x5 19*6a3608eaSParshuram Thombare #define HDCP_PORT_STS_LAST_ERR_MASK (0x0F << 5) 20*6a3608eaSParshuram Thombare #define GET_HDCP_PORT_STS_LAST_ERR(__sts__) \ 21*6a3608eaSParshuram Thombare (((__sts__) & HDCP_PORT_STS_LAST_ERR_MASK) >> \ 22*6a3608eaSParshuram Thombare HDCP_PORT_STS_LAST_ERR_SHIFT) 23*6a3608eaSParshuram Thombare 24*6a3608eaSParshuram Thombare #define HDCP_CONFIG_1_4 BIT(0) /* use HDCP 1.4 only */ 25*6a3608eaSParshuram Thombare #define HDCP_CONFIG_2_2 BIT(1) /* use HDCP 2.2 only */ 26*6a3608eaSParshuram Thombare /* use All HDCP versions */ 27*6a3608eaSParshuram Thombare #define HDCP_CONFIG_ALL (BIT(0) | BIT(1)) 28*6a3608eaSParshuram Thombare #define HDCP_CONFIG_NONE 0 29*6a3608eaSParshuram Thombare 30*6a3608eaSParshuram Thombare enum { 31*6a3608eaSParshuram Thombare HDCP_GENERAL_SET_LC_128, 32*6a3608eaSParshuram Thombare HDCP_SET_SEED, 33*6a3608eaSParshuram Thombare }; 34*6a3608eaSParshuram Thombare 35*6a3608eaSParshuram Thombare enum { 36*6a3608eaSParshuram Thombare HDCP_TRAN_CONFIGURATION, 37*6a3608eaSParshuram Thombare HDCP2X_TX_SET_PUBLIC_KEY_PARAMS, 38*6a3608eaSParshuram Thombare HDCP2X_TX_SET_DEBUG_RANDOM_NUMBERS, 39*6a3608eaSParshuram Thombare HDCP2X_TX_RESPOND_KM, 40*6a3608eaSParshuram Thombare HDCP1_TX_SEND_KEYS, 41*6a3608eaSParshuram Thombare HDCP1_TX_SEND_RANDOM_AN, 42*6a3608eaSParshuram Thombare HDCP_TRAN_STATUS_CHANGE, 43*6a3608eaSParshuram Thombare HDCP2X_TX_IS_KM_STORED, 44*6a3608eaSParshuram Thombare HDCP2X_TX_STORE_KM, 45*6a3608eaSParshuram Thombare HDCP_TRAN_IS_REC_ID_VALID, 46*6a3608eaSParshuram Thombare HDCP_TRAN_RESPOND_RECEIVER_ID_VALID, 47*6a3608eaSParshuram Thombare HDCP_TRAN_TEST_KEYS, 48*6a3608eaSParshuram Thombare HDCP2X_TX_SET_KM_KEY_PARAMS, 49*6a3608eaSParshuram Thombare HDCP_NUM_OF_SUPPORTED_MESSAGES 50*6a3608eaSParshuram Thombare }; 51*6a3608eaSParshuram Thombare 52*6a3608eaSParshuram Thombare enum { 53*6a3608eaSParshuram Thombare HDCP_CONTENT_TYPE_0, 54*6a3608eaSParshuram Thombare HDCP_CONTENT_TYPE_1, 55*6a3608eaSParshuram Thombare }; 56*6a3608eaSParshuram Thombare 57*6a3608eaSParshuram Thombare #define DRM_HDCP_CHECK_PERIOD_MS (128 * 16) 58*6a3608eaSParshuram Thombare 59*6a3608eaSParshuram Thombare #define HDCP_PAIRING_R_ID 5 60*6a3608eaSParshuram Thombare #define HDCP_PAIRING_M_LEN 16 61*6a3608eaSParshuram Thombare #define HDCP_KM_LEN 16 62*6a3608eaSParshuram Thombare #define HDCP_PAIRING_M_EKH 16 63*6a3608eaSParshuram Thombare 64*6a3608eaSParshuram Thombare struct cdns_hdcp_pairing_data { 65*6a3608eaSParshuram Thombare u8 receiver_id[HDCP_PAIRING_R_ID]; 66*6a3608eaSParshuram Thombare u8 m[HDCP_PAIRING_M_LEN]; 67*6a3608eaSParshuram Thombare u8 km[HDCP_KM_LEN]; 68*6a3608eaSParshuram Thombare u8 ekh[HDCP_PAIRING_M_EKH]; 69*6a3608eaSParshuram Thombare }; 70*6a3608eaSParshuram Thombare 71*6a3608eaSParshuram Thombare enum { 72*6a3608eaSParshuram Thombare HDCP_TX_2, 73*6a3608eaSParshuram Thombare HDCP_TX_1, 74*6a3608eaSParshuram Thombare HDCP_TX_BOTH, 75*6a3608eaSParshuram Thombare }; 76*6a3608eaSParshuram Thombare 77*6a3608eaSParshuram Thombare #define DLP_MODULUS_N 384 78*6a3608eaSParshuram Thombare #define DLP_E 3 79*6a3608eaSParshuram Thombare 80*6a3608eaSParshuram Thombare struct cdns_hdcp_tx_public_key_param { 81*6a3608eaSParshuram Thombare u8 N[DLP_MODULUS_N]; 82*6a3608eaSParshuram Thombare u8 E[DLP_E]; 83*6a3608eaSParshuram Thombare }; 84*6a3608eaSParshuram Thombare 85*6a3608eaSParshuram Thombare int cdns_mhdp_hdcp_set_public_key_param(struct cdns_mhdp_device *mhdp, 86*6a3608eaSParshuram Thombare struct cdns_hdcp_tx_public_key_param *val); 87*6a3608eaSParshuram Thombare int cdns_mhdp_hdcp_set_lc(struct cdns_mhdp_device *mhdp, u8 *val); 88*6a3608eaSParshuram Thombare int cdns_mhdp_hdcp_enable(struct cdns_mhdp_device *mhdp, u8 content_type); 89*6a3608eaSParshuram Thombare int cdns_mhdp_hdcp_disable(struct cdns_mhdp_device *mhdp); 90*6a3608eaSParshuram Thombare void cdns_mhdp_hdcp_init(struct cdns_mhdp_device *mhdp); 91*6a3608eaSParshuram Thombare 92*6a3608eaSParshuram Thombare #endif 93