mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-27 17:18:59 +00:00
20ea6adbf1
Build system: x86_64 Build-tested: bcm2708, bcm2709, bcm2710, bcm2711 Run-tested: bcm2708/RPiB+, bcm2709/RPi3B, bcm2710/RPi3B, bcm2711/RPi4B Signed-off-by: Marty Jones <mj8263788@gmail.com> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
210 lines
4.3 KiB
Diff
210 lines
4.3 KiB
Diff
From 22a869d373bc642562e55107028d19926a593984 Mon Sep 17 00:00:00 2001
|
|
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
|
|
Date: Sun, 22 Nov 2020 11:01:08 +0000
|
|
Subject: [PATCH] media: ov9281: Add 1280x720 and 640x480 modes
|
|
|
|
Breaks out common register set and adds the different registers
|
|
for 1280x720 (cropped) and 640x480 (skipped) modes
|
|
|
|
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
|
|
---
|
|
drivers/media/i2c/ov9281.c | 146 ++++++++++++++++++++++++++++++++-----
|
|
1 file changed, 126 insertions(+), 20 deletions(-)
|
|
|
|
--- a/drivers/media/i2c/ov9281.c
|
|
+++ b/drivers/media/i2c/ov9281.c
|
|
@@ -139,7 +139,7 @@ struct ov9281 {
|
|
* max_framerate 120fps for 10 bit, 144fps for 8 bit.
|
|
* mipi_datarate per lane 800Mbps
|
|
*/
|
|
-static const struct regval ov9281_1280x800_regs[] = {
|
|
+static const struct regval ov9281_common_regs[] = {
|
|
{0x0103, 0x01},
|
|
{0x0302, 0x32},
|
|
{0x030e, 0x02},
|
|
@@ -177,13 +177,35 @@ static const struct regval ov9281_1280x8
|
|
{0x372d, 0x22},
|
|
{0x3731, 0x80},
|
|
{0x3732, 0x30},
|
|
- {0x3778, 0x00},
|
|
{0x377d, 0x22},
|
|
{0x3788, 0x02},
|
|
{0x3789, 0xa4},
|
|
{0x378a, 0x00},
|
|
{0x378b, 0x4a},
|
|
{0x3799, 0x20},
|
|
+ {0x3881, 0x42},
|
|
+ {0x38b1, 0x00},
|
|
+ {0x3920, 0xff},
|
|
+ {0x4010, 0x40},
|
|
+ {0x4043, 0x40},
|
|
+ {0x4307, 0x30},
|
|
+ {0x4317, 0x00},
|
|
+ {0x4501, 0x00},
|
|
+ {0x450a, 0x08},
|
|
+ {0x4601, 0x04},
|
|
+ {0x470f, 0x00},
|
|
+ {0x4f07, 0x00},
|
|
+ {0x4800, 0x00},
|
|
+ {0x5000, 0x9f},
|
|
+ {0x5001, 0x00},
|
|
+ {0x5e00, 0x00},
|
|
+ {0x5d00, 0x07},
|
|
+ {0x5d01, 0x00},
|
|
+ {REG_NULL, 0x00},
|
|
+};
|
|
+
|
|
+static const struct regval ov9281_1280x800_regs[] = {
|
|
+ {0x3778, 0x10},
|
|
{0x3800, 0x00},
|
|
{0x3801, 0x00},
|
|
{0x3802, 0x00},
|
|
@@ -208,31 +230,83 @@ static const struct regval ov9281_1280x8
|
|
{0x3815, 0x11},
|
|
{0x3820, 0x40},
|
|
{0x3821, 0x00},
|
|
- {0x3881, 0x42},
|
|
- {0x38b1, 0x00},
|
|
- {0x3920, 0xff},
|
|
{0x4003, 0x40},
|
|
{0x4008, 0x04},
|
|
{0x4009, 0x0b},
|
|
{0x400c, 0x00},
|
|
{0x400d, 0x07},
|
|
- {0x4010, 0x40},
|
|
- {0x4043, 0x40},
|
|
- {0x4307, 0x30},
|
|
- {0x4317, 0x00},
|
|
- {0x4501, 0x00},
|
|
{0x4507, 0x00},
|
|
{0x4509, 0x00},
|
|
- {0x450a, 0x08},
|
|
- {0x4601, 0x04},
|
|
- {0x470f, 0x00},
|
|
- {0x4f07, 0x00},
|
|
- {0x4800, 0x00},
|
|
- {0x5000, 0x9f},
|
|
- {0x5001, 0x00},
|
|
- {0x5e00, 0x00},
|
|
- {0x5d00, 0x07},
|
|
- {0x5d01, 0x00},
|
|
+ {REG_NULL, 0x00},
|
|
+};
|
|
+
|
|
+static const struct regval ov9281_1280x720_regs[] = {
|
|
+ {0x3778, 0x10},
|
|
+ {0x3800, 0x00},
|
|
+ {0x3801, 0x00},
|
|
+ {0x3802, 0x00},
|
|
+ {0x3803, 0x28},
|
|
+ {0x3804, 0x05},
|
|
+ {0x3805, 0x0f},
|
|
+ {0x3806, 0x03},
|
|
+ {0x3807, 0x07},
|
|
+ {0x3808, 0x05},
|
|
+ {0x3809, 0x00},
|
|
+ {0x380a, 0x02},
|
|
+ {0x380b, 0xd0},
|
|
+ {0x380c, 0x02},
|
|
+ {0x380d, 0xd8},
|
|
+ {0x380e, 0x03},
|
|
+ {0x380f, 0x8e},
|
|
+ {0x3810, 0x00},
|
|
+ {0x3811, 0x08},
|
|
+ {0x3812, 0x00},
|
|
+ {0x3813, 0x08},
|
|
+ {0x3814, 0x11},
|
|
+ {0x3815, 0x11},
|
|
+ {0x3820, 0x40},
|
|
+ {0x3821, 0x00},
|
|
+ {0x4003, 0x40},
|
|
+ {0x4008, 0x04},
|
|
+ {0x4009, 0x0b},
|
|
+ {0x400c, 0x00},
|
|
+ {0x400d, 0x07},
|
|
+ {0x4507, 0x00},
|
|
+ {0x4509, 0x00},
|
|
+ {REG_NULL, 0x00},
|
|
+};
|
|
+
|
|
+static const struct regval ov9281_640x400_regs[] = {
|
|
+ {0x3800, 0x00},
|
|
+ {0x3801, 0x00},
|
|
+ {0x3802, 0x00},
|
|
+ {0x3803, 0x00},
|
|
+ {0x3804, 0x05},
|
|
+ {0x3805, 0x0f},
|
|
+ {0x3806, 0x03},
|
|
+ {0x3807, 0x2f},
|
|
+ {0x3808, 0x02},
|
|
+ {0x3809, 0x80},
|
|
+ {0x380a, 0x01},
|
|
+ {0x380b, 0x90},
|
|
+ {0x380c, 0x02},
|
|
+ {0x380d, 0xd8},
|
|
+ {0x380e, 0x02},
|
|
+ {0x380f, 0x08},
|
|
+ {0x3810, 0x00},
|
|
+ {0x3811, 0x04},
|
|
+ {0x3812, 0x00},
|
|
+ {0x3813, 0x04},
|
|
+ {0x3814, 0x31},
|
|
+ {0x3815, 0x22},
|
|
+ {0x3820, 0x60},
|
|
+ {0x3821, 0x01},
|
|
+ {0x4008, 0x02},
|
|
+ {0x4009, 0x05},
|
|
+ {0x400c, 0x00},
|
|
+ {0x400d, 0x03},
|
|
+ {0x4507, 0x03},
|
|
+ {0x4509, 0x80},
|
|
{REG_NULL, 0x00},
|
|
};
|
|
|
|
@@ -263,6 +337,34 @@ static const struct ov9281_mode supporte
|
|
},
|
|
.reg_list = ov9281_1280x800_regs,
|
|
},
|
|
+ {
|
|
+ .width = 1280,
|
|
+ .height = 720,
|
|
+ .exp_def = 0x0320,
|
|
+ .hts_def = 0x05b0,
|
|
+ .vts_def = 761,
|
|
+ .crop = {
|
|
+ .left = 0,
|
|
+ .top = 40,
|
|
+ .width = 1280,
|
|
+ .height = 720
|
|
+ },
|
|
+ .reg_list = ov9281_1280x720_regs,
|
|
+ },
|
|
+ {
|
|
+ .width = 640,
|
|
+ .height = 400,
|
|
+ .exp_def = 0x0320,
|
|
+ .hts_def = 0x05b0,
|
|
+ .vts_def = 421,
|
|
+ .crop = {
|
|
+ .left = 0,
|
|
+ .top = 0,
|
|
+ .width = 1280,
|
|
+ .height = 800
|
|
+ },
|
|
+ .reg_list = ov9281_640x400_regs,
|
|
+ },
|
|
};
|
|
|
|
static const s64 link_freq_menu_items[] = {
|
|
@@ -567,6 +669,10 @@ static int __ov9281_start_stream(struct
|
|
{
|
|
int ret;
|
|
|
|
+ ret = ov9281_write_array(ov9281->client, ov9281_common_regs);
|
|
+ if (ret)
|
|
+ return ret;
|
|
+
|
|
ret = ov9281_write_array(ov9281->client, ov9281->cur_mode->reg_list);
|
|
if (ret)
|
|
return ret;
|