Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 26905
b: refs/heads/master
c: dce1dfc
h: refs/heads/master
i:
  26903: 0febe49
v: v3
  • Loading branch information
Yeasah Pell authored and Mauro Carvalho Chehab committed May 12, 2006
1 parent fc31e2c commit 11771a3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: caf970e09c42843eb3b8456fc0e815f9b5385873
refs/heads/master: dce1dfc2a5736bfc82df5d3fd6396022c7bbbbd8
32 changes: 22 additions & 10 deletions trunk/drivers/media/dvb/frontends/cx24123.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,15 +687,27 @@ static int cx24123_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage
return 0;
}

/* wait for diseqc queue to become ready (or timeout) */
static void cx24123_wait_for_diseqc(struct cx24123_state *state)
{
unsigned long timeout = jiffies + msecs_to_jiffies(200);
while (!(cx24123_readreg(state, 0x29) & 0x40)) {
if(time_after(jiffies, timeout)) {
printk("%s: diseqc queue not ready, command may be lost.\n", __FUNCTION__);
break;
}
msleep(10);
}
}

static int cx24123_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd *cmd)
{
struct cx24123_state *state = fe->demodulator_priv;
int i, val;
unsigned long timeout;

dprintk("%s:\n",__FUNCTION__);

/* check if continuous tone has been stoped */
/* check if continuous tone has been stopped */
if (state->config->use_isl6421)
val = cx24123_readlnbreg(state, 0x00) & 0x10;
else
Expand All @@ -707,6 +719,9 @@ static int cx24123_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_ma
return -ENOTSUPP;
}

/* wait for diseqc queue ready */
cx24123_wait_for_diseqc(state);

/* select tone mode */
cx24123_writereg(state, 0x2a, cx24123_readreg(state, 0x2a) & 0xf8);

Expand All @@ -716,9 +731,8 @@ static int cx24123_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_ma
val = cx24123_readreg(state, 0x29);
cx24123_writereg(state, 0x29, ((val & 0x90) | 0x40) | ((cmd->msg_len-3) & 3));

timeout = jiffies + msecs_to_jiffies(100);
while (!time_after(jiffies, timeout) && !(cx24123_readreg(state, 0x29) & 0x40))
; // wait for LNB ready
/* wait for diseqc message to finish sending */
cx24123_wait_for_diseqc(state);

return 0;
}
Expand All @@ -727,7 +741,6 @@ static int cx24123_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t
{
struct cx24123_state *state = fe->demodulator_priv;
int val;
unsigned long timeout;

dprintk("%s:\n", __FUNCTION__);

Expand All @@ -743,6 +756,8 @@ static int cx24123_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t
return -ENOTSUPP;
}

cx24123_wait_for_diseqc(state);

/* select tone mode */
val = cx24123_readreg(state, 0x2a) & 0xf8;
cx24123_writereg(state, 0x2a, val | 0x04);
Expand All @@ -756,10 +771,7 @@ static int cx24123_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t
else
return -EINVAL;


timeout = jiffies + msecs_to_jiffies(100);
while (!time_after(jiffies, timeout) && !(cx24123_readreg(state, 0x29) & 0x40))
; // wait for LNB ready
cx24123_wait_for_diseqc(state);

return 0;
}
Expand Down

0 comments on commit 11771a3

Please sign in to comment.