Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 17306
b: refs/heads/master
c: 0144f31
h: refs/heads/master
v: v3
  • Loading branch information
Steven Toth authored and Mauro Carvalho Chehab committed Jan 9, 2006
1 parent 0375122 commit 8e3c0ce
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 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: 2c3f11b20fc6c41b4d3f64f301f525e35f18b6bc
refs/heads/master: 0144f31466f0b7f1a8b21b470bfeb93c174a2006
39 changes: 16 additions & 23 deletions trunk/drivers/media/dvb/frontends/cx24123.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,52 +487,45 @@ static int cx24123_pll_calculate(struct dvb_frontend* fe, struct dvb_frontend_pa
static int cx24123_pll_writereg(struct dvb_frontend* fe, struct dvb_frontend_parameters *p, u32 data)
{
struct cx24123_state *state = fe->demodulator_priv;

u8 timeout = 0;
unsigned long timeout;

/* align the 21 bytes into to bit23 boundary */
data = data << 3;

/* Reset the demod pll word length to 0x15 bits */
cx24123_writereg(state, 0x21, 0x15);

timeout = 0;
/* write the msb 8 bits, wait for the send to be completed */
timeout = jiffies + msecs_to_jiffies(40);
cx24123_writereg(state, 0x22, (data >> 16) & 0xff);
while ( ( cx24123_readreg(state, 0x20) & 0x40 ) == 0 )
{
/* Safety - No reason why the write should not complete, and we never get here, avoid hang */
if (timeout++ >= 4) {
printk("%s: demodulator is no longer responding, aborting.\n",__FUNCTION__);
while ((cx24123_readreg(state, 0x20) & 0x40) == 0) {
if (time_after(jiffies, timeout)) {
printk("%s: demodulator is not responding, possibly hung, aborting.\n", __FUNCTION__);
return -EREMOTEIO;
}
msleep(500);
msleep(10);
}

timeout = 0;
/* send another 8 bytes, wait for the send to be completed */
timeout = jiffies + msecs_to_jiffies(40);
cx24123_writereg(state, 0x22, (data>>8) & 0xff );
while ( (cx24123_readreg(state, 0x20) & 0x40 ) == 0 )
{
/* Safety - No reason why the write should not complete, and we never get here, avoid hang */
if (timeout++ >= 4) {
printk("%s: demodulator is not responding, possibly hung, aborting.\n",__FUNCTION__);
while ((cx24123_readreg(state, 0x20) & 0x40) == 0) {
if (time_after(jiffies, timeout)) {
printk("%s: demodulator is not responding, possibly hung, aborting.\n", __FUNCTION__);
return -EREMOTEIO;
}
msleep(500);
msleep(10);
}

timeout = 0;
/* send the lower 5 bits of this byte, padded with 3 LBB, wait for the send to be completed */
timeout = jiffies + msecs_to_jiffies(40);
cx24123_writereg(state, 0x22, (data) & 0xff );
while ((cx24123_readreg(state, 0x20) & 0x80))
{
/* Safety - No reason why the write should not complete, and we never get here, avoid hang */
if (timeout++ >= 4) {
printk("%s: demodulator is not responding, possibly hung, aborting.\n",__FUNCTION__);
while ((cx24123_readreg(state, 0x20) & 0x80)) {
if (time_after(jiffies, timeout)) {
printk("%s: demodulator is not responding, possibly hung, aborting.\n", __FUNCTION__);
return -EREMOTEIO;
}
msleep(500);
msleep(10);
}

/* Trigger the demod to configure the tuner */
Expand Down

0 comments on commit 8e3c0ce

Please sign in to comment.