Loading drivers/media/platform/msm/camera_v2/isp/msm_isp_util.c +54 −0 Original line number Diff line number Diff line Loading @@ -280,6 +280,43 @@ int msm_isp_unsubscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, return rc; } static int msm_isp_get_max_clk_rate(struct vfe_device *vfe_dev, long *rate) { int clk_idx = 0; unsigned long max_value = ~0; long round_rate = 0; if (!vfe_dev || !rate) { pr_err("%s:%d failed: vfe_dev %p rate %p\n", __func__, __LINE__, vfe_dev, rate); return -EINVAL; } *rate = 0; if (!vfe_dev->hw_info) { pr_err("%s:%d failed: vfe_dev->hw_info %p\n", __func__, __LINE__, vfe_dev->hw_info); return -EINVAL; } clk_idx = vfe_dev->hw_info->vfe_clk_idx; if (clk_idx >= ARRAY_SIZE(vfe_dev->vfe_clk)) { pr_err("%s:%d failed: clk_idx %d max array size %d\n", __func__, __LINE__, clk_idx, ARRAY_SIZE(vfe_dev->vfe_clk)); return -EINVAL; } round_rate = clk_round_rate(vfe_dev->vfe_clk[clk_idx], max_value); if (round_rate < 0) { pr_err("%s: Invalid vfe clock rate\n", __func__); return -EINVAL; } *rate = round_rate; return 0; } static int msm_isp_set_clk_rate(struct vfe_device *vfe_dev, long *rate) { int rc = 0; Loading Loading @@ -642,6 +679,23 @@ static int msm_isp_send_hw_cmd(struct vfe_device *vfe_dev, case GET_SOC_HW_VER: *cfg_data = vfe_dev->soc_hw_version; break; case GET_MAX_CLK_RATE: { int rc = 0; if (cmd_len < sizeof(unsigned long)) { pr_err("%s:%d failed: invalid cmd len %d exp %d\n", __func__, __LINE__, cmd_len, sizeof(unsigned long)); return -EINVAL; } rc = msm_isp_get_max_clk_rate(vfe_dev, (unsigned long *)cfg_data); if (rc < 0) { pr_err("%s:%d failed: rc %d\n", __func__, __LINE__, rc); return -EINVAL; } break; } } return 0; } Loading include/media/msmb_isp.h +1 −0 Original line number Diff line number Diff line Loading @@ -235,6 +235,7 @@ enum msm_vfe_reg_cfg_type { VFE_READ_DMI_32BIT, VFE_READ_DMI_64BIT, GET_SOC_HW_VER, GET_MAX_CLK_RATE, }; struct msm_vfe_cfg_cmd2 { Loading Loading
drivers/media/platform/msm/camera_v2/isp/msm_isp_util.c +54 −0 Original line number Diff line number Diff line Loading @@ -280,6 +280,43 @@ int msm_isp_unsubscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, return rc; } static int msm_isp_get_max_clk_rate(struct vfe_device *vfe_dev, long *rate) { int clk_idx = 0; unsigned long max_value = ~0; long round_rate = 0; if (!vfe_dev || !rate) { pr_err("%s:%d failed: vfe_dev %p rate %p\n", __func__, __LINE__, vfe_dev, rate); return -EINVAL; } *rate = 0; if (!vfe_dev->hw_info) { pr_err("%s:%d failed: vfe_dev->hw_info %p\n", __func__, __LINE__, vfe_dev->hw_info); return -EINVAL; } clk_idx = vfe_dev->hw_info->vfe_clk_idx; if (clk_idx >= ARRAY_SIZE(vfe_dev->vfe_clk)) { pr_err("%s:%d failed: clk_idx %d max array size %d\n", __func__, __LINE__, clk_idx, ARRAY_SIZE(vfe_dev->vfe_clk)); return -EINVAL; } round_rate = clk_round_rate(vfe_dev->vfe_clk[clk_idx], max_value); if (round_rate < 0) { pr_err("%s: Invalid vfe clock rate\n", __func__); return -EINVAL; } *rate = round_rate; return 0; } static int msm_isp_set_clk_rate(struct vfe_device *vfe_dev, long *rate) { int rc = 0; Loading Loading @@ -642,6 +679,23 @@ static int msm_isp_send_hw_cmd(struct vfe_device *vfe_dev, case GET_SOC_HW_VER: *cfg_data = vfe_dev->soc_hw_version; break; case GET_MAX_CLK_RATE: { int rc = 0; if (cmd_len < sizeof(unsigned long)) { pr_err("%s:%d failed: invalid cmd len %d exp %d\n", __func__, __LINE__, cmd_len, sizeof(unsigned long)); return -EINVAL; } rc = msm_isp_get_max_clk_rate(vfe_dev, (unsigned long *)cfg_data); if (rc < 0) { pr_err("%s:%d failed: rc %d\n", __func__, __LINE__, rc); return -EINVAL; } break; } } return 0; } Loading
include/media/msmb_isp.h +1 −0 Original line number Diff line number Diff line Loading @@ -235,6 +235,7 @@ enum msm_vfe_reg_cfg_type { VFE_READ_DMI_32BIT, VFE_READ_DMI_64BIT, GET_SOC_HW_VER, GET_MAX_CLK_RATE, }; struct msm_vfe_cfg_cmd2 { Loading