summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGautham Mayyuri <gmayyuri@codeaurora.org>2016-07-21 11:19:03 -0700
committerGautham Mayyuri <gmayyuri@codeaurora.org>2016-08-12 15:13:53 -0700
commit09ea2d70f3438761526ca93c1c055cf4d03b1604 (patch)
tree796746cb37c9bad0fadb129ef828d920ea25c24d
parent974be111a45de527dae13604f343900a11a89811 (diff)
msm: camera: cpp: Vote AHB with clock enabled and no mem retention
Vote for AHB bandwidth after clocks are enabled. For bandwidth voting clocks need to be on. Set the memory retention flags for certain hardware clocks to save power, memory does not need to be retained for these clocks since the driver reinitializes the jpeg hardware whenever the clocks are turned on. CRs-Fixed: 1044777 1044373 Change-Id: Ib8e0ede7e237eb6c43f67e98a3b335067a4a74fc Signed-off-by: Rajakumar Govindaram <rajakuma@codeaurora.org> Signed-off-by: Gautham Mayyuri <gmayyuri@codeaurora.org>
-rw-r--r--drivers/media/platform/msm/camera_v2/pproc/cpp/msm_cpp.c45
1 files changed, 31 insertions, 14 deletions
diff --git a/drivers/media/platform/msm/camera_v2/pproc/cpp/msm_cpp.c b/drivers/media/platform/msm/camera_v2/pproc/cpp/msm_cpp.c
index 5a1e99adc7f3..f4add41c85c9 100644
--- a/drivers/media/platform/msm/camera_v2/pproc/cpp/msm_cpp.c
+++ b/drivers/media/platform/msm/camera_v2/pproc/cpp/msm_cpp.c
@@ -25,6 +25,7 @@
#include <linux/timer.h>
#include <linux/kernel.h>
#include <linux/workqueue.h>
+#include <linux/clk/msm-clk.h>
#include <media/v4l2-event.h>
#include <media/v4l2-ioctl.h>
#include <media/msmb_camera.h>
@@ -788,13 +789,6 @@ static int cpp_init_hardware(struct cpp_device *cpp_dev)
int rc = 0;
uint32_t vbif_version;
- rc = cam_config_ahb_clk(NULL, 0, CAM_AHB_CLIENT_CPP,
- CAM_AHB_SVS_VOTE);
- if (rc < 0) {
- pr_err("%s: failed to vote for AHB\n", __func__);
- goto ahb_vote_fail;
- }
-
rc = msm_camera_regulator_enable(cpp_dev->cpp_vdd,
cpp_dev->num_reg, true);
if (rc < 0) {
@@ -817,6 +811,13 @@ static int cpp_init_hardware(struct cpp_device *cpp_dev)
goto clk_failed;
}
+ rc = cam_config_ahb_clk(NULL, 0, CAM_AHB_CLIENT_CPP,
+ CAM_AHB_SVS_VOTE);
+ if (rc < 0) {
+ pr_err("%s: failed to vote for AHB\n", __func__);
+ goto ahb_vote_fail;
+ }
+
if (cpp_dev->state != CPP_STATE_BOOT) {
rc = msm_camera_register_irq(cpp_dev->pdev, cpp_dev->irq,
msm_cpp_irq, IRQF_TRIGGER_RISING, "cpp", cpp_dev);
@@ -880,16 +881,16 @@ static int cpp_init_hardware(struct cpp_device *cpp_dev)
pwr_collapse_reset:
msm_cpp_update_gdscr_status(cpp_dev, false);
req_irq_fail:
+ if (cam_config_ahb_clk(NULL, 0, CAM_AHB_CLIENT_CPP,
+ CAM_AHB_SUSPEND_VOTE) < 0)
+ pr_err("%s: failed to remove vote for AHB\n", __func__);
+ahb_vote_fail:
msm_camera_clk_enable(&cpp_dev->pdev->dev, cpp_dev->clk_info,
cpp_dev->cpp_clk, cpp_dev->num_clks, false);
clk_failed:
msm_camera_regulator_enable(cpp_dev->cpp_vdd,
cpp_dev->num_reg, false);
reg_enable_failed:
- if (cam_config_ahb_clk(NULL, 0, CAM_AHB_CLIENT_CPP,
- CAM_AHB_SUSPEND_VOTE) < 0)
- pr_err("%s: failed to remove vote for AHB\n", __func__);
-ahb_vote_fail:
return rc;
}
@@ -903,6 +904,9 @@ static void cpp_release_hardware(struct cpp_device *cpp_dev)
}
msm_cpp_delete_buff_queue(cpp_dev);
msm_cpp_update_gdscr_status(cpp_dev, false);
+ if (cam_config_ahb_clk(NULL, 0, CAM_AHB_CLIENT_CPP,
+ CAM_AHB_SUSPEND_VOTE) < 0)
+ pr_err("%s: failed to remove vote for AHB\n", __func__);
msm_camera_clk_enable(&cpp_dev->pdev->dev, cpp_dev->clk_info,
cpp_dev->cpp_clk, cpp_dev->num_clks, false);
msm_camera_regulator_enable(cpp_dev->cpp_vdd, cpp_dev->num_reg, false);
@@ -912,9 +916,6 @@ static void cpp_release_hardware(struct cpp_device *cpp_dev)
}
cpp_dev->stream_cnt = 0;
- if (cam_config_ahb_clk(NULL, 0, CAM_AHB_CLIENT_CPP,
- CAM_AHB_SUSPEND_VOTE) < 0)
- pr_err("%s: failed to remove vote for AHB\n", __func__);
}
static int32_t cpp_load_fw(struct cpp_device *cpp_dev, char *fw_name_bin)
@@ -3932,6 +3933,7 @@ static int cpp_probe(struct platform_device *pdev)
{
struct cpp_device *cpp_dev;
int rc = 0;
+ int i = 0;
CPP_DBG("E");
cpp_dev = kzalloc(sizeof(struct cpp_device), GFP_KERNEL);
@@ -4000,6 +4002,21 @@ static int cpp_probe(struct platform_device *pdev)
goto mem_err;
}
+ /* set memcore and mem periphery logic flags to 0 */
+ for (i = 0; i < cpp_dev->num_clks; i++) {
+ if ((strcmp(cpp_dev->clk_info[i].clk_name,
+ "cpp_core_clk") == 0) ||
+ (strcmp(cpp_dev->clk_info[i].clk_name,
+ "camss_cpp_axi_clk") == 0) ||
+ (strcmp(cpp_dev->clk_info[i].clk_name,
+ "micro_iface_clk") == 0)) {
+ msm_camera_set_clk_flags(cpp_dev->cpp_clk[i],
+ CLKFLAG_NORETAIN_MEM);
+ msm_camera_set_clk_flags(cpp_dev->cpp_clk[i],
+ CLKFLAG_NORETAIN_PERIPH);
+ }
+ }
+
rc = msm_camera_get_regulator_info(pdev, &cpp_dev->cpp_vdd,
&cpp_dev->num_reg);
if (rc < 0) {