Skip to content

Commit 7a5af5a

Browse files
anholtpopcornmix
authored andcommitted
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: Eric Anholt <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent 92f0de8 commit 7a5af5a

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

drivers/clk/bcm/clk-bcm2835.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,12 @@ static long bcm2835_pll_rate_from_divisors(unsigned long parent_rate,
502502
static long bcm2835_pll_round_rate(struct clk_hw *hw, unsigned long rate,
503503
unsigned long *parent_rate)
504504
{
505+
struct bcm2835_pll *pll = container_of(hw, struct bcm2835_pll, hw);
506+
const struct bcm2835_pll_data *data = pll->data;
505507
u32 ndiv, fdiv;
506508

509+
rate = clamp(rate, data->min_rate, data->max_rate);
510+
507511
bcm2835_pll_choose_ndiv_and_fdiv(rate, *parent_rate, &ndiv, &fdiv);
508512

509513
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,
608612
u32 ana[4];
609613
int i;
610614

611-
if (rate < data->min_rate || rate > data->max_rate) {
612-
dev_err(cprman->dev, "%s: rate out of spec: %lu vs (%lu, %lu)\n",
613-
clk_hw_get_name(hw), rate,
614-
data->min_rate, data->max_rate);
615-
return -EINVAL;
616-
}
617-
618615
if (rate > data->max_fb_rate) {
619616
use_fb_prediv = true;
620617
rate /= 2;

0 commit comments

Comments
 (0)