[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240720071606.27930-9-yunfei.dong@mediatek.com>
Date: Sat, 20 Jul 2024 15:15:46 +0800
From: Yunfei Dong <yunfei.dong@...iatek.com>
To: Jeffrey Kardatzke <jkardatzke@...gle.com>,
Nícolas F . R . A . Prado
<nfraprado@...labora.com>, Nathan Hebert <nhebert@...omium.org>, Nicolas
Dufresne <nicolas.dufresne@...labora.com>, Hans Verkuil
<hverkuil-cisco@...all.nl>, AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>, Benjamin Gaignard
<benjamin.gaignard@...labora.com>, Sebastian Fricke
<sebastian.fricke@...labora.com>, Tomasz Figa <tfiga@...omium.org>, Mauro
Carvalho Chehab <mchehab@...nel.org>, Marek Szyprowski
<m.szyprowski@...sung.com>
CC: Chen-Yu Tsai <wenst@...omium.org>, Yong Wu <yong.wu@...iatek.com>, Hsin-Yi
Wang <hsinyi@...omium.org>, Fritz Koenig <frkoenig@...omium.org>, Daniel
Vetter <daniel@...ll.ch>, Steve Cho <stevecho@...omium.org>, Yunfei Dong
<yunfei.dong@...iatek.com>, Sumit Semwal <sumit.semwal@...aro.org>, Brian
Starkey <Brian.Starkey@....com>, John Stultz <jstultz@...gle.com>, "T . J .
Mercier" <tjmercier@...gle.com>, Christian König
<christian.koenig@....com>, Matthias Brugger <matthias.bgg@...il.com>,
<linux-media@...r.kernel.org>, <dri-devel@...ts.freedesktop.org>,
<linux-kernel@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>,
<Project_Global_Chrome_Upstream_Group@...iatek.com>
Subject: [PATCH v7 08/28] media: mediatek: vcodec: build decoder OPTEE driver as module
The tee_* function make the driver depends on the TEE driver, isolate
the decoder OPTEE client into a separate module, and make it depends on
CONFIG_TEE. The driver can open/close the TEE driver dynamically.
Signed-off-by: Yunfei Dong <yunfei.dong@...iatek.com>
---
.../media/platform/mediatek/vcodec/Kconfig | 12 ++++++++++++
.../platform/mediatek/vcodec/decoder/Makefile | 5 ++++-
.../vcodec/decoder/mtk_vcodec_dec_drv.h | 2 ++
.../vcodec/decoder/mtk_vcodec_dec_optee.h | 19 +++++++++++++++++++
4 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/mediatek/vcodec/Kconfig b/drivers/media/platform/mediatek/vcodec/Kconfig
index bc8292232530..ce63e1fa6118 100644
--- a/drivers/media/platform/mediatek/vcodec/Kconfig
+++ b/drivers/media/platform/mediatek/vcodec/Kconfig
@@ -34,3 +34,15 @@ config VIDEO_MEDIATEK_VCODEC
To compile this driver as modules, choose M here: the
modules will be called mtk-vcodec-dec and mtk-vcodec-enc.
+
+config VIDEO_MEDIATEK_VCODEC_TEE
+ bool "MediaTek Video Codec TEE driver"
+ depends on OPTEE
+ depends on TEE
+ select VIDEO_MEDIATEK_VCODEC
+ help
+ MediaTek video codec TEE driver provides interface to
+ communicate with secure os to process secure video.
+
+ Setting this config with Y when the driver need to support
+ secure video playback(SVP).
\ No newline at end of file
diff --git a/drivers/media/platform/mediatek/vcodec/decoder/Makefile b/drivers/media/platform/mediatek/vcodec/decoder/Makefile
index 1624933dfd5e..797ad9ebafb6 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/Makefile
+++ b/drivers/media/platform/mediatek/vcodec/decoder/Makefile
@@ -3,6 +3,8 @@
obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-dec.o \
mtk-vcodec-dec-hw.o
+obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC_TEE) += mtk-vcodec-optee.o
+
mtk-vcodec-dec-y := vdec/vdec_h264_if.o \
vdec/vdec_vp8_if.o \
vdec/vdec_vp8_req_if.o \
@@ -21,6 +23,7 @@ mtk-vcodec-dec-y := vdec/vdec_h264_if.o \
mtk_vcodec_dec_stateful.o \
mtk_vcodec_dec_stateless.o \
mtk_vcodec_dec_pm.o \
- mtk_vcodec_dec_optee.o \
mtk-vcodec-dec-hw-y := mtk_vcodec_dec_hw.o
+
+mtk-vcodec-optee-y := mtk_vcodec_dec_optee.o
\ No newline at end of file
diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h
index 0996a8d2a537..dcab8a257380 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h
+++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h
@@ -309,7 +309,9 @@ struct mtk_vcodec_dec_dev {
enum mtk_vcodec_dec_chip_name chip_name;
+#ifdef CONFIG_VIDEO_MEDIATEK_VCODEC_TEE
struct mtk_vdec_optee_private *optee_private;
+#endif
};
static inline struct mtk_vcodec_dec_ctx *fh_to_dec_ctx(struct v4l2_fh *fh)
diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_optee.h b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_optee.h
index 33134cf0d5d5..8a2a82874597 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_optee.h
+++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_optee.h
@@ -52,6 +52,7 @@ struct mtk_vdec_optee_private {
struct mutex tee_mutex;
};
+#ifdef CONFIG_VIDEO_MEDIATEK_VCODEC_TEE
/**
* mtk_vcodec_dec_optee_open - setup the communication channels with TA.
* @vcodec_dev: pointer to the mtk_vcodec_dec_dev of the device
@@ -70,4 +71,22 @@ int mtk_vcodec_dec_optee_private_init(struct mtk_vcodec_dec_dev *vcodec_dev);
*/
void mtk_vcodec_dec_optee_close(struct mtk_vcodec_dec_dev *vcodec_dev);
+#else
+
+static inline int mtk_vcodec_dec_optee_open(struct mtk_vcodec_dec_dev *vcodec_dev)
+{
+ return 0;
+}
+
+static inline int mtk_vcodec_dec_optee_private_init(struct mtk_vcodec_dec_dev *vcodec_dev)
+{
+ return 0;
+}
+
+static inline void mtk_vcodec_dec_optee_close(struct mtk_vcodec_dec_dev *vcodec_dev)
+{
+}
+
+#endif /* CONFIG_VIDEO_MEDIATEK_VCODEC_TEE */
+
#endif /* _MTK_VCODEC_DEC_OPTEE_H_ */
--
2.18.0
Powered by blists - more mailing lists