[PATCH v7 08/28] media: mediatek: vcodec: build decoder OPTEE driver as module
Yunfei Dong
yunfei.dong at mediatek.com
Sat Jul 20 00:15:46 PDT 2024
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 at mediatek.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
More information about the linux-arm-kernel
mailing list