blob: 4d48de8890ca03d07695987ea6fc0cfd5ad9126a [file] [log] [blame]
Ramalingam C1626eab2019-02-15 14:04:58 +05301/* SPDX-License-Identifier: (GPL-2.0+) */
2/*
Ramalingam C0dcceb32019-08-28 22:12:11 +05303 * Copyright © 2017-2019 Intel Corporation
Ramalingam C1626eab2019-02-15 14:04:58 +05304 *
5 * Authors:
6 * Ramalingam C <ramalingam.c@intel.com>
7 */
8
9#ifndef _I915_MEI_HDCP_INTERFACE_H_
10#define _I915_MEI_HDCP_INTERFACE_H_
11
12#include <linux/mutex.h>
13#include <linux/device.h>
14#include <drm/drm_hdcp.h>
15#include <drm/i915_drm.h>
16
17/**
18 * enum hdcp_port_type - HDCP port implementation type defined by ME FW
19 * @HDCP_PORT_TYPE_INVALID: Invalid hdcp port type
20 * @HDCP_PORT_TYPE_INTEGRATED: In-Host HDCP2.x port
21 * @HDCP_PORT_TYPE_LSPCON: HDCP2.2 discrete wired Tx port with LSPCON
22 * (HDMI 2.0) solution
23 * @HDCP_PORT_TYPE_CPDP: HDCP2.2 discrete wired Tx port using the CPDP (DP 1.3)
24 * solution
25 */
26enum hdcp_port_type {
27 HDCP_PORT_TYPE_INVALID,
28 HDCP_PORT_TYPE_INTEGRATED,
29 HDCP_PORT_TYPE_LSPCON,
30 HDCP_PORT_TYPE_CPDP
31};
32
33/**
34 * enum hdcp_wired_protocol - HDCP adaptation used on the port
35 * @HDCP_PROTOCOL_INVALID: Invalid HDCP adaptation protocol
36 * @HDCP_PROTOCOL_HDMI: HDMI adaptation of HDCP used on the port
37 * @HDCP_PROTOCOL_DP: DP adaptation of HDCP used on the port
38 */
39enum hdcp_wired_protocol {
40 HDCP_PROTOCOL_INVALID,
41 HDCP_PROTOCOL_HDMI,
42 HDCP_PROTOCOL_DP
43};
44
Ramalingam C0dcceb32019-08-28 22:12:11 +053045enum 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
Ramalingam C1626eab2019-02-15 14:04:58 +053057/**
Ramalingam C807c71d2019-08-28 22:12:13 +053058 * enum mei_fw_tc - ME Firmware defined index for transcoders
59 * @MEI_INVALID_TRANSCODER: Index for Invalid transcoder
60 * @MEI_TRANSCODER_EDP: Index for EDP Transcoder
61 * @MEI_TRANSCODER_DSI0: Index for DSI0 Transcoder
62 * @MEI_TRANSCODER_DSI1: Index for DSI1 Transcoder
63 * @MEI_TRANSCODER_A: Index for Transcoder A
64 * @MEI_TRANSCODER_B: Index for Transcoder B
65 * @MEI_TRANSCODER_C: Index for Transcoder C
66 * @MEI_TRANSCODER_D: Index for Transcoder D
67 */
68enum mei_fw_tc {
69 MEI_INVALID_TRANSCODER = 0x00,
70 MEI_TRANSCODER_EDP,
71 MEI_TRANSCODER_DSI0,
72 MEI_TRANSCODER_DSI1,
73 MEI_TRANSCODER_A = 0x10,
74 MEI_TRANSCODER_B,
75 MEI_TRANSCODER_C,
76 MEI_TRANSCODER_D
77};
78
79/**
Ramalingam C1626eab2019-02-15 14:04:58 +053080 * struct hdcp_port_data - intel specific HDCP port data
Ramalingam C0dcceb32019-08-28 22:12:11 +053081 * @fw_ddi: ddi index as per ME FW
Ramalingam C807c71d2019-08-28 22:12:13 +053082 * @fw_tc: transcoder index as per ME FW
Ramalingam C1626eab2019-02-15 14:04:58 +053083 * @port_type: HDCP port type as per ME FW classification
84 * @protocol: HDCP adaptation as per ME FW
85 * @k: No of streams transmitted on a port. Only on DP MST this is != 1
86 * @seq_num_m: Count of RepeaterAuth_Stream_Manage msg propagated.
87 * Initialized to 0 on AKE_INIT. Incremented after every successful
88 * transmission of RepeaterAuth_Stream_Manage message. When it rolls
89 * over re-Auth has to be triggered.
90 * @streams: struct hdcp2_streamid_type[k]. Defines the type and id for the
91 * streams
92 */
93struct hdcp_port_data {
Ramalingam C0dcceb32019-08-28 22:12:11 +053094 enum mei_fw_ddi fw_ddi;
Ramalingam C807c71d2019-08-28 22:12:13 +053095 enum mei_fw_tc fw_tc;
Ramalingam C1626eab2019-02-15 14:04:58 +053096 u8 port_type;
97 u8 protocol;
98 u16 k;
99 u32 seq_num_m;
100 struct hdcp2_streamid_type *streams;
101};
102
103/**
104 * struct i915_hdcp_component_ops- ops for HDCP2.2 services.
105 * @owner: Module providing the ops
106 * @initiate_hdcp2_session: Initiate a Wired HDCP2.2 Tx Session.
107 * And Prepare AKE_Init.
108 * @verify_receiver_cert_prepare_km: Verify the Receiver Certificate
109 * AKE_Send_Cert and prepare
110 AKE_Stored_Km/AKE_No_Stored_Km
111 * @verify_hprime: Verify AKE_Send_H_prime
112 * @store_pairing_info: Store pairing info received
113 * @initiate_locality_check: Prepare LC_Init
114 * @verify_lprime: Verify lprime
115 * @get_session_key: Prepare SKE_Send_Eks
116 * @repeater_check_flow_prepare_ack: Validate the Downstream topology
117 * and prepare rep_ack
118 * @verify_mprime: Verify mprime
119 * @enable_hdcp_authentication: Mark a port as authenticated.
120 * @close_hdcp_session: Close the Wired HDCP Tx session per port.
121 * This also disables the authenticated state of the port.
122 */
123struct i915_hdcp_component_ops {
124 /**
125 * @owner: mei_hdcp module
126 */
127 struct module *owner;
128
129 int (*initiate_hdcp2_session)(struct device *dev,
130 struct hdcp_port_data *data,
131 struct hdcp2_ake_init *ake_data);
132 int (*verify_receiver_cert_prepare_km)(struct device *dev,
133 struct hdcp_port_data *data,
134 struct hdcp2_ake_send_cert
135 *rx_cert,
136 bool *km_stored,
137 struct hdcp2_ake_no_stored_km
138 *ek_pub_km,
139 size_t *msg_sz);
140 int (*verify_hprime)(struct device *dev,
141 struct hdcp_port_data *data,
142 struct hdcp2_ake_send_hprime *rx_hprime);
143 int (*store_pairing_info)(struct device *dev,
144 struct hdcp_port_data *data,
145 struct hdcp2_ake_send_pairing_info
146 *pairing_info);
147 int (*initiate_locality_check)(struct device *dev,
148 struct hdcp_port_data *data,
149 struct hdcp2_lc_init *lc_init_data);
150 int (*verify_lprime)(struct device *dev,
151 struct hdcp_port_data *data,
152 struct hdcp2_lc_send_lprime *rx_lprime);
153 int (*get_session_key)(struct device *dev,
154 struct hdcp_port_data *data,
155 struct hdcp2_ske_send_eks *ske_data);
156 int (*repeater_check_flow_prepare_ack)(struct device *dev,
157 struct hdcp_port_data *data,
158 struct hdcp2_rep_send_receiverid_list
159 *rep_topology,
160 struct hdcp2_rep_send_ack
161 *rep_send_ack);
162 int (*verify_mprime)(struct device *dev,
163 struct hdcp_port_data *data,
164 struct hdcp2_rep_stream_ready *stream_ready);
165 int (*enable_hdcp_authentication)(struct device *dev,
166 struct hdcp_port_data *data);
167 int (*close_hdcp_session)(struct device *dev,
168 struct hdcp_port_data *data);
169};
170
171/**
172 * struct i915_hdcp_component_master - Used for communication between i915
173 * and mei_hdcp drivers for the HDCP2.2 services
174 * @mei_dev: device that provide the HDCP2.2 service from MEI Bus.
175 * @hdcp_ops: Ops implemented by mei_hdcp driver, used by i915 driver.
176 */
177struct i915_hdcp_comp_master {
178 struct device *mei_dev;
179 const struct i915_hdcp_component_ops *ops;
180
181 /* To protect the above members. */
182 struct mutex mutex;
183};
184
185#endif /* _I915_MEI_HDCP_INTERFACE_H_ */