Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 358582
b: refs/heads/master
c: 4d79833
h: refs/heads/master
v: v3
  • Loading branch information
Axel Lin authored and Bryan Wu committed Feb 2, 2013
1 parent 5101f10 commit 25e8d52
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 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: 5e3b7c6b1cb1a579a65fa77c7f785d94013025be
refs/heads/master: 4d7983324507ff23ddf0b6e513864d4eca7a62f1
12 changes: 6 additions & 6 deletions trunk/drivers/leds/leds-renesas-tpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,24 +133,24 @@ static int r_tpu_enable(struct r_tpu_priv *p, enum led_brightness brightness)
rate = clk_get_rate(p->clk);

/* pick the lowest acceptable rate */
for (k = 0; k < ARRAY_SIZE(prescaler); k++)
if ((rate / prescaler[k]) < p->min_rate)
for (k = ARRAY_SIZE(prescaler) - 1; k >= 0; k--)
if ((rate / prescaler[k]) >= p->min_rate)
break;

if (!k) {
if (k < 0) {
dev_err(&p->pdev->dev, "clock rate mismatch\n");
goto err0;
}
dev_dbg(&p->pdev->dev, "rate = %lu, prescaler %u\n",
rate, prescaler[k - 1]);
rate, prescaler[k]);

/* clear TCNT on TGRB match, count on rising edge, set prescaler */
r_tpu_write(p, TCR, 0x0040 | (k - 1));
r_tpu_write(p, TCR, 0x0040 | k);

/* output 0 until TGRA, output 1 until TGRB */
r_tpu_write(p, TIOR, 0x0002);

rate /= prescaler[k - 1] * p->refresh_rate;
rate /= prescaler[k] * p->refresh_rate;
r_tpu_write(p, TGRB, rate);
dev_dbg(&p->pdev->dev, "TRGB = 0x%04lx\n", rate);

Expand Down

0 comments on commit 25e8d52

Please sign in to comment.