Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 156771
b: refs/heads/master
c: 2526ea6
h: refs/heads/master
i:
  156769: 288b90f
  156767: 1927b2f
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed Aug 13, 2009
1 parent 152e6ee commit 5b3d5d4
Show file tree
Hide file tree
Showing 2 changed files with 52 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: d96ecda63f41350dc93c17ccb72ea24511f207a9
refs/heads/master: 2526ea6e46e41322eb98ac0e9c616273402bd661
53 changes: 51 additions & 2 deletions trunk/drivers/media/video/mt9v011.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,34 @@ static struct v4l2_queryctrl mt9v011_qctrl[] = {
.step = 1,
.default_value = 0,
.flags = 0,
},
}, {
.id = V4L2_CID_HFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "Mirror",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0,
.flags = 0,
}, {
.id = V4L2_CID_VFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "Vflip",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0,
.flags = 0,
}, {
}
};

struct mt9v011 {
struct v4l2_subdev sd;
unsigned width, height;
unsigned xtal;
unsigned hflip:1;
unsigned vflip:1;

u16 global_gain, red_bal, blue_bal;
};
Expand Down Expand Up @@ -131,7 +152,6 @@ static const struct i2c_reg_value mt9v011_init_default[] = {

{ R0A_MT9V011_CLK_SPEED, 0x0000 },
{ R1E_MT9V011_DIGITAL_ZOOM, 0x0000 },
{ R20_MT9V011_READ_MODE, 0x1000 },

{ R07_MT9V011_OUT_CTRL, 0x0002 }, /* chip enable */
};
Expand Down Expand Up @@ -255,6 +275,20 @@ static void set_res(struct v4l2_subdev *sd)
calc_fps(sd, NULL, NULL);
};

static void set_read_mode(struct v4l2_subdev *sd)
{
struct mt9v011 *core = to_mt9v011(sd);
unsigned mode = 0x1000;

if (core->hflip)
mode |= 0x4000;

if (core->vflip)
mode |= 0x8000;

mt9v011_write(sd, R20_MT9V011_READ_MODE, mode);
}

static int mt9v011_reset(struct v4l2_subdev *sd, u32 val)
{
int i;
Expand All @@ -265,6 +299,7 @@ static int mt9v011_reset(struct v4l2_subdev *sd, u32 val)

set_balance(sd);
set_res(sd);
set_read_mode(sd);

return 0;
};
Expand All @@ -285,6 +320,12 @@ static int mt9v011_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
case V4L2_CID_BLUE_BALANCE:
ctrl->value = core->blue_bal;
return 0;
case V4L2_CID_HFLIP:
ctrl->value = core->hflip ? 1 : 0;
return 0;
case V4L2_CID_VFLIP:
ctrl->value = core->vflip ? 1 : 0;
return 0;
}
return -EINVAL;
}
Expand Down Expand Up @@ -333,6 +374,14 @@ static int mt9v011_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
case V4L2_CID_BLUE_BALANCE:
core->blue_bal = ctrl->value;
break;
case V4L2_CID_HFLIP:
core->hflip = ctrl->value;
set_read_mode(sd);
return 0;
case V4L2_CID_VFLIP:
core->vflip = ctrl->value;
set_read_mode(sd);
return 0;
default:
return -EINVAL;
}
Expand Down

0 comments on commit 5b3d5d4

Please sign in to comment.