summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video')
-rw-r--r--linux/drivers/media/video/tuner-core.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c
index 3b85b442f..040647c0d 100644
--- a/linux/drivers/media/video/tuner-core.c
+++ b/linux/drivers/media/video/tuner-core.c
@@ -1,5 +1,5 @@
/*
- * $Id: tuner-core.c,v 1.38 2005/07/01 15:02:09 mchehab Exp $
+ * $Id: tuner-core.c,v 1.39 2005/07/01 17:50:10 mchehab Exp $
*
* i2c tv tuner chip device driver
* core core, i.e. kernel interfaces, registering and so on
@@ -143,6 +143,7 @@ static void set_type(struct i2c_client *c, unsigned int type,
enum tuner_admin_state new_admin_status)
{
struct tuner *t = i2c_get_clientdata(c);
+ unsigned int i;
unsigned char buffer[4];
/* sanity check */
@@ -156,11 +157,19 @@ static void set_type(struct i2c_client *c, unsigned int type,
return;
}
+ /* This code prevents against I2C early announces */
if (NULL == t->i2c.dev.driver) {
dprintk("tuner 0x%02x: I2C driver not registred yet!\n",c->addr);
- t->type=type;
- /* not registered yet */
- return;
+
+ for (i=0;(i<5)&&(NULL == t->i2c.dev.driver);i++) {
+ msleep(1); /* Giver 1 ms for I2C */
+ }
+ if (NULL == t->i2c.dev.driver) {
+ dprintk("tuner 0x%02x: I2C driver still not registred. Giving up!\n",c->addr);
+ t->type=type;
+ /* not registered yet */
+ return;
+ }
}
/* if ((t->admin_status==T_UNINITIALIZED) && (t->type == type))
return;