Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 192863
b: refs/heads/master
c: 4671420
h: refs/heads/master
i:
  192861: efcbdec
  192859: 902bf76
  192855: e3b870d
  192847: 69deaf0
  192831: 7a5fe2f
v: v3
  • Loading branch information
Jonathan Corbet authored and Mauro Carvalho Chehab committed May 18, 2010
1 parent 71b940f commit e4d1429
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 364e93372fb21ef5de18d0122c78789f065ddbf5
refs/heads/master: 467142093de1507833a08c50740d74b3b8c8eaca
37 changes: 37 additions & 0 deletions trunk/drivers/media/video/ov7670.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,42 @@ static struct regval_list ov7670_fmt_raw[] = {

/*
* Low-level register I/O.
*
* Note that there are two versions of these. On the XO 1, the
* i2c controller only does SMBUS, so that's what we use. The
* ov7670 is not really an SMBUS device, though, so the communication
* is not always entirely reliable.
*/
#ifdef CONFIG_OLPC_XO_1
static int ov7670_read(struct v4l2_subdev *sd, unsigned char reg,
unsigned char *value)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
int ret;

ret = i2c_smbus_read_byte_data(client, reg);
if (ret >= 0) {
*value = (unsigned char)ret;
ret = 0;
}
return ret;
}


static int ov7670_write(struct v4l2_subdev *sd, unsigned char reg,
unsigned char value)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
int ret = i2c_smbus_write_byte_data(client, reg, value);

if (reg == REG_COM7 && (value & COM7_RESET))
msleep(5); /* Wait for reset to run */
return ret;
}

#else /* ! CONFIG_OLPC_XO_1 */
/*
* On most platforms, we'd rather do straight i2c I/O.
*/
static int ov7670_read(struct v4l2_subdev *sd, unsigned char reg,
unsigned char *value)
Expand Down Expand Up @@ -462,6 +498,7 @@ static int ov7670_write(struct v4l2_subdev *sd, unsigned char reg,
msleep(5); /* Wait for reset to run */
return ret;
}
#endif /* CONFIG_OLPC_XO_1 */


/*
Expand Down

0 comments on commit e4d1429

Please sign in to comment.