Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a1e33505 authored by Lakshmi Narayana Kalavala's avatar Lakshmi Narayana Kalavala Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatarLakshmi Narayana Kalavala <lkalaval@codeaurora.org>
parent 73135edf
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -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);

+4 −4
Original line number Diff line number Diff line
@@ -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
 *