aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends
diff options
context:
space:
mode:
authorHans-Frieder Vogt <hfvogt@gmx.net>2012-04-02 13:18:16 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-04-09 13:51:47 -0400
commit540fd4ba053356cca91429cf4f6bf25fabd2984a (patch)
treec18a707264d166068ffbba435f38e3f1cedb1a16 /drivers/media/dvb/frontends
parent1083a0f9b8f622cefbd53fe75089c37728b6452f (diff)
[media] af9035: add Avermedia Volar HD (A867R) support
Support of AVerMedia AVerTV HD Volar, with tuner MxL5007t. Signed-off-by: Hans-Frieder Vogt <hfvogt@gmx.net> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/frontends')
-rw-r--r--drivers/media/dvb/frontends/af9033.c41
-rw-r--r--drivers/media/dvb/frontends/af9033.h1
-rw-r--r--drivers/media/dvb/frontends/af9033_priv.h35
3 files changed, 68 insertions, 9 deletions
diff --git a/drivers/media/dvb/frontends/af9033.c b/drivers/media/dvb/frontends/af9033.c
index 9eedf93c6384..8c0f4a3ef0f0 100644
--- a/drivers/media/dvb/frontends/af9033.c
+++ b/drivers/media/dvb/frontends/af9033.c
@@ -301,6 +301,10 @@ static int af9033_init(struct dvb_frontend *fe)
301 len = ARRAY_SIZE(tuner_init_fc0011); 301 len = ARRAY_SIZE(tuner_init_fc0011);
302 init = tuner_init_fc0011; 302 init = tuner_init_fc0011;
303 break; 303 break;
304 case AF9033_TUNER_MXL5007T:
305 len = ARRAY_SIZE(tuner_init_mxl5007t);
306 init = tuner_init_mxl5007t;
307 break;
304 default: 308 default:
305 pr_debug("%s: unsupported tuner ID=%d\n", __func__, 309 pr_debug("%s: unsupported tuner ID=%d\n", __func__,
306 state->cfg.tuner); 310 state->cfg.tuner);
@@ -391,9 +395,9 @@ static int af9033_set_frontend(struct dvb_frontend *fe)
391{ 395{
392 struct af9033_state *state = fe->demodulator_priv; 396 struct af9033_state *state = fe->demodulator_priv;
393 struct dtv_frontend_properties *c = &fe->dtv_property_cache; 397 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
394 int ret, i; 398 int ret, i, spec_inv;
395 u8 tmp, buf[3], bandwidth_reg_val; 399 u8 tmp, buf[3], bandwidth_reg_val;
396 u32 if_frequency, freq_cw; 400 u32 if_frequency, freq_cw, adc_freq;
397 401
398 pr_debug("%s: frequency=%d bandwidth_hz=%d\n", __func__, c->frequency, 402 pr_debug("%s: frequency=%d bandwidth_hz=%d\n", __func__, c->frequency,
399 c->bandwidth_hz); 403 c->bandwidth_hz);
@@ -433,22 +437,41 @@ static int af9033_set_frontend(struct dvb_frontend *fe)
433 437
434 /* program frequency control */ 438 /* program frequency control */
435 if (c->bandwidth_hz != state->bandwidth_hz) { 439 if (c->bandwidth_hz != state->bandwidth_hz) {
440 spec_inv = state->cfg.spec_inv ? -1 : 1;
441
442 for (i = 0; i < ARRAY_SIZE(clock_adc_lut); i++) {
443 if (clock_adc_lut[i].clock == state->cfg.clock)
444 break;
445 }
446 adc_freq = clock_adc_lut[i].adc;
447
436 /* get used IF frequency */ 448 /* get used IF frequency */
437 if (fe->ops.tuner_ops.get_if_frequency) 449 if (fe->ops.tuner_ops.get_if_frequency)
438 fe->ops.tuner_ops.get_if_frequency(fe, &if_frequency); 450 fe->ops.tuner_ops.get_if_frequency(fe, &if_frequency);
439 else 451 else
440 if_frequency = 0; 452 if_frequency = 0;
441 453
442 /* FIXME: we support only Zero-IF currently */ 454 while (if_frequency > (adc_freq / 2))
443 if (if_frequency != 0) { 455 if_frequency -= adc_freq;
444 pr_debug("%s: only Zero-IF supported currently\n",
445 __func__);
446 456
447 ret = -ENODEV; 457 if (if_frequency >= 0)
458 spec_inv *= -1;
459 else
460 if_frequency *= -1;
461
462 freq_cw = af9033_div(if_frequency, adc_freq, 23ul);
463
464 if (spec_inv == -1)
465 freq_cw *= -1;
466
467 /* get adc multiplies */
468 ret = af9033_rd_reg(state, 0x800045, &tmp);
469 if (ret < 0)
448 goto err; 470 goto err;
449 }
450 471
451 freq_cw = 0; 472 if (tmp == 1)
473 freq_cw /= 2;
474
452 buf[0] = (freq_cw >> 0) & 0xff; 475 buf[0] = (freq_cw >> 0) & 0xff;
453 buf[1] = (freq_cw >> 8) & 0xff; 476 buf[1] = (freq_cw >> 8) & 0xff;
454 buf[2] = (freq_cw >> 16) & 0x7f; 477 buf[2] = (freq_cw >> 16) & 0x7f;
diff --git a/drivers/media/dvb/frontends/af9033.h b/drivers/media/dvb/frontends/af9033.h
index af8c1e3e30d0..dcf7e290b6fe 100644
--- a/drivers/media/dvb/frontends/af9033.h
+++ b/drivers/media/dvb/frontends/af9033.h
@@ -40,6 +40,7 @@ struct af9033_config {
40 */ 40 */
41#define AF9033_TUNER_TUA9001 0x27 /* Infineon TUA 9001 */ 41#define AF9033_TUNER_TUA9001 0x27 /* Infineon TUA 9001 */
42#define AF9033_TUNER_FC0011 0x28 /* Fitipower FC0011 */ 42#define AF9033_TUNER_FC0011 0x28 /* Fitipower FC0011 */
43#define AF9033_TUNER_MXL5007T 0xa0 /* MaxLinear MxL5007T */
43 u8 tuner; 44 u8 tuner;
44 45
45 /* 46 /*
diff --git a/drivers/media/dvb/frontends/af9033_priv.h b/drivers/media/dvb/frontends/af9033_priv.h
index 337964257dab..e6041bc7c2fc 100644
--- a/drivers/media/dvb/frontends/af9033_priv.h
+++ b/drivers/media/dvb/frontends/af9033_priv.h
@@ -397,5 +397,40 @@ static const struct reg_val tuner_init_fc0011[] = {
397 { 0x80F1E6, 0x00 }, 397 { 0x80F1E6, 0x00 },
398}; 398};
399 399
400/* MaxLinear MxL5007T tuner init
401 AF9033_TUNER_MXL5007T = 0xa0 */
402static const struct reg_val tuner_init_mxl5007t[] = {
403 { 0x800046, 0x1b },
404 { 0x800057, 0x01 },
405 { 0x800058, 0x01 },
406 { 0x80005f, 0x00 },
407 { 0x800060, 0x00 },
408 { 0x800068, 0x96 },
409 { 0x800071, 0x05 },
410 { 0x800072, 0x02 },
411 { 0x800074, 0x01 },
412 { 0x800079, 0x01 },
413 { 0x800093, 0x00 },
414 { 0x800094, 0x00 },
415 { 0x800095, 0x00 },
416 { 0x800096, 0x00 },
417 { 0x8000b3, 0x01 },
418 { 0x8000c1, 0x01 },
419 { 0x8000c2, 0x00 },
420 { 0x80f007, 0x00 },
421 { 0x80f00c, 0x19 },
422 { 0x80f00d, 0x1a },
423 { 0x80f012, 0xda },
424 { 0x80f013, 0x00 },
425 { 0x80f014, 0x00 },
426 { 0x80f015, 0x02 },
427 { 0x80f01f, 0x82 },
428 { 0x80f020, 0x00 },
429 { 0x80f029, 0x82 },
430 { 0x80f02a, 0x00 },
431 { 0x80f077, 0x02 },
432 { 0x80f1e6, 0x00 },
433};
434
400#endif /* AF9033_PRIV_H */ 435#endif /* AF9033_PRIV_H */
401 436