Loading drivers/media/platform/msm/camera_v2/sensor/csid/msm_csid.c +139 −4 Original line number Diff line number Diff line Loading @@ -62,7 +62,14 @@ #define SOF_DEBUG_DISABLE 0 #define SCM_SVC_CAMERASS 0x18 #define SECURE_SYSCALL_ID 0x6 #define SECURE_SYSCALL_ID 0x7 #define TOPOLOGY_SYSCALL_ID 0x8 #define STREAM_NOTIF_SYSCALL_ID 0x9 #define CSIPHY_0_LANES_MASK 0x000f #define CSIPHY_1_LANES_MASK 0x00f0 #define CSIPHY_2_LANES_MASK 0x0f00 #define CSIPHY_3_LANES_MASK 0xf000 #define TRUE 1 #define FALSE 0 Loading @@ -73,6 +80,13 @@ #undef CDBG #define CDBG(fmt, args...) pr_debug(fmt, ##args) static const uint32_t CSIPHY_LANES_MASKS[] = { CSIPHY_0_LANES_MASK, CSIPHY_1_LANES_MASK, CSIPHY_2_LANES_MASK, CSIPHY_3_LANES_MASK, }; static struct camera_vreg_t csid_vreg_info[] = { {"qcom,mipi-csi-vdd", 0, 0, 12000}, }; Loading Loading @@ -340,6 +354,63 @@ static bool msm_csid_find_max_clk_rate(struct csid_device *csid_dev) } return ret; } static int msm_csid_seccam_send_topology(struct csid_device *csid_dev, struct msm_camera_csid_params *csid_params) { void __iomem *csidbase; struct scm_desc desc = {0}; csidbase = csid_dev->base; if (!csidbase || !csid_params) { pr_err("%s:%d csidbase %pK, csid params %pK\n", __func__, __LINE__, csidbase, csid_params); return -EINVAL; } desc.arginfo = SCM_ARGS(2, SCM_VAL, SCM_VAL); desc.args[0] = csid_params->phy_sel; desc.args[1] = csid_params->topology; CDBG("phy_sel %d, topology %d\n", csid_params->phy_sel, csid_params->topology); if (scm_call2(SCM_SIP_FNID(SCM_SVC_CAMERASS, TOPOLOGY_SYSCALL_ID), &desc)) { pr_err("%s:%d scm call to hypervisor failed\n", __func__, __LINE__); return -EINVAL; } return 0; } static int msm_csid_seccam_reset_pipeline(struct csid_device *csid_dev, struct msm_camera_csid_params *csid_params) { void __iomem *csidbase; struct scm_desc desc = {0}; csidbase = csid_dev->base; if (!csidbase || !csid_params) { pr_err("%s:%d csidbase %pK, csid params %pK\n", __func__, __LINE__, csidbase, csid_params); return -EINVAL; } desc.arginfo = SCM_ARGS(2, SCM_VAL, SCM_VAL); desc.args[0] = csid_params->phy_sel; desc.args[1] = csid_params->is_streamon; CDBG("phy_sel %d, is_streamon %d\n", csid_params->phy_sel, csid_params->is_streamon); if (scm_call2(SCM_SIP_FNID(SCM_SVC_CAMERASS, STREAM_NOTIF_SYSCALL_ID), &desc)) { pr_err("%s:%d scm call to hypervisor failed\n", __func__, __LINE__); return -EINVAL; } return 0; } static int msm_csid_config(struct csid_device *csid_dev, struct msm_camera_csid_params *csid_params) { Loading Loading @@ -377,17 +448,19 @@ static int msm_csid_config(struct csid_device *csid_dev, desc.arginfo = SCM_ARGS(2, SCM_VAL, SCM_VAL); desc.args[0] = csid_params->is_secure; desc.args[1] = csid_params->phy_sel; desc.args[1] = CSIPHY_LANES_MASKS[csid_params->phy_sel]; CDBG("phy_sel : %d, secure : %d\n", csid_params->phy_sel, csid_params->is_secure); msm_camera_tz_clear_tzbsp_status(); if (scm_call2(SCM_SIP_FNID(SCM_SVC_CAMERASS, SECURE_SYSCALL_ID), &desc)) { pr_err("%s:%d scm call to hypervisor failed\n", __func__, __LINE__); return -EINVAL; } msm_camera_tz_clear_tzbsp_status(); } csid_dev->csid_lane_cnt = csid_params->lane_cnt; Loading Loading @@ -757,7 +830,8 @@ static int msm_csid_release(struct csid_device *csid_dev) desc.arginfo = SCM_ARGS(2, SCM_VAL, SCM_VAL); desc.args[0] = 0; desc.args[1] = csid_dev->current_csid_params.phy_sel; desc.args[1] = CSIPHY_LANES_MASKS[ csid_dev->current_csid_params.phy_sel]; if (scm_call2(SCM_SIP_FNID(SCM_SVC_CAMERASS, SECURE_SYSCALL_ID), &desc)) { Loading Loading @@ -886,6 +960,32 @@ static int32_t msm_csid_cmd(struct csid_device *csid_dev, void *arg) kfree(csid_params.lut_params.vc_cfg[i]); break; } case CSID_SECCAM_TOPOLOGY: { struct msm_camera_csid_params csid_params; if (copy_from_user(&csid_params, (void __user *)cdata->cfg.csid_params, sizeof(struct msm_camera_csid_params))) { pr_err("%s: %d failed\n", __func__, __LINE__); rc = -EFAULT; break; } rc = msm_csid_seccam_send_topology(csid_dev, &csid_params); break; } case CSID_SECCAM_RESET: { struct msm_camera_csid_params csid_params; if (copy_from_user(&csid_params, (void __user *)cdata->cfg.csid_params, sizeof(struct msm_camera_csid_params))) { pr_err("%s: %d failed\n", __func__, __LINE__); rc = -EFAULT; break; } rc = msm_csid_seccam_reset_pipeline(csid_dev, &csid_params); break; } case CSID_RELEASE: rc = msm_csid_release(csid_dev); break; Loading Loading @@ -1058,6 +1158,41 @@ static int32_t msm_csid_cmd32(struct csid_device *csid_dev, void *arg) } break; } case CSID_SECCAM_TOPOLOGY: { struct msm_camera_csid_params csid_params; struct msm_camera_csid_params32 csid_params32; if (copy_from_user(&csid_params32, (void __user *)compat_ptr(arg32->cfg.csid_params), sizeof(struct msm_camera_csid_params32))) { pr_err("%s: %d failed\n", __func__, __LINE__); rc = -EFAULT; break; } csid_params.topology = csid_params32.topology; csid_params.phy_sel = csid_params32.phy_sel; rc = msm_csid_seccam_send_topology(csid_dev, &csid_params); break; } case CSID_SECCAM_RESET: { struct msm_camera_csid_params csid_params; struct msm_camera_csid_params32 csid_params32; if (copy_from_user(&csid_params32, (void __user *)compat_ptr(arg32->cfg.csid_params), sizeof(struct msm_camera_csid_params32))) { pr_err("%s: %d failed\n", __func__, __LINE__); rc = -EFAULT; break; } csid_params.is_streamon = csid_params32.is_streamon; csid_params.phy_sel = csid_params32.phy_sel; rc = msm_csid_seccam_reset_pipeline(csid_dev, &csid_params); break; } case CSID_RELEASE: rc = msm_csid_release(csid_dev); break; Loading include/media/msm_cam_sensor.h +4 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ #include <linux/compat.h> #define SECURE_CAM_RST_MODULES #ifdef CONFIG_COMPAT struct msm_sensor_power_setting32 { Loading Loading @@ -85,6 +87,8 @@ struct msm_camera_csid_params32 { struct msm_camera_csid_lut_params32 lut_params; uint8_t csi_3p_sel; uint8_t is_secure; uint32_t topology; uint8_t is_streamon; }; struct msm_camera_csi2_params32 { Loading include/uapi/media/msm_cam_sensor.h +2 −0 Original line number Diff line number Diff line Loading @@ -155,6 +155,8 @@ enum csid_cfg_type_t { CSID_CFG, CSID_TESTMODE_CFG, CSID_RELEASE, CSID_SECCAM_TOPOLOGY, CSID_SECCAM_RESET, }; enum csiphy_cfg_type_t { Loading include/uapi/media/msm_camera.h +3 −0 Original line number Diff line number Diff line Loading @@ -1367,6 +1367,7 @@ struct msm_camera_csid_params { uint8_t lane_cnt; uint16_t lane_assign; uint8_t phy_sel; uint32_t topology; struct msm_camera_csid_lut_params lut_params; }; Loading Loading @@ -1411,6 +1412,8 @@ struct csic_cfg_data { enum csid_cfg_type_t { CSID_INIT, CSID_CFG, CSID_SECCAM_TOPOLOGY, CSID_SECCAM_RESET, }; struct csid_cfg_data { Loading include/uapi/media/msm_camsensor_sdk.h +4 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,8 @@ #define SECURE_CAMERA #define SECURE_CAM_RST_MODULES enum msm_sensor_camera_id_t { CAMERA_0, CAMERA_1, Loading Loading @@ -355,6 +357,8 @@ struct msm_camera_csid_params { struct msm_camera_csid_lut_params lut_params; unsigned char csi_3p_sel; unsigned char is_secure; uint32_t topology; unsigned char is_streamon; }; struct msm_camera_csid_testmode_parms { Loading Loading
drivers/media/platform/msm/camera_v2/sensor/csid/msm_csid.c +139 −4 Original line number Diff line number Diff line Loading @@ -62,7 +62,14 @@ #define SOF_DEBUG_DISABLE 0 #define SCM_SVC_CAMERASS 0x18 #define SECURE_SYSCALL_ID 0x6 #define SECURE_SYSCALL_ID 0x7 #define TOPOLOGY_SYSCALL_ID 0x8 #define STREAM_NOTIF_SYSCALL_ID 0x9 #define CSIPHY_0_LANES_MASK 0x000f #define CSIPHY_1_LANES_MASK 0x00f0 #define CSIPHY_2_LANES_MASK 0x0f00 #define CSIPHY_3_LANES_MASK 0xf000 #define TRUE 1 #define FALSE 0 Loading @@ -73,6 +80,13 @@ #undef CDBG #define CDBG(fmt, args...) pr_debug(fmt, ##args) static const uint32_t CSIPHY_LANES_MASKS[] = { CSIPHY_0_LANES_MASK, CSIPHY_1_LANES_MASK, CSIPHY_2_LANES_MASK, CSIPHY_3_LANES_MASK, }; static struct camera_vreg_t csid_vreg_info[] = { {"qcom,mipi-csi-vdd", 0, 0, 12000}, }; Loading Loading @@ -340,6 +354,63 @@ static bool msm_csid_find_max_clk_rate(struct csid_device *csid_dev) } return ret; } static int msm_csid_seccam_send_topology(struct csid_device *csid_dev, struct msm_camera_csid_params *csid_params) { void __iomem *csidbase; struct scm_desc desc = {0}; csidbase = csid_dev->base; if (!csidbase || !csid_params) { pr_err("%s:%d csidbase %pK, csid params %pK\n", __func__, __LINE__, csidbase, csid_params); return -EINVAL; } desc.arginfo = SCM_ARGS(2, SCM_VAL, SCM_VAL); desc.args[0] = csid_params->phy_sel; desc.args[1] = csid_params->topology; CDBG("phy_sel %d, topology %d\n", csid_params->phy_sel, csid_params->topology); if (scm_call2(SCM_SIP_FNID(SCM_SVC_CAMERASS, TOPOLOGY_SYSCALL_ID), &desc)) { pr_err("%s:%d scm call to hypervisor failed\n", __func__, __LINE__); return -EINVAL; } return 0; } static int msm_csid_seccam_reset_pipeline(struct csid_device *csid_dev, struct msm_camera_csid_params *csid_params) { void __iomem *csidbase; struct scm_desc desc = {0}; csidbase = csid_dev->base; if (!csidbase || !csid_params) { pr_err("%s:%d csidbase %pK, csid params %pK\n", __func__, __LINE__, csidbase, csid_params); return -EINVAL; } desc.arginfo = SCM_ARGS(2, SCM_VAL, SCM_VAL); desc.args[0] = csid_params->phy_sel; desc.args[1] = csid_params->is_streamon; CDBG("phy_sel %d, is_streamon %d\n", csid_params->phy_sel, csid_params->is_streamon); if (scm_call2(SCM_SIP_FNID(SCM_SVC_CAMERASS, STREAM_NOTIF_SYSCALL_ID), &desc)) { pr_err("%s:%d scm call to hypervisor failed\n", __func__, __LINE__); return -EINVAL; } return 0; } static int msm_csid_config(struct csid_device *csid_dev, struct msm_camera_csid_params *csid_params) { Loading Loading @@ -377,17 +448,19 @@ static int msm_csid_config(struct csid_device *csid_dev, desc.arginfo = SCM_ARGS(2, SCM_VAL, SCM_VAL); desc.args[0] = csid_params->is_secure; desc.args[1] = csid_params->phy_sel; desc.args[1] = CSIPHY_LANES_MASKS[csid_params->phy_sel]; CDBG("phy_sel : %d, secure : %d\n", csid_params->phy_sel, csid_params->is_secure); msm_camera_tz_clear_tzbsp_status(); if (scm_call2(SCM_SIP_FNID(SCM_SVC_CAMERASS, SECURE_SYSCALL_ID), &desc)) { pr_err("%s:%d scm call to hypervisor failed\n", __func__, __LINE__); return -EINVAL; } msm_camera_tz_clear_tzbsp_status(); } csid_dev->csid_lane_cnt = csid_params->lane_cnt; Loading Loading @@ -757,7 +830,8 @@ static int msm_csid_release(struct csid_device *csid_dev) desc.arginfo = SCM_ARGS(2, SCM_VAL, SCM_VAL); desc.args[0] = 0; desc.args[1] = csid_dev->current_csid_params.phy_sel; desc.args[1] = CSIPHY_LANES_MASKS[ csid_dev->current_csid_params.phy_sel]; if (scm_call2(SCM_SIP_FNID(SCM_SVC_CAMERASS, SECURE_SYSCALL_ID), &desc)) { Loading Loading @@ -886,6 +960,32 @@ static int32_t msm_csid_cmd(struct csid_device *csid_dev, void *arg) kfree(csid_params.lut_params.vc_cfg[i]); break; } case CSID_SECCAM_TOPOLOGY: { struct msm_camera_csid_params csid_params; if (copy_from_user(&csid_params, (void __user *)cdata->cfg.csid_params, sizeof(struct msm_camera_csid_params))) { pr_err("%s: %d failed\n", __func__, __LINE__); rc = -EFAULT; break; } rc = msm_csid_seccam_send_topology(csid_dev, &csid_params); break; } case CSID_SECCAM_RESET: { struct msm_camera_csid_params csid_params; if (copy_from_user(&csid_params, (void __user *)cdata->cfg.csid_params, sizeof(struct msm_camera_csid_params))) { pr_err("%s: %d failed\n", __func__, __LINE__); rc = -EFAULT; break; } rc = msm_csid_seccam_reset_pipeline(csid_dev, &csid_params); break; } case CSID_RELEASE: rc = msm_csid_release(csid_dev); break; Loading Loading @@ -1058,6 +1158,41 @@ static int32_t msm_csid_cmd32(struct csid_device *csid_dev, void *arg) } break; } case CSID_SECCAM_TOPOLOGY: { struct msm_camera_csid_params csid_params; struct msm_camera_csid_params32 csid_params32; if (copy_from_user(&csid_params32, (void __user *)compat_ptr(arg32->cfg.csid_params), sizeof(struct msm_camera_csid_params32))) { pr_err("%s: %d failed\n", __func__, __LINE__); rc = -EFAULT; break; } csid_params.topology = csid_params32.topology; csid_params.phy_sel = csid_params32.phy_sel; rc = msm_csid_seccam_send_topology(csid_dev, &csid_params); break; } case CSID_SECCAM_RESET: { struct msm_camera_csid_params csid_params; struct msm_camera_csid_params32 csid_params32; if (copy_from_user(&csid_params32, (void __user *)compat_ptr(arg32->cfg.csid_params), sizeof(struct msm_camera_csid_params32))) { pr_err("%s: %d failed\n", __func__, __LINE__); rc = -EFAULT; break; } csid_params.is_streamon = csid_params32.is_streamon; csid_params.phy_sel = csid_params32.phy_sel; rc = msm_csid_seccam_reset_pipeline(csid_dev, &csid_params); break; } case CSID_RELEASE: rc = msm_csid_release(csid_dev); break; Loading
include/media/msm_cam_sensor.h +4 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ #include <linux/compat.h> #define SECURE_CAM_RST_MODULES #ifdef CONFIG_COMPAT struct msm_sensor_power_setting32 { Loading Loading @@ -85,6 +87,8 @@ struct msm_camera_csid_params32 { struct msm_camera_csid_lut_params32 lut_params; uint8_t csi_3p_sel; uint8_t is_secure; uint32_t topology; uint8_t is_streamon; }; struct msm_camera_csi2_params32 { Loading
include/uapi/media/msm_cam_sensor.h +2 −0 Original line number Diff line number Diff line Loading @@ -155,6 +155,8 @@ enum csid_cfg_type_t { CSID_CFG, CSID_TESTMODE_CFG, CSID_RELEASE, CSID_SECCAM_TOPOLOGY, CSID_SECCAM_RESET, }; enum csiphy_cfg_type_t { Loading
include/uapi/media/msm_camera.h +3 −0 Original line number Diff line number Diff line Loading @@ -1367,6 +1367,7 @@ struct msm_camera_csid_params { uint8_t lane_cnt; uint16_t lane_assign; uint8_t phy_sel; uint32_t topology; struct msm_camera_csid_lut_params lut_params; }; Loading Loading @@ -1411,6 +1412,8 @@ struct csic_cfg_data { enum csid_cfg_type_t { CSID_INIT, CSID_CFG, CSID_SECCAM_TOPOLOGY, CSID_SECCAM_RESET, }; struct csid_cfg_data { Loading
include/uapi/media/msm_camsensor_sdk.h +4 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,8 @@ #define SECURE_CAMERA #define SECURE_CAM_RST_MODULES enum msm_sensor_camera_id_t { CAMERA_0, CAMERA_1, Loading Loading @@ -355,6 +357,8 @@ struct msm_camera_csid_params { struct msm_camera_csid_lut_params lut_params; unsigned char csi_3p_sel; unsigned char is_secure; uint32_t topology; unsigned char is_streamon; }; struct msm_camera_csid_testmode_parms { Loading