Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2213498rdb; Sun, 4 Feb 2024 21:52:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IH0t1xsRMxj5W/SDAwz5MUdLDCL2IhDAJ0UTXZisJbj+wg3rOaQ+xc6HKFKNuhHhH2iBtSt X-Received: by 2002:a05:6512:3886:b0:510:12f9:84b7 with SMTP id n6-20020a056512388600b0051012f984b7mr7999101lft.31.1707112343689; Sun, 04 Feb 2024 21:52:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707112343; cv=pass; d=google.com; s=arc-20160816; b=e8jK1LFEeha716RW6Itj8ylSoviVse/yMbtIkgBPGMdlqu+3dCbat9YDEmPEw+Uxlh vuN8foAN5qtaRljLVpscsukFV8FCIE+gqwgJsN8AK7xvG8b7/UOapBpmvrr672lxXIHu QYSa3lWB+VXGc1SZMq/1vi7YNrUp9xwlfnPNKoxCe4RO1JwjxXHOUJomtSv35/ZhPS2y yZVjbHuihVmbVb/L5fryWOvit8jl87k7ZLjBB9OVcEPs0AgTDIk8BQ5o4exAwIWg+wrW kfSMjhU+kSLBnoy9VtOuJirG3PM3WweiRWNs1SQNi24qua61ZoIP7Ah7vNdSOnvcTY5J lToA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=cjwr8OfJxt9ACbx2ozd/vhd/QTWHF6m3uMddm4JGxwA=; fh=H+u/YpYw7fjY2/E8mc3X9PBo1NQKMQfJRiqK0nY5lJI=; b=G410BASJll9i/2lK6IC0j9lgUBwrn30MfWVavrzrKo8R/dxhaufgWTyp1gckc2UiK7 Yc+z4RBZ/Gq+SCrGrNDG4ocOPKxGoivXp4Ec5OWg2+J/HqJEYTO/RYVKt0oMKomWQWqB vyxY5eNfuU8is9GAIukewEGf+oNfpDNJUgtXpbnIBFbGNVsl1IJoc0l23Rn+F86Zu8Mc n+fIuhFrhYjYKO+f9A/l8Q/IT7cvjwxzLWVoui2uiArV+VLbc3nMC8La7kg++IYkuW/D bEdlM8pGfCs+KSWtlaPDAFP8qDyvSwBDd6hhacawx6GhovrnE/IT/5PAVmIysUpzfeAp scwA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=F0hjBsHo; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-52059-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52059-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com X-Forwarded-Encrypted: i=1; AJvYcCXDJUo2QFt44gRZwa5tDmW9XAEhC8eUn7dOz3d1Tm4V+vA/AhhYlcBbxdsRVO9LyGouMg5oy872gPyVSTvDh9niDtuizxxsxQ7hcbKYpw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id um12-20020a170906cf8c00b00a37dc82a238si198424ejb.810.2024.02.04.21.52.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 21:52:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52059-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=F0hjBsHo; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-52059-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52059-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 820581F2175B for ; Mon, 5 Feb 2024 05:52:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D4CE310A36; Mon, 5 Feb 2024 05:51:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="F0hjBsHo" Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47FE8BA38 for ; Mon, 5 Feb 2024 05:51:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.61.82.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707112299; cv=none; b=ozVBUynNJbz+3amHEpCjEJI+OmoDDtrM8HATbI7DO5wwHdPFiNwuHFCxxu80LSn4LMFnD7QU0qPhkSIvc5jpWMPuc5NdHDi0TNTL0k9fpxhPJu7mtyMC+oB0IcxE8RXJLvxXAtzT1pfatBX/KniKevptkNq3tnGng78IRGWAIF4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707112299; c=relaxed/simple; bh=LLGW4b/FjrKTRsBfHpncB63lndsuLXDmYjaseu/Ll+E=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Q1BVzW7cqnLnOzsxQboef3RyOx0TIc5nANi+MM/oFMEs9JgQ8REMo3U4GJNTXe2JVw8ZFhWfg1qqBjNAYoRrpM20htAmMZRZl4eWOro80NFvPdkMyirzgCtrBlAOpdTohb2JuTHfAVtsRXqhgeTIukwI+zU0bLv80itjtiezfDE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=F0hjBsHo; arc=none smtp.client-ip=210.61.82.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com X-UUID: 9a7c235ec3ea11eea2298b7352fd921d-20240205 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:16af0c50-c95a-4e74-9336-99f2de17cbb4,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:04af84fe-c16b-4159-a099-3b9d0558e447,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: 9a7c235ec3ea11eea2298b7352fd921d-20240205 Received: from mtkmbs14n1.mediatek.inc [(172.21.101.75)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 42553156; Mon, 05 Feb 2024 13:51:27 +0800 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 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