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: 196635 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp687525dyb; Sun, 4 Feb 2024 21:52:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IGkLS2Oko0TJZuKLdXsSsKo48veQMMmBK0xg3BvMrJkO0wIXyl5iYa7vTb85IYSGgzgD5IX X-Received: by 2002:a17:906:ac5:b0:a35:70d8:89e9 with SMTP id z5-20020a1709060ac500b00a3570d889e9mr10862117ejf.63.1707112367945; Sun, 04 Feb 2024 21:52:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707112367; cv=pass; d=google.com; s=arc-20160816; b=S1Ut3RNpL3Fr5EEtjs+l+45ZAqZK44puqE3RZVOs4YBtVywl0k3fSoJBriVrTmBFgW MJRCrPLT8a+zjqVYcUigRi5+l1gKWFjZTwKhCFR63G93QqYmOjCfEzDAW3xXIe0Ffvjh OW7edGx/yD2w/PVxwnoN9OtJLGigFmpev9qtpLxo2KdjZXVvRhBIswwJKjckjFbbBn1Y QrWKNH7GVcjkDInOXxJtatFYwT/nxiXQlNZ4H3udI/+uc0LX9075QkSybd59WuwgZ/Qm h+NmoZv3MPJNi3cXljBzsAyuwKpkSICVkRDchJXUcR2+UU3wikKQ5b7e06R2BkzgxDxR JjmQ== 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=dqJtK2RculYR1C5bEbrHq/EzV3/9+gLVhrUC9y8HIJ4=; b=Qv8se4CIJ4hyi2P0VrVOacylWIGtTo7sCN7eaHt4IZXNqSbwFFMP34gQW34cNflK3A tsR0SvbfMEdhi8hfuXq2dYVHnqFO4Bky9dEjp53jMPqgz1mK8k3z1MOgmS7ff4RDm3Yc UChm48tn/GnNHGJ5IC+6ZzysVWzhCxsMiO+0uxotcc9JP/x2qT+R3WZj/MEdfKg7zV/o 2o0ZMM/yjcyIjsUd20DV8LWUqmC1uIOVBCachCIVi1XcRL1AtBLxL0kQ3ZKf8Iq3UR1K W6GtFBMUFBcXoPbrCuLaAcOaek0kVtYgEVAscS5gvxCePOCGaPsBvm7tOQZwW5jU8nyl PbpA==; 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52059-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com X-Forwarded-Encrypted: i=1; AJvYcCX7MVOWBHAfZAZIcm2iieFxUnh99Qm15ifRtDf/eGHygobBij32mm6ClbvUgEzK8f5K+axYuPn1UofBom3yEemrd3ZZXw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h22-20020a1709063b5600b00a37a9d29cfcsi1015527ejf.856.2024.02.04.21.52.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 21:52:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52059-ouuuleilei=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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52059-ouuuleilei=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 D2B481F218C2 for ; Mon, 5 Feb 2024 05:52:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 091D511714; Mon, 5 Feb 2024 05:51:52 +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 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790037058171045126 X-GMAIL-MSGID: 1790037058171045126 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