Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915: mei_hdcp: I915 sends ddi index as per ME FW

I915 converts it's port value into ddi index defiend by ME FW
and pass it as a member of hdcp_port_data structure.

Hence expose the enum mei_fw_ddi to I915 through
i915_mei_interface.h.

v2:
Copyright years are bumped [Tomas]

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190828164216.405-2-ramalingam.c@intel.com

authored by

Ramalingam C and committed by
Uma Shankar
0dcceb35 11988e39

+42 -39
+16 -1
drivers/gpu/drm/i915/display/intel_hdcp.c
··· 1 1 /* SPDX-License-Identifier: MIT */ 2 2 /* 3 3 * Copyright (C) 2017 Google, Inc. 4 + * Copyright _ 2017-2019, Intel Corporation. 4 5 * 5 6 * Authors: 6 7 * Sean Paul <seanpaul@chromium.org> 8 + * Ramalingam C <ramalingam.c@intel.com> 7 9 */ 8 10 9 11 #include <linux/component.h> ··· 1751 1749 .unbind = i915_hdcp_component_unbind, 1752 1750 }; 1753 1751 1752 + static inline 1753 + enum mei_fw_ddi intel_get_mei_fw_ddi_index(enum port port) 1754 + { 1755 + switch (port) { 1756 + case PORT_A: 1757 + return MEI_DDI_A; 1758 + case PORT_B ... PORT_F: 1759 + return (enum mei_fw_ddi)port; 1760 + default: 1761 + return MEI_DDI_INVALID_PORT; 1762 + } 1763 + } 1764 + 1754 1765 static inline int initialize_hdcp_port_data(struct intel_connector *connector, 1755 1766 const struct intel_hdcp_shim *shim) 1756 1767 { 1757 1768 struct intel_hdcp *hdcp = &connector->hdcp; 1758 1769 struct hdcp_port_data *data = &hdcp->port_data; 1759 1770 1760 - data->port = connector->encoder->port; 1771 + data->fw_ddi = intel_get_mei_fw_ddi_index(connector->encoder->port); 1761 1772 data->port_type = (u8)HDCP_PORT_TYPE_INTEGRATED; 1762 1773 data->protocol = (u8)shim->protocol; 1763 1774
+11 -23
drivers/misc/mei/hdcp/mei_hdcp.c
··· 27 27 28 28 #include "mei_hdcp.h" 29 29 30 - static inline u8 mei_get_ddi_index(enum port port) 31 - { 32 - switch (port) { 33 - case PORT_A: 34 - return MEI_DDI_A; 35 - case PORT_B ... PORT_F: 36 - return (u8)port; 37 - default: 38 - return MEI_DDI_INVALID_PORT; 39 - } 40 - } 41 - 42 30 /** 43 31 * mei_hdcp_initiate_session() - Initiate a Wired HDCP2.2 Tx Session in ME FW 44 32 * @dev: device corresponding to the mei_cl_device ··· 57 69 WIRED_CMD_BUF_LEN_INITIATE_HDCP2_SESSION_IN; 58 70 59 71 session_init_in.port.integrated_port_type = data->port_type; 60 - session_init_in.port.physical_port = mei_get_ddi_index(data->port); 72 + session_init_in.port.physical_port = (u8)data->fw_ddi; 61 73 session_init_in.protocol = data->protocol; 62 74 63 75 byte = mei_cldev_send(cldev, (u8 *)&session_init_in, ··· 126 138 WIRED_CMD_BUF_LEN_VERIFY_RECEIVER_CERT_IN; 127 139 128 140 verify_rxcert_in.port.integrated_port_type = data->port_type; 129 - verify_rxcert_in.port.physical_port = mei_get_ddi_index(data->port); 141 + verify_rxcert_in.port.physical_port = (u8)data->fw_ddi; 130 142 131 143 verify_rxcert_in.cert_rx = rx_cert->cert_rx; 132 144 memcpy(verify_rxcert_in.r_rx, &rx_cert->r_rx, HDCP_2_2_RRX_LEN); ··· 196 208 send_hprime_in.header.buffer_len = WIRED_CMD_BUF_LEN_AKE_SEND_HPRIME_IN; 197 209 198 210 send_hprime_in.port.integrated_port_type = data->port_type; 199 - send_hprime_in.port.physical_port = mei_get_ddi_index(data->port); 211 + send_hprime_in.port.physical_port = (u8)data->fw_ddi; 200 212 201 213 memcpy(send_hprime_in.h_prime, rx_hprime->h_prime, 202 214 HDCP_2_2_H_PRIME_LEN); ··· 253 265 WIRED_CMD_BUF_LEN_SEND_PAIRING_INFO_IN; 254 266 255 267 pairing_info_in.port.integrated_port_type = data->port_type; 256 - pairing_info_in.port.physical_port = mei_get_ddi_index(data->port); 268 + pairing_info_in.port.physical_port = (u8)data->fw_ddi; 257 269 258 270 memcpy(pairing_info_in.e_kh_km, pairing_info->e_kh_km, 259 271 HDCP_2_2_E_KH_KM_LEN); ··· 311 323 lc_init_in.header.buffer_len = WIRED_CMD_BUF_LEN_INIT_LOCALITY_CHECK_IN; 312 324 313 325 lc_init_in.port.integrated_port_type = data->port_type; 314 - lc_init_in.port.physical_port = mei_get_ddi_index(data->port); 326 + lc_init_in.port.physical_port = (u8)data->fw_ddi; 315 327 316 328 byte = mei_cldev_send(cldev, (u8 *)&lc_init_in, sizeof(lc_init_in)); 317 329 if (byte < 0) { ··· 366 378 WIRED_CMD_BUF_LEN_VALIDATE_LOCALITY_IN; 367 379 368 380 verify_lprime_in.port.integrated_port_type = data->port_type; 369 - verify_lprime_in.port.physical_port = mei_get_ddi_index(data->port); 381 + verify_lprime_in.port.physical_port = (u8)data->fw_ddi; 370 382 371 383 memcpy(verify_lprime_in.l_prime, rx_lprime->l_prime, 372 384 HDCP_2_2_L_PRIME_LEN); ··· 423 435 get_skey_in.header.buffer_len = WIRED_CMD_BUF_LEN_GET_SESSION_KEY_IN; 424 436 425 437 get_skey_in.port.integrated_port_type = data->port_type; 426 - get_skey_in.port.physical_port = mei_get_ddi_index(data->port); 438 + get_skey_in.port.physical_port = (u8)data->fw_ddi; 427 439 428 440 byte = mei_cldev_send(cldev, (u8 *)&get_skey_in, sizeof(get_skey_in)); 429 441 if (byte < 0) { ··· 487 499 WIRED_CMD_BUF_LEN_VERIFY_REPEATER_IN; 488 500 489 501 verify_repeater_in.port.integrated_port_type = data->port_type; 490 - verify_repeater_in.port.physical_port = mei_get_ddi_index(data->port); 502 + verify_repeater_in.port.physical_port = (u8)data->fw_ddi; 491 503 492 504 memcpy(verify_repeater_in.rx_info, rep_topology->rx_info, 493 505 HDCP_2_2_RXINFO_LEN); ··· 557 569 WIRED_CMD_BUF_LEN_REPEATER_AUTH_STREAM_REQ_MIN_IN; 558 570 559 571 verify_mprime_in.port.integrated_port_type = data->port_type; 560 - verify_mprime_in.port.physical_port = mei_get_ddi_index(data->port); 572 + verify_mprime_in.port.physical_port = (u8)data->fw_ddi; 561 573 562 574 memcpy(verify_mprime_in.m_prime, stream_ready->m_prime, 563 575 HDCP_2_2_MPRIME_LEN); ··· 618 630 enable_auth_in.header.buffer_len = WIRED_CMD_BUF_LEN_ENABLE_AUTH_IN; 619 631 620 632 enable_auth_in.port.integrated_port_type = data->port_type; 621 - enable_auth_in.port.physical_port = mei_get_ddi_index(data->port); 633 + enable_auth_in.port.physical_port = (u8)data->fw_ddi; 622 634 enable_auth_in.stream_type = data->streams[0].stream_type; 623 635 624 636 byte = mei_cldev_send(cldev, (u8 *)&enable_auth_in, ··· 672 684 WIRED_CMD_BUF_LEN_CLOSE_SESSION_IN; 673 685 674 686 session_close_in.port.integrated_port_type = data->port_type; 675 - session_close_in.port.physical_port = mei_get_ddi_index(data->port); 687 + session_close_in.port.physical_port = (u8)data->fw_ddi; 676 688 677 689 byte = mei_cldev_send(cldev, (u8 *)&session_close_in, 678 690 sizeof(session_close_in));
-12
drivers/misc/mei/hdcp/mei_hdcp.h
··· 362 362 struct hdcp_cmd_header header; 363 363 struct hdcp_port_id port; 364 364 } __packed; 365 - 366 - enum mei_fw_ddi { 367 - MEI_DDI_INVALID_PORT = 0x0, 368 - 369 - MEI_DDI_B = 1, 370 - MEI_DDI_C, 371 - MEI_DDI_D, 372 - MEI_DDI_E, 373 - MEI_DDI_F, 374 - MEI_DDI_A = 7, 375 - MEI_DDI_RANGE_END = MEI_DDI_A, 376 - }; 377 365 #endif /* __MEI_HDCP_H__ */
+15 -3
include/drm/i915_mei_hdcp_interface.h
··· 1 1 /* SPDX-License-Identifier: (GPL-2.0+) */ 2 2 /* 3 - * Copyright © 2017-2018 Intel Corporation 3 + * Copyright © 2017-2019 Intel Corporation 4 4 * 5 5 * Authors: 6 6 * Ramalingam C <ramalingam.c@intel.com> ··· 42 42 HDCP_PROTOCOL_DP 43 43 }; 44 44 45 + enum mei_fw_ddi { 46 + MEI_DDI_INVALID_PORT = 0x0, 47 + 48 + MEI_DDI_B = 1, 49 + MEI_DDI_C, 50 + MEI_DDI_D, 51 + MEI_DDI_E, 52 + MEI_DDI_F, 53 + MEI_DDI_A = 7, 54 + MEI_DDI_RANGE_END = MEI_DDI_A, 55 + }; 56 + 45 57 /** 46 58 * struct hdcp_port_data - intel specific HDCP port data 47 - * @port: port index as per I915 59 + * @fw_ddi: ddi index as per ME FW 48 60 * @port_type: HDCP port type as per ME FW classification 49 61 * @protocol: HDCP adaptation as per ME FW 50 62 * @k: No of streams transmitted on a port. Only on DP MST this is != 1 ··· 68 56 * streams 69 57 */ 70 58 struct hdcp_port_data { 71 - enum port port; 59 + enum mei_fw_ddi fw_ddi; 72 60 u8 port_type; 73 61 u8 protocol; 74 62 u16 k;