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