[v7,08/28] media: mediatek: vcodec: build decoder OPTEE driver as module
Commit Message
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@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(-)
@@ -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
@@ -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
@@ -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)
@@ -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_ */