aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-12-26 13:01:57 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-12-31 06:46:10 -0500
commitd8f7cc28464bc07dbf055b062ef1dec2cda07032 (patch)
tree1cc0504ab9308b9fdf7f059b0f703fd66db4369f /drivers
parent81931e940e72e0324968a1afdd555b8c17456dba (diff)
[media] or51132: 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')
-rw-r--r--drivers/media/dvb/frontends/or51132.c51
1 files changed, 29 insertions, 22 deletions
diff --git a/drivers/media/dvb/frontends/or51132.c b/drivers/media/dvb/frontends/or51132.c
index e0c952c535a9..1fc7778a58c8 100644
--- a/drivers/media/dvb/frontends/or51132.c
+++ b/drivers/media/dvb/frontends/or51132.c
@@ -306,9 +306,9 @@ static int modulation_fw_class(fe_modulation_t modulation)
306 } 306 }
307} 307}
308 308
309static int or51132_set_parameters(struct dvb_frontend* fe, 309static int or51132_set_parameters(struct dvb_frontend *fe)
310 struct dvb_frontend_parameters *param)
311{ 310{
311 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
312 int ret; 312 int ret;
313 struct or51132_state* state = fe->demodulator_priv; 313 struct or51132_state* state = fe->demodulator_priv;
314 const struct firmware *fw; 314 const struct firmware *fw;
@@ -317,8 +317,8 @@ static int or51132_set_parameters(struct dvb_frontend* fe,
317 317
318 /* Upload new firmware only if we need a different one */ 318 /* Upload new firmware only if we need a different one */
319 if (modulation_fw_class(state->current_modulation) != 319 if (modulation_fw_class(state->current_modulation) !=
320 modulation_fw_class(param->u.vsb.modulation)) { 320 modulation_fw_class(p->modulation)) {
321 switch(modulation_fw_class(param->u.vsb.modulation)) { 321 switch (modulation_fw_class(p->modulation)) {
322 case MOD_FWCLASS_VSB: 322 case MOD_FWCLASS_VSB:
323 dprintk("set_parameters VSB MODE\n"); 323 dprintk("set_parameters VSB MODE\n");
324 fwname = OR51132_VSB_FIRMWARE; 324 fwname = OR51132_VSB_FIRMWARE;
@@ -335,7 +335,7 @@ static int or51132_set_parameters(struct dvb_frontend* fe,
335 break; 335 break;
336 default: 336 default:
337 printk("or51132: Modulation type(%d) UNSUPPORTED\n", 337 printk("or51132: Modulation type(%d) UNSUPPORTED\n",
338 param->u.vsb.modulation); 338 p->modulation);
339 return -1; 339 return -1;
340 } 340 }
341 printk("or51132: Waiting for firmware upload(%s)...\n", 341 printk("or51132: Waiting for firmware upload(%s)...\n",
@@ -357,8 +357,8 @@ static int or51132_set_parameters(struct dvb_frontend* fe,
357 state->config->set_ts_params(fe, clock_mode); 357 state->config->set_ts_params(fe, clock_mode);
358 } 358 }
359 /* Change only if we are actually changing the modulation */ 359 /* Change only if we are actually changing the modulation */
360 if (state->current_modulation != param->u.vsb.modulation) { 360 if (state->current_modulation != p->modulation) {
361 state->current_modulation = param->u.vsb.modulation; 361 state->current_modulation = p->modulation;
362 or51132_setmode(fe); 362 or51132_setmode(fe);
363 } 363 }
364 364
@@ -371,12 +371,12 @@ static int or51132_set_parameters(struct dvb_frontend* fe,
371 or51132_setmode(fe); 371 or51132_setmode(fe);
372 372
373 /* Update current frequency */ 373 /* Update current frequency */
374 state->current_frequency = param->frequency; 374 state->current_frequency = p->frequency;
375 return 0; 375 return 0;
376} 376}
377 377
378static int or51132_get_parameters(struct dvb_frontend* fe, 378static int or51132_get_parameters(struct dvb_frontend* fe,
379 struct dvb_frontend_parameters *param) 379 struct dtv_frontend_properties *p)
380{ 380{
381 struct or51132_state* state = fe->demodulator_priv; 381 struct or51132_state* state = fe->demodulator_priv;
382 int status; 382 int status;
@@ -389,21 +389,28 @@ start:
389 return -EREMOTEIO; 389 return -EREMOTEIO;
390 } 390 }
391 switch(status&0xff) { 391 switch(status&0xff) {
392 case 0x06: param->u.vsb.modulation = VSB_8; break; 392 case 0x06:
393 case 0x43: param->u.vsb.modulation = QAM_64; break; 393 p->modulation = VSB_8;
394 case 0x45: param->u.vsb.modulation = QAM_256; break; 394 break;
395 default: 395 case 0x43:
396 if (retry--) goto start; 396 p->modulation = QAM_64;
397 printk(KERN_WARNING "or51132: unknown status 0x%02x\n", 397 break;
398 status&0xff); 398 case 0x45:
399 return -EREMOTEIO; 399 p->modulation = QAM_256;
400 break;
401 default:
402 if (retry--)
403 goto start;
404 printk(KERN_WARNING "or51132: unknown status 0x%02x\n",
405 status&0xff);
406 return -EREMOTEIO;
400 } 407 }
401 408
402 /* FIXME: Read frequency from frontend, take AFC into account */ 409 /* FIXME: Read frequency from frontend, take AFC into account */
403 param->frequency = state->current_frequency; 410 p->frequency = state->current_frequency;
404 411
405 /* FIXME: How to read inversion setting? Receiver 6 register? */ 412 /* FIXME: How to read inversion setting? Receiver 6 register? */
406 param->inversion = INVERSION_AUTO; 413 p->inversion = INVERSION_AUTO;
407 414
408 return 0; 415 return 0;
409} 416}
@@ -579,7 +586,7 @@ struct dvb_frontend* or51132_attach(const struct or51132_config* config,
579} 586}
580 587
581static struct dvb_frontend_ops or51132_ops = { 588static struct dvb_frontend_ops or51132_ops = {
582 589 .delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B },
583 .info = { 590 .info = {
584 .name = "Oren OR51132 VSB/QAM Frontend", 591 .name = "Oren OR51132 VSB/QAM Frontend",
585 .type = FE_ATSC, 592 .type = FE_ATSC,
@@ -597,8 +604,8 @@ static struct dvb_frontend_ops or51132_ops = {
597 .init = or51132_init, 604 .init = or51132_init,
598 .sleep = or51132_sleep, 605 .sleep = or51132_sleep,
599 606
600 .set_frontend_legacy = or51132_set_parameters, 607 .set_frontend = or51132_set_parameters,
601 .get_frontend_legacy = or51132_get_parameters, 608 .get_frontend = or51132_get_parameters,
602 .get_tune_settings = or51132_get_tune_settings, 609 .get_tune_settings = or51132_get_tune_settings,
603 610
604 .read_status = or51132_read_status, 611 .read_status = or51132_read_status,