Skip to content

Commit db67fb5

Browse files
committed
media: i2c: ov8858: Add sensor's pixel matrix size
The OV8858 pixel array is composed as: - vertically: 16 dummy columns, 3264 valid ones and 16 dummy columns for a total of 3296 columns - horizontally: 24 optical black lines, 16 dummy ones, 2448 valid, 16 dummies and 24 optical black lines for a total of 2528 lines Set native and active sensor pixel sizes. Signed-off-by: Vincent Knecht <[email protected]>
1 parent 45e24f4 commit db67fb5

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

drivers/media/i2c/ov8858.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@
7777

7878
#define REG_NULL 0xffff
7979

80+
/* OV8858 native and active pixel array size */
81+
#define OV8858_NATIVE_WIDTH 3296U
82+
#define OV8858_NATIVE_HEIGHT 2528U
83+
#define OV8858_PIXEL_ARRAY_LEFT 16U
84+
#define OV8858_PIXEL_ARRAY_TOP 40U
85+
#define OV8858_PIXEL_ARRAY_WIDTH 3264U
86+
#define OV8858_PIXEL_ARRAY_HEIGHT 2448U
87+
8088
static const char * const ov8858_supply_names[] = {
8189
"avdd", /* Analog power */
8290
"dovdd", /* Digital I/O power */
@@ -1492,11 +1500,40 @@ static int ov8858_init_state(struct v4l2_subdev *sd,
14921500
return 0;
14931501
}
14941502

1503+
static int ov8858_get_selection(struct v4l2_subdev *sd,
1504+
struct v4l2_subdev_state *sd_state,
1505+
struct v4l2_subdev_selection *sel)
1506+
{
1507+
switch(sel->target) {
1508+
case V4L2_SEL_TGT_CROP:
1509+
sel->r = *v4l2_subdev_state_get_crop(sd_state, 0);
1510+
return 0;
1511+
1512+
case V4L2_SEL_TGT_NATIVE_SIZE:
1513+
sel->r.top = 0;
1514+
sel->r.left = 0;
1515+
sel->r.width = OV8858_NATIVE_WIDTH;
1516+
sel->r.height = OV8858_NATIVE_HEIGHT;
1517+
return 0;
1518+
1519+
case V4L2_SEL_TGT_CROP_DEFAULT:
1520+
case V4L2_SEL_TGT_CROP_BOUNDS:
1521+
sel->r.top = OV8858_PIXEL_ARRAY_TOP;
1522+
sel->r.left = OV8858_PIXEL_ARRAY_LEFT;
1523+
sel->r.width = OV8858_PIXEL_ARRAY_WIDTH;
1524+
sel->r.height = OV8858_PIXEL_ARRAY_HEIGHT;
1525+
return 0;
1526+
}
1527+
1528+
return -EINVAL;
1529+
}
1530+
14951531
static const struct v4l2_subdev_pad_ops ov8858_pad_ops = {
14961532
.enum_mbus_code = ov8858_enum_mbus_code,
14971533
.enum_frame_size = ov8858_enum_frame_sizes,
14981534
.get_fmt = v4l2_subdev_get_fmt,
14991535
.set_fmt = ov8858_set_fmt,
1536+
.get_selection = ov8858_get_selection,
15001537
};
15011538

15021539
static const struct v4l2_subdev_ops ov8858_subdev_ops = {

0 commit comments

Comments
 (0)