summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ov7670.c
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2007-08-17 06:02:33 +0200
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-08-20 17:18:04 +0200
commit6d77444aca298b43a88086be446f943cd0442ef7 (patch)
tree3d0b4c4834fcd1048e4f80c5f60847efbe102fdf /drivers/media/video/ov7670.c
parentV4L/DVB (6026): Avoid powering up the camera on resume (diff)
downloadlinux-6d77444aca298b43a88086be446f943cd0442ef7.tar.xz
linux-6d77444aca298b43a88086be446f943cd0442ef7.zip
V4L/DVB (6027): Get rid of an ill-behaved msleep in i2c write
Configuring the OLPC camera requires something over 150 register writes. Unfortunately, querying the CAFE i2c controller too soon after a write causes the hardware to flake. The problem had been "solved" with an msleep() call, but, between the number of registers and how msleep() behaves, that resulted in a 3-second delay on camera initialization. Instead, we hand-code a wait for the completion interrupt which avoids reading the status registers. Signed-off-by: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to '')
-rw-r--r--drivers/media/video/ov7670.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c
index f8f21ddd9843..c4c5bd67f795 100644
--- a/drivers/media/video/ov7670.c
+++ b/drivers/media/video/ov7670.c
@@ -416,7 +416,10 @@ static int ov7670_read(struct i2c_client *c, unsigned char reg,
static int ov7670_write(struct i2c_client *c, unsigned char reg,
unsigned char value)
{
- return i2c_smbus_write_byte_data(c, reg, value);
+ int ret = i2c_smbus_write_byte_data(c, reg, value);
+ if (reg == REG_COM7 && (value & COM7_RESET))
+ msleep(2); /* Wait for reset to run */
+ return ret;
}