kernel: bump kernel 4.4 to 4.4.129 for 17.01
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.4 / 0521-clk-bcm2835-Clamp-the-PLL-s-requested-rate-to-the-ha.patch
1 From 4d372013a839ae71582004fbc1aa1905c73d1497 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
5 limits.
6
7 Fixes setting low-resolution video modes on HDMI. Now the PLLH_PIX
8 divider adjusts itself until the PLLH is within bounds.
9
10 Signed-off-by: Eric Anholt <eric@anholt.net>
11 ---
12 drivers/clk/bcm/clk-bcm2835.c | 11 ++++-------
13 1 file changed, 4 insertions(+), 7 deletions(-)
14
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)
20 {
21 + struct bcm2835_pll *pll = container_of(hw, struct bcm2835_pll, hw);
22 + const struct bcm2835_pll_data *data = pll->data;
23 u32 ndiv, fdiv;
24
25 + rate = clamp(rate, data->min_rate, data->max_rate);
26 +
27 bcm2835_pll_choose_ndiv_and_fdiv(rate, *parent_rate, &ndiv, &fdiv);
28
29 return bcm2835_pll_rate_from_divisors(*parent_rate, ndiv, fdiv, 1);
30 @@ -633,13 +637,6 @@ static int bcm2835_pll_set_rate(struct c
31 u32 ana[4];
32 int i;
33
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);
38 - return -EINVAL;
39 - }
40 -
41 if (rate > data->max_fb_rate) {
42 use_fb_prediv = true;
43 rate /= 2;