Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 137337
b: refs/heads/master
c: b324504
h: refs/heads/master
i:
  137335: 97133d6
v: v3
  • Loading branch information
Paul Walmsley authored and Russell King committed Feb 8, 2009
1 parent 3eab7f8 commit 38536c0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c1bd7aaf678a7e35086520e284d5b44bc69b6599
refs/heads/master: b32450409847dddf060a468707212d3493df4f63
23 changes: 13 additions & 10 deletions trunk/arch/arm/mach-omap2/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,19 +877,22 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate)
int m, n, r, e, scaled_max_m;
unsigned long scaled_rt_rp, new_rate;
int min_e = -1, min_e_m = -1, min_e_n = -1;
struct dpll_data *dd;

if (!clk || !clk->dpll_data)
return ~0;

dd = clk->dpll_data;

pr_debug("clock: starting DPLL round_rate for clock %s, target rate "
"%ld\n", clk->name, target_rate);

scaled_rt_rp = target_rate / (clk->parent->rate / DPLL_SCALE_FACTOR);
scaled_max_m = clk->dpll_data->max_multiplier * DPLL_SCALE_FACTOR;
scaled_max_m = dd->max_multiplier * DPLL_SCALE_FACTOR;

clk->dpll_data->last_rounded_rate = 0;
dd->last_rounded_rate = 0;

for (n = clk->dpll_data->max_divider; n >= DPLL_MIN_DIVIDER; n--) {
for (n = dd->max_divider; n >= DPLL_MIN_DIVIDER; n--) {

/* Compute the scaled DPLL multiplier, based on the divider */
m = scaled_rt_rp * n;
Expand All @@ -909,7 +912,7 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate)
"(new_rate = %ld)\n", n, m, e, new_rate);

if (min_e == -1 ||
min_e >= (int)(abs(e) - clk->dpll_data->rate_tolerance)) {
min_e >= (int)(abs(e) - dd->rate_tolerance)) {
min_e = e;
min_e_m = m;
min_e_n = n;
Expand All @@ -932,17 +935,17 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate)
return ~0;
}

clk->dpll_data->last_rounded_m = min_e_m;
clk->dpll_data->last_rounded_n = min_e_n;
clk->dpll_data->last_rounded_rate =
_dpll_compute_new_rate(clk->parent->rate, min_e_m, min_e_n);
dd->last_rounded_m = min_e_m;
dd->last_rounded_n = min_e_n;
dd->last_rounded_rate = _dpll_compute_new_rate(clk->parent->rate,
min_e_m, min_e_n);

pr_debug("clock: final least error: e = %d, m = %d, n = %d\n",
min_e, min_e_m, min_e_n);
pr_debug("clock: final rate: %ld (target rate: %ld)\n",
clk->dpll_data->last_rounded_rate, target_rate);
dd->last_rounded_rate, target_rate);

return clk->dpll_data->last_rounded_rate;
return dd->last_rounded_rate;
}

/*-------------------------------------------------------------------------
Expand Down

0 comments on commit 38536c0

Please sign in to comment.