Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 357524
b: refs/heads/master
c: 04ee6d9
h: refs/heads/master
v: v3
  • Loading branch information
Javier Martin authored and Mauro Carvalho Chehab committed Feb 8, 2013
1 parent e343a23 commit 2a5c3e9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 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: f6dd927f34d64014c4b196132b5cdf9f2e2a3ae5
refs/heads/master: 04ee6d92047e1ac68d4eb615119343f4f0fc57db
28 changes: 26 additions & 2 deletions trunk/drivers/media/i2c/ov7670.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ struct ov7670_info {
int clock_speed; /* External clock speed (MHz) */
u8 clkrc; /* Clock divider value */
bool use_smbus; /* Use smbus I/O instead of I2C */
bool pll_bypass;
const struct ov7670_devtype *devtype; /* Device specifics */
};

Expand Down Expand Up @@ -755,7 +756,12 @@ static void ov7675_get_framerate(struct v4l2_subdev *sd,
{
struct ov7670_info *info = to_state(sd);
u32 clkrc = info->clkrc;
u32 pll_factor = PLL_FACTOR;
int pll_factor;

if (info->pll_bypass)
pll_factor = 1;
else
pll_factor = PLL_FACTOR;

clkrc++;
if (info->fmt->mbus_code == V4L2_MBUS_FMT_SBGGR8_1X8)
Expand All @@ -771,7 +777,7 @@ static int ov7675_set_framerate(struct v4l2_subdev *sd,
{
struct ov7670_info *info = to_state(sd);
u32 clkrc;
u32 pll_factor = PLL_FACTOR;
int pll_factor;
int ret;

/*
Expand All @@ -781,6 +787,16 @@ static int ov7675_set_framerate(struct v4l2_subdev *sd,
* pixclk = clock_speed / (clkrc + 1) * PLLfactor
*
*/
if (info->pll_bypass) {
pll_factor = 1;
ret = ov7670_write(sd, REG_DBLV, DBLV_BYPASS);
} else {
pll_factor = PLL_FACTOR;
ret = ov7670_write(sd, REG_DBLV, DBLV_X4);
}
if (ret < 0)
return ret;

if (tpf->numerator == 0 || tpf->denominator == 0) {
clkrc = 0;
} else {
Expand Down Expand Up @@ -808,6 +824,7 @@ static int ov7675_set_framerate(struct v4l2_subdev *sd,
ret = ov7670_write(sd, REG_CLKRC, info->clkrc);
if (ret < 0)
return ret;

return ov7670_write(sd, REG_DBLV, DBLV_X4);
}

Expand Down Expand Up @@ -1688,6 +1705,13 @@ static int ov7670_probe(struct i2c_client *client,

if (config->clock_speed)
info->clock_speed = config->clock_speed;

/*
* It should be allowed for ov7670 too when it is migrated to
* the new frame rate formula.
*/
if (config->pll_bypass && id->driver_data != MODEL_OV7670)
info->pll_bypass = true;
}

/* Make sure it's an ov7670 */
Expand Down
1 change: 1 addition & 0 deletions trunk/include/media/ov7670.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ struct ov7670_config {
int min_height; /* Filter out smaller sizes */
int clock_speed; /* External clock speed (MHz) */
bool use_smbus; /* Use smbus I/O instead of I2C */
bool pll_bypass; /* Choose whether to bypass the PLL */
};

#endif

0 comments on commit 2a5c3e9

Please sign in to comment.