From 3079b3cb678cc5659d52dbac48c93ee406f38df6 Mon Sep 17 00:00:00 2001 From: Andrew de Quincy Date: Tue, 9 Nov 2004 19:07:14 +0000 Subject: Added delay loop --- linux/drivers/media/dvb/ttpci/av7110.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'linux/drivers/media/dvb') diff --git a/linux/drivers/media/dvb/ttpci/av7110.c b/linux/drivers/media/dvb/ttpci/av7110.c index cc646721d..418fc6438 100644 --- a/linux/drivers/media/dvb/ttpci/av7110.c +++ b/linux/drivers/media/dvb/ttpci/av7110.c @@ -1650,6 +1650,8 @@ static int nexusca_stv0297_pll_set(struct dvb_frontend* fe, struct dvb_frontend_ u32 div; u8 data[4]; struct i2c_msg msg = { .addr = 0x63, .flags = 0, .buf = data, .len = sizeof(data) }; + struct i2c_msg readmsg = { .addr = 0x63, .flags = I2C_M_RD, .buf = data, .len = 1 }; + int i; // this calculation does not match the TDA6405TS datasheet! div = (params->frequency + 36150000) / 62500; @@ -1675,7 +1677,15 @@ static int nexusca_stv0297_pll_set(struct dvb_frontend* fe, struct dvb_frontend_ return -EIO; } - msleep(20); + // wait for PLL lock + for(i=0; i< 20; i++) { + + stv0297_enable_plli2c(fe); + if (i2c_transfer (&av7110->i2c_adap, &readmsg, 1) == 1) + if (data[0] & 0x40) break; + msleep(10); + } + return 0; } -- cgit v1.2.3