From 6b5ce362f942f4acd779e953f13964e67b3aee07 Mon Sep 17 00:00:00 2001 From: Stanimir Varbanov Date: Tue, 28 Apr 2015 17:20:09 +0300 Subject: [PATCH] firmware: qcom: scm: add video (vidc) scm calls Signed-off-by: Stanimir Varbanov Conflicts: drivers/firmware/qcom_scm.c --- drivers/firmware/qcom_scm-32.c | 48 ++++++++++++++++++++++++++++++++++ drivers/firmware/qcom_scm-64.c | 44 +++++++++++++++++++++++++++++++ drivers/firmware/qcom_scm.c | 15 +++++++++++ drivers/firmware/qcom_scm.h | 5 ++++ include/linux/qcom_scm.h | 4 +++ 5 files changed, 116 insertions(+) diff --git a/drivers/firmware/qcom_scm-32.c b/drivers/firmware/qcom_scm-32.c index c6ec89548354..2ac6abc0d652 100644 --- a/drivers/firmware/qcom_scm-32.c +++ b/drivers/firmware/qcom_scm-32.c @@ -835,3 +835,51 @@ int __qcom_scm_restore_sec_cfg(u32 device_id, u32 spare) return 0; } + +#define TZBSP_VIDEO_SET_STATE 0xa +int __qcom_scm_set_video_state(u32 state, u32 spare) +{ + struct { + u32 state; + u32 spare; + } req; + int scm_ret = 0; + int ret; + + req.state = state; + req.spare = spare; + + ret = qcom_scm_call(SCM_SVC_BOOT, TZBSP_VIDEO_SET_STATE, &req, + sizeof(req), &scm_ret, sizeof(scm_ret)); + if (ret || scm_ret) + return ret ? ret : -EINVAL; + + return 0; +} + +#define TZBSP_MEM_PROTECT_VIDEO_VAR 0x8 + +int __qcom_scm_mem_protect_video_var(u32 start, u32 size, u32 nonpixel_start, + u32 nonpixel_size) +{ + struct { + u32 cp_start; + u32 cp_size; + u32 cp_nonpixel_start; + u32 cp_nonpixel_size; + } req; + int ret, scm_ret; + + req.cp_start = start; + req.cp_size = size; + req.cp_nonpixel_start = nonpixel_start; + req.cp_nonpixel_size = nonpixel_size; + + ret = qcom_scm_call(SCM_SVC_MP, TZBSP_MEM_PROTECT_VIDEO_VAR, &req, + sizeof(req), &scm_ret, sizeof(scm_ret)); + + if (ret || scm_ret) + return ret ? ret : -EINVAL; + + return 0; +} diff --git a/drivers/firmware/qcom_scm-64.c b/drivers/firmware/qcom_scm-64.c index 2584336105c0..030b584dec2a 100644 --- a/drivers/firmware/qcom_scm-64.c +++ b/drivers/firmware/qcom_scm-64.c @@ -796,6 +796,50 @@ int __qcom_scm_restore_sec_cfg(u32 device_id, u32 spare) return 0; } +#define TZBSP_VIDEO_SET_STATE 0xa +int __qcom_scm_set_video_state(u32 state, u32 spare) +{ + struct qcom_scm_desc desc = {0}; + int ret, scm_ret; + + desc.args[0] = state; + desc.args[1] = spare; + desc.arginfo = QCOM_SCM_ARGS(2); + + ret = qcom_scm_call(SCM_SVC_BOOT, TZBSP_VIDEO_SET_STATE, &desc); + + scm_ret = desc.ret[0]; + + if (ret || scm_ret) + return ret ? ret : -EINVAL; + + return 0; +} + +#define TZBSP_MEM_PROTECT_VIDEO_VAR 0x8 + +int __qcom_scm_mem_protect_video_var(u32 start, u32 size, u32 nonpixel_start, + u32 nonpixel_size) +{ + struct qcom_scm_desc desc = {0}; + int ret, scm_ret; + + desc.args[0] = start; + desc.args[1] = size; + desc.args[2] = nonpixel_start; + desc.args[3] = nonpixel_size; + desc.arginfo = QCOM_SCM_ARGS(4); + + ret = qcom_scm_call(SCM_SVC_MP, TZBSP_MEM_PROTECT_VIDEO_VAR, &desc); + + scm_ret = desc.ret[0]; + + if (ret || scm_ret) + return ret ? ret : -EINVAL; + + return 0; +} + #define QCOM_SCM_SVC_INFO 0x6 static int __init qcom_scm_init(void) { diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c index 34477a827836..5fff0858f7ba 100644 --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c @@ -254,3 +254,18 @@ int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare) return __qcom_scm_restore_sec_cfg(device_id, spare); } EXPORT_SYMBOL(qcom_scm_restore_sec_cfg); + +int qcom_scm_set_video_state(u32 state, u32 spare) +{ + return __qcom_scm_set_video_state(state, spare); +} +EXPORT_SYMBOL(qcom_scm_set_video_state); + +int qcom_scm_mem_protect_video_var(u32 start, u32 size, + u32 nonpixel_start, + u32 nonpixel_size) +{ + return __qcom_scm_mem_protect_video_var(start, size, nonpixel_start, + nonpixel_size); +} +EXPORT_SYMBOL(qcom_scm_mem_protect_video_var); diff --git a/drivers/firmware/qcom_scm.h b/drivers/firmware/qcom_scm.h index 3730201661c4..5d7f0ef6fee7 100644 --- a/drivers/firmware/qcom_scm.h +++ b/drivers/firmware/qcom_scm.h @@ -86,6 +86,7 @@ enum scm_cmd { PAS_SHUTDOWN_CMD, }; +#define SCM_SVC_BOOT 0x1 #define SCM_SVC_PIL 0x2 #define SCM_SVC_INFO 0x6 @@ -111,4 +112,8 @@ extern int __qcom_scm_is_call_available(u32 svc_id, u32 cmd_id); extern int __qcom_scm_get_feat_version(u32 feat); extern int __qcom_scm_restore_sec_cfg(u32 device_id, u32 spare); +extern int __qcom_scm_set_video_state(u32 state, u32 spare); +extern int __qcom_scm_mem_protect_video_var(u32 start, u32 size, + u32 nonpixel_start, + u32 nonpixel_size); #endif diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h index 5b613ac14961..8e042773dd58 100644 --- a/include/linux/qcom_scm.h +++ b/include/linux/qcom_scm.h @@ -66,4 +66,8 @@ extern int qcom_scm_is_call_available(u32 svc_id, u32 cmd_id); extern int qcom_scm_get_feat_version(u32 feat); extern int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare); +extern int qcom_scm_set_video_state(u32 state, u32 spare); +extern int qcom_scm_mem_protect_video_var(u32 start, u32 size, + u32 nonpixel_start, + u32 nonpixel_size); #endif -- 2.39.5