drm_hdcp_init is extended to support HDCP spec Ver2.2. Signed-off-by: Ramalingam C <ramalingam.c@xxxxxxxxx> --- drivers/gpu/drm/drm_hdcp.c | 37 +++++++++++++++++++++++++++++++++++++ include/drm/drm_hdcp.h | 6 ++++++ 2 files changed, 43 insertions(+) diff --git a/drivers/gpu/drm/drm_hdcp.c b/drivers/gpu/drm/drm_hdcp.c index 9785ab6..5441b55 100644 --- a/drivers/gpu/drm/drm_hdcp.c +++ b/drivers/gpu/drm/drm_hdcp.c @@ -198,6 +198,36 @@ void drm_hdcp_connector_state_change_handler(struct drm_connector *connector) } EXPORT_SYMBOL(drm_hdcp_connector_state_change_handler); +static inline int drm_hdcp2_init(struct drm_connector *connector, + struct drm_hdcp *hdcp, + uint8_t spec_supported) +{ + if (!hdcp->hdcp2_funcs) { + DRM_ERROR("Callback functions are missing\n"); + return -EINVAL; + } + + /* No of streams transmitted on the port */ + /* + * TODO: For DP, in case of MST we need to figure out a way to + * configure this value on the run. on HDMI it is always 1. + */ + hdcp->k = 1; + + hdcp->streams = kmalloc_array(hdcp->k, + sizeof(struct wired_streamid_type), GFP_KERNEL); + if (!hdcp->streams) + return -ENOMEM; + + /* For HDMI this is forced to be 0x0 */ + hdcp->streams[0].stream_id = 0; + + /* Setting it to Type 0 by default */ + hdcp->streams[0].stream_type = HDCP_STREAM_TYPE0_CODE; + + return 0; +} + /** * @drm_hdcp_init: * Initialization of the HDCP stack of the DRM @@ -209,6 +239,7 @@ int drm_hdcp_init(struct drm_connector *connector, uint8_t spec_supported) { struct drm_mode_config *config = &connector->dev->mode_config; + int ret; if (!hdcp) return -EINVAL; @@ -227,6 +258,12 @@ int drm_hdcp_init(struct drm_connector *connector, if (!hdcp->hdcp_funcs->link_write || !hdcp->hdcp_funcs->link_read) return -EINVAL; + if (spec_supported & HDCP_2_2_SUPPORT) { + ret = drm_hdcp2_init(connector, hdcp, spec_supported); + if (ret < 0) + return ret; + } + hdcp->ver_support_on_plat = spec_supported; connector->hdcp = hdcp; diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h index 94acd8d..47862a7 100644 --- a/include/drm/drm_hdcp.h +++ b/include/drm/drm_hdcp.h @@ -320,6 +320,12 @@ struct drm_hdcp_funcs { struct drm_hdcp { struct drm_connector *connector; + /* No of streams transmitted on the port. 1 incase of HDMI & DP SST */ + uint16_t k; + + /* k no of structures of wired_streamid_type */ + struct wired_streamid_type *streams; + /* HDCP Specifications support flag */ uint32_t ver_support_on_plat; uint32_t ver_support_on_panel; -- 2.7.4 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel