Lines Matching full:settings
53 /* Multiplier/divider settings */
97 struct clk_si514_muldiv *settings) in si514_get_muldiv() argument
107 settings->m_frac = reg[0] | reg[1] << 8 | reg[2] << 16 | in si514_get_muldiv()
109 settings->m_int = (reg[4] & 0x3f) << 3 | reg[3] >> 5; in si514_get_muldiv()
110 settings->ls_div_bits = (reg[6] >> 4) & 0x07; in si514_get_muldiv()
111 settings->hs_div = (reg[6] & 0x03) << 8 | reg[5]; in si514_get_muldiv()
116 struct clk_si514_muldiv *settings) in si514_set_muldiv() argument
124 if (settings->m_int < 65 || in si514_set_muldiv()
125 (settings->m_int == 65 && settings->m_frac <= 139575831)) in si514_set_muldiv()
128 else if (settings->m_int < 67 || in si514_set_muldiv()
129 (settings->m_int == 67 && settings->m_frac <= 461581994)) in si514_set_muldiv()
132 else if (settings->m_int < 72 || in si514_set_muldiv()
133 (settings->m_int == 72 && settings->m_frac <= 503383578)) in si514_set_muldiv()
136 else if (settings->m_int < 75 || in si514_set_muldiv()
137 (settings->m_int == 75 && settings->m_frac <= 452724474)) in si514_set_muldiv()
146 reg[0] = settings->m_frac; in si514_set_muldiv()
147 reg[1] = settings->m_frac >> 8; in si514_set_muldiv()
148 reg[2] = settings->m_frac >> 16; in si514_set_muldiv()
149 reg[3] = settings->m_frac >> 24 | settings->m_int << 5; in si514_set_muldiv()
150 reg[4] = settings->m_int >> 3; in si514_set_muldiv()
151 reg[5] = settings->hs_div; in si514_set_muldiv()
152 reg[6] = (settings->hs_div >> 8) | (settings->ls_div_bits << 4); in si514_set_muldiv()
164 /* Calculate divider settings for a given frequency */
165 static int si514_calc_muldiv(struct clk_si514_muldiv *settings, in si514_calc_muldiv() argument
179 settings->ls_div_bits = 0; in si514_calc_muldiv()
189 settings->ls_div_bits = res; in si514_calc_muldiv()
194 settings->hs_div = DIV_ROUND_UP(FVCO_MIN >> 1, ls_freq) << 1; in si514_calc_muldiv()
197 m = ((u64)(ls_freq * settings->hs_div) << 29) + (FXO / 2); in si514_calc_muldiv()
199 settings->m_frac = (u32)m & (BIT(29) - 1); in si514_calc_muldiv()
200 settings->m_int = (u32)(m >> 29); in si514_calc_muldiv()
205 /* Calculate resulting frequency given the register settings */
206 static unsigned long si514_calc_rate(struct clk_si514_muldiv *settings) in si514_calc_rate() argument
208 u64 m = settings->m_frac | ((u64)settings->m_int << 29); in si514_calc_rate()
209 u32 d = settings->hs_div * BIT(settings->ls_div_bits); in si514_calc_rate()
218 struct clk_si514_muldiv settings; in si514_recalc_rate() local
221 err = si514_get_muldiv(data, &settings); in si514_recalc_rate()
223 dev_err(&data->i2c_client->dev, "unable to retrieve settings\n"); in si514_recalc_rate()
227 return si514_calc_rate(&settings); in si514_recalc_rate()
233 struct clk_si514_muldiv settings; in si514_round_rate() local
239 err = si514_calc_muldiv(&settings, rate); in si514_round_rate()
243 return si514_calc_rate(&settings); in si514_round_rate()
255 struct clk_si514_muldiv settings; in si514_set_rate() local
259 err = si514_calc_muldiv(&settings, rate); in si514_set_rate()
269 err = si514_set_muldiv(data, &settings); in si514_set_rate()