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: Hanumath Prasad <hpprasad@codeaurora.org>
This commit is contained in:
Hanumath Prasad 2015-11-12 19:50:24 +05:30 committed by David Keitel
parent 4b5b233f04
commit 69d2c9fae6

View file

@ -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) static int dev_target(struct device *dev, unsigned long *freq, u32 flags)
{ {
struct dev_data *d = dev_get_drvdata(dev); struct dev_data *d = dev_get_drvdata(dev);
unsigned long rfreq;
find_freq(&d->profile, freq, flags); 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) static int dev_get_cur_freq(struct device *dev, unsigned long *freq)