From 8857c7d065e900a0b3829c97634c99501b606541 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Fri, 8 Feb 2019 00:27:59 +0100 Subject: i915/snd_hdac: I915 subcomponent for the snd_hdac Since we need multiple components for I915 for different purposes (Audio & Mei_hdcp), we adopt the subcomponents methodology introduced by the previous patch (mentioned below). Author: Daniel Vetter Date: Mon Jan 28 17:08:20 2019 +0530 components: multiple components for a device Reviewed-by: Takashi Iwai Signed-off-by-by: Ramalingam C (commit message) Signed-off-by: Daniel Vetter (code) cc: Greg Kroah-Hartman cc: Russell King cc: Rafael J. Wysocki cc: Jaroslav Kysela cc: Takashi Iwai cc: Rodrigo Vivi cc: Jani Nikula Link: https://patchwork.freedesktop.org/patch/msgid/20190207232759.14553-4-daniel.vetter@ffwll.ch --- include/drm/i915_component.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/drm') diff --git a/include/drm/i915_component.h b/include/drm/i915_component.h index fca22d463e1b..72fbb037f9b3 100644 --- a/include/drm/i915_component.h +++ b/include/drm/i915_component.h @@ -26,6 +26,10 @@ #include "drm_audio_component.h" +enum i915_component_type { + I915_COMPONENT_AUDIO = 1, +}; + /* MAX_PORT is the number of port * It must be sync with I915_MAX_PORTS defined i915_drv.h */ -- cgit From 8605a1366015afb0ec7dd486262d0b4088e3c75f Mon Sep 17 00:00:00 2001 From: Ramalingam C Date: Fri, 15 Feb 2019 14:04:57 +0530 Subject: drm/i915: enum port definition is moved into i915_drm.h For the reusability of the enum port in other driver modules (like mei_hdcp), enum port definition is moved from I915 local header intel_display.h to drm/i915_drm.h Signed-off-by: Ramalingam C Acked-by: Daniel Vetter [danvet: Fix subject prefix.] Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/1550219730-17734-3-git-send-email-ramalingam.c@intel.com --- include/drm/i915_drm.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include/drm') diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h index c44703f471b3..7523e9a7b6e2 100644 --- a/include/drm/i915_drm.h +++ b/include/drm/i915_drm.h @@ -100,4 +100,19 @@ extern struct resource intel_graphics_stolen_res; #define INTEL_GEN11_BSM_DW1 0xc4 #define INTEL_BSM_MASK (-(1u << 20)) +enum port { + PORT_NONE = -1, + + PORT_A = 0, + PORT_B, + PORT_C, + PORT_D, + PORT_E, + PORT_F, + + I915_MAX_PORTS +}; + +#define port_name(p) ((p) + 'A') + #endif /* _I915_DRM_H_ */ -- cgit From 1626eab70ebc61d015e69a4bc3479d9228539343 Mon Sep 17 00:00:00 2001 From: Ramalingam C Date: Fri, 15 Feb 2019 14:04:58 +0530 Subject: drm/i915: header for i915 - MEI_HDCP interface Header defines the interface for the I915 and MEI_HDCP drivers. This interface is specific to the usage of mei_hdcp from gen9+ platforms for ME FW based HDCP2.2 services. And Generic HDCP2.2 protocol specific definitions are added at drm/drm_hdcp.h. v2: Commit msg is enhanced [Daniel] v3: i915_hdcp_comp_master is defined. Signed-off-by: Ramalingam C Reviewed-by: Daniel Vetter [v2] Reviewed-by: Uma Shankar [v2] [danvet: Fix subject to drm/i915.] Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/1550219730-17734-4-git-send-email-ramalingam.c@intel.com --- include/drm/i915_mei_hdcp_interface.h | 149 ++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 include/drm/i915_mei_hdcp_interface.h (limited to 'include/drm') diff --git a/include/drm/i915_mei_hdcp_interface.h b/include/drm/i915_mei_hdcp_interface.h new file mode 100644 index 000000000000..8c344255146a --- /dev/null +++ b/include/drm/i915_mei_hdcp_interface.h @@ -0,0 +1,149 @@ +/* SPDX-License-Identifier: (GPL-2.0+) */ +/* + * Copyright © 2017-2018 Intel Corporation + * + * Authors: + * Ramalingam C + */ + +#ifndef _I915_MEI_HDCP_INTERFACE_H_ +#define _I915_MEI_HDCP_INTERFACE_H_ + +#include +#include +#include +#include + +/** + * enum hdcp_port_type - HDCP port implementation type defined by ME FW + * @HDCP_PORT_TYPE_INVALID: Invalid hdcp port type + * @HDCP_PORT_TYPE_INTEGRATED: In-Host HDCP2.x port + * @HDCP_PORT_TYPE_LSPCON: HDCP2.2 discrete wired Tx port with LSPCON + * (HDMI 2.0) solution + * @HDCP_PORT_TYPE_CPDP: HDCP2.2 discrete wired Tx port using the CPDP (DP 1.3) + * solution + */ +enum hdcp_port_type { + HDCP_PORT_TYPE_INVALID, + HDCP_PORT_TYPE_INTEGRATED, + HDCP_PORT_TYPE_LSPCON, + HDCP_PORT_TYPE_CPDP +}; + +/** + * enum hdcp_wired_protocol - HDCP adaptation used on the port + * @HDCP_PROTOCOL_INVALID: Invalid HDCP adaptation protocol + * @HDCP_PROTOCOL_HDMI: HDMI adaptation of HDCP used on the port + * @HDCP_PROTOCOL_DP: DP adaptation of HDCP used on the port + */ +enum hdcp_wired_protocol { + HDCP_PROTOCOL_INVALID, + HDCP_PROTOCOL_HDMI, + HDCP_PROTOCOL_DP +}; + +/** + * struct hdcp_port_data - intel specific HDCP port data + * @port: port index as per I915 + * @port_type: HDCP port type as per ME FW classification + * @protocol: HDCP adaptation as per ME FW + * @k: No of streams transmitted on a port. Only on DP MST this is != 1 + * @seq_num_m: Count of RepeaterAuth_Stream_Manage msg propagated. + * Initialized to 0 on AKE_INIT. Incremented after every successful + * transmission of RepeaterAuth_Stream_Manage message. When it rolls + * over re-Auth has to be triggered. + * @streams: struct hdcp2_streamid_type[k]. Defines the type and id for the + * streams + */ +struct hdcp_port_data { + enum port port; + u8 port_type; + u8 protocol; + u16 k; + u32 seq_num_m; + struct hdcp2_streamid_type *streams; +}; + +/** + * struct i915_hdcp_component_ops- ops for HDCP2.2 services. + * @owner: Module providing the ops + * @initiate_hdcp2_session: Initiate a Wired HDCP2.2 Tx Session. + * And Prepare AKE_Init. + * @verify_receiver_cert_prepare_km: Verify the Receiver Certificate + * AKE_Send_Cert and prepare + AKE_Stored_Km/AKE_No_Stored_Km + * @verify_hprime: Verify AKE_Send_H_prime + * @store_pairing_info: Store pairing info received + * @initiate_locality_check: Prepare LC_Init + * @verify_lprime: Verify lprime + * @get_session_key: Prepare SKE_Send_Eks + * @repeater_check_flow_prepare_ack: Validate the Downstream topology + * and prepare rep_ack + * @verify_mprime: Verify mprime + * @enable_hdcp_authentication: Mark a port as authenticated. + * @close_hdcp_session: Close the Wired HDCP Tx session per port. + * This also disables the authenticated state of the port. + */ +struct i915_hdcp_component_ops { + /** + * @owner: mei_hdcp module + */ + struct module *owner; + + int (*initiate_hdcp2_session)(struct device *dev, + struct hdcp_port_data *data, + struct hdcp2_ake_init *ake_data); + int (*verify_receiver_cert_prepare_km)(struct device *dev, + struct hdcp_port_data *data, + struct hdcp2_ake_send_cert + *rx_cert, + bool *km_stored, + struct hdcp2_ake_no_stored_km + *ek_pub_km, + size_t *msg_sz); + int (*verify_hprime)(struct device *dev, + struct hdcp_port_data *data, + struct hdcp2_ake_send_hprime *rx_hprime); + int (*store_pairing_info)(struct device *dev, + struct hdcp_port_data *data, + struct hdcp2_ake_send_pairing_info + *pairing_info); + int (*initiate_locality_check)(struct device *dev, + struct hdcp_port_data *data, + struct hdcp2_lc_init *lc_init_data); + int (*verify_lprime)(struct device *dev, + struct hdcp_port_data *data, + struct hdcp2_lc_send_lprime *rx_lprime); + int (*get_session_key)(struct device *dev, + struct hdcp_port_data *data, + struct hdcp2_ske_send_eks *ske_data); + int (*repeater_check_flow_prepare_ack)(struct device *dev, + struct hdcp_port_data *data, + struct hdcp2_rep_send_receiverid_list + *rep_topology, + struct hdcp2_rep_send_ack + *rep_send_ack); + int (*verify_mprime)(struct device *dev, + struct hdcp_port_data *data, + struct hdcp2_rep_stream_ready *stream_ready); + int (*enable_hdcp_authentication)(struct device *dev, + struct hdcp_port_data *data); + int (*close_hdcp_session)(struct device *dev, + struct hdcp_port_data *data); +}; + +/** + * struct i915_hdcp_component_master - Used for communication between i915 + * and mei_hdcp drivers for the HDCP2.2 services + * @mei_dev: device that provide the HDCP2.2 service from MEI Bus. + * @hdcp_ops: Ops implemented by mei_hdcp driver, used by i915 driver. + */ +struct i915_hdcp_comp_master { + struct device *mei_dev; + const struct i915_hdcp_component_ops *ops; + + /* To protect the above members. */ + struct mutex mutex; +}; + +#endif /* _I915_MEI_HDCP_INTERFACE_H_ */ -- cgit From 1bf7cb4d8f3d1f7388b230903cae35dfb43901d3 Mon Sep 17 00:00:00 2001 From: Ramalingam C Date: Fri, 15 Feb 2019 14:05:00 +0530 Subject: drm/i915: MEI interface definition Defining the mei-i915 interface functions and initialization of the interface. v2: Adjust to the new interface changes. [Tomas] Added further debug logs for the failures at MEI i/f. port in hdcp_port data is equipped to handle -ve values. v3: mei comp is matched for global i915 comp master. [Daniel] In hdcp_shim hdcp_protocol() is replaced with const variable. [Daniel] mei wrappers are adjusted as per the i/f change [Daniel] v4: port initialization is done only at hdcp2_init only [Danvet] v5: I915 registers a subcomponent to be matched with mei_hdcp [Daniel] v6: HDCP_disable for all connectors incase of comp_unbind. Tear down HDCP comp interface at i915_unload [Daniel] v7: Component init and fini are moved out of connector ops [Daniel] hdcp_disable is not called from unbind. [Daniel] Signed-off-by: Ramalingam C Reviewed-by: Daniel Vetter [v11] [danvet: For the topic/mei-hdcp shared branch drop everything but the header change needed by both drm/i915 and mei-hdcp. Also drop the no longer needed device.h include.] Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/1550219730-17734-6-git-send-email-ramalingam.c@intel.com --- include/drm/i915_component.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/drm') diff --git a/include/drm/i915_component.h b/include/drm/i915_component.h index 72fbb037f9b3..dcb95bd9dee6 100644 --- a/include/drm/i915_component.h +++ b/include/drm/i915_component.h @@ -28,6 +28,7 @@ enum i915_component_type { I915_COMPONENT_AUDIO = 1, + I915_COMPONENT_HDCP, }; /* MAX_PORT is the number of port -- cgit From 32097060189bf215439e719c5df514399235c52e Mon Sep 17 00:00:00 2001 From: Ramalingam C Date: Fri, 15 Feb 2019 14:05:04 +0530 Subject: drm: helper functions for hdcp2 seq_num to from u32 Library functions for endianness are aligned for 16/32/64 bits. But hdcp sequence numbers are 24bits(big endian). So for their conversion to and from u32 helper functions are developed. v2: Comment is updated. [Daniel] Reviewed-by Uma. Signed-off-by: Ramalingam C Reviewed-by: Daniel Vetter Reviewed-by: Uma Shankar Acked-by: Dave Airlie Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/1550219730-17734-10-git-send-email-ramalingam.c@intel.com --- include/drm/drm_hdcp.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include/drm') diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h index a6de09c5e47f..c21682f76cd3 100644 --- a/include/drm/drm_hdcp.h +++ b/include/drm/drm_hdcp.h @@ -250,4 +250,22 @@ struct hdcp2_dp_errata_stream_type { #define HDCP_2_2_HDMI_RXSTATUS_READY(x) ((x) & BIT(2)) #define HDCP_2_2_HDMI_RXSTATUS_REAUTH_REQ(x) ((x) & BIT(3)) +/* + * Helper functions to convert 24bit big endian hdcp sequence number to + * host format and back + */ +static inline +u32 drm_hdcp2_seq_num_to_u32(u8 seq_num[HDCP_2_2_SEQ_NUM_LEN]) +{ + return (u32)(seq_num[2] | seq_num[1] << 8 | seq_num[0] << 16); +} + +static inline +void drm_hdcp2_u32_to_seq_num(u8 seq_num[HDCP_2_2_SEQ_NUM_LEN], u32 val) +{ + seq_num[0] = val >> 16; + seq_num[1] = val >> 8; + seq_num[2] = val; +} + #endif -- cgit From 35c0272502cca0a1b461d310c23aac94a503983d Mon Sep 17 00:00:00 2001 From: Ramalingam C Date: Sat, 16 Feb 2019 10:34:59 +0530 Subject: drm/audio: declaration of struct device Header has used the references to struct device without it definition or declaration. Hence resulting in compilation warning such as "'struct device' declared inside parameter list..." This changes adds a declaration to struct device in the header to avoid any such warnings. Signed-off-by: Ramalingam C cc: Takashi Iwai cc: Daniel Vetter Acked-by: Dave Airlie Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/1550293499-5560-1-git-send-email-ramalingam.c@intel.com --- include/drm/drm_audio_component.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/drm') diff --git a/include/drm/drm_audio_component.h b/include/drm/drm_audio_component.h index 4923b00328c1..93a386be38fa 100644 --- a/include/drm/drm_audio_component.h +++ b/include/drm/drm_audio_component.h @@ -5,6 +5,7 @@ #define _DRM_AUDIO_COMPONENT_H_ struct drm_audio_component; +struct device; /** * struct drm_audio_component_ops - Ops implemented by DRM driver, called by hda driver -- cgit