diff options
| author | Lakshmi Narayana Kalavala <lkalaval@codeaurora.org> | 2016-02-18 14:56:48 -0800 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-25 16:02:54 -0700 |
| commit | 5a3ebc46d9ebe39de0fd9d39ed5267a5d37f4b3d (patch) | |
| tree | ed87ddcb2be700dc54fcf626b2ce41fb75ccf163 | |
| parent | 7f82315e56a85d3b154b2d9c6d40ff908cc26c31 (diff) | |
msm: camera: Change API to set and get clock rate
Some of the camera modules need to get the clock rate
back after rounded to a new value, Hence change the
msm_camera_clk_set_rate API to return the rounded
clock rate after setting it.
Change-Id: Ie3ed17ad6658e51448a769fd141aef63ff0c79fe
Signed-off-by: Lakshmi Narayana Kalavala <lkalaval@codeaurora.org>
| -rw-r--r-- | drivers/media/platform/msm/camera_v2/common/cam_soc_api.c | 13 | ||||
| -rw-r--r-- | drivers/media/platform/msm/camera_v2/common/cam_soc_api.h | 8 |
2 files changed, 11 insertions, 10 deletions
diff --git a/drivers/media/platform/msm/camera_v2/common/cam_soc_api.c b/drivers/media/platform/msm/camera_v2/common/cam_soc_api.c index d3ef03691d12..d699d091e3c7 100644 --- a/drivers/media/platform/msm/camera_v2/common/cam_soc_api.c +++ b/drivers/media/platform/msm/camera_v2/common/cam_soc_api.c @@ -395,32 +395,33 @@ cam_clk_set_err: EXPORT_SYMBOL(msm_camera_clk_enable); /* Set rate on a specific clock */ -int msm_camera_clk_set_rate(struct device *dev, +long msm_camera_clk_set_rate(struct device *dev, struct clk *clk, long clk_rate) { int rc = 0; + long rate = 0; - if (!dev || !clk) + if (!dev || !clk || (clk_rate < 0)) return -EINVAL; CDBG("clk : %p, enable : %ld\n", clk, clk_rate); if (clk_rate > 0) { - clk_rate = clk_round_rate(clk, clk_rate); - if (clk_rate < 0) { + rate = clk_round_rate(clk, clk_rate); + if (rate < 0) { pr_err("round rate failed\n"); return -EINVAL; } - rc = clk_set_rate(clk, clk_rate); + rc = clk_set_rate(clk, rate); if (rc < 0) { pr_err("set rate failed\n"); return -EINVAL; } } - return 0; + return rate; } EXPORT_SYMBOL(msm_camera_clk_set_rate); diff --git a/drivers/media/platform/msm/camera_v2/common/cam_soc_api.h b/drivers/media/platform/msm/camera_v2/common/cam_soc_api.h index e8f34504a04a..0b60d4137354 100644 --- a/drivers/media/platform/msm/camera_v2/common/cam_soc_api.h +++ b/drivers/media/platform/msm/camera_v2/common/cam_soc_api.h @@ -134,19 +134,19 @@ int msm_camera_clk_enable(struct device *dev, /** * @brief : Set clock rate * - * This function sets the rate for a specified clock + * This function sets the rate for a specified clock and + * returns the rounded value * * @param dev : Device to get clocks information * @param clk : Pointer to clock to set rate * @param clk_rate : Rate to be set * - * @return Status of operation. Negative in case of error. Zero otherwise. + * @return Status of operation. Negative in case of error. clk rate otherwise. */ -int msm_camera_clk_set_rate(struct device *dev, +long msm_camera_clk_set_rate(struct device *dev, struct clk *clk, long clk_rate); - /** * @brief : Gets regulator info * |
