Merge "msm: camera: isp: add support for CX iPeak limits management"

This commit is contained in:
Linux Build Service Account 2017-02-28 17:03:41 -08:00 committed by Gerrit - the friendly Code Review server
commit e328726a91
3 changed files with 32 additions and 2 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -588,6 +588,12 @@ int vfe_hw_probe(struct platform_device *pdev)
}
vfe_dev->hw_info =
(struct msm_vfe_hardware_info *) match_dev->data;
/* Cx ipeak support */
if (of_find_property(pdev->dev.of_node,
"qcom,vfe_cx_ipeak", NULL)) {
vfe_dev->vfe_cx_ipeak = cx_ipeak_register(
pdev->dev.of_node, "qcom,vfe_cx_ipeak");
}
} else {
vfe_dev->hw_info = (struct msm_vfe_hardware_info *)
platform_get_device_id(pdev)->driver_data;

View file

@ -29,6 +29,7 @@
#include "msm_buf_mgr.h"
#include "cam_hw_ops.h"
#include <soc/qcom/cx_ipeak.h>
#define VFE40_8974V1_VERSION 0x10000018
#define VFE40_8974V2_VERSION 0x1001001A
@ -767,6 +768,8 @@ struct vfe_device {
size_t num_hvx_clk;
size_t num_norm_clk;
enum cam_ahb_clk_vote ahb_vote;
bool turbo_vote;
struct cx_ipeak_client *vfe_cx_ipeak;
/* Sync variables*/
struct completion reset_complete;

View file

@ -331,6 +331,7 @@ int msm_vfe47_init_hardware(struct vfe_device *vfe_dev)
goto ahb_vote_fail;
}
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->vfe_base;
@ -2556,6 +2557,7 @@ int msm_vfe47_set_clk_rate(struct vfe_device *vfe_dev, long *rate)
{
int rc = 0;
int clk_idx = vfe_dev->hw_info->vfe_clk_idx;
int ret;
rc = msm_camera_clk_set_rate(&vfe_dev->pdev->dev,
vfe_dev->vfe_clk[clk_idx], *rate);
@ -2563,7 +2565,26 @@ int msm_vfe47_set_clk_rate(struct vfe_device *vfe_dev, long *rate)
return rc;
*rate = clk_round_rate(vfe_dev->vfe_clk[clk_idx], *rate);
vfe_dev->msm_isp_vfe_clk_rate = *rate;
if (vfe_dev->vfe_cx_ipeak) {
if (vfe_dev->msm_isp_vfe_clk_rate >=
vfe_dev->vfe_clk_rates[MSM_VFE_CLK_RATE_TURBO]
[vfe_dev->hw_info->vfe_clk_idx] &&
vfe_dev->turbo_vote == 0) {
ret = cx_ipeak_update(vfe_dev->vfe_cx_ipeak, true);
if (ret)
pr_debug("%s: cx_ipeak_update failed %d\n",
__func__, ret);
else
vfe_dev->turbo_vote = 1;
} else if (vfe_dev->turbo_vote == 1) {
ret = cx_ipeak_update(vfe_dev->vfe_cx_ipeak, false);
if (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)
vfe_dev->hw_info->vfe_ops.core_ops.ahb_clk_cfg(vfe_dev, NULL);
return 0;