Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 273624
b: refs/heads/master
c: d46ebd4
h: refs/heads/master
v: v3
  • Loading branch information
Guennadi Liakhovetski authored and Mauro Carvalho Chehab committed Nov 3, 2011
1 parent 22e69d1 commit 055be32
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 40 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: a35057557271ed09a38b9d22483863f5415f2e54
refs/heads/master: d46ebd463c15ec81bcba83686134035893a95564
81 changes: 42 additions & 39 deletions trunk/drivers/media/video/mt9t112.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@
/* #define EXT_CLOCK 24000000 */

/************************************************************************
macro
************************************************************************/
/*
* frame size
Expand Down Expand Up @@ -80,11 +76,7 @@
#define VAR8(id, offset) _VAR(id, offset, 0x8000)

/************************************************************************
struct
************************************************************************/
struct mt9t112_frame_size {
u16 width;
Expand All @@ -108,15 +100,12 @@ struct mt9t112_priv {
int model;
u32 flags;
/* for flags */
#define INIT_DONE (1<<0)
#define INIT_DONE (1 << 0)
#define PCLK_RISING (1 << 1)
};

/************************************************************************
supported format
************************************************************************/

static const struct mt9t112_format mt9t112_cfmts[] = {
Expand Down Expand Up @@ -154,11 +143,7 @@ static const struct mt9t112_format mt9t112_cfmts[] = {
};

/************************************************************************
general function
************************************************************************/
static struct mt9t112_priv *to_mt9t112(const struct i2c_client *client)
{
Expand Down Expand Up @@ -758,15 +743,18 @@ static int mt9t112_init_camera(const struct i2c_client *client)
}

/************************************************************************
soc_camera_ops
************************************************************************/
static int mt9t112_set_bus_param(struct soc_camera_device *icd,
unsigned long flags)
{
struct soc_camera_link *icl = to_soc_camera_link(icd);
struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
struct mt9t112_priv *priv = to_mt9t112(client);

if (soc_camera_apply_sensor_flags(icl, flags) & SOCAM_PCLK_SAMPLE_RISING)
priv->flags |= PCLK_RISING;

return 0;
}

Expand Down Expand Up @@ -795,11 +783,7 @@ static struct soc_camera_ops mt9t112_ops = {
};

/************************************************************************
v4l2_subdev_core_ops
************************************************************************/
static int mt9t112_g_chip_ident(struct v4l2_subdev *sd,
struct v4l2_dbg_chip_ident *id)
Expand Down Expand Up @@ -850,11 +834,7 @@ static struct v4l2_subdev_core_ops mt9t112_subdev_core_ops = {


/************************************************************************
v4l2_subdev_video_ops
************************************************************************/
static int mt9t112_s_stream(struct v4l2_subdev *sd, int enable)
{
Expand All @@ -877,8 +857,7 @@ static int mt9t112_s_stream(struct v4l2_subdev *sd, int enable)
}

if (!(priv->flags & INIT_DONE)) {
u16 param = (MT9T112_FLAG_PCLK_RISING_EDGE &
priv->info->flags) ? 0x0001 : 0x0000;
u16 param = PCLK_RISING & priv->flags ? 0x0001 : 0x0000;

ECHECKER(ret, mt9t112_init_camera(client));

Expand Down Expand Up @@ -1027,6 +1006,36 @@ static int mt9t112_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
return 0;
}

static int mt9t112_g_mbus_config(struct v4l2_subdev *sd,
struct v4l2_mbus_config *cfg)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct soc_camera_link *icl = to_soc_camera_link(icd);

cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_VSYNC_ACTIVE_HIGH |
V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_DATA_ACTIVE_HIGH |
V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING;
cfg->type = V4L2_MBUS_PARALLEL;
cfg->flags = soc_camera_apply_board_flags(icl, cfg);

return 0;
}

static int mt9t112_s_mbus_config(struct v4l2_subdev *sd,
const struct v4l2_mbus_config *cfg)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data;
struct soc_camera_link *icl = to_soc_camera_link(icd);
struct mt9t112_priv *priv = to_mt9t112(client);

if (soc_camera_apply_board_flags(icl, cfg) & V4L2_MBUS_PCLK_SAMPLE_RISING)
priv->flags |= PCLK_RISING;

return 0;
}

static struct v4l2_subdev_video_ops mt9t112_subdev_video_ops = {
.s_stream = mt9t112_s_stream,
.g_mbus_fmt = mt9t112_g_fmt,
Expand All @@ -1036,14 +1045,12 @@ static struct v4l2_subdev_video_ops mt9t112_subdev_video_ops = {
.g_crop = mt9t112_g_crop,
.s_crop = mt9t112_s_crop,
.enum_mbus_fmt = mt9t112_enum_fmt,
.g_mbus_config = mt9t112_g_mbus_config,
.s_mbus_config = mt9t112_s_mbus_config,
};

/************************************************************************
i2c driver
************************************************************************/
static struct v4l2_subdev_ops mt9t112_subdev_ops = {
.core = &mt9t112_subdev_core_ops,
Expand Down Expand Up @@ -1147,11 +1154,7 @@ static struct i2c_driver mt9t112_i2c_driver = {
};

/************************************************************************
module function
************************************************************************/
static int __init mt9t112_module_init(void)
{
Expand Down

0 comments on commit 055be32

Please sign in to comment.