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

Commit 6955f760 authored by Hanumath Prasad's avatar Hanumath Prasad
Browse files

devfreq: devfreq_simple_dev: call clk_round_rate in dev_target



clk_set_rate is failing for some of the frequencies due to higher
precision introduced in clock driver. Hence call the clk_round_rate
again in dev_target to make sure we send the correct frequency to
clk_set_rate.

Change-Id: I3e40690bf794d99debbcecdcaf05aaac3363caa8
Signed-off-by: default avatarHanumath Prasad <hpprasad@codeaurora.org>
parent 61a16a5e
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -61,9 +61,18 @@ static void find_freq(struct devfreq_dev_profile *p, unsigned long *freq,
static int dev_target(struct device *dev, unsigned long *freq, u32 flags)
{
	struct dev_data *d = dev_get_drvdata(dev);
	unsigned long rfreq;

	find_freq(&d->profile, freq, flags);
	return clk_set_rate(d->clk, *freq * 1000);

	rfreq = clk_round_rate(d->clk, *freq * 1000);
	if (IS_ERR_VALUE(rfreq)) {
		dev_err(dev, "devfreq: Cannot find matching frequency for %lu\n",
			*freq);
		return rfreq;
	}

	return clk_set_rate(d->clk, rfreq);
}

static int dev_get_cur_freq(struct device *dev, unsigned long *freq)