diff options
author | Andreas Regel <andreas.regel@gmx.de> | 2009-04-08 16:27:51 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-06-16 17:20:38 -0400 |
commit | f9ed95d03e3a736627493690bfd1cb893ebaa200 (patch) | |
tree | bc197ec907eaf4cae12cfd8fed6371f704eb9c5f /drivers/media | |
parent | 54d859ec563d2f0cbbc03e45e204325c5f2118bf (diff) |
V4L/DVB (11584): stv090x: add tone burst control
Signed-off-by: Andreas Regel <andreas.regel@gmx.de>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb/frontends/stv090x.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c index b450bf12db44..0643bffea508 100644 --- a/drivers/media/dvb/frontends/stv090x.c +++ b/drivers/media/dvb/frontends/stv090x.c | |||
@@ -3360,6 +3360,15 @@ static int stv090x_send_diseqc_msg(struct dvb_frontend *fe, struct dvb_diseqc_ma | |||
3360 | int i; | 3360 | int i; |
3361 | 3361 | ||
3362 | reg = STV090x_READ_DEMOD(state, DISTXCTL); | 3362 | reg = STV090x_READ_DEMOD(state, DISTXCTL); |
3363 | |||
3364 | STV090x_SETFIELD_Px(reg, DISTX_MODE_FIELD, 2); | ||
3365 | STV090x_SETFIELD_Px(reg, DISEQC_RESET_FIELD, 1); | ||
3366 | if (STV090x_WRITE_DEMOD(state, DISTXCTL, reg) < 0) | ||
3367 | goto err; | ||
3368 | STV090x_SETFIELD_Px(reg, DISEQC_RESET_FIELD, 0); | ||
3369 | if (STV090x_WRITE_DEMOD(state, DISTXCTL, reg) < 0) | ||
3370 | goto err; | ||
3371 | |||
3363 | STV090x_SETFIELD_Px(reg, DIS_PRECHARGE_FIELD, 1); | 3372 | STV090x_SETFIELD_Px(reg, DIS_PRECHARGE_FIELD, 1); |
3364 | if (STV090x_WRITE_DEMOD(state, DISTXCTL, reg) < 0) | 3373 | if (STV090x_WRITE_DEMOD(state, DISTXCTL, reg) < 0) |
3365 | goto err; | 3374 | goto err; |
@@ -3373,8 +3382,64 @@ static int stv090x_send_diseqc_msg(struct dvb_frontend *fe, struct dvb_diseqc_ma | |||
3373 | 3382 | ||
3374 | if (STV090x_WRITE_DEMOD(state, DISTXDATA, cmd->msg[i]) < 0) | 3383 | if (STV090x_WRITE_DEMOD(state, DISTXDATA, cmd->msg[i]) < 0) |
3375 | goto err; | 3384 | goto err; |
3385 | } | ||
3386 | reg = STV090x_READ_DEMOD(state, DISTXCTL); | ||
3387 | STV090x_SETFIELD_Px(reg, DIS_PRECHARGE_FIELD, 0); | ||
3388 | if (STV090x_WRITE_DEMOD(state, DISTXCTL, reg) < 0) | ||
3389 | goto err; | ||
3390 | |||
3391 | i = 0; | ||
3392 | |||
3393 | while ((!idle) && (i < 10)) { | ||
3394 | reg = STV090x_READ_DEMOD(state, DISTXSTATUS); | ||
3395 | idle = STV090x_GETFIELD_Px(reg, TX_IDLE_FIELD); | ||
3396 | msleep(10); | ||
3376 | i++; | 3397 | i++; |
3377 | } | 3398 | } |
3399 | |||
3400 | return 0; | ||
3401 | err: | ||
3402 | dprintk(FE_ERROR, 1, "I/O error"); | ||
3403 | return -1; | ||
3404 | } | ||
3405 | |||
3406 | static int stv090x_send_diseqc_burst(struct dvb_frontend *fe, fe_sec_mini_cmd_t burst) | ||
3407 | { | ||
3408 | struct stv090x_state *state = fe->demodulator_priv; | ||
3409 | u32 reg, idle = 0, fifo_full = 1; | ||
3410 | u8 mode, value; | ||
3411 | int i; | ||
3412 | |||
3413 | reg = STV090x_READ_DEMOD(state, DISTXCTL); | ||
3414 | |||
3415 | if (burst == SEC_MINI_A) { | ||
3416 | mode = 3; | ||
3417 | value = 0x00; | ||
3418 | } else { | ||
3419 | mode = 2; | ||
3420 | value = 0xFF; | ||
3421 | } | ||
3422 | |||
3423 | STV090x_SETFIELD_Px(reg, DISTX_MODE_FIELD, mode); | ||
3424 | STV090x_SETFIELD_Px(reg, DISEQC_RESET_FIELD, 1); | ||
3425 | if (STV090x_WRITE_DEMOD(state, DISTXCTL, reg) < 0) | ||
3426 | goto err; | ||
3427 | STV090x_SETFIELD_Px(reg, DISEQC_RESET_FIELD, 0); | ||
3428 | if (STV090x_WRITE_DEMOD(state, DISTXCTL, reg) < 0) | ||
3429 | goto err; | ||
3430 | |||
3431 | STV090x_SETFIELD_Px(reg, DIS_PRECHARGE_FIELD, 1); | ||
3432 | if (STV090x_WRITE_DEMOD(state, DISTXCTL, reg) < 0) | ||
3433 | goto err; | ||
3434 | |||
3435 | while (fifo_full) { | ||
3436 | reg = STV090x_READ_DEMOD(state, DISTXSTATUS); | ||
3437 | fifo_full = STV090x_GETFIELD_Px(reg, FIFO_FULL_FIELD); | ||
3438 | } | ||
3439 | |||
3440 | if (STV090x_WRITE_DEMOD(state, DISTXDATA, value) < 0) | ||
3441 | goto err; | ||
3442 | |||
3378 | reg = STV090x_READ_DEMOD(state, DISTXCTL); | 3443 | reg = STV090x_READ_DEMOD(state, DISTXCTL); |
3379 | STV090x_SETFIELD_Px(reg, DIS_PRECHARGE_FIELD, 0); | 3444 | STV090x_SETFIELD_Px(reg, DIS_PRECHARGE_FIELD, 0); |
3380 | if (STV090x_WRITE_DEMOD(state, DISTXCTL, reg) < 0) | 3445 | if (STV090x_WRITE_DEMOD(state, DISTXCTL, reg) < 0) |
@@ -3882,6 +3947,7 @@ static struct dvb_frontend_ops stv090x_ops = { | |||
3882 | .i2c_gate_ctrl = stv090x_i2c_gate_ctrl, | 3947 | .i2c_gate_ctrl = stv090x_i2c_gate_ctrl, |
3883 | 3948 | ||
3884 | .diseqc_send_master_cmd = stv090x_send_diseqc_msg, | 3949 | .diseqc_send_master_cmd = stv090x_send_diseqc_msg, |
3950 | .diseqc_send_burst = stv090x_send_diseqc_burst, | ||
3885 | .diseqc_recv_slave_reply = stv090x_recv_slave_reply, | 3951 | .diseqc_recv_slave_reply = stv090x_recv_slave_reply, |
3886 | .set_tone = stv090x_set_tone, | 3952 | .set_tone = stv090x_set_tone, |
3887 | 3953 | ||