From patchwork Wed Jul 12 08:28:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramalingam C X-Patchwork-Id: 9836255 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E6A9260363 for ; Wed, 12 Jul 2017 08:30:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D92681FF2D for ; Wed, 12 Jul 2017 08:30:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDC8B284FF; Wed, 12 Jul 2017 08:30:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7F9511FF2D for ; Wed, 12 Jul 2017 08:30:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8C4EB6E3A8; Wed, 12 Jul 2017 08:29:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id A9C976E3A8; Wed, 12 Jul 2017 08:29:37 +0000 (UTC) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jul 2017 01:29:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,349,1496127600"; d="scan'208";a="126135041" Received: from mint-dev.iind.intel.com ([10.223.25.164]) by fmsmga006.fm.intel.com with ESMTP; 12 Jul 2017 01:29:35 -0700 From: Ramalingam C To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, daniel.vetter@intel.com Subject: [RFC v1 07/20] drm/hdcp: Initialization of DRM hdcp stack Date: Wed, 12 Jul 2017 13:58:51 +0530 Message-Id: <1499848144-8456-8-git-send-email-ramalingam.c@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499848144-8456-1-git-send-email-ramalingam.c@intel.com> References: <1499848144-8456-1-git-send-email-ramalingam.c@intel.com> Cc: Ramalingam C , uma.shankar@intel.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Initialization of the drm hdcp stack drm_hdcp_init is implemented. This function has to be called by the display driver to get the DRM support for HDCP. This function will take the pointers to the drm_hdcp and associated drm_conenctor. These two entities will be linked. And HDCP version supported by the Display driver is received as another parameter. And corresponding callback fucntions can be validated. Signed-off-by: Ramalingam C --- drivers/gpu/drm/drm_hdcp.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++ include/drm/drm_hdcp.h | 7 +++++ 2 files changed, 82 insertions(+) create mode 100644 drivers/gpu/drm/drm_hdcp.c diff --git a/drivers/gpu/drm/drm_hdcp.c b/drivers/gpu/drm/drm_hdcp.c new file mode 100644 index 0000000..481bc24 --- /dev/null +++ b/drivers/gpu/drm/drm_hdcp.c @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2017 Intel Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ +/** + * Implementation of HDCP stack for DRM + */ +#include +#include +#include +#include +#include +#include +#include + +/** + * @drm_hdcp_init: + * Initialization of the HDCP stack of the DRM + * + * Return 0 on success else -ve. + */ +int drm_hdcp_init(struct drm_connector *connector, + struct drm_hdcp *hdcp, + uint8_t spec_supported) +{ + struct drm_mode_config *config = &connector->dev->mode_config; + + if (!hdcp) + return -EINVAL; + + if (!hdcp->hdcp_funcs) { + DRM_ERROR("Callback functions are missing\n"); + return -EINVAL; + } + + if (!spec_supported) { + DRM_ERROR("HDCP version support is not mentioned\n"); + return -EINVAL; + } + + /* Check for Essential Service Funcs */ + if (!hdcp->hdcp_funcs->link_write || !hdcp->hdcp_funcs->link_read) + return -EINVAL; + + hdcp->ver_support_on_plat = spec_supported; + + connector->hdcp = hdcp; + hdcp->connector = connector; + + drm_object_attach_property(&connector->base, + config->hdcp_property, + 0); + + mutex_init(&hdcp->mutex); + + return 0; +} +EXPORT_SYMBOL(drm_hdcp_init); diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h index 2a48ef9..e8136ef 100644 --- a/include/drm/drm_hdcp.h +++ b/include/drm/drm_hdcp.h @@ -37,6 +37,9 @@ struct drm_hdcp; #define HDCP_1_4_SUPPORT (1<<0) #define HDCP_2_2_SUPPORT (1<<1) +#define HDCP_STREAM_TYPE0_CODE 0x00 +#define HDCP_STREAM_TYPE1_CODE 0x01 + /** * @enum hdcp_status Enumeration of all HDCP Status Codes */ @@ -154,4 +157,8 @@ struct drm_hdcp { DRM_HDCP_LINK_INTEGRITY_FAILED | \ DRM_HDCP_REAUTH_REQUESTED) +/* Functions exported */ +extern int drm_hdcp_init(struct drm_connector *connector, + struct drm_hdcp *hdcp, + uint8_t spec_supported); #endif /* __DRM_HDCP_H__ */