Commit c4e634ce authored by Eric Anholt's avatar Eric Anholt Committed by Stephen Boyd

clk: bcm2835: Clamp the PLL's requested rate to the hardware limits.

Fixes setting low-resolution video modes on HDMI.  Now the PLLH_PIX
divider adjusts itself until the PLLH is within bounds.
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
parent 1c703225
...@@ -502,8 +502,12 @@ static long bcm2835_pll_rate_from_divisors(unsigned long parent_rate, ...@@ -502,8 +502,12 @@ static long bcm2835_pll_rate_from_divisors(unsigned long parent_rate,
static long bcm2835_pll_round_rate(struct clk_hw *hw, unsigned long rate, static long bcm2835_pll_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *parent_rate) unsigned long *parent_rate)
{ {
struct bcm2835_pll *pll = container_of(hw, struct bcm2835_pll, hw);
const struct bcm2835_pll_data *data = pll->data;
u32 ndiv, fdiv; u32 ndiv, fdiv;
rate = clamp(rate, data->min_rate, data->max_rate);
bcm2835_pll_choose_ndiv_and_fdiv(rate, *parent_rate, &ndiv, &fdiv); bcm2835_pll_choose_ndiv_and_fdiv(rate, *parent_rate, &ndiv, &fdiv);
return bcm2835_pll_rate_from_divisors(*parent_rate, ndiv, fdiv, 1); return bcm2835_pll_rate_from_divisors(*parent_rate, ndiv, fdiv, 1);
...@@ -608,13 +612,6 @@ static int bcm2835_pll_set_rate(struct clk_hw *hw, ...@@ -608,13 +612,6 @@ static int bcm2835_pll_set_rate(struct clk_hw *hw,
u32 ana[4]; u32 ana[4];
int i; int i;
if (rate < data->min_rate || rate > data->max_rate) {
dev_err(cprman->dev, "%s: rate out of spec: %lu vs (%lu, %lu)\n",
clk_hw_get_name(hw), rate,
data->min_rate, data->max_rate);
return -EINVAL;
}
if (rate > data->max_fb_rate) { if (rate > data->max_fb_rate) {
use_fb_prediv = true; use_fb_prediv = true;
rate /= 2; rate /= 2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment