/linux-4.19.296/drivers/clk/rockchip/ ! |
D | clk-pll.c | 59 struct rockchip_clk_pll *pll, unsigned long rate) in rockchip_get_pll_settings() argument 65 if (rate == rate_table[i].rate) in rockchip_get_pll_settings() 81 if (drate >= rate_table[i].rate) in rockchip_pll_round_rate() 82 return rate_table[i].rate; in rockchip_pll_round_rate() 86 return rate_table[i - 1].rate; in rockchip_pll_round_rate() 138 struct rockchip_pll_rate_table *rate) in rockchip_rk3036_pll_get_params() argument 143 rate->fbdiv = ((pllcon >> RK3036_PLLCON0_FBDIV_SHIFT) in rockchip_rk3036_pll_get_params() 145 rate->postdiv1 = ((pllcon >> RK3036_PLLCON0_POSTDIV1_SHIFT) in rockchip_rk3036_pll_get_params() 149 rate->refdiv = ((pllcon >> RK3036_PLLCON1_REFDIV_SHIFT) in rockchip_rk3036_pll_get_params() 151 rate->postdiv2 = ((pllcon >> RK3036_PLLCON1_POSTDIV2_SHIFT) in rockchip_rk3036_pll_get_params() [all …]
|
/linux-4.19.296/drivers/clk/sunxi-ng/ ! |
D | ccu_nm.c | 25 u64 rate = parent; in ccu_nm_calc_rate() local 27 rate *= n; in ccu_nm_calc_rate() 28 do_div(rate, m); in ccu_nm_calc_rate() 30 return rate; in ccu_nm_calc_rate() 33 static void ccu_nm_find_best(unsigned long parent, unsigned long rate, in ccu_nm_find_best() argument 45 if (tmp_rate > rate) in ccu_nm_find_best() 48 if ((rate - tmp_rate) < (rate - best_rate)) { in ccu_nm_find_best() 85 unsigned long rate; in ccu_nm_recalc_rate() local 90 rate = ccu_frac_helper_read_rate(&nm->common, &nm->frac); in ccu_nm_recalc_rate() 93 rate /= nm->fixed_post_div; in ccu_nm_recalc_rate() [all …]
|
D | ccu_mp.c | 16 static void ccu_mp_find_best(unsigned long parent, unsigned long rate, in ccu_mp_find_best() argument 28 if (tmp_rate > rate) in ccu_mp_find_best() 31 if ((rate - tmp_rate) < (rate - best_rate)) { in ccu_mp_find_best() 46 unsigned long rate, in ccu_mp_round_rate() argument 54 rate *= cmp->fixed_post_div; in ccu_mp_round_rate() 59 ccu_mp_find_best(*parent_rate, rate, max_m, max_p, &m, &p); in ccu_mp_round_rate() 60 rate = *parent_rate / p / m; in ccu_mp_round_rate() 63 rate /= cmp->fixed_post_div; in ccu_mp_round_rate() 65 return rate; in ccu_mp_round_rate() 93 unsigned long rate; in ccu_mp_recalc_rate() local [all …]
|
D | ccu_nk.c | 21 static void ccu_nk_find_best(unsigned long parent, unsigned long rate, in ccu_nk_find_best() argument 32 if (tmp_rate > rate) in ccu_nk_find_best() 35 if ((rate - tmp_rate) < (rate - best_rate)) { in ccu_nk_find_best() 72 unsigned long rate, n, k; in ccu_nk_recalc_rate() local 89 rate = parent_rate * n * k; in ccu_nk_recalc_rate() 91 rate /= nk->fixed_post_div; in ccu_nk_recalc_rate() 93 return rate; in ccu_nk_recalc_rate() 96 static long ccu_nk_round_rate(struct clk_hw *hw, unsigned long rate, in ccu_nk_round_rate() argument 103 rate *= nk->fixed_post_div; in ccu_nk_round_rate() 110 ccu_nk_find_best(*parent_rate, rate, &_nk); in ccu_nk_round_rate() [all …]
|
D | ccu_nkmp.c | 27 u64 rate = parent; in ccu_nkmp_calc_rate() local 29 rate *= n * k; in ccu_nkmp_calc_rate() 30 do_div(rate, m * p); in ccu_nkmp_calc_rate() 32 return rate; in ccu_nkmp_calc_rate() 35 static void ccu_nkmp_find_best(unsigned long parent, unsigned long rate, in ccu_nkmp_find_best() argument 52 if (tmp_rate > rate) in ccu_nkmp_find_best() 55 if ((rate - tmp_rate) < (rate - best_rate)) { in ccu_nkmp_find_best() 98 unsigned long n, m, k, p, rate; in ccu_nkmp_recalc_rate() local 124 rate = ccu_nkmp_calc_rate(parent_rate, n, k, m, 1 << p); in ccu_nkmp_recalc_rate() 126 rate /= nkmp->fixed_post_div; in ccu_nkmp_recalc_rate() [all …]
|
/linux-4.19.296/drivers/clk/qcom/ ! |
D | clk-rcg2.c | 133 calc_rate(unsigned long rate, u32 m, u32 n, u32 mode, u32 hid_div) in calc_rate() argument 136 rate *= 2; in calc_rate() 137 rate /= hid_div + 1; in calc_rate() 141 u64 tmp = rate; in calc_rate() 144 rate = tmp; in calc_rate() 147 return rate; in calc_rate() 181 unsigned long clk_flags, rate = req->rate; in _freq_tbl_determine_rate() local 188 f = qcom_find_freq_floor(f, rate); in _freq_tbl_determine_rate() 191 f = qcom_find_freq(f, rate); in _freq_tbl_determine_rate() 210 rate = f->freq; in _freq_tbl_determine_rate() [all …]
|
/linux-4.19.296/drivers/clk/samsung/ ! |
D | clk-pll.c | 38 struct samsung_clk_pll *pll, unsigned long rate) in samsung_get_pll_settings() argument 44 if (rate == rate_table[i].rate) in samsung_get_pll_settings() 60 if (drate >= rate_table[i].rate) in samsung_pll_round_rate() 61 return rate_table[i].rate; in samsung_pll_round_rate() 65 return rate_table[i - 1].rate; in samsung_pll_round_rate() 196 const struct samsung_pll_rate_table *rate, u32 pll_con) in samsung_pll35xx_mp_change() argument 203 return (rate->mdiv != old_mdiv || rate->pdiv != old_pdiv); in samsung_pll35xx_mp_change() 210 const struct samsung_pll_rate_table *rate; in samsung_pll35xx_set_rate() local 214 rate = samsung_get_pll_settings(pll, drate); in samsung_pll35xx_set_rate() 215 if (!rate) { in samsung_pll35xx_set_rate() [all …]
|
/linux-4.19.296/drivers/clk/actions/ ! |
D | owl-composite.c | 56 static long owl_comp_div_round_rate(struct clk_hw *hw, unsigned long rate, in owl_comp_div_round_rate() argument 61 return owl_divider_helper_round_rate(&comp->common, &comp->rate.div_hw, in owl_comp_div_round_rate() 62 rate, parent_rate); in owl_comp_div_round_rate() 70 return owl_divider_helper_recalc_rate(&comp->common, &comp->rate.div_hw, in owl_comp_div_recalc_rate() 74 static int owl_comp_div_set_rate(struct clk_hw *hw, unsigned long rate, in owl_comp_div_set_rate() argument 79 return owl_divider_helper_set_rate(&comp->common, &comp->rate.div_hw, in owl_comp_div_set_rate() 80 rate, parent_rate); in owl_comp_div_set_rate() 83 static long owl_comp_fact_round_rate(struct clk_hw *hw, unsigned long rate, in owl_comp_fact_round_rate() argument 89 &comp->rate.factor_hw, in owl_comp_fact_round_rate() 90 rate, parent_rate); in owl_comp_fact_round_rate() [all …]
|
D | owl-factor.c | 45 unsigned long rate, unsigned long parent_rate) in _get_table_val() argument 55 if ((unsigned long)calc_rate <= rate) { in _get_table_val() 68 struct clk_hw *hw, unsigned long rate, in owl_clk_val_best() argument 76 if (!rate) in owl_clk_val_best() 77 rate = 1; in owl_clk_val_best() 81 bestval = _get_table_val(clkt, rate, parent_rate); in owl_clk_val_best() 86 try_parent_rate = rate * clkt->div / clkt->mul; in owl_clk_val_best() 104 if (cur_rate <= rate && cur_rate > best) { in owl_clk_val_best() 122 unsigned long rate, in owl_factor_helper_round_rate() argument 128 val = owl_clk_val_best(factor_hw, &common->hw, rate, parent_rate); in owl_factor_helper_round_rate() [all …]
|
D | owl-pll.c | 18 static u32 owl_pll_calculate_mul(struct owl_pll_hw *pll_hw, unsigned long rate) in owl_pll_calculate_mul() argument 22 mul = DIV_ROUND_CLOSEST(rate, pll_hw->bfreq); in owl_pll_calculate_mul() 36 for (clkt = table; clkt->rate; clkt++) in _get_table_rate() 38 return clkt->rate; in _get_table_rate() 44 const struct clk_pll_table *table, unsigned long rate) in _get_pll_table() argument 48 for (clkt = table; clkt->rate; clkt++) { in _get_pll_table() 49 if (clkt->rate == rate) { in _get_pll_table() 52 } else if (clkt->rate < rate) in _get_pll_table() 59 static long owl_pll_round_rate(struct clk_hw *hw, unsigned long rate, in owl_pll_round_rate() argument 68 clkt = _get_pll_table(pll_hw->table, rate); in owl_pll_round_rate() [all …]
|
/linux-4.19.296/drivers/clk/ ! |
D | clk-multiplier.c | 18 unsigned long rate, in __get_mult() argument 22 return DIV_ROUND_CLOSEST(rate, parent_rate); in __get_mult() 24 return rate / parent_rate; in __get_mult() 42 static bool __is_best_rate(unsigned long rate, unsigned long new, in __is_best_rate() argument 46 return abs(rate - new) < abs(rate - best); in __is_best_rate() 48 return new >= rate && new < best; in __is_best_rate() 51 static unsigned long __bestmult(struct clk_hw *hw, unsigned long rate, in __bestmult() argument 62 bestmult = rate / orig_parent_rate; in __bestmult() 77 if (rate == orig_parent_rate * i) { in __bestmult() 88 rate / i); in __bestmult() [all …]
|
D | clk-cdce925.c | 108 static void cdce925_pll_find_rate(unsigned long rate, in cdce925_pll_find_rate() argument 115 if (rate <= parent_rate) { in cdce925_pll_find_rate() 117 rate = parent_rate; in cdce925_pll_find_rate() 122 if (rate < CDCE925_PLL_FREQUENCY_MIN) in cdce925_pll_find_rate() 123 rate = CDCE925_PLL_FREQUENCY_MIN; in cdce925_pll_find_rate() 124 else if (rate > CDCE925_PLL_FREQUENCY_MAX) in cdce925_pll_find_rate() 125 rate = CDCE925_PLL_FREQUENCY_MAX; in cdce925_pll_find_rate() 127 g = gcd(rate, parent_rate); in cdce925_pll_find_rate() 129 un = rate / g; in cdce925_pll_find_rate() 145 static long cdce925_pll_round_rate(struct clk_hw *hw, unsigned long rate, in cdce925_pll_round_rate() argument [all …]
|
D | clk-vt8500.c | 140 static long vt8500_dclk_round_rate(struct clk_hw *hw, unsigned long rate, in vt8500_dclk_round_rate() argument 146 if (rate == 0) in vt8500_dclk_round_rate() 149 divisor = *prate / rate; in vt8500_dclk_round_rate() 152 if (rate * divisor < *prate) in vt8500_dclk_round_rate() 166 static int vt8500_dclk_set_rate(struct clk_hw *hw, unsigned long rate, in vt8500_dclk_set_rate() argument 173 if (rate == 0) in vt8500_dclk_set_rate() 176 divisor = parent_rate / rate; in vt8500_dclk_set_rate() 359 static int vt8500_find_pll_bits(unsigned long rate, unsigned long parent_rate, in vt8500_find_pll_bits() argument 365 if ((rate < parent_rate * 4) || (rate > parent_rate * 62)) { in vt8500_find_pll_bits() 371 if (rate <= parent_rate * 31) in vt8500_find_pll_bits() [all …]
|
D | clk-hsdk-pll.c | 50 u32 rate; member 97 int (*update_rate)(struct hsdk_pll_clk *clk, unsigned long rate, 166 u64 rate; in hsdk_pll_recalc_rate() local 189 rate = (u64)parent_rate * fbdiv; in hsdk_pll_recalc_rate() 190 do_div(rate, idiv * odiv); in hsdk_pll_recalc_rate() 192 return rate; in hsdk_pll_recalc_rate() 195 static long hsdk_pll_round_rate(struct clk_hw *hw, unsigned long rate, in hsdk_pll_round_rate() argument 203 if (pll_cfg[0].rate == 0) in hsdk_pll_round_rate() 206 best_rate = pll_cfg[0].rate; in hsdk_pll_round_rate() 208 for (i = 1; pll_cfg[i].rate != 0; i++) { in hsdk_pll_round_rate() [all …]
|
D | clk-si5351.c | 274 unsigned long rate; in si5351_clkin_recalc_rate() local 277 rate = parent_rate; in si5351_clkin_recalc_rate() 280 rate /= 8; in si5351_clkin_recalc_rate() 283 rate /= 4; in si5351_clkin_recalc_rate() 286 rate /= 2; in si5351_clkin_recalc_rate() 295 __func__, (1 << (idiv >> 6)), rate); in si5351_clkin_recalc_rate() 297 return rate; in si5351_clkin_recalc_rate() 330 static int si5351_vxco_set_rate(struct clk_hw *hw, unsigned long rate, in si5351_vxco_set_rate() argument 425 unsigned long long rate; in si5351_pll_recalc_rate() local 434 rate = hwdata->params.p1 * hwdata->params.p3; in si5351_pll_recalc_rate() [all …]
|
/linux-4.19.296/drivers/clk/imx/ ! |
D | clk-pllv3.c | 124 static long clk_pllv3_round_rate(struct clk_hw *hw, unsigned long rate, in clk_pllv3_round_rate() argument 129 return (rate >= parent_rate * 22) ? parent_rate * 22 : in clk_pllv3_round_rate() 133 static int clk_pllv3_set_rate(struct clk_hw *hw, unsigned long rate, in clk_pllv3_set_rate() argument 139 if (rate == parent_rate * 22) in clk_pllv3_set_rate() 141 else if (rate == parent_rate * 20) in clk_pllv3_set_rate() 172 static long clk_pllv3_sys_round_rate(struct clk_hw *hw, unsigned long rate, in clk_pllv3_sys_round_rate() argument 180 if (rate > max_rate) in clk_pllv3_sys_round_rate() 181 rate = max_rate; in clk_pllv3_sys_round_rate() 182 else if (rate < min_rate) in clk_pllv3_sys_round_rate() 183 rate = min_rate; in clk_pllv3_sys_round_rate() [all …]
|
/linux-4.19.296/drivers/clk/meson/ ! |
D | clk-pll.c | 48 u64 rate = (u64)parent_rate * pllt->m; in __pll_params_to_rate() local 54 rate += DIV_ROUND_UP_ULL(frac_rate, in __pll_params_to_rate() 58 return DIV_ROUND_UP_ULL(rate, pllt->n << od); in __pll_params_to_rate() 88 static u16 __pll_params_with_frac(unsigned long rate, in __pll_params_with_frac() argument 94 u64 val = (u64)rate * pllt->n; in __pll_params_with_frac() 109 meson_clk_get_pll_settings(unsigned long rate, in meson_clk_get_pll_settings() argument 119 while (table[i].rate && table[i].rate <= rate) in meson_clk_get_pll_settings() 125 (abs(rate - table[i - 1].rate) < in meson_clk_get_pll_settings() 126 abs(rate - table[i].rate))) in meson_clk_get_pll_settings() 133 static long meson_clk_pll_round_rate(struct clk_hw *hw, unsigned long rate, in meson_clk_pll_round_rate() argument [all …]
|
/linux-4.19.296/drivers/clk/zte/ ! |
D | clk.c | 28 static int rate_to_idx(struct clk_zx_pll *zx_pll, unsigned long rate) in rate_to_idx() argument 34 if (config[i].rate > rate) in rate_to_idx() 37 if (config[i].rate == rate) in rate_to_idx() 78 return zx_pll->lookup_table[idx].rate; in zx_pll_recalc_rate() 81 static long zx_pll_round_rate(struct clk_hw *hw, unsigned long rate, in zx_pll_round_rate() argument 87 idx = rate_to_idx(zx_pll, rate); in zx_pll_round_rate() 89 return zx_pll->lookup_table[idx].rate; in zx_pll_round_rate() 92 static int zx_pll_set_rate(struct clk_hw *hw, unsigned long rate, in zx_pll_set_rate() argument 100 idx = rate_to_idx(zx_pll, rate); in zx_pll_set_rate() 192 static u32 calc_reg(u32 parent_rate, u32 rate) in calc_reg() argument [all …]
|
/linux-4.19.296/drivers/clk/pxa/ ! |
D | clk-pxa.c | 214 unsigned long rate; in pxa2xx_determine_rate() local 217 rate = freqs[i].cpll; in pxa2xx_determine_rate() 218 if (rate == req->rate) in pxa2xx_determine_rate() 220 if (rate < req->min_rate) in pxa2xx_determine_rate() 222 if (rate > req->max_rate) in pxa2xx_determine_rate() 224 if (rate <= req->rate) in pxa2xx_determine_rate() 226 if ((rate >= req->rate) && (closest_above == -1)) in pxa2xx_determine_rate() 233 rate = req->rate; in pxa2xx_determine_rate() 235 rate = freqs[closest_below].cpll; in pxa2xx_determine_rate() 237 rate = freqs[closest_above].cpll; in pxa2xx_determine_rate() [all …]
|
/linux-4.19.296/drivers/clk/at91/ ! |
D | clk-audio-pll.c | 219 static int clk_audio_pll_frac_compute_frac(unsigned long rate, in clk_audio_pll_frac_compute_frac() argument 226 if (!rate) in clk_audio_pll_frac_compute_frac() 229 tmp = rate; in clk_audio_pll_frac_compute_frac() 254 req->rate, req->best_parent_rate); in clk_audio_pll_frac_determine_rate() 256 req->rate = clamp(req->rate, AUDIO_PLL_FOUT_MIN, AUDIO_PLL_FOUT_MAX); in clk_audio_pll_frac_determine_rate() 261 ret = clk_audio_pll_frac_compute_frac(req->rate, req->best_parent_rate, in clk_audio_pll_frac_determine_rate() 266 req->rate = clk_audio_pll_fout(req->best_parent_rate, nd, fracr); in clk_audio_pll_frac_determine_rate() 271 __func__, req->rate, nd, fracr); in clk_audio_pll_frac_determine_rate() 276 static long clk_audio_pll_pad_round_rate(struct clk_hw *hw, unsigned long rate, in clk_audio_pll_pad_round_rate() argument 289 rate, *parent_rate); in clk_audio_pll_pad_round_rate() [all …]
|
/linux-4.19.296/drivers/clk/ti/ ! |
D | fapll.c | 171 u64 rate; in ti_fapll_recalc_rate() local 176 rate = parent_rate; in ti_fapll_recalc_rate() 182 do_div(rate, fapll_p); in ti_fapll_recalc_rate() 185 rate *= fapll_n; in ti_fapll_recalc_rate() 187 return rate; in ti_fapll_recalc_rate() 200 static int ti_fapll_set_div_mult(unsigned long rate, in ti_fapll_set_div_mult() argument 210 if (rate < parent_rate) { in ti_fapll_set_div_mult() 215 *mult_n = rate / parent_rate; in ti_fapll_set_div_mult() 223 static long ti_fapll_round_rate(struct clk_hw *hw, unsigned long rate, in ti_fapll_round_rate() argument 229 if (!rate) in ti_fapll_round_rate() [all …]
|
/linux-4.19.296/drivers/sh/clk/ ! |
D | core.c | 64 freq = clk->parent->rate * mult / div; in clk_rate_table_build() 78 unsigned long rate; member 107 rate_error = abs(freq - rounder->rate); in clk_rate_round_helper() 117 if (rounder->rate >= highest) in clk_rate_round_helper() 119 if (rounder->rate <= lowest) in clk_rate_round_helper() 139 unsigned long rate) in clk_rate_table_round() argument 146 .rate = rate, in clk_rate_table_round() 162 unsigned int div_max, unsigned long rate) in clk_rate_div_range_round() argument 169 .rate = rate, in clk_rate_div_range_round() 182 unsigned int mult_max, unsigned long rate) in clk_rate_mult_range_round() argument [all …]
|
/linux-4.19.296/drivers/clk/tegra/ ! |
D | clk-emc.c | 72 unsigned long rate, parent_rate; member 134 if (timing->rate > req->max_rate) { in emc_determine_rate() 136 req->rate = tegra->timings[i - 1].rate; in emc_determine_rate() 140 if (timing->rate < req->min_rate) in emc_determine_rate() 143 if (timing->rate >= req->rate) { in emc_determine_rate() 144 req->rate = timing->rate; in emc_determine_rate() 150 req->rate = timing->rate; in emc_determine_rate() 154 req->rate = clk_hw_get_rate(hw); in emc_determine_rate() 213 pr_debug("going to rate %ld prate %ld p %s\n", timing->rate, in emc_set_timing() 239 div = timing->parent_rate / (timing->rate / 2) - 2; in emc_set_timing() [all …]
|
/linux-4.19.296/drivers/clk/versatile/ ! |
D | clk-vexpress-osc.c | 35 u32 rate; in vexpress_osc_recalc_rate() local 37 regmap_read(osc->reg, 0, &rate); in vexpress_osc_recalc_rate() 39 return rate; in vexpress_osc_recalc_rate() 42 static long vexpress_osc_round_rate(struct clk_hw *hw, unsigned long rate, in vexpress_osc_round_rate() argument 47 if (osc->rate_min && rate < osc->rate_min) in vexpress_osc_round_rate() 48 rate = osc->rate_min; in vexpress_osc_round_rate() 50 if (osc->rate_max && rate > osc->rate_max) in vexpress_osc_round_rate() 51 rate = osc->rate_max; in vexpress_osc_round_rate() 53 return rate; in vexpress_osc_round_rate() 56 static int vexpress_osc_set_rate(struct clk_hw *hw, unsigned long rate, in vexpress_osc_set_rate() argument [all …]
|
/linux-4.19.296/drivers/clk/sunxi/ ! |
D | clk-sunxi.c | 46 div = req->rate / 6000000; in sun4i_get_pll1_factors() 47 req->rate = 6000000 * div; in sun4i_get_pll1_factors() 53 if (req->rate >= 768000000 || req->rate == 42000000 || in sun4i_get_pll1_factors() 54 req->rate == 54000000) in sun4i_get_pll1_factors() 94 u32 freq_mhz = req->rate / 1000000; in sun6i_a31_get_pll1_factors() 109 req->rate = freq_mhz * 1000000; in sun6i_a31_get_pll1_factors() 170 div = req->rate / 6000000; in sun8i_a23_get_pll1_factors() 171 req->rate = 6000000 * div; in sun8i_a23_get_pll1_factors() 177 if (req->rate >= 768000000 || req->rate == 42000000 || in sun8i_a23_get_pll1_factors() 178 req->rate == 54000000) in sun8i_a23_get_pll1_factors() [all …]
|