Skip to content

Commit e57cf1e

Browse files
caiohbmkartben
authored andcommitted
drivers: video: ov5640: add support to QVGA and QQVGA in CSI mode
The ov5640 driver already supports QVGA and QQVGA in dvp mode but not in CSI mode. This PR adds support for these resolutions in CSI mode. Signed-off-by: Caio Barz Molinari <caioheitor.barzmolinari_1@nxp.com>
1 parent c32bf58 commit e57cf1e

File tree

1 file changed

+43
-3
lines changed

1 file changed

+43
-3
lines changed

drivers/video/ov5640.c

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,21 @@ static const struct ov5640_reg init_params_dvp[] = {
466466
{0x3a15, 0xae},
467467
};
468468

469-
static const struct ov5640_reg csi2_low_res_params[] = {
469+
static const struct ov5640_reg csi2_qqvga_res_params[] = {
470+
{0x3800, 0x00}, {0x3801, 0x10}, {0x3802, 0x00}, {0x3803, 0x0E}, {0x3804, 0x0a},
471+
{0x3805, 0x2f}, {0x3806, 0x07}, {0x3807, 0xa5}, {0x3808, 0x00}, {0x3809, 0xa0},
472+
{0x380a, 0x00}, {0x380b, 0x78}, {0x380c, 0x06}, {0x380d, 0x40}, {0x380e, 0x03},
473+
{0x380f, 0xe6}, {0x3810, 0x00}, {0x3811, 0x02}, {0x3812, 0x00}, {0x3813, 0x04},
474+
{0x3814, 0x31}, {0x3815, 0x31}, {0x3824, 0x02}, {0x460c, 0x22}};
475+
476+
static const struct ov5640_reg csi2_qvga_res_params[] = {
477+
{0x3800, 0x00}, {0x3801, 0x10}, {0x3802, 0x00}, {0x3803, 0x0E}, {0x3804, 0x0a},
478+
{0x3805, 0x2f}, {0x3806, 0x07}, {0x3807, 0xa5}, {0x3808, 0x01}, {0x3809, 0x40},
479+
{0x380a, 0x00}, {0x380b, 0xf0}, {0x380c, 0x06}, {0x380d, 0x40}, {0x380e, 0x03},
480+
{0x380f, 0xe8}, {0x3810, 0x00}, {0x3811, 0x02}, {0x3812, 0x00}, {0x3813, 0x04},
481+
{0x3814, 0x31}, {0x3815, 0x31}, {0x3824, 0x02}, {0x460c, 0x22}};
482+
483+
static const struct ov5640_reg csi2_vga_res_params[] = {
470484
{0x3800, 0x00}, {0x3801, 0x00}, {0x3802, 0x00}, {0x3803, 0x04}, {0x3804, 0x0a},
471485
{0x3805, 0x3f}, {0x3806, 0x07}, {0x3807, 0x9b}, {0x3808, 0x02}, {0x3809, 0x80},
472486
{0x380a, 0x01}, {0x380b, 0xe0}, {0x380c, 0x07}, {0x380d, 0x68}, {0x380e, 0x03},
@@ -486,12 +500,36 @@ static const struct ov5640_mipi_frmrate_config mipi_hd_frmrate_params[] = {
486500
static const struct ov5640_mipi_frmrate_config mipi_vga_frmrate_params[] = {
487501
{15, 0x22, 0x38, 24000000}, {30, 0x14, 0x38, 24000000}, {60, 0x14, 0x70, 48000000}};
488502

503+
static const struct ov5640_mipi_frmrate_config mipi_qvga_frmrate_params[] = {
504+
{15, 0x22, 0x30, 24000000}, {30, 0x14, 0x30, 24000000}, {60, 0x14, 0x60, 48000000}};
505+
506+
static const struct ov5640_mipi_frmrate_config mipi_qqvga_frmrate_params[] = {
507+
{15, 0x22, 0x30, 24000000}, {30, 0x14, 0x30, 24000000}, {60, 0x14, 0x60, 48000000}};
508+
489509
static const struct ov5640_mode_config csi2_modes[] = {
510+
{
511+
.width = 160,
512+
.height = 120,
513+
.array_size_res_params = ARRAY_SIZE(csi2_qqvga_res_params),
514+
.res_params = csi2_qqvga_res_params,
515+
.mipi_frmrate_config = mipi_qqvga_frmrate_params,
516+
.max_frmrate = OV5640_60_FPS,
517+
.def_frmrate = OV5640_30_FPS,
518+
},
519+
{
520+
.width = 320,
521+
.height = 240,
522+
.array_size_res_params = ARRAY_SIZE(csi2_qvga_res_params),
523+
.res_params = csi2_qvga_res_params,
524+
.mipi_frmrate_config = mipi_qvga_frmrate_params,
525+
.max_frmrate = OV5640_60_FPS,
526+
.def_frmrate = OV5640_30_FPS,
527+
},
490528
{
491529
.width = 640,
492530
.height = 480,
493-
.array_size_res_params = ARRAY_SIZE(csi2_low_res_params),
494-
.res_params = csi2_low_res_params,
531+
.array_size_res_params = ARRAY_SIZE(csi2_vga_res_params),
532+
.res_params = csi2_vga_res_params,
495533
.mipi_frmrate_config = mipi_vga_frmrate_params,
496534
.max_frmrate = OV5640_60_FPS,
497535
.def_frmrate = OV5640_30_FPS,
@@ -575,6 +613,8 @@ static const struct video_format_cap csi2_fmts[] = {
575613
OV5640_VIDEO_FORMAT_CAP(1280, 720, VIDEO_PIX_FMT_YUYV),
576614
OV5640_VIDEO_FORMAT_CAP(640, 480, VIDEO_PIX_FMT_RGB565),
577615
OV5640_VIDEO_FORMAT_CAP(640, 480, VIDEO_PIX_FMT_YUYV),
616+
OV5640_VIDEO_FORMAT_CAP(320, 240, VIDEO_PIX_FMT_RGB565),
617+
OV5640_VIDEO_FORMAT_CAP(160, 120, VIDEO_PIX_FMT_RGB565),
578618
{0}};
579619

580620
static const struct video_format_cap dvp_fmts[] = {

0 commit comments

Comments
 (0)