Commit da2cf18f authored by Daniel Scheller's avatar Daniel Scheller Committed by Mauro Carvalho Chehab

media: dvb-frontends/stv0910: rework and fix DiSEqC send

Rework both DiSEqC send functions (send_master_cmd() and send_burst()) to
utilise the new SET_REG() and SET_FIELD() macros. Esp. due to SET_FIELD(),
this makes sure that not all bits (with unrelated purposes) are always
rewritten, but only those needed for sending DiSEqC commands. In
send_burst(), this makes sure that DISEQC_MODE isn't changed from 3 to 2
inbetween when sending SEC_MINI_A. Also, change both functions to write
DISEQC_MODE first before setting DIS_PRECHARGE. This makes diseqc control
work more reliable for "fullblown" DiSEqC strings in VDR's diseqc.conf in
combination with certain multiswitches.

Fixes: 448461af ("media: dvb-frontends/stv0910: implement diseqc_send_burst")
Reported-by: default avatarHelmut Auer <post@helmutauer.de>
Cc: Ralph Metzler <rjkm@metzlerbros.de>
Signed-off-by: default avatarDaniel Scheller <d.scheller@gmx.net>
Tested-by: default avatarHelmut Auer <post@helmutauer.de>
Tested-by: default avatarRichard Scobie <rascobie@slingshot.co.nz>
Tested-by: default avatarDietmar Spingler <d_spingler@freenet.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 15f757bb
...@@ -1673,15 +1673,15 @@ static int send_master_cmd(struct dvb_frontend *fe, ...@@ -1673,15 +1673,15 @@ static int send_master_cmd(struct dvb_frontend *fe,
struct dvb_diseqc_master_cmd *cmd) struct dvb_diseqc_master_cmd *cmd)
{ {
struct stv *state = fe->demodulator_priv; struct stv *state = fe->demodulator_priv;
u16 offs = state->nr ? 0x40 : 0;
int i; int i;
write_reg(state, RSTV0910_P1_DISTXCFG + offs, 0x3E); SET_FIELD(DISEQC_MODE, 2);
SET_FIELD(DIS_PRECHARGE, 1);
for (i = 0; i < cmd->msg_len; i++) { for (i = 0; i < cmd->msg_len; i++) {
wait_dis(state, 0x40, 0x00); wait_dis(state, 0x40, 0x00);
write_reg(state, RSTV0910_P1_DISTXFIFO + offs, cmd->msg[i]); SET_REG(DISTXFIFO, cmd->msg[i]);
} }
write_reg(state, RSTV0910_P1_DISTXCFG + offs, 0x3A); SET_FIELD(DIS_PRECHARGE, 0);
wait_dis(state, 0x20, 0x20); wait_dis(state, 0x20, 0x20);
return 0; return 0;
} }
...@@ -1689,19 +1689,20 @@ static int send_master_cmd(struct dvb_frontend *fe, ...@@ -1689,19 +1689,20 @@ static int send_master_cmd(struct dvb_frontend *fe,
static int send_burst(struct dvb_frontend *fe, enum fe_sec_mini_cmd burst) static int send_burst(struct dvb_frontend *fe, enum fe_sec_mini_cmd burst)
{ {
struct stv *state = fe->demodulator_priv; struct stv *state = fe->demodulator_priv;
u16 offs = state->nr ? 0x40 : 0;
u8 value; u8 value;
if (burst == SEC_MINI_A) { if (burst == SEC_MINI_A) {
write_reg(state, RSTV0910_P1_DISTXCFG + offs, 0x3F); SET_FIELD(DISEQC_MODE, 3);
value = 0x00; value = 0x00;
} else { } else {
write_reg(state, RSTV0910_P1_DISTXCFG + offs, 0x3E); SET_FIELD(DISEQC_MODE, 2);
value = 0xFF; value = 0xFF;
} }
SET_FIELD(DIS_PRECHARGE, 1);
wait_dis(state, 0x40, 0x00); wait_dis(state, 0x40, 0x00);
write_reg(state, RSTV0910_P1_DISTXFIFO + offs, value); SET_REG(DISTXFIFO, value);
write_reg(state, RSTV0910_P1_DISTXCFG + offs, 0x3A); SET_FIELD(DIS_PRECHARGE, 0);
wait_dis(state, 0x20, 0x20); wait_dis(state, 0x20, 0x20);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment