Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <eric@anholt.net>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>

authored by

Eric Anholt and committed by
Stephen Boyd
c4e634ce 1c703225

+4 -7
+4 -7
drivers/clk/bcm/clk-bcm2835.c
··· 502 502 static long bcm2835_pll_round_rate(struct clk_hw *hw, unsigned long rate, 503 503 unsigned long *parent_rate) 504 504 { 505 + struct bcm2835_pll *pll = container_of(hw, struct bcm2835_pll, hw); 506 + const struct bcm2835_pll_data *data = pll->data; 505 507 u32 ndiv, fdiv; 508 + 509 + rate = clamp(rate, data->min_rate, data->max_rate); 506 510 507 511 bcm2835_pll_choose_ndiv_and_fdiv(rate, *parent_rate, &ndiv, &fdiv); 508 512 ··· 611 607 u32 ndiv, fdiv, a2w_ctl; 612 608 u32 ana[4]; 613 609 int i; 614 - 615 - if (rate < data->min_rate || rate > data->max_rate) { 616 - dev_err(cprman->dev, "%s: rate out of spec: %lu vs (%lu, %lu)\n", 617 - clk_hw_get_name(hw), rate, 618 - data->min_rate, data->max_rate); 619 - return -EINVAL; 620 - } 621 610 622 611 if (rate > data->max_fb_rate) { 623 612 use_fb_prediv = true;