From patchwork Mon Feb 5 05:50:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "mac.shen" X-Patchwork-Id: 13544982 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B5B00C48291 for ; Mon, 5 Feb 2024 05:52:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cjwr8OfJxt9ACbx2ozd/vhd/QTWHF6m3uMddm4JGxwA=; b=YQl+HqQYWPLu+7g7+xV9EwNiLa tPiffn+/ozqKCk7pvBmUxGXl3zat5JXPLQ788KK8silB0LchpuHPycCrScpK0MUGw9fNXy14Lo3Tk 4qJ55QQW10DZVf2m/Cs/IQ+IJBX1stU95BZnhturtVNYuJ02DdqUYD+twjoko5GtQSolktXpOp53U XyedpwcRVZUVgoIAfyLcwA6JS32zNnu+l/g2ZXs4XpL/XV7njaYN5XDFlhbRuemocZk11TTZaBw/h KW0SW0bt3XwwMSmHhSONYAvJbtWy1z0Ut498+8DrGm/Ud4R/+qcS9iifF0pZvJgNzlpmvq8FxWVI6 AR4VRAaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rWruH-000000027BZ-0et9; Mon, 05 Feb 2024 05:52:37 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rWrtu-000000026vk-28Vj; Mon, 05 Feb 2024 05:52:24 +0000 X-UUID: ae0d2472c3ea11ee9a263b4415211400-20240204 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=cjwr8OfJxt9ACbx2ozd/vhd/QTWHF6m3uMddm4JGxwA=; b=F0hjBsHoJ91V5nOZru/slYLnUtN1+TbNGaRlQTsjPkGgDJAdKizOwwxWFv+px5GyfC6mNYfFc54DYvhA4hXexr1cwShXQEBi1ki2S7pu4IhX/uM+v9zx2fY8q7rmK5TZawycOvFZy33Te82zm1OXKDFx4X3edvItrka7hVQU0Q8=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.37,REQID:3ad96d7c-8ce5-4b0c-8b9e-d26bab579bf0,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:6f543d0,CLOUDID:1394068f-e2c0-40b0-a8fe-7c7e47299109,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:1,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1, SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULS X-UUID: ae0d2472c3ea11ee9a263b4415211400-20240204 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 249965772; Sun, 04 Feb 2024 22:52:00 -0700 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by MTKMBS14N1.mediatek.inc (172.21.101.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Mon, 5 Feb 2024 13:51:26 +0800 Received: from mszsdhlt06.gcn.mediatek.inc (10.16.6.206) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Mon, 5 Feb 2024 13:51:26 +0800 From: mac.shen To: , , , , , , CC: , , , , , Subject: [PATCH v2 2/3] Subject: [PATCH] drm/mediatek/dp: Add HDCP2.x feature for DisplayPort Date: Mon, 5 Feb 2024 13:50:37 +0800 Message-ID: <20240205055055.25340-3-mac.shen@mediatek.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240205055055.25340-1-mac.shen@mediatek.com> References: <20240205055055.25340-1-mac.shen@mediatek.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--12.052400-8.000000 X-TMASE-MatchedRID: Ko/xPG+Qbtdocr5vRHCIakKcYi5Qw/RVFJFr2qlKix8UHVz/b87KIwc3 Uc04WCqQ3aflduQTdlKCwyR78G3yDd4bgXBxaoBL0Xw0ILvo/uUpWss5kPUFdMlgi/vLS272hCY Q0GRRnBOQZeD+o76AoTVj2AJAih8uNlBChwzdMMzTnRs9f/DkZp4Q/QN0mu6WNSweOixQAJKZAn qxTGmm4sP5Lp773ebNnL5zsA3xXh0WmnbffcYqJISvKOGqLLPKWDdWpJMntKhC7LJNP9sKquxgV 4GaRi5cytLZ8XDer2b1keySn5FFP7gcZtzF8Se3Yx1jPJKy+DxT4DtiSkMnWCp9nOAnLazCvkES pfBKzZR35pRAWpykN/OWMixYHwEQo27xiIuUglDhuXUWQoMQt+szMj2s3tqva0TOsL14A2lK0FA stcpT0oY0L6KZX8LSDVS4QmWw8VT1s8eCOeeiYKwxbZnudyr7GSqdEmeD/nW/wPtA9baOj2+3ct xX3zZNgs6uuv8OgBhvXoisElHfiHnkqK+DiFA+nu1HSadECDWagpdUd+Iwz2ecrqZc3vabUXVyd uKWVxC4/9wU9VR9Orw+nvdymavdiMEMY19woczUWdZik3yrYdspPGnf5a0gRaXolgMyx3FXXXTX sOyc4qOKAoYvxV6O2dUSZLK2MOy7sY7IeJaO+LdQIb8hCnY+LAnNohUyMa2nMzRhUWarpty6nSG CIrVTBi0hgQDrPd/m07dxH4adm1pgJVkXDtuh9Ib/6w+1lWSJ7IEVMTX5x6hGNiAliV44o8WMkQ Wv6iX7ev9h4HyIA1cppCzPq+1Uymsk/wUE4hoD/dHyT/Xh7Q== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--12.052400-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: 356CDC7B5E6F71D0DBF110D907440BB9C662829359FA9C0A0110922FBF210CEE2000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240204_215214_631632_596E5DEC X-CRM114-Status: GOOD ( 25.73 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Add HDCP2.x feature for DisplayPort. When userspace request the kernel protect future content communicated over the link with Content_Protection property, the feature will do HDCP2.x authentication if the sink support HDCP2.X. Changes in v2: - remove switch case, and refine code to make more clear - remove some definitions, and use the definitions in include/drm/drm_hdcp.h - use the struct which defined in include/drm/drm_hdcp.h - do HDCP2.x authentication when userspace request the kernel protect future content communicated per suggestion from the previous thread: https://lore.kernel.org/all/8fff59b5567449d8201dd1138c8fa 9218a545c46.camel@mediatek.com/ Signed-off-by: mac.shen --- drivers/gpu/drm/mediatek/Makefile | 1 + drivers/gpu/drm/mediatek/mtk_dp.c | 297 +++++-- drivers/gpu/drm/mediatek/mtk_dp.h | 99 +++ drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c | 1021 +++++++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_dp_hdcp2.h | 52 ++ drivers/gpu/drm/mediatek/mtk_dp_reg.h | 4 +- drivers/gpu/drm/mediatek/mtk_dpi.c | 3 + 7 files changed, 1392 insertions(+), 85 deletions(-) create mode 100644 drivers/gpu/drm/mediatek/mtk_dp.h create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp2.h diff --git a/drivers/gpu/drm/mediatek/Makefile b/drivers/gpu/drm/mediatek/Makefile index c80e6c2f9336..50ea069b047e 100644 --- a/drivers/gpu/drm/mediatek/Makefile +++ b/drivers/gpu/drm/mediatek/Makefile @@ -27,6 +27,7 @@ mediatek-drm-hdmi-objs := mtk_cec.o \ obj-$(CONFIG_DRM_MEDIATEK_HDMI) += mediatek-drm-hdmi.o mtk-dp-objs := tlc_dp_hdcp.o \ + mtk_dp_hdcp2.o \ mtk_dp.o obj-$(CONFIG_DRM_MEDIATEK_DP) += mtk-dp.o diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c index e4c16ba9902d..7ff72f15528b 100644 --- a/drivers/gpu/drm/mediatek/mtk_dp.c +++ b/drivers/gpu/drm/mediatek/mtk_dp.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (c) 2019-2022 MediaTek Inc. + * Copyright (c) 2019-2024 MediaTek Inc. * Copyright (c) 2022 BayLibre */ @@ -8,13 +8,13 @@ #include #include #include -#include #include #include #include #include #include #include +#include #include #include #include @@ -30,10 +30,10 @@ #include #include #include -#include -#include