aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-12-26 14:12:40 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-12-31 06:57:40 -0500
commite11eb28876867ea4d5837e79da0fc95dc042979b (patch)
treed876a755929145a7125ec3e326f5e5cab715d566
parente4b40030bf14986b8b295b4bdebe252b6a512528 (diff)
[media] firedtv: convert set_fontend to use DVBv5 parameters
Instead of using dvb_frontend_parameters struct, that were designed for a subset of the supported standards, use the DVBv5 cache information. Also, fill the supported delivery systems at dvb_frontend_ops struct. Cc: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/dvb/firewire/firedtv-avc.c95
-rw-r--r--drivers/media/dvb/firewire/firedtv-fe.c17
-rw-r--r--drivers/media/dvb/firewire/firedtv.h4
3 files changed, 60 insertions, 56 deletions
diff --git a/drivers/media/dvb/firewire/firedtv-avc.c b/drivers/media/dvb/firewire/firedtv-avc.c
index 9debf0f9a137..d1a1a1324ef8 100644
--- a/drivers/media/dvb/firewire/firedtv-avc.c
+++ b/drivers/media/dvb/firewire/firedtv-avc.c
@@ -335,7 +335,7 @@ static int add_pid_filter(struct firedtv *fdtv, u8 *operand)
335 * (not supported by the AVC standard) 335 * (not supported by the AVC standard)
336 */ 336 */
337static int avc_tuner_tuneqpsk(struct firedtv *fdtv, 337static int avc_tuner_tuneqpsk(struct firedtv *fdtv,
338 struct dvb_frontend_parameters *params) 338 struct dtv_frontend_properties *p)
339{ 339{
340 struct avc_command_frame *c = (void *)fdtv->avc_data; 340 struct avc_command_frame *c = (void *)fdtv->avc_data;
341 341
@@ -349,15 +349,15 @@ static int avc_tuner_tuneqpsk(struct firedtv *fdtv,
349 else 349 else
350 c->operand[3] = SFE_VENDOR_OPCODE_TUNE_QPSK; 350 c->operand[3] = SFE_VENDOR_OPCODE_TUNE_QPSK;
351 351
352 c->operand[4] = (params->frequency >> 24) & 0xff; 352 c->operand[4] = (p->frequency >> 24) & 0xff;
353 c->operand[5] = (params->frequency >> 16) & 0xff; 353 c->operand[5] = (p->frequency >> 16) & 0xff;
354 c->operand[6] = (params->frequency >> 8) & 0xff; 354 c->operand[6] = (p->frequency >> 8) & 0xff;
355 c->operand[7] = params->frequency & 0xff; 355 c->operand[7] = p->frequency & 0xff;
356 356
357 c->operand[8] = ((params->u.qpsk.symbol_rate / 1000) >> 8) & 0xff; 357 c->operand[8] = ((p->symbol_rate / 1000) >> 8) & 0xff;
358 c->operand[9] = (params->u.qpsk.symbol_rate / 1000) & 0xff; 358 c->operand[9] = (p->symbol_rate / 1000) & 0xff;
359 359
360 switch (params->u.qpsk.fec_inner) { 360 switch (p->fec_inner) {
361 case FEC_1_2: c->operand[10] = 0x1; break; 361 case FEC_1_2: c->operand[10] = 0x1; break;
362 case FEC_2_3: c->operand[10] = 0x2; break; 362 case FEC_2_3: c->operand[10] = 0x2; break;
363 case FEC_3_4: c->operand[10] = 0x3; break; 363 case FEC_3_4: c->operand[10] = 0x3; break;
@@ -416,7 +416,7 @@ static int avc_tuner_tuneqpsk(struct firedtv *fdtv,
416} 416}
417 417
418static int avc_tuner_dsd_dvb_c(struct firedtv *fdtv, 418static int avc_tuner_dsd_dvb_c(struct firedtv *fdtv,
419 struct dvb_frontend_parameters *params) 419 struct dtv_frontend_properties *p)
420{ 420{
421 struct avc_command_frame *c = (void *)fdtv->avc_data; 421 struct avc_command_frame *c = (void *)fdtv->avc_data;
422 422
@@ -435,8 +435,8 @@ static int avc_tuner_dsd_dvb_c(struct firedtv *fdtv,
435 | 1 << 4 /* Frequency */ 435 | 1 << 4 /* Frequency */
436 | 1 << 3 /* Symbol_Rate */ 436 | 1 << 3 /* Symbol_Rate */
437 | 0 << 2 /* FEC_outer */ 437 | 0 << 2 /* FEC_outer */
438 | (params->u.qam.fec_inner != FEC_AUTO ? 1 << 1 : 0) 438 | (p->fec_inner != FEC_AUTO ? 1 << 1 : 0)
439 | (params->u.qam.modulation != QAM_AUTO ? 1 << 0 : 0); 439 | (p->modulation != QAM_AUTO ? 1 << 0 : 0);
440 440
441 /* multiplex_valid_flags, low byte */ 441 /* multiplex_valid_flags, low byte */
442 c->operand[6] = 0 << 7 /* NetworkID */ 442 c->operand[6] = 0 << 7 /* NetworkID */
@@ -447,15 +447,15 @@ static int avc_tuner_dsd_dvb_c(struct firedtv *fdtv,
447 c->operand[9] = 0x00; 447 c->operand[9] = 0x00;
448 c->operand[10] = 0x00; 448 c->operand[10] = 0x00;
449 449
450 c->operand[11] = (((params->frequency / 4000) >> 16) & 0xff) | (2 << 6); 450 c->operand[11] = (((p->frequency / 4000) >> 16) & 0xff) | (2 << 6);
451 c->operand[12] = ((params->frequency / 4000) >> 8) & 0xff; 451 c->operand[12] = ((p->frequency / 4000) >> 8) & 0xff;
452 c->operand[13] = (params->frequency / 4000) & 0xff; 452 c->operand[13] = (p->frequency / 4000) & 0xff;
453 c->operand[14] = ((params->u.qpsk.symbol_rate / 1000) >> 12) & 0xff; 453 c->operand[14] = ((p->symbol_rate / 1000) >> 12) & 0xff;
454 c->operand[15] = ((params->u.qpsk.symbol_rate / 1000) >> 4) & 0xff; 454 c->operand[15] = ((p->symbol_rate / 1000) >> 4) & 0xff;
455 c->operand[16] = ((params->u.qpsk.symbol_rate / 1000) << 4) & 0xf0; 455 c->operand[16] = ((p->symbol_rate / 1000) << 4) & 0xf0;
456 c->operand[17] = 0x00; 456 c->operand[17] = 0x00;
457 457
458 switch (params->u.qpsk.fec_inner) { 458 switch (p->fec_inner) {
459 case FEC_1_2: c->operand[18] = 0x1; break; 459 case FEC_1_2: c->operand[18] = 0x1; break;
460 case FEC_2_3: c->operand[18] = 0x2; break; 460 case FEC_2_3: c->operand[18] = 0x2; break;
461 case FEC_3_4: c->operand[18] = 0x3; break; 461 case FEC_3_4: c->operand[18] = 0x3; break;
@@ -467,7 +467,7 @@ static int avc_tuner_dsd_dvb_c(struct firedtv *fdtv,
467 default: c->operand[18] = 0x0; 467 default: c->operand[18] = 0x0;
468 } 468 }
469 469
470 switch (params->u.qam.modulation) { 470 switch (p->modulation) {
471 case QAM_16: c->operand[19] = 0x08; break; 471 case QAM_16: c->operand[19] = 0x08; break;
472 case QAM_32: c->operand[19] = 0x10; break; 472 case QAM_32: c->operand[19] = 0x10; break;
473 case QAM_64: c->operand[19] = 0x18; break; 473 case QAM_64: c->operand[19] = 0x18; break;
@@ -484,9 +484,8 @@ static int avc_tuner_dsd_dvb_c(struct firedtv *fdtv,
484} 484}
485 485
486static int avc_tuner_dsd_dvb_t(struct firedtv *fdtv, 486static int avc_tuner_dsd_dvb_t(struct firedtv *fdtv,
487 struct dvb_frontend_parameters *params) 487 struct dtv_frontend_properties *p)
488{ 488{
489 struct dvb_ofdm_parameters *ofdm = &params->u.ofdm;
490 struct avc_command_frame *c = (void *)fdtv->avc_data; 489 struct avc_command_frame *c = (void *)fdtv->avc_data;
491 490
492 c->opcode = AVC_OPCODE_DSD; 491 c->opcode = AVC_OPCODE_DSD;
@@ -501,42 +500,42 @@ static int avc_tuner_dsd_dvb_t(struct firedtv *fdtv,
501 c->operand[5] = 500 c->operand[5] =
502 0 << 7 /* reserved */ 501 0 << 7 /* reserved */
503 | 1 << 6 /* CenterFrequency */ 502 | 1 << 6 /* CenterFrequency */
504 | (ofdm->bandwidth != BANDWIDTH_AUTO ? 1 << 5 : 0) 503 | (p->bandwidth_hz != 0 ? 1 << 5 : 0)
505 | (ofdm->constellation != QAM_AUTO ? 1 << 4 : 0) 504 | (p->modulation != QAM_AUTO ? 1 << 4 : 0)
506 | (ofdm->hierarchy_information != HIERARCHY_AUTO ? 1 << 3 : 0) 505 | (p->hierarchy != HIERARCHY_AUTO ? 1 << 3 : 0)
507 | (ofdm->code_rate_HP != FEC_AUTO ? 1 << 2 : 0) 506 | (p->code_rate_HP != FEC_AUTO ? 1 << 2 : 0)
508 | (ofdm->code_rate_LP != FEC_AUTO ? 1 << 1 : 0) 507 | (p->code_rate_LP != FEC_AUTO ? 1 << 1 : 0)
509 | (ofdm->guard_interval != GUARD_INTERVAL_AUTO ? 1 << 0 : 0); 508 | (p->guard_interval != GUARD_INTERVAL_AUTO ? 1 << 0 : 0);
510 509
511 /* multiplex_valid_flags, low byte */ 510 /* multiplex_valid_flags, low byte */
512 c->operand[6] = 511 c->operand[6] =
513 0 << 7 /* NetworkID */ 512 0 << 7 /* NetworkID */
514 | (ofdm->transmission_mode != TRANSMISSION_MODE_AUTO ? 1 << 6 : 0) 513 | (p->transmission_mode != TRANSMISSION_MODE_AUTO ? 1 << 6 : 0)
515 | 0 << 5 /* OtherFrequencyFlag */ 514 | 0 << 5 /* OtherFrequencyFlag */
516 | 0 << 0 /* reserved */ ; 515 | 0 << 0 /* reserved */ ;
517 516
518 c->operand[7] = 0x0; 517 c->operand[7] = 0x0;
519 c->operand[8] = (params->frequency / 10) >> 24; 518 c->operand[8] = (p->frequency / 10) >> 24;
520 c->operand[9] = ((params->frequency / 10) >> 16) & 0xff; 519 c->operand[9] = ((p->frequency / 10) >> 16) & 0xff;
521 c->operand[10] = ((params->frequency / 10) >> 8) & 0xff; 520 c->operand[10] = ((p->frequency / 10) >> 8) & 0xff;
522 c->operand[11] = (params->frequency / 10) & 0xff; 521 c->operand[11] = (p->frequency / 10) & 0xff;
523 522
524 switch (ofdm->bandwidth) { 523 switch (p->bandwidth_hz) {
525 case BANDWIDTH_7_MHZ: c->operand[12] = 0x20; break; 524 case 7000000: c->operand[12] = 0x20; break;
526 case BANDWIDTH_8_MHZ: 525 case 8000000:
527 case BANDWIDTH_6_MHZ: /* not defined by AVC spec */ 526 case 6000000: /* not defined by AVC spec */
528 case BANDWIDTH_AUTO: 527 case 0:
529 default: c->operand[12] = 0x00; 528 default: c->operand[12] = 0x00;
530 } 529 }
531 530
532 switch (ofdm->constellation) { 531 switch (p->modulation) {
533 case QAM_16: c->operand[13] = 1 << 6; break; 532 case QAM_16: c->operand[13] = 1 << 6; break;
534 case QAM_64: c->operand[13] = 2 << 6; break; 533 case QAM_64: c->operand[13] = 2 << 6; break;
535 case QPSK: 534 case QPSK:
536 default: c->operand[13] = 0x00; 535 default: c->operand[13] = 0x00;
537 } 536 }
538 537
539 switch (ofdm->hierarchy_information) { 538 switch (p->hierarchy) {
540 case HIERARCHY_1: c->operand[13] |= 1 << 3; break; 539 case HIERARCHY_1: c->operand[13] |= 1 << 3; break;
541 case HIERARCHY_2: c->operand[13] |= 2 << 3; break; 540 case HIERARCHY_2: c->operand[13] |= 2 << 3; break;
542 case HIERARCHY_4: c->operand[13] |= 3 << 3; break; 541 case HIERARCHY_4: c->operand[13] |= 3 << 3; break;
@@ -545,7 +544,7 @@ static int avc_tuner_dsd_dvb_t(struct firedtv *fdtv,
545 default: break; 544 default: break;
546 } 545 }
547 546
548 switch (ofdm->code_rate_HP) { 547 switch (p->code_rate_HP) {
549 case FEC_2_3: c->operand[13] |= 1; break; 548 case FEC_2_3: c->operand[13] |= 1; break;
550 case FEC_3_4: c->operand[13] |= 2; break; 549 case FEC_3_4: c->operand[13] |= 2; break;
551 case FEC_5_6: c->operand[13] |= 3; break; 550 case FEC_5_6: c->operand[13] |= 3; break;
@@ -554,7 +553,7 @@ static int avc_tuner_dsd_dvb_t(struct firedtv *fdtv,
554 default: break; 553 default: break;
555 } 554 }
556 555
557 switch (ofdm->code_rate_LP) { 556 switch (p->code_rate_LP) {
558 case FEC_2_3: c->operand[14] = 1 << 5; break; 557 case FEC_2_3: c->operand[14] = 1 << 5; break;
559 case FEC_3_4: c->operand[14] = 2 << 5; break; 558 case FEC_3_4: c->operand[14] = 2 << 5; break;
560 case FEC_5_6: c->operand[14] = 3 << 5; break; 559 case FEC_5_6: c->operand[14] = 3 << 5; break;
@@ -563,7 +562,7 @@ static int avc_tuner_dsd_dvb_t(struct firedtv *fdtv,
563 default: c->operand[14] = 0x00; break; 562 default: c->operand[14] = 0x00; break;
564 } 563 }
565 564
566 switch (ofdm->guard_interval) { 565 switch (p->guard_interval) {
567 case GUARD_INTERVAL_1_16: c->operand[14] |= 1 << 3; break; 566 case GUARD_INTERVAL_1_16: c->operand[14] |= 1 << 3; break;
568 case GUARD_INTERVAL_1_8: c->operand[14] |= 2 << 3; break; 567 case GUARD_INTERVAL_1_8: c->operand[14] |= 2 << 3; break;
569 case GUARD_INTERVAL_1_4: c->operand[14] |= 3 << 3; break; 568 case GUARD_INTERVAL_1_4: c->operand[14] |= 3 << 3; break;
@@ -572,7 +571,7 @@ static int avc_tuner_dsd_dvb_t(struct firedtv *fdtv,
572 default: break; 571 default: break;
573 } 572 }
574 573
575 switch (ofdm->transmission_mode) { 574 switch (p->transmission_mode) {
576 case TRANSMISSION_MODE_8K: c->operand[14] |= 1 << 1; break; 575 case TRANSMISSION_MODE_8K: c->operand[14] |= 1 << 1; break;
577 case TRANSMISSION_MODE_2K: 576 case TRANSMISSION_MODE_2K:
578 case TRANSMISSION_MODE_AUTO: 577 case TRANSMISSION_MODE_AUTO:
@@ -586,7 +585,7 @@ static int avc_tuner_dsd_dvb_t(struct firedtv *fdtv,
586} 585}
587 586
588int avc_tuner_dsd(struct firedtv *fdtv, 587int avc_tuner_dsd(struct firedtv *fdtv,
589 struct dvb_frontend_parameters *params) 588 struct dtv_frontend_properties *p)
590{ 589{
591 struct avc_command_frame *c = (void *)fdtv->avc_data; 590 struct avc_command_frame *c = (void *)fdtv->avc_data;
592 int pos, ret; 591 int pos, ret;
@@ -598,9 +597,9 @@ int avc_tuner_dsd(struct firedtv *fdtv,
598 597
599 switch (fdtv->type) { 598 switch (fdtv->type) {
600 case FIREDTV_DVB_S: 599 case FIREDTV_DVB_S:
601 case FIREDTV_DVB_S2: pos = avc_tuner_tuneqpsk(fdtv, params); break; 600 case FIREDTV_DVB_S2: pos = avc_tuner_tuneqpsk(fdtv, p); break;
602 case FIREDTV_DVB_C: pos = avc_tuner_dsd_dvb_c(fdtv, params); break; 601 case FIREDTV_DVB_C: pos = avc_tuner_dsd_dvb_c(fdtv, p); break;
603 case FIREDTV_DVB_T: pos = avc_tuner_dsd_dvb_t(fdtv, params); break; 602 case FIREDTV_DVB_T: pos = avc_tuner_dsd_dvb_t(fdtv, p); break;
604 default: 603 default:
605 BUG(); 604 BUG();
606 } 605 }
diff --git a/drivers/media/dvb/firewire/firedtv-fe.c b/drivers/media/dvb/firewire/firedtv-fe.c
index 1eb5ad3a5dfa..e1705a903f5c 100644
--- a/drivers/media/dvb/firewire/firedtv-fe.c
+++ b/drivers/media/dvb/firewire/firedtv-fe.c
@@ -141,16 +141,16 @@ static int fdtv_read_uncorrected_blocks(struct dvb_frontend *fe, u32 *ucblocks)
141 return -EOPNOTSUPP; 141 return -EOPNOTSUPP;
142} 142}
143 143
144static int fdtv_set_frontend(struct dvb_frontend *fe, 144static int fdtv_set_frontend(struct dvb_frontend *fe)
145 struct dvb_frontend_parameters *params)
146{ 145{
146 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
147 struct firedtv *fdtv = fe->sec_priv; 147 struct firedtv *fdtv = fe->sec_priv;
148 148
149 return avc_tuner_dsd(fdtv, params); 149 return avc_tuner_dsd(fdtv, p);
150} 150}
151 151
152static int fdtv_get_frontend(struct dvb_frontend *fe, 152static int fdtv_get_frontend(struct dvb_frontend *fe,
153 struct dvb_frontend_parameters *params) 153 struct dtv_frontend_properties *params)
154{ 154{
155 return -EOPNOTSUPP; 155 return -EOPNOTSUPP;
156} 156}
@@ -173,8 +173,8 @@ void fdtv_frontend_init(struct firedtv *fdtv, const char *name)
173 ops->init = fdtv_dvb_init; 173 ops->init = fdtv_dvb_init;
174 ops->sleep = fdtv_sleep; 174 ops->sleep = fdtv_sleep;
175 175
176 ops->set_frontend_legacy = fdtv_set_frontend; 176 ops->set_frontend = fdtv_set_frontend;
177 ops->get_frontend_legacy = fdtv_get_frontend; 177 ops->get_frontend = fdtv_get_frontend;
178 178
179 ops->get_property = fdtv_get_property; 179 ops->get_property = fdtv_get_property;
180 ops->set_property = fdtv_set_property; 180 ops->set_property = fdtv_set_property;
@@ -192,6 +192,7 @@ void fdtv_frontend_init(struct firedtv *fdtv, const char *name)
192 192
193 switch (fdtv->type) { 193 switch (fdtv->type) {
194 case FIREDTV_DVB_S: 194 case FIREDTV_DVB_S:
195 ops->delsys[0] = SYS_DVBS;
195 fi->type = FE_QPSK; 196 fi->type = FE_QPSK;
196 197
197 fi->frequency_min = 950000; 198 fi->frequency_min = 950000;
@@ -211,6 +212,8 @@ void fdtv_frontend_init(struct firedtv *fdtv, const char *name)
211 break; 212 break;
212 213
213 case FIREDTV_DVB_S2: 214 case FIREDTV_DVB_S2:
215 ops->delsys[0] = SYS_DVBS;
216 ops->delsys[1] = SYS_DVBS;
214 fi->type = FE_QPSK; 217 fi->type = FE_QPSK;
215 218
216 fi->frequency_min = 950000; 219 fi->frequency_min = 950000;
@@ -231,6 +234,7 @@ void fdtv_frontend_init(struct firedtv *fdtv, const char *name)
231 break; 234 break;
232 235
233 case FIREDTV_DVB_C: 236 case FIREDTV_DVB_C:
237 ops->delsys[0] = SYS_DVBC_ANNEX_A;
234 fi->type = FE_QAM; 238 fi->type = FE_QAM;
235 239
236 fi->frequency_min = 47000000; 240 fi->frequency_min = 47000000;
@@ -249,6 +253,7 @@ void fdtv_frontend_init(struct firedtv *fdtv, const char *name)
249 break; 253 break;
250 254
251 case FIREDTV_DVB_T: 255 case FIREDTV_DVB_T:
256 ops->delsys[0] = SYS_DVBT;
252 fi->type = FE_OFDM; 257 fi->type = FE_OFDM;
253 258
254 fi->frequency_min = 49000000; 259 fi->frequency_min = 49000000;
diff --git a/drivers/media/dvb/firewire/firedtv.h b/drivers/media/dvb/firewire/firedtv.h
index bd00b04e079d..4fdcd8cb7530 100644
--- a/drivers/media/dvb/firewire/firedtv.h
+++ b/drivers/media/dvb/firewire/firedtv.h
@@ -112,8 +112,8 @@ struct firedtv {
112/* firedtv-avc.c */ 112/* firedtv-avc.c */
113int avc_recv(struct firedtv *fdtv, void *data, size_t length); 113int avc_recv(struct firedtv *fdtv, void *data, size_t length);
114int avc_tuner_status(struct firedtv *fdtv, struct firedtv_tuner_status *stat); 114int avc_tuner_status(struct firedtv *fdtv, struct firedtv_tuner_status *stat);
115struct dvb_frontend_parameters; 115struct dtv_frontend_properties;
116int avc_tuner_dsd(struct firedtv *fdtv, struct dvb_frontend_parameters *params); 116int avc_tuner_dsd(struct firedtv *fdtv, struct dtv_frontend_properties *params);
117int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[]); 117int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[]);
118int avc_tuner_get_ts(struct firedtv *fdtv); 118int avc_tuner_get_ts(struct firedtv *fdtv);
119int avc_identify_subunit(struct firedtv *fdtv); 119int avc_identify_subunit(struct firedtv *fdtv);