aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-12-26 13:20:03 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-12-31 06:49:02 -0500
commitdfc6438410ebe2b9858aaf41376f35a0a68eeb4b (patch)
tree60989f7c66356176dccff1d27563ca283da16aa7 /drivers/staging
parentf6c699680cfaf50482577c3475d468a6902415e5 (diff)
[media] staging/as102: 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. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/media/as102/as102_fe.c78
-rw-r--r--drivers/staging/media/as102/as10x_cmd.c4
-rw-r--r--drivers/staging/media/as102/as10x_types.h4
3 files changed, 43 insertions, 43 deletions
diff --git a/drivers/staging/media/as102/as102_fe.c b/drivers/staging/media/as102/as102_fe.c
index b0c5128db88e..d6472eace7b5 100644
--- a/drivers/staging/media/as102/as102_fe.c
+++ b/drivers/staging/media/as102/as102_fe.c
@@ -23,15 +23,15 @@
23#include "as10x_types.h" 23#include "as10x_types.h"
24#include "as10x_cmd.h" 24#include "as10x_cmd.h"
25 25
26static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst, 26static void as10x_fe_copy_tps_parameters(struct dtv_frontend_properties *dst,
27 struct as10x_tps *src); 27 struct as10x_tps *src);
28 28
29static void as102_fe_copy_tune_parameters(struct as10x_tune_args *dst, 29static void as102_fe_copy_tune_parameters(struct as10x_tune_args *dst,
30 struct dvb_frontend_parameters *src); 30 struct dtv_frontend_properties *src);
31 31
32static int as102_fe_set_frontend(struct dvb_frontend *fe, 32static int as102_fe_set_frontend(struct dvb_frontend *fe)
33 struct dvb_frontend_parameters *params)
34{ 33{
34 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
35 int ret = 0; 35 int ret = 0;
36 struct as102_dev_t *dev; 36 struct as102_dev_t *dev;
37 struct as10x_tune_args tune_args = { 0 }; 37 struct as10x_tune_args tune_args = { 0 };
@@ -45,7 +45,7 @@ static int as102_fe_set_frontend(struct dvb_frontend *fe,
45 if (mutex_lock_interruptible(&dev->bus_adap.lock)) 45 if (mutex_lock_interruptible(&dev->bus_adap.lock))
46 return -EBUSY; 46 return -EBUSY;
47 47
48 as102_fe_copy_tune_parameters(&tune_args, params); 48 as102_fe_copy_tune_parameters(&tune_args, p);
49 49
50 /* send abilis command: SET_TUNE */ 50 /* send abilis command: SET_TUNE */
51 ret = as10x_cmd_set_tune(&dev->bus_adap, &tune_args); 51 ret = as10x_cmd_set_tune(&dev->bus_adap, &tune_args);
@@ -59,7 +59,8 @@ static int as102_fe_set_frontend(struct dvb_frontend *fe,
59} 59}
60 60
61static int as102_fe_get_frontend(struct dvb_frontend *fe, 61static int as102_fe_get_frontend(struct dvb_frontend *fe,
62 struct dvb_frontend_parameters *p) { 62 struct dtv_frontend_properties *p)
63{
63 int ret = 0; 64 int ret = 0;
64 struct as102_dev_t *dev; 65 struct as102_dev_t *dev;
65 struct as10x_tps tps = { 0 }; 66 struct as10x_tps tps = { 0 };
@@ -278,6 +279,7 @@ static int as102_fe_ts_bus_ctrl(struct dvb_frontend *fe, int acquire)
278} 279}
279 280
280static struct dvb_frontend_ops as102_fe_ops = { 281static struct dvb_frontend_ops as102_fe_ops = {
282 .delsys = { SYS_DVBT },
281 .info = { 283 .info = {
282 .name = "Unknown AS102 device", 284 .name = "Unknown AS102 device",
283 .type = FE_OFDM, 285 .type = FE_OFDM,
@@ -296,8 +298,8 @@ static struct dvb_frontend_ops as102_fe_ops = {
296 | FE_CAN_MUTE_TS 298 | FE_CAN_MUTE_TS
297 }, 299 },
298 300
299 .set_frontend_legacy = as102_fe_set_frontend, 301 .set_frontend = as102_fe_set_frontend,
300 .get_frontend_legacy = as102_fe_get_frontend, 302 .get_frontend = as102_fe_get_frontend,
301 .get_tune_settings = as102_fe_get_tune_settings, 303 .get_tune_settings = as102_fe_get_tune_settings,
302 304
303 .read_status = as102_fe_read_status, 305 .read_status = as102_fe_read_status,
@@ -344,38 +346,36 @@ int as102_dvb_register_fe(struct as102_dev_t *as102_dev,
344 return errno; 346 return errno;
345} 347}
346 348
347static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst, 349static void as10x_fe_copy_tps_parameters(struct dtv_frontend_properties *fe_tps,
348 struct as10x_tps *as10x_tps) 350 struct as10x_tps *as10x_tps)
349{ 351{
350 352
351 struct dvb_ofdm_parameters *fe_tps = &dst->u.ofdm;
352
353 /* extract consteallation */ 353 /* extract consteallation */
354 switch (as10x_tps->constellation) { 354 switch (as10x_tps->modulation) {
355 case CONST_QPSK: 355 case CONST_QPSK:
356 fe_tps->constellation = QPSK; 356 fe_tps->modulation = QPSK;
357 break; 357 break;
358 case CONST_QAM16: 358 case CONST_QAM16:
359 fe_tps->constellation = QAM_16; 359 fe_tps->modulation = QAM_16;
360 break; 360 break;
361 case CONST_QAM64: 361 case CONST_QAM64:
362 fe_tps->constellation = QAM_64; 362 fe_tps->modulation = QAM_64;
363 break; 363 break;
364 } 364 }
365 365
366 /* extract hierarchy */ 366 /* extract hierarchy */
367 switch (as10x_tps->hierarchy) { 367 switch (as10x_tps->hierarchy) {
368 case HIER_NONE: 368 case HIER_NONE:
369 fe_tps->hierarchy_information = HIERARCHY_NONE; 369 fe_tps->hierarchy = HIERARCHY_NONE;
370 break; 370 break;
371 case HIER_ALPHA_1: 371 case HIER_ALPHA_1:
372 fe_tps->hierarchy_information = HIERARCHY_1; 372 fe_tps->hierarchy = HIERARCHY_1;
373 break; 373 break;
374 case HIER_ALPHA_2: 374 case HIER_ALPHA_2:
375 fe_tps->hierarchy_information = HIERARCHY_2; 375 fe_tps->hierarchy = HIERARCHY_2;
376 break; 376 break;
377 case HIER_ALPHA_4: 377 case HIER_ALPHA_4:
378 fe_tps->hierarchy_information = HIERARCHY_4; 378 fe_tps->hierarchy = HIERARCHY_4;
379 break; 379 break;
380 } 380 }
381 381
@@ -473,7 +473,7 @@ static uint8_t as102_fe_get_code_rate(fe_code_rate_t arg)
473} 473}
474 474
475static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args, 475static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args,
476 struct dvb_frontend_parameters *params) 476 struct dtv_frontend_properties *params)
477{ 477{
478 478
479 /* set frequency */ 479 /* set frequency */
@@ -482,21 +482,21 @@ static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args,
482 /* fix interleaving_mode */ 482 /* fix interleaving_mode */
483 tune_args->interleaving_mode = INTLV_NATIVE; 483 tune_args->interleaving_mode = INTLV_NATIVE;
484 484
485 switch (params->u.ofdm.bandwidth) { 485 switch (params->bandwidth_hz) {
486 case BANDWIDTH_8_MHZ: 486 case 8000000:
487 tune_args->bandwidth = BW_8_MHZ; 487 tune_args->bandwidth = BW_8_MHZ;
488 break; 488 break;
489 case BANDWIDTH_7_MHZ: 489 case 7000000:
490 tune_args->bandwidth = BW_7_MHZ; 490 tune_args->bandwidth = BW_7_MHZ;
491 break; 491 break;
492 case BANDWIDTH_6_MHZ: 492 case 6000000:
493 tune_args->bandwidth = BW_6_MHZ; 493 tune_args->bandwidth = BW_6_MHZ;
494 break; 494 break;
495 default: 495 default:
496 tune_args->bandwidth = BW_8_MHZ; 496 tune_args->bandwidth = BW_8_MHZ;
497 } 497 }
498 498
499 switch (params->u.ofdm.guard_interval) { 499 switch (params->guard_interval) {
500 case GUARD_INTERVAL_1_32: 500 case GUARD_INTERVAL_1_32:
501 tune_args->guard_interval = GUARD_INT_1_32; 501 tune_args->guard_interval = GUARD_INT_1_32;
502 break; 502 break;
@@ -515,22 +515,22 @@ static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args,
515 break; 515 break;
516 } 516 }
517 517
518 switch (params->u.ofdm.constellation) { 518 switch (params->modulation) {
519 case QPSK: 519 case QPSK:
520 tune_args->constellation = CONST_QPSK; 520 tune_args->modulation = CONST_QPSK;
521 break; 521 break;
522 case QAM_16: 522 case QAM_16:
523 tune_args->constellation = CONST_QAM16; 523 tune_args->modulation = CONST_QAM16;
524 break; 524 break;
525 case QAM_64: 525 case QAM_64:
526 tune_args->constellation = CONST_QAM64; 526 tune_args->modulation = CONST_QAM64;
527 break; 527 break;
528 default: 528 default:
529 tune_args->constellation = CONST_UNKNOWN; 529 tune_args->modulation = CONST_UNKNOWN;
530 break; 530 break;
531 } 531 }
532 532
533 switch (params->u.ofdm.transmission_mode) { 533 switch (params->transmission_mode) {
534 case TRANSMISSION_MODE_2K: 534 case TRANSMISSION_MODE_2K:
535 tune_args->transmission_mode = TRANS_MODE_2K; 535 tune_args->transmission_mode = TRANS_MODE_2K;
536 break; 536 break;
@@ -541,7 +541,7 @@ static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args,
541 tune_args->transmission_mode = TRANS_MODE_UNKNOWN; 541 tune_args->transmission_mode = TRANS_MODE_UNKNOWN;
542 } 542 }
543 543
544 switch (params->u.ofdm.hierarchy_information) { 544 switch (params->hierarchy) {
545 case HIERARCHY_NONE: 545 case HIERARCHY_NONE:
546 tune_args->hierarchy = HIER_NONE; 546 tune_args->hierarchy = HIER_NONE;
547 break; 547 break;
@@ -569,19 +569,19 @@ static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args,
569 * if HP/LP are both set to FEC_NONE, HP will be selected. 569 * if HP/LP are both set to FEC_NONE, HP will be selected.
570 */ 570 */
571 if ((tune_args->hierarchy != HIER_NONE) && 571 if ((tune_args->hierarchy != HIER_NONE) &&
572 ((params->u.ofdm.code_rate_LP == FEC_NONE) || 572 ((params->code_rate_LP == FEC_NONE) ||
573 (params->u.ofdm.code_rate_HP == FEC_NONE))) { 573 (params->code_rate_HP == FEC_NONE))) {
574 574
575 if (params->u.ofdm.code_rate_LP == FEC_NONE) { 575 if (params->code_rate_LP == FEC_NONE) {
576 tune_args->hier_select = HIER_HIGH_PRIORITY; 576 tune_args->hier_select = HIER_HIGH_PRIORITY;
577 tune_args->code_rate = 577 tune_args->code_rate =
578 as102_fe_get_code_rate(params->u.ofdm.code_rate_HP); 578 as102_fe_get_code_rate(params->code_rate_HP);
579 } 579 }
580 580
581 if (params->u.ofdm.code_rate_HP == FEC_NONE) { 581 if (params->code_rate_HP == FEC_NONE) {
582 tune_args->hier_select = HIER_LOW_PRIORITY; 582 tune_args->hier_select = HIER_LOW_PRIORITY;
583 tune_args->code_rate = 583 tune_args->code_rate =
584 as102_fe_get_code_rate(params->u.ofdm.code_rate_LP); 584 as102_fe_get_code_rate(params->code_rate_LP);
585 } 585 }
586 586
587 dprintk(debug, "\thierarchy: 0x%02x " 587 dprintk(debug, "\thierarchy: 0x%02x "
@@ -594,6 +594,6 @@ static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args,
594 tune_args->code_rate); 594 tune_args->code_rate);
595 } else { 595 } else {
596 tune_args->code_rate = 596 tune_args->code_rate =
597 as102_fe_get_code_rate(params->u.ofdm.code_rate_HP); 597 as102_fe_get_code_rate(params->code_rate_HP);
598 } 598 }
599} 599}
diff --git a/drivers/staging/media/as102/as10x_cmd.c b/drivers/staging/media/as102/as10x_cmd.c
index 0387bb85cafe..262bb94ad27e 100644
--- a/drivers/staging/media/as102/as10x_cmd.c
+++ b/drivers/staging/media/as102/as10x_cmd.c
@@ -141,7 +141,7 @@ int as10x_cmd_set_tune(struct as10x_bus_adapter_t *adap,
141 preq->body.set_tune.req.args.freq = cpu_to_le32(ptune->freq); 141 preq->body.set_tune.req.args.freq = cpu_to_le32(ptune->freq);
142 preq->body.set_tune.req.args.bandwidth = ptune->bandwidth; 142 preq->body.set_tune.req.args.bandwidth = ptune->bandwidth;
143 preq->body.set_tune.req.args.hier_select = ptune->hier_select; 143 preq->body.set_tune.req.args.hier_select = ptune->hier_select;
144 preq->body.set_tune.req.args.constellation = ptune->constellation; 144 preq->body.set_tune.req.args.modulation = ptune->modulation;
145 preq->body.set_tune.req.args.hierarchy = ptune->hierarchy; 145 preq->body.set_tune.req.args.hierarchy = ptune->hierarchy;
146 preq->body.set_tune.req.args.interleaving_mode = 146 preq->body.set_tune.req.args.interleaving_mode =
147 ptune->interleaving_mode; 147 ptune->interleaving_mode;
@@ -279,7 +279,7 @@ int as10x_cmd_get_tps(struct as10x_bus_adapter_t *adap, struct as10x_tps *ptps)
279 goto out; 279 goto out;
280 280
281 /* Response OK -> get response data */ 281 /* Response OK -> get response data */
282 ptps->constellation = prsp->body.get_tps.rsp.tps.constellation; 282 ptps->modulation = prsp->body.get_tps.rsp.tps.modulation;
283 ptps->hierarchy = prsp->body.get_tps.rsp.tps.hierarchy; 283 ptps->hierarchy = prsp->body.get_tps.rsp.tps.hierarchy;
284 ptps->interleaving_mode = prsp->body.get_tps.rsp.tps.interleaving_mode; 284 ptps->interleaving_mode = prsp->body.get_tps.rsp.tps.interleaving_mode;
285 ptps->code_rate_HP = prsp->body.get_tps.rsp.tps.code_rate_HP; 285 ptps->code_rate_HP = prsp->body.get_tps.rsp.tps.code_rate_HP;
diff --git a/drivers/staging/media/as102/as10x_types.h b/drivers/staging/media/as102/as10x_types.h
index c40c8128cb76..fde8140ae88b 100644
--- a/drivers/staging/media/as102/as10x_types.h
+++ b/drivers/staging/media/as102/as10x_types.h
@@ -112,7 +112,7 @@
112#define CFG_MODE_AUTO 2 112#define CFG_MODE_AUTO 2
113 113
114struct as10x_tps { 114struct as10x_tps {
115 uint8_t constellation; 115 uint8_t modulation;
116 uint8_t hierarchy; 116 uint8_t hierarchy;
117 uint8_t interleaving_mode; 117 uint8_t interleaving_mode;
118 uint8_t code_rate_HP; 118 uint8_t code_rate_HP;
@@ -132,7 +132,7 @@ struct as10x_tune_args {
132 /* hierarchy selection */ 132 /* hierarchy selection */
133 uint8_t hier_select; 133 uint8_t hier_select;
134 /* constellation */ 134 /* constellation */
135 uint8_t constellation; 135 uint8_t modulation;
136 /* hierarchy */ 136 /* hierarchy */
137 uint8_t hierarchy; 137 uint8_t hierarchy;
138 /* interleaving mode */ 138 /* interleaving mode */