Lines Matching full:p1
24 unsigned int p1; in aptina_pll_calculate() local
41 /* Compute the multiplier M and combined N*P1 divisor. */ in aptina_pll_calculate()
46 /* We now have the smallest M and N*P1 values that will result in the in aptina_pll_calculate()
54 * - minimum/maximum combined N*P1 divisor in aptina_pll_calculate()
67 dev_err(dev, "pll: no valid combined N*P1 divisor.\n"); in aptina_pll_calculate()
72 * We're looking for the highest acceptable P1 value for which a in aptina_pll_calculate()
75 * 1. p1 is in the [p1_min, p1_max] range given by the limits and is in aptina_pll_calculate()
78 * 3. div * mf is a multiple of p1, in order to compute in aptina_pll_calculate()
79 * n = div * mf / p1 in aptina_pll_calculate()
86 * The first naive approach is to iterate over all p1 values acceptable in aptina_pll_calculate()
95 * mf_inc = p1 / gcd(div, p1) (6) in aptina_pll_calculate()
101 * acceptable p1 and mf values by modifying the minimum and maximum in aptina_pll_calculate()
104 * ext_clock / (div * mf / p1) * m * mf >= out_clock_min in aptina_pll_calculate()
105 * ext_clock / (div * mf / p1) * m * mf <= out_clock_max in aptina_pll_calculate()
109 * p1 >= out_clock_min * div / (ext_clock * m) (7) in aptina_pll_calculate()
110 * p1 <= out_clock_max * div / (ext_clock * m) in aptina_pll_calculate()
114 * mf >= ext_clock * p1 / (int_clock_max * div) (8) in aptina_pll_calculate()
115 * mf <= ext_clock * p1 / (int_clock_min * div) in aptina_pll_calculate()
117 * We can thus iterate over the restricted p1 range defined by the in aptina_pll_calculate()
121 * select the mf lwoer bound and the corresponding p1 value. in aptina_pll_calculate()
124 dev_err(dev, "pll: P1 minimum value must be >0.\n"); in aptina_pll_calculate()
133 for (p1 = p1_max & ~1; p1 >= p1_min; p1 -= 2) { in aptina_pll_calculate()
134 unsigned int mf_inc = p1 / gcd(div, p1); in aptina_pll_calculate()
138 mf_low = roundup(max(mf_min, DIV_ROUND_UP(pll->ext_clock * p1, in aptina_pll_calculate()
140 mf_high = min(mf_max, pll->ext_clock * p1 / in aptina_pll_calculate()
146 pll->n = div * mf_low / p1; in aptina_pll_calculate()
148 pll->p1 = p1; in aptina_pll_calculate()
149 dev_dbg(dev, "PLL: N %u M %u P1 %u\n", pll->n, pll->m, pll->p1); in aptina_pll_calculate()
153 dev_err(dev, "pll: no valid N and P1 divisors found.\n"); in aptina_pll_calculate()