Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 56785
b: refs/heads/master
c: edd75ed
h: refs/heads/master
i:
  56783: a73595d
v: v3
  • Loading branch information
Jonathan Corbet authored and Mauro Carvalho Chehab committed May 22, 2007
1 parent 3f45f98 commit 9d1a205
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 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: 7acf90c70c6ee063f7465b2f10e2083bc49f355b
refs/heads/master: edd75ede2d40eadb98e07d87e88fa970f86ffe9e
21 changes: 18 additions & 3 deletions trunk/drivers/media/video/ov7670.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,11 +720,21 @@ static int ov7670_s_fmt(struct i2c_client *c, struct v4l2_format *fmt)
struct ov7670_format_struct *ovfmt;
struct ov7670_win_size *wsize;
struct ov7670_info *info = i2c_get_clientdata(c);
unsigned char com7;
unsigned char com7, clkrc;

ret = ov7670_try_fmt(c, fmt, &ovfmt, &wsize);
if (ret)
return ret;
/*
* HACK: if we're running rgb565 we need to grab then rewrite
* CLKRC. If we're *not*, however, then rewriting clkrc hoses
* the colors.
*/
if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_RGB565) {
ret = ov7670_read(c, REG_CLKRC, &clkrc);
if (ret)
return ret;
}
/*
* COM7 is a pain in the ass, it doesn't like to be read then
* quickly written afterward. But we have everything we need
Expand All @@ -744,7 +754,10 @@ static int ov7670_s_fmt(struct i2c_client *c, struct v4l2_format *fmt)
if (wsize->regs)
ret = ov7670_write_array(c, wsize->regs);
info->fmt = ovfmt;
return 0;

if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_RGB565 && ret == 0)
ret = ov7670_write(c, REG_CLKRC, clkrc);
return ret;
}

/*
Expand Down Expand Up @@ -1267,7 +1280,9 @@ static int ov7670_attach(struct i2c_adapter *adapter)
ret = ov7670_detect(client);
if (ret)
goto out_free_info;
i2c_attach_client(client);
ret = i2c_attach_client(client);
if (ret)
goto out_free_info;
return 0;

out_free_info:
Expand Down

0 comments on commit 9d1a205

Please sign in to comment.