Merge "msm: camera: isp: correct the CX iPeak voting logic"

This commit is contained in:
Linux Build Service Account 2017-03-14 23:45:36 -07:00 committed by Gerrit - the friendly Code Review server
commit ba76a5fa05
3 changed files with 44 additions and 24 deletions

View file

@ -590,9 +590,9 @@ int vfe_hw_probe(struct platform_device *pdev)
(struct msm_vfe_hardware_info *) match_dev->data; (struct msm_vfe_hardware_info *) match_dev->data;
/* Cx ipeak support */ /* Cx ipeak support */
if (of_find_property(pdev->dev.of_node, if (of_find_property(pdev->dev.of_node,
"qcom,vfe_cx_ipeak", NULL)) { "qcom,vfe-cx-ipeak", NULL)) {
vfe_dev->vfe_cx_ipeak = cx_ipeak_register( vfe_dev->vfe_cx_ipeak = cx_ipeak_register(
pdev->dev.of_node, "qcom,vfe_cx_ipeak"); pdev->dev.of_node, "qcom,vfe-cx-ipeak");
} }
} else { } else {
vfe_dev->hw_info = (struct msm_vfe_hardware_info *) vfe_dev->hw_info = (struct msm_vfe_hardware_info *)

View file

@ -768,7 +768,6 @@ struct vfe_device {
size_t num_hvx_clk; size_t num_hvx_clk;
size_t num_norm_clk; size_t num_norm_clk;
enum cam_ahb_clk_vote ahb_vote; enum cam_ahb_clk_vote ahb_vote;
bool turbo_vote;
struct cx_ipeak_client *vfe_cx_ipeak; struct cx_ipeak_client *vfe_cx_ipeak;
/* Sync variables*/ /* Sync variables*/

View file

@ -331,7 +331,6 @@ int msm_vfe47_init_hardware(struct vfe_device *vfe_dev)
goto ahb_vote_fail; goto ahb_vote_fail;
} }
vfe_dev->ahb_vote = CAM_AHB_SVS_VOTE; vfe_dev->ahb_vote = CAM_AHB_SVS_VOTE;
vfe_dev->turbo_vote = 0;
vfe_dev->common_data->dual_vfe_res->vfe_base[vfe_dev->pdev->id] = vfe_dev->common_data->dual_vfe_res->vfe_base[vfe_dev->pdev->id] =
vfe_dev->vfe_base; vfe_dev->vfe_base;
@ -2563,31 +2562,53 @@ int msm_vfe47_set_clk_rate(struct vfe_device *vfe_dev, long *rate)
int rc = 0; int rc = 0;
int clk_idx = vfe_dev->hw_info->vfe_clk_idx; int clk_idx = vfe_dev->hw_info->vfe_clk_idx;
int ret; int ret;
long clk_rate, prev_clk_rate;
clk_rate = clk_round_rate(vfe_dev->vfe_clk[clk_idx], *rate);
if (vfe_dev->msm_isp_vfe_clk_rate == clk_rate)
return rc;
prev_clk_rate = vfe_dev->msm_isp_vfe_clk_rate;
vfe_dev->msm_isp_vfe_clk_rate = clk_rate;
/*
* if cx_ipeak is supported vote first so that dsp throttling is
* reduced before we go to turbo
*/
if ((vfe_dev->vfe_cx_ipeak) &&
(vfe_dev->msm_isp_vfe_clk_rate >=
vfe_dev->vfe_clk_rates[MSM_VFE_CLK_RATE_TURBO]
[vfe_dev->hw_info->vfe_clk_idx]) &&
prev_clk_rate <
vfe_dev->vfe_clk_rates[MSM_VFE_CLK_RATE_TURBO]
[vfe_dev->hw_info->vfe_clk_idx]) {
ret = cx_ipeak_update(vfe_dev->vfe_cx_ipeak, true);
if (ret) {
pr_err("%s: cx_ipeak_update failed %d\n",
__func__, ret);
return ret;
}
}
/*set vfe clock*/
rc = msm_camera_clk_set_rate(&vfe_dev->pdev->dev, rc = msm_camera_clk_set_rate(&vfe_dev->pdev->dev,
vfe_dev->vfe_clk[clk_idx], *rate); vfe_dev->vfe_clk[clk_idx], *rate);
if (rc < 0) if (rc < 0)
return rc; return rc;
*rate = clk_round_rate(vfe_dev->vfe_clk[clk_idx], *rate); /*
vfe_dev->msm_isp_vfe_clk_rate = *rate; * if cx_ipeak is supported remove the vote for non-turbo clock and
if (vfe_dev->vfe_cx_ipeak) { * if voting done earlier
if (vfe_dev->msm_isp_vfe_clk_rate >= */
vfe_dev->vfe_clk_rates[MSM_VFE_CLK_RATE_TURBO] if ((vfe_dev->vfe_cx_ipeak) &&
[vfe_dev->hw_info->vfe_clk_idx] && (vfe_dev->msm_isp_vfe_clk_rate <
vfe_dev->turbo_vote == 0) { vfe_dev->vfe_clk_rates[MSM_VFE_CLK_RATE_TURBO]
ret = cx_ipeak_update(vfe_dev->vfe_cx_ipeak, true); [vfe_dev->hw_info->vfe_clk_idx]) &&
if (ret) prev_clk_rate >=
pr_debug("%s: cx_ipeak_update failed %d\n", vfe_dev->vfe_clk_rates[MSM_VFE_CLK_RATE_TURBO]
__func__, ret); [vfe_dev->hw_info->vfe_clk_idx]) {
else ret = cx_ipeak_update(vfe_dev->vfe_cx_ipeak, false);
vfe_dev->turbo_vote = 1; if (ret) {
} else if (vfe_dev->turbo_vote == 1) { pr_err("%s: cx_ipeak_update failed %d\n",
ret = cx_ipeak_update(vfe_dev->vfe_cx_ipeak, false); __func__, ret);
if (ret) return ret;
pr_debug("%s: cx_ipeak_update failed %d\n",
__func__, ret);
else
vfe_dev->turbo_vote = 0;
} }
} }
if (vfe_dev->hw_info->vfe_ops.core_ops.ahb_clk_cfg) if (vfe_dev->hw_info->vfe_ops.core_ops.ahb_clk_cfg)