diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2006-04-06 05:03:09 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-25 00:57:50 -0400 |
commit | 0dbbc0a7ce1acc3a20857f25aa656bf2f5925766 (patch) | |
tree | 2e1b36a538b4438b784b92a2ae54fa75afc14d1b | |
parent | e142e7c4186821f03890ff223925cdc7fc963742 (diff) |
V4L/DVB (3739): Add support for FE_GET_FRONTEND to or51132 frontend
Adds the FE_GET_FRONTEND ioctl to the or51132 frontend. Current modulation is
read from the hardware, while frequency is taken from the driver's state.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/dvb/frontends/or51132.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/drivers/media/dvb/frontends/or51132.c b/drivers/media/dvb/frontends/or51132.c index 619856b076cd..c25ec73440e7 100644 --- a/drivers/media/dvb/frontends/or51132.c +++ b/drivers/media/dvb/frontends/or51132.c | |||
@@ -400,6 +400,44 @@ static int or51132_set_parameters(struct dvb_frontend* fe, | |||
400 | return 0; | 400 | return 0; |
401 | } | 401 | } |
402 | 402 | ||
403 | static int or51132_get_parameters(struct dvb_frontend* fe, | ||
404 | struct dvb_frontend_parameters *param) | ||
405 | { | ||
406 | struct or51132_state* state = fe->demodulator_priv; | ||
407 | u8 buf[2]; | ||
408 | |||
409 | /* Receiver Status */ | ||
410 | buf[0]=0x04; | ||
411 | buf[1]=0x00; | ||
412 | msleep(30); /* 30ms */ | ||
413 | if (i2c_writebytes(state,state->config->demod_address,buf,2)) { | ||
414 | printk(KERN_WARNING "or51132: get_parameters write error\n"); | ||
415 | return -EREMOTEIO; | ||
416 | } | ||
417 | msleep(30); /* 30ms */ | ||
418 | if (i2c_readbytes(state,state->config->demod_address,buf,2)) { | ||
419 | printk(KERN_WARNING "or51132: get_parameters read error\n"); | ||
420 | return -EREMOTEIO; | ||
421 | } | ||
422 | switch(buf[0]) { | ||
423 | case 0x06: param->u.vsb.modulation = VSB_8; break; | ||
424 | case 0x43: param->u.vsb.modulation = QAM_64; break; | ||
425 | case 0x45: param->u.vsb.modulation = QAM_256; break; | ||
426 | default: | ||
427 | printk(KERN_WARNING "or51132: unknown status 0x%02x\n", | ||
428 | buf[0]); | ||
429 | return -EREMOTEIO; | ||
430 | } | ||
431 | |||
432 | /* FIXME: Read frequency from frontend, take AFC into account */ | ||
433 | param->frequency = state->current_frequency; | ||
434 | |||
435 | /* FIXME: How to read inversion setting? Receiver 6 register? */ | ||
436 | param->inversion = INVERSION_AUTO; | ||
437 | |||
438 | return 0; | ||
439 | } | ||
440 | |||
403 | static int or51132_read_status(struct dvb_frontend* fe, fe_status_t* status) | 441 | static int or51132_read_status(struct dvb_frontend* fe, fe_status_t* status) |
404 | { | 442 | { |
405 | struct or51132_state* state = fe->demodulator_priv; | 443 | struct or51132_state* state = fe->demodulator_priv; |
@@ -618,6 +656,7 @@ static struct dvb_frontend_ops or51132_ops = { | |||
618 | .sleep = or51132_sleep, | 656 | .sleep = or51132_sleep, |
619 | 657 | ||
620 | .set_frontend = or51132_set_parameters, | 658 | .set_frontend = or51132_set_parameters, |
659 | .get_frontend = or51132_get_parameters, | ||
621 | .get_tune_settings = or51132_get_tune_settings, | 660 | .get_tune_settings = or51132_get_tune_settings, |
622 | 661 | ||
623 | .read_status = or51132_read_status, | 662 | .read_status = or51132_read_status, |