Call the clock's round_rate op, if it exists, before setting
dvfs rate. Ensures dvfs is set to the rate the clock will
be at after the later call to set_rate.
Change-Id: I4c8e85991238492adc3c37aed57c7269f3b41a2c
Signed-off-by: Colin Cross <ccross@android.com>
int ret = 0;
unsigned long flags;
unsigned long old_rate;
+ long new_rate;
clk_lock_save(c, flags);
if (rate > c->max_rate)
rate = c->max_rate;
+ if (c->ops && c->ops->round_rate) {
+ new_rate = c->ops->round_rate(c, rate);
+
+ if (new_rate < 0) {
+ ret = new_rate;
+ goto out;
+ }
+
+ rate = new_rate;
+ }
+
if (clk_is_auto_dvfs(c) && rate > old_rate && c->refcnt > 0) {
ret = tegra_dvfs_set_rate(c, rate);
if (ret)