OSDN Git Service

msm: camera: isp: Set the clock rate for camss vfe clock
authorAlok Kediya <kediya@codeaurora.org>
Thu, 2 Mar 2017 23:43:06 +0000 (15:43 -0800)
committerShubhraprakash Das <sadas@codeaurora.org>
Thu, 30 Mar 2017 21:22:48 +0000 (14:22 -0700)
Make sure rate for camss vfe clock is set before enabling it.
Also, reuse existing variables for the vfe src clk.

CRs-Fixed: 2013802
Change-Id: Ic4acd4c8330b9300ea6bb84eb99a120453841f7a
Signed-off-by: Alok Kediya <kediya@codeaurora.org>
drivers/media/platform/msm/camera_v2/isp/msm_isp.h
drivers/media/platform/msm/camera_v2/isp/msm_isp47.c
drivers/media/platform/msm/camera_v2/isp/msm_isp_axi_util.c
drivers/media/platform/msm/camera_v2/isp/msm_isp_util.c

index 45c2dd5..7f88abc 100644 (file)
@@ -802,7 +802,6 @@ struct vfe_device {
 
        /* State variables */
        uint32_t vfe_hw_version;
-       int vfe_clk_idx;
        uint32_t vfe_open_cnt;
        uint8_t vt_enable;
        uint32_t vfe_ub_policy;
@@ -819,7 +818,6 @@ struct vfe_device {
        struct msm_isp_statistics *stats;
        uint64_t msm_isp_last_overflow_ab;
        uint64_t msm_isp_last_overflow_ib;
-       uint32_t msm_isp_vfe_clk_rate;
        struct msm_isp_ub_info *ub_info;
        uint32_t isp_sof_debug;
        uint32_t isp_raw0_debug;
index 9c74695..5628aa0 100644 (file)
@@ -281,9 +281,11 @@ int msm_isp47_ahb_clk_cfg(struct vfe_device *vfe_dev,
 
        vfe_dev->hw_info->vfe_ops.platform_ops.get_clk_rates(vfe_dev,
                                                        &clk_rates);
-       if (vfe_dev->msm_isp_vfe_clk_rate <= clk_rates.svs_rate)
+       if (vfe_dev->vfe_clk_info[vfe_dev->hw_info->vfe_clk_idx].clk_rate <=
+               clk_rates.svs_rate)
                src_clk_vote = CAM_AHB_SVS_VOTE;
-       else if (vfe_dev->msm_isp_vfe_clk_rate <= clk_rates.nominal_rate)
+       else if (vfe_dev->vfe_clk_info[vfe_dev->hw_info->vfe_clk_idx].clk_rate
+               <= clk_rates.nominal_rate)
                src_clk_vote = CAM_AHB_NOMINAL_VOTE;
        else
                src_clk_vote = CAM_AHB_TURBO_VOTE;
@@ -2595,17 +2597,19 @@ int msm_vfe47_set_clk_rate(struct vfe_device *vfe_dev, long *rate)
        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)
+       if (vfe_dev->vfe_clk_info[clk_idx].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;
+       prev_clk_rate =
+               vfe_dev->vfe_clk_info[clk_idx].clk_rate;
+       vfe_dev->vfe_clk_info[clk_idx].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_info[clk_idx].clk_rate >=
                vfe_dev->vfe_clk_rates[MSM_VFE_CLK_RATE_NOMINAL]
                [vfe_dev->hw_info->vfe_clk_idx]) &&
                prev_clk_rate <
@@ -2628,7 +2632,7 @@ int msm_vfe47_set_clk_rate(struct vfe_device *vfe_dev, long *rate)
         * if voting done earlier
         */
        if ((vfe_dev->vfe_cx_ipeak) &&
-               (vfe_dev->msm_isp_vfe_clk_rate <
+               (vfe_dev->vfe_clk_info[clk_idx].clk_rate <
                vfe_dev->vfe_clk_rates[MSM_VFE_CLK_RATE_NOMINAL]
                [vfe_dev->hw_info->vfe_clk_idx]) &&
                prev_clk_rate >=
index b44b757..ebd3a32 100644 (file)
@@ -1136,7 +1136,8 @@ static void msm_isp_calculate_bandwidth(
                axi_data = &vfe_dev->axi_data;
                if (stream_info->stream_src < RDI_INTF_0) {
                        stream_info->bandwidth[i] =
-                               (vfe_dev->msm_isp_vfe_clk_rate /
+                               (vfe_dev->vfe_clk_info[
+                               vfe_dev->hw_info->vfe_clk_idx].clk_rate /
                                axi_data->src_info[VFE_PIX_0].width) *
                                stream_info->max_width[i];
                        stream_info->bandwidth[i] =
@@ -1149,7 +1150,9 @@ static void msm_isp_calculate_bandwidth(
                                        stream_info->output_format);
                        if (rdi < VFE_SRC_MAX) {
                                stream_info->bandwidth[i] =
-                               (vfe_dev->msm_isp_vfe_clk_rate / 8) * bpp;
+                               (vfe_dev->vfe_clk_info[
+                               vfe_dev->hw_info->vfe_clk_idx].clk_rate /
+                               8) * bpp;
                        } else {
                                pr_err("%s: Invalid rdi interface\n", __func__);
                        }
index f4e81c0..4ba358f 100644 (file)
@@ -166,7 +166,8 @@ void msm_isp_util_get_bandwidth_stats(struct vfe_device *vfe_dev,
        stats->isp_cpp_ib = isp_bandwidth_mgr.client_info[ISP_CPP].ib;
        stats->last_overflow_ab = vfe_dev->msm_isp_last_overflow_ab;
        stats->last_overflow_ib = vfe_dev->msm_isp_last_overflow_ib;
-       stats->vfe_clk_rate = vfe_dev->msm_isp_vfe_clk_rate;
+       stats->vfe_clk_rate = vfe_dev->vfe_clk_info[
+                               vfe_dev->hw_info->vfe_clk_idx].clk_rate;
        stats->cpp_clk_rate = msm_isp_cpp_clk_rate;
 }
 
@@ -538,7 +539,8 @@ int msm_isp_cfg_input(struct vfe_device *vfe_dev, void *arg)
         * Only set rate to higher, do not lower higher
         * rate needed by another input
         */
-       if (pixel_clock > vfe_dev->msm_isp_vfe_clk_rate) {
+       if (pixel_clock > vfe_dev->vfe_clk_info[
+                               vfe_dev->hw_info->vfe_clk_idx].clk_rate) {
                rc = vfe_dev->hw_info->vfe_ops.platform_ops.set_clk_rate(
                        vfe_dev,
                        &pixel_clock);