Message ID | 20130403213412.3383.84823@quantum (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Mike, On 03/04/13 22:34, Mike Turquette wrote: > diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h > index 9fdfae7..1a19186 100644 > --- a/include/linux/clk-provider.h > +++ b/include/linux/clk-provider.h > @@ -126,6 +126,9 @@ struct clk_ops { > unsigned long parent_rate); > long (*round_rate)(struct clk_hw *hw, unsigned long, > unsigned long *); > + s64 (*determine_rate)(struct clk_hw *hw, unsigned long rate, > + unsigned long *best_parent_rate, > + struct clk *best_parent_clk); Thanks for the comments. I've sent a new patchset based on this. I've left the return value for determine_rate the same as round_rate though (long rather than s64), figuring that introducing s64 would be a can of worms, and if wanting to convert code to use s64, it should probably be done together in a separate patchset. Cheers James
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 0230c9d..0708fa3 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1043,12 +1043,17 @@ static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate) /* never propagate up to the parent */ if (!(clk->flags & CLK_SET_RATE_PARENT)) { - if (!clk->ops->round_rate) { + if (clk->ops->determine_rate) { + new_rate = clk->ops->determine_rate(clk->hw, rate, + &best_parent_rate, &best_parent_clk); + goto out; + } else if (clk->ops->round_rate) { + new_rate = clk->ops->round_rate(clk->hw, rate, &best_parent_rate); + goto out; + } else { clk->new_rate = clk->rate; return NULL; } - new_rate = clk->ops->round_rate(clk->hw, rate, &best_parent_rate); - goto out; } /* need clk->parent from here on out */ diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 9fdfae7..1a19186 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -126,6 +126,9 @@ struct clk_ops { unsigned long parent_rate); long (*round_rate)(struct clk_hw *hw, unsigned long, unsigned long *); + s64 (*determine_rate)(struct clk_hw *hw, unsigned long rate, + unsigned long *best_parent_rate, + struct clk *best_parent_clk); 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,