Skip to content

Commit 75b542c

Browse files
Guoniu.zhouDong Aisheng
Guoniu.zhou
authored and
Dong Aisheng
committed
media: i2c: fix hang issue when ov5640 work at DVP mode
When setting ov5640 to XGA, 720P, 1080P and 2592x1944 at DVP mode, receiver can't get data from sensor. After trying many configuration, I found 0x3824[1] need to be set to control divide DVP PCLK and do software power-down when configure sensor to XGA and 720P. For 1080P and 2592x1944, sensor don't support 30fps. So return NULL when user try to get 1080P@30 and 2592x1944@30fps. Signed-off-by: Guoniu.zhou <[email protected]>
1 parent 54f171f commit 75b542c

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

drivers/media/i2c/ov5640.c

+20-3
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ enum ov5640_frame_rate {
111111
OV5640_15_FPS = 0,
112112
OV5640_30_FPS,
113113
OV5640_60_FPS,
114+
OV5640_07_FPS,
114115
OV5640_NUM_FRAMERATES,
115116
};
116117

@@ -352,7 +353,8 @@ static const struct reg_value ov5640_init_setting_30fps_VGA[] = {
352353
{0x583b, 0x28, 0, 0}, {0x583c, 0x42, 0, 0}, {0x583d, 0xce, 0, 0},
353354
{0x5025, 0x00, 0, 0}, {0x3a0f, 0x30, 0, 0}, {0x3a10, 0x28, 0, 0},
354355
{0x3a1b, 0x30, 0, 0}, {0x3a1e, 0x26, 0, 0}, {0x3a11, 0x60, 0, 0},
355-
{0x3a1f, 0x14, 0, 0}, {0x3008, 0x02, 0, 0}, {0x3c00, 0x04, 0, 300},
356+
{0x3a1f, 0x14, 0, 0}, {0x3008, 0x42, 0, 0}, {0x3c00, 0x04, 0, 300},
357+
{0x302c, 0xc2, 0, 0},
356358
};
357359

358360
static const struct reg_value ov5640_setting_VGA_640_480[] = {
@@ -375,6 +377,7 @@ static const struct reg_value ov5640_setting_VGA_640_480[] = {
375377
};
376378

377379
static const struct reg_value ov5640_setting_XGA_1024_768[] = {
380+
{0x3008, 0x42, 0, 0},
378381
{0x3c07, 0x08, 0, 0},
379382
{0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0},
380383
{0x3814, 0x31, 0, 0},
@@ -389,8 +392,9 @@ static const struct reg_value ov5640_setting_XGA_1024_768[] = {
389392
{0x3a0a, 0x00, 0, 0}, {0x3a0b, 0xf6, 0, 0}, {0x3a0e, 0x03, 0, 0},
390393
{0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0},
391394
{0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0},
392-
{0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0},
395+
{0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x20, 0, 0},
393396
{0x3824, 0x02, 0, 0}, {0x5001, 0xa3, 0, 0},
397+
{0x3008, 0x02, 0, 10}
394398
};
395399

396400
static const struct reg_value ov5640_setting_QVGA_320_240[] = {
@@ -470,6 +474,7 @@ static const struct reg_value ov5640_setting_PAL_720_576[] = {
470474
};
471475

472476
static const struct reg_value ov5640_setting_720P_1280_720[] = {
477+
{0x3008, 0x42, 0, 0},
473478
{0x3c07, 0x07, 0, 0},
474479
{0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0},
475480
{0x3814, 0x31, 0, 0},
@@ -486,6 +491,7 @@ static const struct reg_value ov5640_setting_720P_1280_720[] = {
486491
{0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0},
487492
{0x4407, 0x04, 0, 0}, {0x460b, 0x37, 0, 0}, {0x460c, 0x20, 0, 0},
488493
{0x3824, 0x04, 0, 0}, {0x5001, 0x83, 0, 0},
494+
{0x3008, 0x02, 0, 15},
489495
};
490496

491497
static const struct reg_value ov5640_setting_1080P_1920_1080[] = {
@@ -521,6 +527,7 @@ static const struct reg_value ov5640_setting_1080P_1920_1080[] = {
521527
};
522528

523529
static const struct reg_value ov5640_setting_QSXGA_2592_1944[] = {
530+
{0x3008, 0x42, 0, 0},
524531
{0x3c07, 0x08, 0, 0},
525532
{0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0},
526533
{0x3814, 0x11, 0, 0},
@@ -535,8 +542,9 @@ static const struct reg_value ov5640_setting_QSXGA_2592_1944[] = {
535542
{0x3a0a, 0x00, 0, 0}, {0x3a0b, 0xf6, 0, 0}, {0x3a0e, 0x03, 0, 0},
536543
{0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0},
537544
{0x4001, 0x02, 0, 0}, {0x4004, 0x06, 0, 0},
538-
{0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0},
545+
{0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x20, 0, 0},
539546
{0x3824, 0x02, 0, 0}, {0x5001, 0x83, 0, 70},
547+
{0x3008, 0x02, 0, 20},
540548
};
541549

542550
/* power-on sensor init reg table */
@@ -1602,6 +1610,15 @@ ov5640_find_mode(struct ov5640_dev *sensor, enum ov5640_frame_rate fr,
16021610
hact, vact,
16031611
width, height);
16041612

1613+
/*
1614+
* DVP mode support [email protected], 1080P@15
1615+
*/
1616+
if (sensor->ep.bus_type != V4L2_MBUS_CSI2_DPHY) {
1617+
if (((mode->id == OV5640_MODE_1080P_1920_1080) && (fr != OV5640_15_FPS)) ||
1618+
((mode->id == OV5640_MODE_QSXGA_2592_1944) && (fr != OV5640_07_FPS)))
1619+
return NULL;
1620+
}
1621+
16051622
if (!mode ||
16061623
(!nearest && (mode->hact != width || mode->vact != height)))
16071624
return NULL;

0 commit comments

Comments
 (0)