Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 308203
b: refs/heads/master
c: 1c0035d
h: refs/heads/master
i:
  308201: 7171993
  308199: 467227a
v: v3
  • Loading branch information
Shawn Guo authored and Mike Turquette committed Apr 24, 2012
1 parent 7a09b84 commit 6e2a85e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 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: 81536e072b54e30bbfd1a9a6b8094f7b3dd5321c
refs/heads/master: 1c0035d710dd3bfa86d58f851b8737c7f11a9bbc
5 changes: 3 additions & 2 deletions trunk/drivers/clk/clk-divider.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,15 @@ static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate,
return *prate / div;
}

static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate)
static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
struct clk_divider *divider = to_clk_divider(hw);
unsigned int div;
unsigned long flags = 0;
u32 val;

div = __clk_get_rate(__clk_get_parent(hw->clk)) / rate;
div = parent_rate / rate;

if (!(divider->flags & CLK_DIVIDER_ONE_BASED))
div--;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/clk/clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ static void clk_change_rate(struct clk *clk)
old_rate = clk->rate;

if (clk->ops->set_rate)
clk->ops->set_rate(clk->hw, clk->new_rate);
clk->ops->set_rate(clk->hw, clk->new_rate, clk->parent->rate);

if (clk->ops->recalc_rate)
clk->rate = clk->ops->recalc_rate(clk->hw,
Expand Down
21 changes: 7 additions & 14 deletions trunk/include/linux/clk-provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,11 @@ struct clk_hw {
* array index into the value programmed into the hardware.
* Returns 0 on success, -EERROR otherwise.
*
* @set_rate: Change the rate of this clock. If this callback returns
* CLK_SET_RATE_PARENT, the rate change will be propagated to the
* parent clock (which may propagate again if the parent clock
* also sets this flag). The requested rate of the parent is
* passed back from the callback in the second 'unsigned long *'
* argument. Note that it is up to the hardware clock's set_rate
* implementation to insure that clocks do not run out of spec
* when propgating the call to set_rate up to the parent. One way
* to do this is to gate the clock (via clk_disable and/or
* clk_unprepare) before calling clk_set_rate, then ungating it
* afterward. If your clock also has the CLK_GATE_SET_RATE flag
* set then this will insure safety. Returns 0 on success,
* -EERROR otherwise.
* @set_rate: Change the rate of this clock. The requested rate is specified
* by the second argument, which should typically be the return
* of .round_rate call. The third argument gives the parent rate
* which is likely helpful for most .set_rate implementation.
* Returns 0 on success, -EERROR otherwise.
*
* The clk_enable/clk_disable and clk_prepare/clk_unprepare pairs allow
* implementations to split any work between atomic (enable) and sleepable
Expand All @@ -125,7 +117,8 @@ struct clk_ops {
unsigned long *);
int (*set_parent)(struct clk_hw *hw, u8 index);
u8 (*get_parent)(struct clk_hw *hw);
int (*set_rate)(struct clk_hw *hw, unsigned long);
int (*set_rate)(struct clk_hw *hw, unsigned long,
unsigned long);
void (*init)(struct clk_hw *hw);
};

Expand Down

0 comments on commit 6e2a85e

Please sign in to comment.