1 From d9ab4b6b57e450db6a03df299079e8d80093ef45 Mon Sep 17 00:00:00 2001
2 From: Eric Anholt <eric@anholt.net>
3 Date: Wed, 28 Sep 2016 17:58:52 -0700
4 Subject: [PATCH] clk: bcm2835: Clamp the PLL's requested rate to the hardware
7 Fixes setting low-resolution video modes on HDMI. Now the PLLH_PIX
8 divider adjusts itself until the PLLH is within bounds.
10 Signed-off-by: Eric Anholt <eric@anholt.net>
12 drivers/clk/bcm/clk-bcm2835.c | 11 ++++-------
13 1 file changed, 4 insertions(+), 7 deletions(-)
15 --- a/drivers/clk/bcm/clk-bcm2835.c
16 +++ b/drivers/clk/bcm/clk-bcm2835.c
17 @@ -523,8 +523,12 @@ static long bcm2835_pll_rate_from_diviso
18 static long bcm2835_pll_round_rate(struct clk_hw *hw, unsigned long rate,
19 unsigned long *parent_rate)
21 + struct bcm2835_pll *pll = container_of(hw, struct bcm2835_pll, hw);
22 + const struct bcm2835_pll_data *data = pll->data;
25 + rate = clamp(rate, data->min_rate, data->max_rate);
27 bcm2835_pll_choose_ndiv_and_fdiv(rate, *parent_rate, &ndiv, &fdiv);
29 return bcm2835_pll_rate_from_divisors(*parent_rate, ndiv, fdiv, 1);
30 @@ -629,13 +633,6 @@ static int bcm2835_pll_set_rate(struct c
34 - if (rate < data->min_rate || rate > data->max_rate) {
35 - dev_err(cprman->dev, "%s: rate out of spec: %lu vs (%lu, %lu)\n",
36 - clk_hw_get_name(hw), rate,
37 - data->min_rate, data->max_rate);
41 if (rate > data->max_fb_rate) {