Skip to content

Commit

Permalink
bugcamera: mt9t111: only change format if newly requested format is d…
Browse files Browse the repository at this point in the history
…ifferent. This is to help settling issues when switching formats
  • Loading branch information
dirjud committed Nov 16, 2010
1 parent d7ca630 commit 609e482
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions drivers/bmi/pims/camera/mt9t111.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ static int mt9t111_loaddefault(struct i2c_client *client)
// return err;
//
//return mt9t111_refresh(client);
sensor->format.width = sensor->format.height = 1;
return 0;
}

Expand Down Expand Up @@ -413,6 +414,13 @@ int mt9t111_set_format(struct i2c_client *client, struct v4l2_mbus_framefmt *fmt
int ret;
struct mt9t111_sensor *sensor = i2c_get_clientdata(client);

if(sensor->format.width == fmt->width &&
sensor->format.height == fmt->height &&
sensor->format.code == fmt->code) {
printk(KERN_INFO "%s: Sensor already in requested format (%dx%d).\n", __func__, fmt->width, fmt->height);
return 0;
}

// clamp width and height to multiples of 16
fmt->width = (fmt->width / 16) * 16;
fmt->height = (fmt->height / 16) * 16;
Expand Down Expand Up @@ -914,16 +922,16 @@ static int mt9t111_probe(struct i2c_client *client,

i2c_set_clientdata(client, sensor);
sensor->client = client;
sensor->format.width = 640;
sensor->format.height = 480;
sensor->format.width = 1;
sensor->format.height = 1;
sensor->format.code = V4L2_MBUS_FMT_YUYV16_1X16;
sensor->format.colorspace = V4L2_COLORSPACE_SRGB;
sensor->format.field = V4L2_FIELD_NONE;
sensor->frame_interval.numerator = 1;
sensor->frame_interval.denominator= 22;
sensor->test_pat_id = 0;
sensor->colorfx_id = 0;
sensor->streaming = 0;
sensor->colorfx_id = 0;
sensor->streaming = 0;
return 0;
}

Expand Down

0 comments on commit 609e482

Please sign in to comment.