Lines Matching full:settings

68  * struct clk_si544_muldiv - Multiplier/divider settings
120 struct clk_si544_muldiv *settings) in si544_get_muldiv() argument
129 settings->ls_div_bits = (reg[1] >> 4) & 0x07; in si544_get_muldiv()
130 settings->hs_div = (reg[1] & 0x07) << 8 | reg[0]; in si544_get_muldiv()
136 settings->fb_div_int = reg[4] | (reg[5] & 0x07) << 8; in si544_get_muldiv()
137 settings->fb_div_frac = reg[0] | reg[1] << 8 | reg[2] << 16 | in si544_get_muldiv()
145 settings->delta_m = reg[0] << 8 | reg[1] << 16 | reg[2] << 24; in si544_get_muldiv()
146 settings->delta_m >>= 8; in si544_get_muldiv()
164 struct clk_si544_muldiv *settings) in si544_set_muldiv() argument
169 reg[0] = settings->hs_div; in si544_set_muldiv()
170 reg[1] = settings->hs_div >> 8 | settings->ls_div_bits << 4; in si544_set_muldiv()
176 reg[0] = settings->fb_div_frac; in si544_set_muldiv()
177 reg[1] = settings->fb_div_frac >> 8; in si544_set_muldiv()
178 reg[2] = settings->fb_div_frac >> 16; in si544_set_muldiv()
179 reg[3] = settings->fb_div_frac >> 24; in si544_set_muldiv()
180 reg[4] = settings->fb_div_int; in si544_set_muldiv()
181 reg[5] = settings->fb_div_int >> 8; in si544_set_muldiv()
199 /* Calculate divider settings for a given frequency */
200 static int si544_calc_muldiv(struct clk_si544_muldiv *settings, in si544_calc_muldiv() argument
210 settings->ls_div_bits = 0; in si544_calc_muldiv()
213 settings->ls_div_bits = 0; in si544_calc_muldiv()
223 settings->ls_div_bits = res; in si544_calc_muldiv()
230 settings->hs_div = vco; in si544_calc_muldiv()
233 if ((settings->hs_div & 1) && in si544_calc_muldiv()
234 (settings->hs_div > HS_DIV_MAX_ODD || settings->ls_div_bits)) in si544_calc_muldiv()
235 ++settings->hs_div; in si544_calc_muldiv()
238 vco = (u64)ls_freq * settings->hs_div; in si544_calc_muldiv()
242 settings->fb_div_int = vco; in si544_calc_muldiv()
248 settings->fb_div_frac = vco; in si544_calc_muldiv()
251 settings->delta_m = 0; in si544_calc_muldiv()
256 /* Calculate resulting frequency given the register settings */
258 const struct clk_si544_muldiv *settings) in si544_calc_center_rate() argument
260 u32 d = settings->hs_div * BIT(settings->ls_div_bits); in si544_calc_center_rate()
264 vco = (u64)settings->fb_div_frac * FXO; in si544_calc_center_rate()
269 vco += (u64)settings->fb_div_int * FXO; in si544_calc_center_rate()
277 static unsigned long si544_calc_rate(const struct clk_si544_muldiv *settings) in si544_calc_rate() argument
279 unsigned long rate = si544_calc_center_rate(settings); in si544_calc_rate()
280 s64 delta = (s64)rate * (DELTA_M_FRAC_NUM * settings->delta_m); in si544_calc_rate()
287 if (settings->delta_m < 0) in si544_calc_rate()
300 struct clk_si544_muldiv settings; in si544_recalc_rate() local
303 err = si544_get_muldiv(data, &settings); in si544_recalc_rate()
307 return si544_calc_rate(&settings); in si544_recalc_rate()
344 struct clk_si544_muldiv settings; in si544_set_rate() local
355 err = si544_get_muldiv(data, &settings); in si544_set_rate()
359 center = si544_calc_center_rate(&settings); in si544_set_rate()
368 err = si544_calc_muldiv(&settings, rate); in si544_set_rate()
383 err = si544_set_delta_m(data, settings.delta_m); in si544_set_rate()
387 err = si544_set_muldiv(data, &settings); in si544_set_rate()