|
53 | 53 | #define OV5647_REG_AEC_AGC 0x3503 |
54 | 54 | #define OV5647_REG_GAIN_HI 0x350a |
55 | 55 | #define OV5647_REG_GAIN_LO 0x350b |
| 56 | +#define OV5647_REG_HTS_HI 0x380c |
| 57 | +#define OV5647_REG_HTS_LO 0x380d |
56 | 58 | #define OV5647_REG_VTS_HI 0x380e |
57 | 59 | #define OV5647_REG_VTS_LO 0x380f |
58 | 60 | #define OV5647_REG_VFLIP 0x3820 |
|
79 | 81 | #define OV5647_VBLANK_MIN 24 |
80 | 82 | #define OV5647_VTS_MAX 32767 |
81 | 83 |
|
| 84 | +#define OV5647_HTS_MAX 0x1fff |
| 85 | + |
82 | 86 | #define OV5647_EXPOSURE_MIN 4 |
83 | 87 | #define OV5647_EXPOSURE_STEP 1 |
84 | 88 | #define OV5647_EXPOSURE_DEFAULT 1000 |
@@ -188,8 +192,6 @@ static struct regval_list ov5647_2592x1944_10bpp[] = { |
188 | 192 | {0x3a19, 0xf8}, |
189 | 193 | {0x3c01, 0x80}, |
190 | 194 | {0x3b07, 0x0c}, |
191 | | - {0x380c, 0x0b}, |
192 | | - {0x380d, 0x1c}, |
193 | 195 | {0x3814, 0x11}, |
194 | 196 | {0x3815, 0x11}, |
195 | 197 | {0x3708, 0x64}, |
@@ -277,8 +279,6 @@ static struct regval_list ov5647_1080p30_10bpp[] = { |
277 | 279 | {0x3a19, 0xf8}, |
278 | 280 | {0x3c01, 0x80}, |
279 | 281 | {0x3b07, 0x0c}, |
280 | | - {0x380c, 0x09}, |
281 | | - {0x380d, 0x70}, |
282 | 282 | {0x3814, 0x11}, |
283 | 283 | {0x3815, 0x11}, |
284 | 284 | {0x3708, 0x64}, |
@@ -376,8 +376,6 @@ static struct regval_list ov5647_2x2binned_10bpp[] = { |
376 | 376 | {0x3809, 0x10}, |
377 | 377 | {0x380a, 0x03}, |
378 | 378 | {0x380b, 0xcc}, |
379 | | - {0x380c, 0x07}, |
380 | | - {0x380d, 0x68}, |
381 | 379 | {0x3811, 0x0c}, |
382 | 380 | {0x3813, 0x06}, |
383 | 381 | {0x3814, 0x31}, |
@@ -451,8 +449,6 @@ static struct regval_list ov5647_640x480_10bpp[] = { |
451 | 449 | {0x3a19, 0xf8}, |
452 | 450 | {0x3c01, 0x80}, |
453 | 451 | {0x3b07, 0x0c}, |
454 | | - {0x380c, 0x07}, |
455 | | - {0x380d, 0x3c}, |
456 | 452 | {0x3814, 0x35}, |
457 | 453 | {0x3815, 0x35}, |
458 | 454 | {0x3708, 0x64}, |
@@ -1079,7 +1075,8 @@ static int ov5647_set_pad_fmt(struct v4l2_subdev *sd, |
1079 | 1075 | mode->pixel_rate, 1, mode->pixel_rate); |
1080 | 1076 |
|
1081 | 1077 | hblank = mode->hts - mode->format.width; |
1082 | | - __v4l2_ctrl_modify_range(sensor->hblank, hblank, hblank, 1, |
| 1078 | + __v4l2_ctrl_modify_range(sensor->hblank, hblank, |
| 1079 | + OV5647_HTS_MAX - mode->format.width, 1, |
1083 | 1080 | hblank); |
1084 | 1081 |
|
1085 | 1082 | vblank = mode->vts - mode->format.height; |
@@ -1343,14 +1340,17 @@ static int ov5647_s_ctrl(struct v4l2_ctrl *ctrl) |
1343 | 1340 | ret = ov5647_write16(sd, OV5647_REG_VTS_HI, |
1344 | 1341 | sensor->mode->format.height + ctrl->val); |
1345 | 1342 | break; |
| 1343 | + case V4L2_CID_HBLANK: |
| 1344 | + ret = ov5647_write16(sd, OV5647_REG_HTS_HI, |
| 1345 | + sensor->mode->format.width + ctrl->val); |
| 1346 | + break; |
1346 | 1347 | case V4L2_CID_TEST_PATTERN: |
1347 | 1348 | ret = ov5647_write(sd, OV5647_REG_ISPCTRL3D, |
1348 | 1349 | ov5647_test_pattern_val[ctrl->val]); |
1349 | 1350 | break; |
1350 | 1351 |
|
1351 | 1352 | /* Read-only, but we adjust it based on mode. */ |
1352 | 1353 | case V4L2_CID_PIXEL_RATE: |
1353 | | - case V4L2_CID_HBLANK: |
1354 | 1354 | /* Read-only, but we adjust it based on mode. */ |
1355 | 1355 | break; |
1356 | 1356 |
|
@@ -1427,10 +1427,11 @@ static int ov5647_init_controls(struct ov5647 *sensor, struct device *dev) |
1427 | 1427 | sensor->mode->pixel_rate, 1, |
1428 | 1428 | sensor->mode->pixel_rate); |
1429 | 1429 |
|
1430 | | - /* By default, HBLANK is read only, but it does change per mode. */ |
1431 | 1430 | hblank = sensor->mode->hts - sensor->mode->format.width; |
1432 | 1431 | sensor->hblank = v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops, |
1433 | | - V4L2_CID_HBLANK, hblank, hblank, 1, |
| 1432 | + V4L2_CID_HBLANK, hblank, |
| 1433 | + OV5647_HTS_MAX - |
| 1434 | + sensor->mode->format.width, 1, |
1434 | 1435 | hblank); |
1435 | 1436 |
|
1436 | 1437 | sensor->vblank = v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops, |
@@ -1464,7 +1465,6 @@ static int ov5647_init_controls(struct ov5647 *sensor, struct device *dev) |
1464 | 1465 | goto handler_free; |
1465 | 1466 |
|
1466 | 1467 | sensor->pixel_rate->flags |= V4L2_CTRL_FLAG_READ_ONLY; |
1467 | | - sensor->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY; |
1468 | 1468 | sensor->sd.ctrl_handler = &sensor->ctrls; |
1469 | 1469 |
|
1470 | 1470 | return 0; |
|
0 commit comments