84 .flags = 0, .buf =
buf, .len = 2 };
88 "I2C write reg failed, reg: %02x, val: %02x\n",
101 .flags = 0, .buf = &
reg, .len = 1 },
102 { .addr = priv->
addr,
108 "I2C read failed, reg: %02x\n", reg);
134 dev_err(&priv->
i2c->dev,
"Power-on callback failed\n");
140 dev_err(&priv->
i2c->dev,
"Reset callback failed\n");
148 static int fc0011_vcocal_trigger(
struct fc0011_priv *priv)
183 unsigned int i, vco_retries;
186 u32 fvco, xin, xdiv, xdivr;
188 u8 fa,
fp, vco_sel, vco_cal;
208 }
else if (freq < 108000) {
211 }
else if (freq < 216000) {
214 }
else if (freq < 432000) {
224 frac = fvco - xdiv * 18000;
225 frac = (frac << 15) / 18000;
232 else if (frac < 65026)
241 if (fvco - xdiv * 18000 >= 9000)
255 "fa %02X >= fp %02X, but trying to continue\n",
256 (
unsigned int)(
u8)fa, (
unsigned int)(
u8)fp);
269 dev_warn(&priv->
i2c->dev,
"Unsupported bandwidth %u kHz. "
280 if (fvco < 2320000) {
283 }
else if (fvco < 3080000) {
304 err = fc0011_writereg(priv, i, regs[i]);
310 err = fc0011_vcocal_trigger(priv);
313 err = fc0011_vcocal_read(priv, &vco_cal);
322 dev_err(&priv->
i2c->dev,
"Failed to reset tuner\n");
328 err |= fc0011_writereg(priv, i, regs[i]);
337 err = fc0011_vcocal_trigger(priv);
340 err = fc0011_vcocal_read(priv, &vco_cal);
345 if (!(vco_cal & FC11_VCOCAL_OK)) {
347 "Failed to read VCO calibration value (got %02X)\n",
348 (
unsigned int)vco_cal);
362 err = fc0011_vcocal_trigger(priv);
381 err = fc0011_vcocal_trigger(priv);
384 }
else if (vco_cal <= 48) {
397 err = fc0011_vcocal_trigger(priv);
410 err = fc0011_vcocal_trigger(priv);
423 err = fc0011_vcocal_read(priv,
NULL);
440 "fa=%02X fp=%02X xin=%02X%02X vco=%02X vcosel=%02X "
441 "vcocal=%02X(%u) bw=%u\n",
448 (
unsigned int)vco_cal, vco_retries,
449 (
unsigned int)bandwidth);
473 static int fc0011_get_bandwidth(
struct dvb_frontend *fe,
u32 *bandwidth)
484 .name =
"Fitipower FC0011",
486 .frequency_min = 45000000,
487 .frequency_max = 1000000000,
490 .release = fc0011_release,
493 .set_params = fc0011_set_params,
495 .get_frequency = fc0011_get_frequency,
496 .get_if_frequency = fc0011_get_if_frequency,
497 .get_bandwidth = fc0011_get_bandwidth,
514 fe->
ops.tuner_ops = fc0011_tuner_ops;
516 dev_info(&priv->
i2c->dev,
"Fitipower FC0011 tuner attached\n");