Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0+) */
0002 /*
0003  * Copyright © 2017-2019 Intel Corporation
0004  *
0005  * Authors:
0006  * Ramalingam C <ramalingam.c@intel.com>
0007  */
0008 
0009 #ifndef _I915_MEI_HDCP_INTERFACE_H_
0010 #define _I915_MEI_HDCP_INTERFACE_H_
0011 
0012 #include <linux/mutex.h>
0013 #include <linux/device.h>
0014 #include <drm/display/drm_hdcp.h>
0015 
0016 /**
0017  * enum hdcp_port_type - HDCP port implementation type defined by ME FW
0018  * @HDCP_PORT_TYPE_INVALID: Invalid hdcp port type
0019  * @HDCP_PORT_TYPE_INTEGRATED: In-Host HDCP2.x port
0020  * @HDCP_PORT_TYPE_LSPCON: HDCP2.2 discrete wired Tx port with LSPCON
0021  *             (HDMI 2.0) solution
0022  * @HDCP_PORT_TYPE_CPDP: HDCP2.2 discrete wired Tx port using the CPDP (DP 1.3)
0023  *           solution
0024  */
0025 enum hdcp_port_type {
0026     HDCP_PORT_TYPE_INVALID,
0027     HDCP_PORT_TYPE_INTEGRATED,
0028     HDCP_PORT_TYPE_LSPCON,
0029     HDCP_PORT_TYPE_CPDP
0030 };
0031 
0032 /**
0033  * enum hdcp_wired_protocol - HDCP adaptation used on the port
0034  * @HDCP_PROTOCOL_INVALID: Invalid HDCP adaptation protocol
0035  * @HDCP_PROTOCOL_HDMI: HDMI adaptation of HDCP used on the port
0036  * @HDCP_PROTOCOL_DP: DP adaptation of HDCP used on the port
0037  */
0038 enum hdcp_wired_protocol {
0039     HDCP_PROTOCOL_INVALID,
0040     HDCP_PROTOCOL_HDMI,
0041     HDCP_PROTOCOL_DP
0042 };
0043 
0044 enum mei_fw_ddi {
0045     MEI_DDI_INVALID_PORT = 0x0,
0046 
0047     MEI_DDI_B = 1,
0048     MEI_DDI_C,
0049     MEI_DDI_D,
0050     MEI_DDI_E,
0051     MEI_DDI_F,
0052     MEI_DDI_A = 7,
0053     MEI_DDI_RANGE_END = MEI_DDI_A,
0054 };
0055 
0056 /**
0057  * enum mei_fw_tc - ME Firmware defined index for transcoders
0058  * @MEI_INVALID_TRANSCODER: Index for Invalid transcoder
0059  * @MEI_TRANSCODER_EDP: Index for EDP Transcoder
0060  * @MEI_TRANSCODER_DSI0: Index for DSI0 Transcoder
0061  * @MEI_TRANSCODER_DSI1: Index for DSI1 Transcoder
0062  * @MEI_TRANSCODER_A: Index for Transcoder A
0063  * @MEI_TRANSCODER_B: Index for Transcoder B
0064  * @MEI_TRANSCODER_C: Index for Transcoder C
0065  * @MEI_TRANSCODER_D: Index for Transcoder D
0066  */
0067 enum mei_fw_tc {
0068     MEI_INVALID_TRANSCODER = 0x00,
0069     MEI_TRANSCODER_EDP,
0070     MEI_TRANSCODER_DSI0,
0071     MEI_TRANSCODER_DSI1,
0072     MEI_TRANSCODER_A = 0x10,
0073     MEI_TRANSCODER_B,
0074     MEI_TRANSCODER_C,
0075     MEI_TRANSCODER_D
0076 };
0077 
0078 /**
0079  * struct hdcp_port_data - intel specific HDCP port data
0080  * @fw_ddi: ddi index as per ME FW
0081  * @fw_tc: transcoder index as per ME FW
0082  * @port_type: HDCP port type as per ME FW classification
0083  * @protocol: HDCP adaptation as per ME FW
0084  * @k: No of streams transmitted on a port. Only on DP MST this is != 1
0085  * @seq_num_m: Count of RepeaterAuth_Stream_Manage msg propagated.
0086  *         Initialized to 0 on AKE_INIT. Incremented after every successful
0087  *         transmission of RepeaterAuth_Stream_Manage message. When it rolls
0088  *         over re-Auth has to be triggered.
0089  * @streams: struct hdcp2_streamid_type[k]. Defines the type and id for the
0090  *       streams
0091  */
0092 struct hdcp_port_data {
0093     enum mei_fw_ddi fw_ddi;
0094     enum mei_fw_tc fw_tc;
0095     u8 port_type;
0096     u8 protocol;
0097     u16 k;
0098     u32 seq_num_m;
0099     struct hdcp2_streamid_type *streams;
0100 };
0101 
0102 /**
0103  * struct i915_hdcp_component_ops- ops for HDCP2.2 services.
0104  * @owner: Module providing the ops
0105  * @initiate_hdcp2_session: Initiate a Wired HDCP2.2 Tx Session.
0106  *              And Prepare AKE_Init.
0107  * @verify_receiver_cert_prepare_km: Verify the Receiver Certificate
0108  *                   AKE_Send_Cert and prepare
0109                      AKE_Stored_Km/AKE_No_Stored_Km
0110  * @verify_hprime: Verify AKE_Send_H_prime
0111  * @store_pairing_info: Store pairing info received
0112  * @initiate_locality_check: Prepare LC_Init
0113  * @verify_lprime: Verify lprime
0114  * @get_session_key: Prepare SKE_Send_Eks
0115  * @repeater_check_flow_prepare_ack: Validate the Downstream topology
0116  *                   and prepare rep_ack
0117  * @verify_mprime: Verify mprime
0118  * @enable_hdcp_authentication:  Mark a port as authenticated.
0119  * @close_hdcp_session: Close the Wired HDCP Tx session per port.
0120  *          This also disables the authenticated state of the port.
0121  */
0122 struct i915_hdcp_component_ops {
0123     /**
0124      * @owner: mei_hdcp module
0125      */
0126     struct module *owner;
0127 
0128     int (*initiate_hdcp2_session)(struct device *dev,
0129                       struct hdcp_port_data *data,
0130                       struct hdcp2_ake_init *ake_data);
0131     int (*verify_receiver_cert_prepare_km)(struct device *dev,
0132                            struct hdcp_port_data *data,
0133                            struct hdcp2_ake_send_cert
0134                                 *rx_cert,
0135                            bool *km_stored,
0136                            struct hdcp2_ake_no_stored_km
0137                                 *ek_pub_km,
0138                            size_t *msg_sz);
0139     int (*verify_hprime)(struct device *dev,
0140                  struct hdcp_port_data *data,
0141                  struct hdcp2_ake_send_hprime *rx_hprime);
0142     int (*store_pairing_info)(struct device *dev,
0143                   struct hdcp_port_data *data,
0144                   struct hdcp2_ake_send_pairing_info
0145                                 *pairing_info);
0146     int (*initiate_locality_check)(struct device *dev,
0147                        struct hdcp_port_data *data,
0148                        struct hdcp2_lc_init *lc_init_data);
0149     int (*verify_lprime)(struct device *dev,
0150                  struct hdcp_port_data *data,
0151                  struct hdcp2_lc_send_lprime *rx_lprime);
0152     int (*get_session_key)(struct device *dev,
0153                    struct hdcp_port_data *data,
0154                    struct hdcp2_ske_send_eks *ske_data);
0155     int (*repeater_check_flow_prepare_ack)(struct device *dev,
0156                            struct hdcp_port_data *data,
0157                            struct hdcp2_rep_send_receiverid_list
0158                                 *rep_topology,
0159                            struct hdcp2_rep_send_ack
0160                                 *rep_send_ack);
0161     int (*verify_mprime)(struct device *dev,
0162                  struct hdcp_port_data *data,
0163                  struct hdcp2_rep_stream_ready *stream_ready);
0164     int (*enable_hdcp_authentication)(struct device *dev,
0165                       struct hdcp_port_data *data);
0166     int (*close_hdcp_session)(struct device *dev,
0167                   struct hdcp_port_data *data);
0168 };
0169 
0170 /**
0171  * struct i915_hdcp_component_master - Used for communication between i915
0172  * and mei_hdcp drivers for the HDCP2.2 services
0173  * @mei_dev: device that provide the HDCP2.2 service from MEI Bus.
0174  * @hdcp_ops: Ops implemented by mei_hdcp driver, used by i915 driver.
0175  */
0176 struct i915_hdcp_comp_master {
0177     struct device *mei_dev;
0178     const struct i915_hdcp_component_ops *ops;
0179 
0180     /* To protect the above members. */
0181     struct mutex mutex;
0182 };
0183 
0184 #endif /* _I915_MEI_HDCP_INTERFACE_H_ */