diff --git a/drivers/amlogic/media/video_processor/ppmgr/ppmgr_drv.c b/drivers/amlogic/media/video_processor/ppmgr/ppmgr_drv.c index 07bd70d31d9b..1b52e50ec0f7 100644 --- a/drivers/amlogic/media/video_processor/ppmgr/ppmgr_drv.c +++ b/drivers/amlogic/media/video_processor/ppmgr/ppmgr_drv.c @@ -65,6 +65,8 @@ static bool scaler_pos_reset; #endif static struct ppmgr_dev_reg_s ppmgr_dev_reg; +int ppmgr_secure_debug; +int ppmgr_secure_mode; enum platform_type_t get_platform_type(void) { @@ -1069,6 +1071,29 @@ static ssize_t tb_status_read(struct class *cla, return snprintf(buf, 80, "#################\n"); } +static ssize_t secure_mode_read(struct class *cla, + struct class_attribute *attr, char *buf) +{ + return snprintf(buf, 80, "secure_debug is %d secure_mode is %d\n", + ppmgr_secure_debug, ppmgr_secure_mode); +} + +static ssize_t secure_mode_write(struct class *cla, + struct class_attribute *attr, + const char *buf, size_t count) +{ + int parsed[2]; + + if (parse_para(buf, 2, parsed) == 2) { + ppmgr_secure_debug = parsed[0]; + ppmgr_secure_mode = parsed[1]; + } else { + PPMGRDRV_ERR("echo > secure_mode"); + return -1; + } + return count; +} + #ifdef CONFIG_AMLOGIC_POST_PROCESS_MANAGER_3D_PROCESS static ssize_t _3dmode_read( struct class *cla, struct class_attribute *attr, char *buf) @@ -1674,6 +1699,10 @@ __ATTR(orientation, 0644, tb_status_read, NULL), + __ATTR(secure_mode, + 0644, + secure_mode_read, + secure_mode_write), __ATTR_NULL }; static struct class ppmgr_class = {.name = PPMGR_CLASS_NAME, .class_attrs = diff --git a/drivers/amlogic/media/video_processor/ppmgr/ppmgr_vpp.c b/drivers/amlogic/media/video_processor/ppmgr/ppmgr_vpp.c index 9760cc6aa3c2..7e1a300f92e7 100644 --- a/drivers/amlogic/media/video_processor/ppmgr/ppmgr_vpp.c +++ b/drivers/amlogic/media/video_processor/ppmgr/ppmgr_vpp.c @@ -2629,6 +2629,8 @@ static int ppmgr_task(void *data) vf = ppmgr_vf_get_dec(); if (!vf) break; + if (ppmgr_secure_debug) + vf->mem_sec = ppmgr_secure_mode; if (vf && ppmgr_device.started) { if (!(vf->type & (VIDTYPE_VIU_422 diff --git a/drivers/amlogic/media/video_processor/ppmgr/ppmgr_vpp.h b/drivers/amlogic/media/video_processor/ppmgr/ppmgr_vpp.h index 95e48c17fcfc..855af38f4c27 100644 --- a/drivers/amlogic/media/video_processor/ppmgr/ppmgr_vpp.h +++ b/drivers/amlogic/media/video_processor/ppmgr/ppmgr_vpp.h @@ -73,6 +73,8 @@ enum ppmgr_source_type { }; extern u32 omx_cur_session; +extern int ppmgr_secure_debug; +extern int ppmgr_secure_mode; #endif