Lines Matching +full:vco +full:- +full:hz

1 // SPDX-License-Identifier: GPL-2.0-or-later
74 [STB6100_VCO] = "VCO",
125 .addr = state->config->tuner_address, in stb6100_read_regs()
131 rc = i2c_transfer(state->i2c, &msg, 1); in stb6100_read_regs()
134 state->config->tuner_address, rc); in stb6100_read_regs()
136 return -EREMOTEIO; in stb6100_read_regs()
141 dprintk(verbose, FE_DEBUG, 1, " Read from 0x%02x", state->config->tuner_address); in stb6100_read_regs()
153 .addr = state->config->tuner_address + reg, in stb6100_read_reg()
159 i2c_transfer(state->i2c, &msg, 1); in stb6100_read_reg()
163 return -EINVAL; in stb6100_read_reg()
166 dprintk(verbose, FE_DEBUG, 1, " Read from 0x%02x", state->config->tuner_address); in stb6100_read_reg()
178 .addr = state->config->tuner_address, in stb6100_write_reg_range()
188 return -EINVAL; in stb6100_write_reg_range()
194 return -EINVAL; in stb6100_write_reg_range()
202 …dprintk(verbose, FE_DEBUG, 1, " Write @ 0x%02x: [%d:%d]", state->config->tuner_address, start, … in stb6100_write_reg_range()
206 rc = i2c_transfer(state->i2c, &msg, 1); in stb6100_write_reg_range()
209 (unsigned int)state->config->tuner_address, start, len, rc); in stb6100_write_reg_range()
210 return -EREMOTEIO; in stb6100_write_reg_range()
221 return -EREMOTEIO; in stb6100_write_reg()
231 struct stb6100_state *state = fe->tuner_priv; in stb6100_get_status()
246 struct stb6100_state *state = fe->tuner_priv; in stb6100_get_bandwidth()
255 *bandwidth = state->bandwidth = bw * 1000; in stb6100_get_bandwidth()
256 dprintk(verbose, FE_DEBUG, 1, "bandwidth = %u Hz", state->bandwidth); in stb6100_get_bandwidth()
264 struct stb6100_state *state = fe->tuner_priv; in stb6100_set_bandwidth()
266 dprintk(verbose, FE_DEBUG, 1, "set bandwidth to %u Hz", bandwidth); in stb6100_set_bandwidth()
275 tmp = (bandwidth + 500000) / 1000000 - 5; in stb6100_set_bandwidth()
303 struct stb6100_state *state = fe->tuner_priv; in stb6100_get_frequency()
314 fvco = (nfrac * state->reference >> (9 - psd2)) + (nint * state->reference << psd2); in stb6100_get_frequency()
315 *frequency = state->frequency = fvco >> (odiv + 1); in stb6100_get_frequency()
319 state->frequency, odiv, psd2, state->reference, fvco, nint, nfrac); in stb6100_get_frequency()
328 struct stb6100_state *state = fe->tuner_priv; in stb6100_set_frequency()
329 struct dtv_frontend_properties *p = &fe->dtv_property_cache; in stb6100_set_frequency()
335 dprintk(verbose, FE_DEBUG, 1, "Version 2010-8-14 13:51"); in stb6100_set_frequency()
337 if (fe->ops.get_frontend) { in stb6100_set_frequency()
339 fe->ops.get_frontend(fe, p); in stb6100_set_frequency()
341 srate = p->symbol_rate; in stb6100_set_frequency()
348 /* PLL Loop disabled, bias on, VCO on, synth on */ in stb6100_set_frequency()
356 /* VCO divide ratio (LO divide ratio, VCO prescaler enable). */ in stb6100_set_frequency()
362 /* VCO enabled, search clock off as per LL3.7, 3.4.1 */ in stb6100_set_frequency()
367 (ptr->val_high != 0) && !CHKRANGE(frequency, ptr->val_low, ptr->val_high); in stb6100_set_frequency()
370 if (ptr->val_high == 0) { in stb6100_set_frequency()
372 return -EINVAL; in stb6100_set_frequency()
374 regs[STB6100_VCO] = (regs[STB6100_VCO] & ~STB6100_VCO_OSM) | ptr->reg; in stb6100_set_frequency()
383 /* F(VCO) = F(LO) * (ODIV == 0 ? 2 : 4) */ in stb6100_set_frequency()
385 /* N(I) = floor(f(VCO) / (f(XTAL) * (PSD2 ? 2 : 1))) */ in stb6100_set_frequency()
386 nint = fvco / (state->reference << psd2); in stb6100_set_frequency()
387 /* N(F) = round(f(VCO) / f(XTAL) * (PSD2 ? 2 : 1) - N(I)) * 2 ^ 9 */ in stb6100_set_frequency()
388 nfrac = DIV_ROUND_CLOSEST((fvco - (nint * state->reference << psd2)) in stb6100_set_frequency()
389 << (9 - psd2), state->reference); in stb6100_set_frequency()
420 regs[STB6100_G] |= (1 << 5); /* 2Vp-p Mode */ in stb6100_set_frequency()
427 /* DLB set DC servo loop BW to 160Hz (LLA 3.8 / 2.1) */ in stb6100_set_frequency()
436 (unsigned int)psd2, state->reference, in stb6100_set_frequency()
437 ptr->reg, fvco, nint, nfrac); in stb6100_set_frequency()
450 regs[STB6100_LPEN] = 0xfb; /* PLL Loop enabled, bias on, VCO on, synth on */ in stb6100_set_frequency()
458 regs[STB6100_VCO] &= ~STB6100_VCO_OCK; /* VCO fast search */ in stb6100_set_frequency()
465 regs[STB6100_VCO] &= ~STB6100_VCO_OSCH; /* vco search disabled */ in stb6100_set_frequency()
488 struct stb6100_state *state = fe->tuner_priv; in stb6100_init()
489 int refclk = 27000000; /* Hz */ in stb6100_init()
495 state->bandwidth = 36000000; /* Hz */ in stb6100_init()
496 state->reference = refclk / 1000; /* kHz */ in stb6100_init()
498 /* Set default bandwidth. Modified, PN 13-May-10 */ in stb6100_init()
504 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in stb6100_set_params()
506 if (c->frequency > 0) in stb6100_set_params()
507 stb6100_set_frequency(fe, c->frequency); in stb6100_set_params()
509 if (c->bandwidth_hz > 0) in stb6100_set_params()
510 stb6100_set_bandwidth(fe, c->bandwidth_hz); in stb6100_set_params()
541 state->config = config; in stb6100_attach()
542 state->i2c = i2c; in stb6100_attach()
543 state->frontend = fe; in stb6100_attach()
544 state->reference = config->refclock / 1000; /* kHz */ in stb6100_attach()
545 fe->tuner_priv = state; in stb6100_attach()
546 fe->ops.tuner_ops = stb6100_ops; in stb6100_attach()
554 struct stb6100_state *state = fe->tuner_priv; in stb6100_release()
556 fe->tuner_priv = NULL; in stb6100_release()