Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 164218
b: refs/heads/master
c: a0705b0
h: refs/heads/master
v: v3
  • Loading branch information
Guennadi Liakhovetski authored and Mauro Carvalho Chehab committed Sep 19, 2009
1 parent 1b2972b commit 3499568
Show file tree
Hide file tree
Showing 14 changed files with 175 additions and 155 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: 4a6110bc50da9a1883bf45614ac1d591253f0457
refs/heads/master: a0705b07f1816ae2b85388fcda71de69c221b4b8
30 changes: 16 additions & 14 deletions trunk/drivers/media/video/mt9m001.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ static int mt9m001_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
struct i2c_client *client = sd->priv;
struct soc_camera_device *icd = client->dev.platform_data;
struct v4l2_rect rect = {
.left = icd->x_current,
.top = icd->y_current,
.left = icd->rect_current.left,
.top = icd->rect_current.top,
.width = f->fmt.pix.width,
.height = f->fmt.pix.height,
};
Expand Down Expand Up @@ -467,11 +467,13 @@ static int mt9m001_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
case V4L2_CID_EXPOSURE_AUTO:
if (ctrl->value) {
const u16 vblank = 25;
if (reg_write(client, MT9M001_SHUTTER_WIDTH, icd->height +
if (reg_write(client, MT9M001_SHUTTER_WIDTH,
icd->rect_current.height +
icd->y_skip_top + vblank) < 0)
return -EIO;
qctrl = soc_camera_find_qctrl(icd->ops, V4L2_CID_EXPOSURE);
icd->exposure = (524 + (icd->height + icd->y_skip_top + vblank - 1) *
icd->exposure = (524 + (icd->rect_current.height +
icd->y_skip_top + vblank - 1) *
(qctrl->maximum - qctrl->minimum)) /
1048 + qctrl->minimum;
mt9m001->autoexposure = 1;
Expand Down Expand Up @@ -613,16 +615,16 @@ static int mt9m001_probe(struct i2c_client *client,
v4l2_i2c_subdev_init(&mt9m001->subdev, client, &mt9m001_subdev_ops);

/* Second stage probe - when a capture adapter is there */
icd->ops = &mt9m001_ops;
icd->x_min = 20;
icd->y_min = 12;
icd->x_current = 20;
icd->y_current = 12;
icd->width_min = 48;
icd->width_max = 1280;
icd->height_min = 32;
icd->height_max = 1024;
icd->y_skip_top = 1;
icd->ops = &mt9m001_ops;
icd->rect_max.left = 20;
icd->rect_max.top = 12;
icd->rect_max.width = 1280;
icd->rect_max.height = 1024;
icd->rect_current.left = 20;
icd->rect_current.top = 12;
icd->width_min = 48;
icd->height_min = 32;
icd->y_skip_top = 1;
/* Simulated autoexposure. If enabled, we calculate shutter width
* ourselves in the driver based on vertical blanking and frame width */
mt9m001->autoexposure = 1;
Expand Down
20 changes: 10 additions & 10 deletions trunk/drivers/media/video/mt9m111.c
Original file line number Diff line number Diff line change
Expand Up @@ -948,16 +948,16 @@ static int mt9m111_probe(struct i2c_client *client,
v4l2_i2c_subdev_init(&mt9m111->subdev, client, &mt9m111_subdev_ops);

/* Second stage probe - when a capture adapter is there */
icd->ops = &mt9m111_ops;
icd->x_min = MT9M111_MIN_DARK_COLS;
icd->y_min = MT9M111_MIN_DARK_ROWS;
icd->x_current = icd->x_min;
icd->y_current = icd->y_min;
icd->width_min = MT9M111_MIN_DARK_ROWS;
icd->width_max = MT9M111_MAX_WIDTH;
icd->height_min = MT9M111_MIN_DARK_COLS;
icd->height_max = MT9M111_MAX_HEIGHT;
icd->y_skip_top = 0;
icd->ops = &mt9m111_ops;
icd->rect_max.left = MT9M111_MIN_DARK_COLS;
icd->rect_max.top = MT9M111_MIN_DARK_ROWS;
icd->rect_max.width = MT9M111_MAX_WIDTH;
icd->rect_max.height = MT9M111_MAX_HEIGHT;
icd->rect_current.left = icd->rect_max.left;
icd->rect_current.top = icd->rect_max.top;
icd->width_min = MT9M111_MIN_DARK_ROWS;
icd->height_min = MT9M111_MIN_DARK_COLS;
icd->y_skip_top = 0;

ret = mt9m111_video_probe(icd, client);
if (ret) {
Expand Down
49 changes: 26 additions & 23 deletions trunk/drivers/media/video/mt9t031.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,12 @@ static unsigned long mt9t031_query_bus_param(struct soc_camera_device *icd)
static void recalculate_limits(struct soc_camera_device *icd,
u16 xskip, u16 yskip)
{
icd->x_min = (MT9T031_COLUMN_SKIP + xskip - 1) / xskip;
icd->y_min = (MT9T031_ROW_SKIP + yskip - 1) / yskip;
icd->rect_max.left = (MT9T031_COLUMN_SKIP + xskip - 1) / xskip;
icd->rect_max.top = (MT9T031_ROW_SKIP + yskip - 1) / yskip;
icd->width_min = (MT9T031_MIN_WIDTH + xskip - 1) / xskip;
icd->height_min = (MT9T031_MIN_HEIGHT + yskip - 1) / yskip;
icd->width_max = MT9T031_MAX_WIDTH / xskip;
icd->height_max = MT9T031_MAX_HEIGHT / yskip;
icd->rect_max.width = MT9T031_MAX_WIDTH / xskip;
icd->rect_max.height = MT9T031_MAX_HEIGHT / yskip;
}

static int mt9t031_set_params(struct soc_camera_device *icd,
Expand All @@ -241,11 +241,13 @@ static int mt9t031_set_params(struct soc_camera_device *icd,
vblank = MT9T031_VERTICAL_BLANK;

/* Make sure we don't exceed sensor limits */
if (rect->left + rect->width > icd->width_max)
rect->left = (icd->width_max - rect->width) / 2 + icd->x_min;
if (rect->left + rect->width > icd->rect_max.width)
rect->left = (icd->rect_max.width - rect->width) / 2 +
icd->rect_max.left;

if (rect->top + rect->height > icd->height_max)
rect->top = (icd->height_max - rect->height) / 2 + icd->y_min;
if (rect->top + rect->height > icd->rect_max.height)
rect->top = (icd->rect_max.height - rect->height) / 2 +
icd->rect_max.top;

width = rect->width * xskip;
height = rect->height * yskip;
Expand Down Expand Up @@ -346,8 +348,8 @@ static int mt9t031_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
int ret;
u16 xskip, yskip;
struct v4l2_rect rect = {
.left = icd->x_current,
.top = icd->y_current,
.left = icd->rect_current.left,
.top = icd->rect_current.top,
.width = f->fmt.pix.width,
.height = f->fmt.pix.height,
};
Expand Down Expand Up @@ -618,12 +620,13 @@ static int mt9t031_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
if (ctrl->value) {
const u16 vblank = MT9T031_VERTICAL_BLANK;
const u32 shutter_max = MT9T031_MAX_HEIGHT + vblank;
if (set_shutter(client, icd->height +
if (set_shutter(client, icd->rect_current.height +
icd->y_skip_top + vblank) < 0)
return -EIO;
qctrl = soc_camera_find_qctrl(icd->ops, V4L2_CID_EXPOSURE);
icd->exposure = (shutter_max / 2 + (icd->height +
icd->y_skip_top + vblank - 1) *
icd->exposure = (shutter_max / 2 +
(icd->rect_current.height +
icd->y_skip_top + vblank - 1) *
(qctrl->maximum - qctrl->minimum)) /
shutter_max + qctrl->minimum;
mt9t031->autoexposure = 1;
Expand Down Expand Up @@ -726,16 +729,16 @@ static int mt9t031_probe(struct i2c_client *client,
v4l2_i2c_subdev_init(&mt9t031->subdev, client, &mt9t031_subdev_ops);

/* Second stage probe - when a capture adapter is there */
icd->ops = &mt9t031_ops;
icd->x_min = MT9T031_COLUMN_SKIP;
icd->y_min = MT9T031_ROW_SKIP;
icd->x_current = icd->x_min;
icd->y_current = icd->y_min;
icd->width_min = MT9T031_MIN_WIDTH;
icd->width_max = MT9T031_MAX_WIDTH;
icd->height_min = MT9T031_MIN_HEIGHT;
icd->height_max = MT9T031_MAX_HEIGHT;
icd->y_skip_top = 0;
icd->ops = &mt9t031_ops;
icd->rect_max.left = MT9T031_COLUMN_SKIP;
icd->rect_max.top = MT9T031_ROW_SKIP;
icd->rect_current.left = icd->rect_max.left;
icd->rect_current.top = icd->rect_max.top;
icd->width_min = MT9T031_MIN_WIDTH;
icd->rect_max.width = MT9T031_MAX_WIDTH;
icd->height_min = MT9T031_MIN_HEIGHT;
icd->rect_max.height = MT9T031_MAX_HEIGHT;
icd->y_skip_top = 0;
/* Simulated autoexposure. If enabled, we calculate shutter width
* ourselves in the driver based on vertical blanking and frame width */
mt9t031->autoexposure = 1;
Expand Down
24 changes: 12 additions & 12 deletions trunk/drivers/media/video/mt9v022.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ static int mt9v022_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
struct soc_camera_device *icd = client->dev.platform_data;
struct v4l2_pix_format *pix = &f->fmt.pix;
struct v4l2_rect rect = {
.left = icd->x_current,
.top = icd->y_current,
.left = icd->rect_current.left,
.top = icd->rect_current.top,
.width = pix->width,
.height = pix->height,
};
Expand Down Expand Up @@ -741,16 +741,16 @@ static int mt9v022_probe(struct i2c_client *client,

mt9v022->chip_control = MT9V022_CHIP_CONTROL_DEFAULT;

icd->ops = &mt9v022_ops;
icd->x_min = 1;
icd->y_min = 4;
icd->x_current = 1;
icd->y_current = 4;
icd->width_min = 48;
icd->width_max = 752;
icd->height_min = 32;
icd->height_max = 480;
icd->y_skip_top = 1;
icd->ops = &mt9v022_ops;
icd->rect_max.left = 1;
icd->rect_max.top = 4;
icd->rect_max.width = 752;
icd->rect_max.height = 480;
icd->rect_current.left = 1;
icd->rect_current.top = 4;
icd->width_min = 48;
icd->height_min = 32;
icd->y_skip_top = 1;

ret = mt9v022_video_probe(icd, client);
if (ret) {
Expand Down
10 changes: 5 additions & 5 deletions trunk/drivers/media/video/mx1_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static int mx1_videobuf_setup(struct videobuf_queue *vq, unsigned int *count,
{
struct soc_camera_device *icd = vq->priv_data;

*size = icd->width * icd->height *
*size = icd->rect_current.width * icd->rect_current.height *
((icd->current_fmt->depth + 7) >> 3);

if (!*count)
Expand Down Expand Up @@ -178,12 +178,12 @@ static int mx1_videobuf_prepare(struct videobuf_queue *vq,
buf->inwork = 1;

if (buf->fmt != icd->current_fmt ||
vb->width != icd->width ||
vb->height != icd->height ||
vb->width != icd->rect_current.width ||
vb->height != icd->rect_current.height ||
vb->field != field) {
buf->fmt = icd->current_fmt;
vb->width = icd->width;
vb->height = icd->height;
vb->width = icd->rect_current.width;
vb->height = icd->rect_current.height;
vb->field = field;
vb->state = VIDEOBUF_NEEDS_INIT;
}
Expand Down
25 changes: 13 additions & 12 deletions trunk/drivers/media/video/mx3_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ static int mx3_videobuf_setup(struct videobuf_queue *vq, unsigned int *count,
if (!mx3_cam->idmac_channel[0])
return -EINVAL;

*size = icd->width * icd->height * bpp;
*size = icd->rect_current.width * icd->rect_current.height * bpp;

if (!*count)
*count = 32;
Expand All @@ -241,7 +241,7 @@ static int mx3_videobuf_prepare(struct videobuf_queue *vq,
struct mx3_camera_buffer *buf =
container_of(vb, struct mx3_camera_buffer, vb);
/* current_fmt _must_ always be set */
size_t new_size = icd->width * icd->height *
size_t new_size = icd->rect_current.width * icd->rect_current.height *
((icd->current_fmt->depth + 7) >> 3);
int ret;

Expand All @@ -251,12 +251,12 @@ static int mx3_videobuf_prepare(struct videobuf_queue *vq,
*/

if (buf->fmt != icd->current_fmt ||
vb->width != icd->width ||
vb->height != icd->height ||
vb->width != icd->rect_current.width ||
vb->height != icd->rect_current.height ||
vb->field != field) {
buf->fmt = icd->current_fmt;
vb->width = icd->width;
vb->height = icd->height;
vb->width = icd->rect_current.width;
vb->height = icd->rect_current.height;
vb->field = field;
if (vb->state != VIDEOBUF_NEEDS_INIT)
free_buffer(vq, buf);
Expand Down Expand Up @@ -354,9 +354,9 @@ static void mx3_videobuf_queue(struct videobuf_queue *vq,

/* This is the configuration of one sg-element */
video->out_pixel_fmt = fourcc_to_ipu_pix(data_fmt->fourcc);
video->out_width = icd->width;
video->out_height = icd->height;
video->out_stride = icd->width;
video->out_width = icd->rect_current.width;
video->out_height = icd->rect_current.height;
video->out_stride = icd->rect_current.width;

#ifdef DEBUG
/* helps to see what DMA actually has written */
Expand Down Expand Up @@ -538,7 +538,8 @@ static bool channel_change_requested(struct soc_camera_device *icd,
struct idmac_channel *ichan = mx3_cam->idmac_channel[0];

/* Do buffers have to be re-allocated or channel re-configured? */
return ichan && rect->width * rect->height > icd->width * icd->height;
return ichan && rect->width * rect->height >
icd->rect_current.width * icd->rect_current.height;
}

static int test_platform_param(struct mx3_camera_dev *mx3_cam,
Expand Down Expand Up @@ -808,8 +809,8 @@ static int mx3_camera_set_fmt(struct soc_camera_device *icd,
const struct soc_camera_format_xlate *xlate;
struct v4l2_pix_format *pix = &f->fmt.pix;
struct v4l2_rect rect = {
.left = icd->x_current,
.top = icd->y_current,
.left = icd->rect_current.left,
.top = icd->rect_current.top,
.width = pix->width,
.height = pix->height,
};
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/media/video/ov772x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1120,9 +1120,9 @@ static int ov772x_probe(struct i2c_client *client,

v4l2_i2c_subdev_init(&priv->subdev, client, &ov772x_subdev_ops);

icd->ops = &ov772x_ops;
icd->width_max = MAX_WIDTH;
icd->height_max = MAX_HEIGHT;
icd->ops = &ov772x_ops;
icd->rect_max.width = MAX_WIDTH;
icd->rect_max.height = MAX_HEIGHT;

ret = ov772x_video_probe(icd, client);
if (ret) {
Expand Down
14 changes: 7 additions & 7 deletions trunk/drivers/media/video/pxa_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ static int pxa_videobuf_setup(struct videobuf_queue *vq, unsigned int *count,

dev_dbg(&icd->dev, "count=%d, size=%d\n", *count, *size);

*size = roundup(icd->width * icd->height *
*size = roundup(icd->rect_current.width * icd->rect_current.height *
((icd->current_fmt->depth + 7) >> 3), 8);

if (0 == *count)
Expand Down Expand Up @@ -443,12 +443,12 @@ static int pxa_videobuf_prepare(struct videobuf_queue *vq,
buf->inwork = 1;

if (buf->fmt != icd->current_fmt ||
vb->width != icd->width ||
vb->height != icd->height ||
vb->width != icd->rect_current.width ||
vb->height != icd->rect_current.height ||
vb->field != field) {
buf->fmt = icd->current_fmt;
vb->width = icd->width;
vb->height = icd->height;
vb->width = icd->rect_current.width;
vb->height = icd->rect_current.height;
vb->field = field;
vb->state = VIDEOBUF_NEEDS_INIT;
}
Expand Down Expand Up @@ -1118,7 +1118,7 @@ static int pxa_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt)
if (cicr0 & CICR0_ENB)
__raw_writel(cicr0 & ~CICR0_ENB, pcdev->base + CICR0);

cicr1 = CICR1_PPL_VAL(icd->width - 1) | bpp | dw;
cicr1 = CICR1_PPL_VAL(icd->rect_current.width - 1) | bpp | dw;

switch (pixfmt) {
case V4L2_PIX_FMT_YUV422P:
Expand Down Expand Up @@ -1147,7 +1147,7 @@ static int pxa_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt)
}

cicr2 = 0;
cicr3 = CICR3_LPF_VAL(icd->height - 1) |
cicr3 = CICR3_LPF_VAL(icd->rect_current.height - 1) |
CICR3_BFW_VAL(min((unsigned short)255, icd->y_skip_top));
cicr4 |= pcdev->mclk_divisor;

Expand Down
Loading

0 comments on commit 3499568

Please sign in to comment.