Lines Matching +full:clock +full:- +full:presc
53 return a - b; in abssub()
55 return b - a; in abssub()
60 kfree(fe->tuner_priv); in stv6110_release()
61 fe->tuner_priv = NULL; in stv6110_release()
67 struct stv6110_priv *priv = fe->tuner_priv; in stv6110_write_regs()
71 .addr = priv->i2c_address, in stv6110_write_regs()
83 return -EINVAL; in stv6110_write_regs()
87 return -EINVAL; in stv6110_write_regs()
92 if (fe->ops.i2c_gate_ctrl) in stv6110_write_regs()
93 fe->ops.i2c_gate_ctrl(fe, 1); in stv6110_write_regs()
95 rc = i2c_transfer(priv->i2c, &msg, 1); in stv6110_write_regs()
99 if (fe->ops.i2c_gate_ctrl) in stv6110_write_regs()
100 fe->ops.i2c_gate_ctrl(fe, 0); in stv6110_write_regs()
108 struct stv6110_priv *priv = fe->tuner_priv; in stv6110_read_regs()
113 .addr = priv->i2c_address, in stv6110_read_regs()
118 .addr = priv->i2c_address, in stv6110_read_regs()
125 if (fe->ops.i2c_gate_ctrl) in stv6110_read_regs()
126 fe->ops.i2c_gate_ctrl(fe, 1); in stv6110_read_regs()
128 rc = i2c_transfer(priv->i2c, msg, 2); in stv6110_read_regs()
132 if (fe->ops.i2c_gate_ctrl) in stv6110_read_regs()
133 fe->ops.i2c_gate_ctrl(fe, 0); in stv6110_read_regs()
135 memcpy(&priv->regs[start], regs, len); in stv6110_read_regs()
177 struct stv6110_priv *priv = fe->tuner_priv; in stv6110_set_bandwidth()
186 r8 = (bandwidth / 2) / 1000000 - 5; in stv6110_set_bandwidth()
188 /* ctrl3, RCCLKOFF = 0 Activate the calibration Clock */ in stv6110_set_bandwidth()
190 priv->regs[RSTV6110_CTRL3] &= ~((1 << 6) | 0x1f); in stv6110_set_bandwidth()
191 priv->regs[RSTV6110_CTRL3] |= (r8 & 0x1f); in stv6110_set_bandwidth()
192 stv6110_write_regs(fe, &priv->regs[RSTV6110_CTRL3], RSTV6110_CTRL3, 1); in stv6110_set_bandwidth()
194 priv->regs[RSTV6110_STAT1] |= 0x02; in stv6110_set_bandwidth()
195 stv6110_write_regs(fe, &priv->regs[RSTV6110_STAT1], RSTV6110_STAT1, 1); in stv6110_set_bandwidth()
205 /* RCCLKOFF = 1 calibration done, desactivate the calibration Clock */ in stv6110_set_bandwidth()
206 priv->regs[RSTV6110_CTRL3] |= (1 << 6); in stv6110_set_bandwidth()
207 stv6110_write_regs(fe, &priv->regs[RSTV6110_CTRL3], RSTV6110_CTRL3, 1); in stv6110_set_bandwidth()
213 struct stv6110_priv *priv = fe->tuner_priv; in stv6110_init()
216 memcpy(priv->regs, buf0, 8); in stv6110_init()
217 /* K = (Reference / 1000000) - 16 */ in stv6110_init()
218 priv->regs[RSTV6110_CTRL1] &= ~(0x1f << 3); in stv6110_init()
219 priv->regs[RSTV6110_CTRL1] |= in stv6110_init()
220 ((((priv->mclk / 1000000) - 16) & 0x1f) << 3); in stv6110_init()
222 /* divisor value for the output clock */ in stv6110_init()
223 priv->regs[RSTV6110_CTRL2] &= ~0xc0; in stv6110_init()
224 priv->regs[RSTV6110_CTRL2] |= (priv->clk_div << 6); in stv6110_init()
226 stv6110_write_regs(fe, &priv->regs[RSTV6110_CTRL1], RSTV6110_CTRL1, 8); in stv6110_init()
235 struct stv6110_priv *priv = fe->tuner_priv; in stv6110_get_frequency()
241 divider = (priv->regs[RSTV6110_TUNING2] & 0x0f) << 8; in stv6110_get_frequency()
242 divider += priv->regs[RSTV6110_TUNING1]; in stv6110_get_frequency()
245 nbsteps = (priv->regs[RSTV6110_TUNING2] >> 6) & 3; in stv6110_get_frequency()
247 psd2 = (priv->regs[RSTV6110_TUNING2] >> 4) & 1; in stv6110_get_frequency()
249 freq = divider * (priv->mclk / 1000); in stv6110_get_frequency()
260 struct stv6110_priv *priv = fe->tuner_priv; in stv6110_set_frequency()
262 u32 divider, ref, p, presc, i, result_freq, vco_freq; in stv6110_set_frequency() local
266 frequency, priv->mclk); in stv6110_set_frequency()
268 /* K = (Reference / 1000000) - 16 */ in stv6110_set_frequency()
269 priv->regs[RSTV6110_CTRL1] &= ~(0x1f << 3); in stv6110_set_frequency()
270 priv->regs[RSTV6110_CTRL1] |= in stv6110_set_frequency()
271 ((((priv->mclk / 1000000) - 16) & 0x1f) << 3); in stv6110_set_frequency()
274 priv->regs[RSTV6110_CTRL2] &= ~0x0f; in stv6110_set_frequency()
275 priv->regs[RSTV6110_CTRL2] |= (priv->gain & 0x0f); in stv6110_set_frequency()
279 presc = 0; in stv6110_set_frequency()
282 presc = 1; in stv6110_set_frequency()
285 presc = 0; in stv6110_set_frequency()
288 presc = 1; in stv6110_set_frequency()
291 priv->regs[RSTV6110_TUNING2] &= ~(1 << 4); in stv6110_set_frequency()
292 priv->regs[RSTV6110_TUNING2] |= (p << 4); in stv6110_set_frequency()
294 /* PRESC32ON = presc */ in stv6110_set_frequency()
295 priv->regs[RSTV6110_TUNING2] &= ~(1 << 5); in stv6110_set_frequency()
296 priv->regs[RSTV6110_TUNING2] |= (presc << 5); in stv6110_set_frequency()
300 p_calc = (priv->mclk / 100000); in stv6110_set_frequency()
305 p_calc_opt = (priv->mclk / 100000); in stv6110_set_frequency()
309 ref = priv->mclk / ((1 << (r_div_opt + 1)) * (1 << (p + 1))); in stv6110_set_frequency()
313 priv->regs[RSTV6110_TUNING2] &= ~(3 << 6); in stv6110_set_frequency()
314 priv->regs[RSTV6110_TUNING2] |= (((r_div_opt) & 3) << 6); in stv6110_set_frequency()
317 priv->regs[RSTV6110_TUNING2] &= ~0x0f; in stv6110_set_frequency()
318 priv->regs[RSTV6110_TUNING2] |= (((divider) >> 8) & 0x0f); in stv6110_set_frequency()
321 priv->regs[RSTV6110_TUNING1] = (divider & 0xff); in stv6110_set_frequency()
324 priv->regs[RSTV6110_STAT1] |= 0x04; in stv6110_set_frequency()
325 stv6110_write_regs(fe, &priv->regs[RSTV6110_CTRL1], in stv6110_set_frequency()
339 vco_freq = divider * ((priv->mclk / 1000) / ((1 << (r_div_opt + 1)))); in stv6110_set_frequency()
348 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in stv6110_set_params()
349 u32 bandwidth = carrier_width(c->symbol_rate, c->rolloff); in stv6110_set_params()
351 stv6110_set_frequency(fe, c->frequency); in stv6110_set_params()
359 struct stv6110_priv *priv = fe->tuner_priv; in stv6110_get_bandwidth()
365 r8 = priv->regs[RSTV6110_CTRL3] & 0x1f; in stv6110_get_bandwidth()
398 .addr = config->i2c_address, in stv6110_attach()
406 /* divisor value for the output clock */ in stv6110_attach()
408 reg0[2] |= (config->clk_div << 6); in stv6110_attach()
410 if (fe->ops.i2c_gate_ctrl) in stv6110_attach()
411 fe->ops.i2c_gate_ctrl(fe, 1); in stv6110_attach()
415 if (fe->ops.i2c_gate_ctrl) in stv6110_attach()
416 fe->ops.i2c_gate_ctrl(fe, 0); in stv6110_attach()
425 priv->i2c_address = config->i2c_address; in stv6110_attach()
426 priv->i2c = i2c; in stv6110_attach()
427 priv->mclk = config->mclk; in stv6110_attach()
428 priv->clk_div = config->clk_div; in stv6110_attach()
429 priv->gain = config->gain; in stv6110_attach()
431 memcpy(&priv->regs, ®0[1], 8); in stv6110_attach()
433 memcpy(&fe->ops.tuner_ops, &stv6110_tuner_ops, in stv6110_attach()
435 fe->tuner_priv = priv; in stv6110_attach()
436 printk(KERN_INFO "STV6110 attached on addr=%x!\n", priv->i2c_address); in stv6110_attach()