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>
This commit is contained in:
parent
7f82315e56
commit
5a3ebc46d9
2 changed files with 11 additions and 10 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue