diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-17 18:37:00 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-20 10:51:51 -0500 |
commit | 74b4576e63ec4cc765271db8815a42aa8f80ed14 (patch) | |
tree | b672bc4d6557e29dde4dd1ed65090ef184fbb5a2 | |
parent | 37c52abd565aa8d10ffd7f31a37792425d1564df (diff) |
[media] tda10023: add support for DVB-C Annex C
The difference between Annex A and C is the roll-off factor.
Properly implement it inside the driver, using the information
provided by Andreas.
Thanks-to: Andreas Oberriter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/dvb/frontends/tda10023.c | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/drivers/media/dvb/frontends/tda10023.c b/drivers/media/dvb/frontends/tda10023.c index e6c321e799d7..af7f1b808a34 100644 --- a/drivers/media/dvb/frontends/tda10023.c +++ b/drivers/media/dvb/frontends/tda10023.c | |||
@@ -305,6 +305,10 @@ struct qam_params { | |||
305 | static int tda10023_set_parameters (struct dvb_frontend *fe, | 305 | static int tda10023_set_parameters (struct dvb_frontend *fe, |
306 | struct dvb_frontend_parameters *p) | 306 | struct dvb_frontend_parameters *p) |
307 | { | 307 | { |
308 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
309 | u32 delsys = c->delivery_system; | ||
310 | unsigned qam = c->modulation; | ||
311 | bool is_annex_c; | ||
308 | struct tda10023_state* state = fe->demodulator_priv; | 312 | struct tda10023_state* state = fe->demodulator_priv; |
309 | static const struct qam_params qam_params[] = { | 313 | static const struct qam_params qam_params[] = { |
310 | /* Modulation QAM LOCKTHR MSETH AREF AGCREFNYQ ERAGCNYQ_THD */ | 314 | /* Modulation QAM LOCKTHR MSETH AREF AGCREFNYQ ERAGCNYQ_THD */ |
@@ -315,7 +319,17 @@ static int tda10023_set_parameters (struct dvb_frontend *fe, | |||
315 | [QAM_128] = { (3<<2), 0x36, 0x34, 0x7e, 0x78, 0x4c }, | 319 | [QAM_128] = { (3<<2), 0x36, 0x34, 0x7e, 0x78, 0x4c }, |
316 | [QAM_256] = { (4<<2), 0x26, 0x23, 0x6c, 0x5c, 0x3c }, | 320 | [QAM_256] = { (4<<2), 0x26, 0x23, 0x6c, 0x5c, 0x3c }, |
317 | }; | 321 | }; |
318 | unsigned qam = p->u.qam.modulation; | 322 | |
323 | switch (delsys) { | ||
324 | case SYS_DVBC_ANNEX_A: | ||
325 | is_annex_c = false; | ||
326 | break; | ||
327 | case SYS_DVBC_ANNEX_C: | ||
328 | is_annex_c = true; | ||
329 | break; | ||
330 | default: | ||
331 | return -EINVAL; | ||
332 | } | ||
319 | 333 | ||
320 | /* | 334 | /* |
321 | * gcc optimizes the code bellow the same way as it would code: | 335 | * gcc optimizes the code bellow the same way as it would code: |
@@ -341,23 +355,43 @@ static int tda10023_set_parameters (struct dvb_frontend *fe, | |||
341 | if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); | 355 | if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); |
342 | } | 356 | } |
343 | 357 | ||
344 | tda10023_set_symbolrate (state, p->u.qam.symbol_rate); | 358 | tda10023_set_symbolrate(state, c->symbol_rate); |
345 | tda10023_writereg(state, 0x05, qam_params[qam].lockthr); | 359 | tda10023_writereg(state, 0x05, qam_params[qam].lockthr); |
346 | tda10023_writereg(state, 0x08, qam_params[qam].mseth); | 360 | tda10023_writereg(state, 0x08, qam_params[qam].mseth); |
347 | tda10023_writereg(state, 0x09, qam_params[qam].aref); | 361 | tda10023_writereg(state, 0x09, qam_params[qam].aref); |
348 | tda10023_writereg(state, 0xb4, qam_params[qam].agcrefnyq); | 362 | tda10023_writereg(state, 0xb4, qam_params[qam].agcrefnyq); |
349 | tda10023_writereg(state, 0xb6, qam_params[qam].eragnyq_thd); | 363 | tda10023_writereg(state, 0xb6, qam_params[qam].eragnyq_thd); |
350 | |||
351 | #if 0 | 364 | #if 0 |
352 | tda10023_writereg(state, 0x04, (p->inversion ? 0x12 : 0x32)); | 365 | tda10023_writereg(state, 0x04, (c->inversion ? 0x12 : 0x32)); |
353 | tda10023_writebit(state, 0x04, 0x60, (p->inversion ? 0 : 0x20)); | 366 | tda10023_writebit(state, 0x04, 0x60, (c->inversion ? 0 : 0x20)); |
354 | #endif | 367 | #endif |
355 | tda10023_writebit(state, 0x04, 0x40, 0x40); | 368 | tda10023_writebit(state, 0x04, 0x40, 0x40); |
369 | |||
370 | if (is_annex_c) | ||
371 | tda10023_writebit(state, 0x3d, 0xfc, 0x03); | ||
372 | else | ||
373 | tda10023_writebit(state, 0x3d, 0xfc, 0x02); | ||
374 | |||
356 | tda10023_setup_reg0(state, qam_params[qam].qam); | 375 | tda10023_setup_reg0(state, qam_params[qam].qam); |
357 | 376 | ||
358 | return 0; | 377 | return 0; |
359 | } | 378 | } |
360 | 379 | ||
380 | static int tda10023_get_property(struct dvb_frontend *fe, | ||
381 | struct dtv_property *p) | ||
382 | { | ||
383 | switch (p->cmd) { | ||
384 | case DTV_ENUM_DELSYS: | ||
385 | p->u.buffer.data[0] = SYS_DVBC_ANNEX_A; | ||
386 | p->u.buffer.data[1] = SYS_DVBC_ANNEX_C; | ||
387 | p->u.buffer.len = 2; | ||
388 | break; | ||
389 | default: | ||
390 | break; | ||
391 | } | ||
392 | return 0; | ||
393 | } | ||
394 | |||
361 | static int tda10023_read_status(struct dvb_frontend* fe, fe_status_t* status) | 395 | static int tda10023_read_status(struct dvb_frontend* fe, fe_status_t* status) |
362 | { | 396 | { |
363 | struct tda10023_state* state = fe->demodulator_priv; | 397 | struct tda10023_state* state = fe->demodulator_priv; |
@@ -577,7 +611,7 @@ static struct dvb_frontend_ops tda10023_ops = { | |||
577 | 611 | ||
578 | .set_frontend = tda10023_set_parameters, | 612 | .set_frontend = tda10023_set_parameters, |
579 | .get_frontend = tda10023_get_frontend, | 613 | .get_frontend = tda10023_get_frontend, |
580 | 614 | .get_property = tda10023_get_property, | |
581 | .read_status = tda10023_read_status, | 615 | .read_status = tda10023_read_status, |
582 | .read_ber = tda10023_read_ber, | 616 | .read_ber = tda10023_read_ber, |
583 | .read_signal_strength = tda10023_read_signal_strength, | 617 | .read_signal_strength = tda10023_read_signal_strength, |