From 658e583bea78c6d496ff8968dee0222987b98c19 Mon Sep 17 00:00:00 2001 From: Wang Panzhenzhuan Date: Sat, 16 Jul 2022 08:12:16 +0000 Subject: [PATCH] media: i2c: ov13855: adjust some config for cts 1. 4224x3136@15fps & 2114x1568@60fps only enable for debug 2. fix some regs setting Signed-off-by: Wang Panzhenzhuan Change-Id: Iab37357aea55a66c51ef70a76383b8b7b26ffd14 --- drivers/media/i2c/ov13855.c | 632 ++++++++++++++++-------------------- 1 file changed, 271 insertions(+), 361 deletions(-) diff --git a/drivers/media/i2c/ov13855.c b/drivers/media/i2c/ov13855.c index ca5eaf7c31e1..9beeddedfe2c 100644 --- a/drivers/media/i2c/ov13855.c +++ b/drivers/media/i2c/ov13855.c @@ -7,9 +7,11 @@ * V0.0X01.0X00 first version. * V0.0X01.0X01 fix some errors. * V0.0X01.0X02 add get_selection. - * + * V0.0X01.0X03 + * 1. 4224x3136@15fps & 2114x1568@60fps only enable for debug. + * 2. fix some regs setting. */ - +//#define DEBUG #include #include #include @@ -29,7 +31,7 @@ #include #include -#define DRIVER_VERSION KERNEL_VERSION(0, 0x01, 0x02) +#define DRIVER_VERSION KERNEL_VERSION(0, 0x01, 0x03) #ifndef V4L2_CID_DIGITAL_GAIN #define V4L2_CID_DIGITAL_GAIN V4L2_CID_GAIN @@ -188,7 +190,7 @@ static const struct regval ov13855_global_regs[] = { {0x3622, 0x30}, {0x3624, 0x1c}, {0x3640, 0x10}, - {0x3661, 0x70}, + {0x3641, 0x70}, {0x3661, 0x80}, {0x3662, 0x12}, {0x3664, 0x73}, @@ -357,13 +359,13 @@ static const struct regval ov13855_global_regs[] = { {REG_NULL, 0x00}, }; +#ifdef DEBUG /* * Xclk 24Mhz * max_framerate 30fps * mipi_datarate per lane 540Mbps */ -static const struct regval ov13855_2112x1568_30fps_regs[] = { - {0x0103, 0x01}, +static const struct regval ov13855_2112x1568_60fps_regs[] = { {0x0300, 0x02}, {0x0301, 0x00}, {0x0302, 0x5a}, @@ -373,65 +375,25 @@ static const struct regval ov13855_2112x1568_30fps_regs[] = { {0x3022, 0x01}, {0x3013, 0x32}, {0x3016, 0x72}, - {0x301b, 0xF0}, + {0x301b, 0xf0}, {0x301f, 0xd0}, {0x3106, 0x15}, {0x3107, 0x23}, {0x3500, 0x00}, - {0x3501, 0x40}, + {0x3501, 0x64}, {0x3502, 0x00}, - {0x3508, 0x02}, - {0x3509, 0x00}, - {0x350a, 0x00}, - {0x350e, 0x00}, - {0x3510, 0x00}, - {0x3511, 0x02}, - {0x3512, 0x00}, - {0x3600, 0x2b}, - {0x3601, 0x52}, - {0x3602, 0x60}, - {0x3612, 0x05}, - {0x3613, 0xa4}, - {0x3620, 0x80}, - {0x3621, 0x08}, {0x3622, 0x30}, {0x3624, 0x1c}, - {0x3640, 0x08}, - {0x3641, 0x70}, - {0x3661, 0x80}, {0x3662, 0x10}, - {0x3664, 0x73}, - {0x3665, 0xa7}, - {0x366e, 0xff}, - {0x366f, 0xf4}, - {0x3674, 0x00}, - {0x3679, 0x0c}, - {0x367f, 0x01}, - {0x3680, 0x0c}, - {0x3681, 0x60}, - {0x3682, 0x17}, - {0x3683, 0xa9}, - {0x3684, 0x9a}, - {0x3709, 0x68}, + {0x3709, 0x5f}, {0x3714, 0x28}, - {0x371a, 0x3e}, {0x3737, 0x08}, - {0x3738, 0xcc}, {0x3739, 0x20}, - {0x373d, 0x26}, - {0x3764, 0x20}, - {0x3765, 0x20}, {0x37a1, 0x36}, {0x37a8, 0x3b}, {0x37ab, 0x31}, {0x37c2, 0x14}, - {0x37c3, 0xf1}, - {0x37c5, 0x00}, - {0x37d8, 0x03}, {0x37d9, 0x0c}, - {0x37da, 0xc2}, - {0x37dc, 0x02}, - {0x37e0, 0x00}, {0x37e1, 0x0a}, {0x37e2, 0x14}, {0x37e3, 0x08}, @@ -441,6 +403,7 @@ static const struct regval ov13855_2112x1568_30fps_regs[] = { {0x3800, 0x00}, {0x3801, 0x00}, {0x3802, 0x00}, + {0x3803, 0x08}, {0x3804, 0x10}, {0x3805, 0x9f}, @@ -450,11 +413,12 @@ static const struct regval ov13855_2112x1568_30fps_regs[] = { {0x3809, 0x40}, {0x380a, 0x06}, {0x380b, 0x20}, - {0x380c, 0x08}, - {0x380d, 0xc4}, - {0x380e, 0x06}, - {0x380f, 0x48}, + {0x380c, 0x04}, + {0x380d, 0x62}, + {0x380e, 0x0c}, + {0x380f, 0x89}, {0x3811, 0x08}, + {0x3812, 0x00}, {0x3813, 0x02}, {0x3814, 0x03}, {0x3815, 0x01}, @@ -462,52 +426,15 @@ static const struct regval ov13855_2112x1568_30fps_regs[] = { {0x3817, 0x01}, {0x3820, 0xab}, {0x3821, 0x00}, - {0x3822, 0xc2}, - {0x3823, 0x18}, {0x3826, 0x04}, {0x3827, 0x90}, {0x3829, 0x07}, - {0x3832, 0x00}, - {0x3c80, 0x00}, - {0x3c87, 0x01}, - {0x3c8c, 0x19}, - {0x3c8d, 0x1c}, - {0x3c90, 0x00}, - {0x3c91, 0x00}, - {0x3c92, 0x00}, - {0x3c93, 0x00}, - {0x3c94, 0x40}, - {0x3c95, 0x54}, - {0x3c96, 0x34}, - {0x3c97, 0x04}, - {0x3c98, 0x00}, - {0x3d8c, 0x73}, - {0x3d8d, 0xc0}, - {0x3f00, 0x0b}, {0x3f03, 0x00}, - {0x4001, 0xe0}, - {0x4008, 0x00}, {0x4009, 0x0d}, {0x4011, 0xf0}, - {0x4017, 0x08}, {0x4050, 0x04}, {0x4051, 0x0b}, - {0x4052, 0x00}, - {0x4053, 0x80}, - {0x4054, 0x00}, - {0x4055, 0x80}, - {0x4056, 0x00}, - {0x4057, 0x80}, - {0x4058, 0x00}, - {0x4059, 0x80}, - {0x405e, 0x20}, {0x4500, 0x07}, - {0x4503, 0x00}, - {0x450a, 0x04}, - {0x4809, 0x04}, - {0x480c, 0x12}, - {0x481f, 0x30}, - {0x4833, 0x10}, {0x4837, 0x1c}, {0x4902, 0x01}, {0x4d00, 0x03}, @@ -516,264 +443,20 @@ static const struct regval ov13855_2112x1568_30fps_regs[] = { {0x4d03, 0xd7}, {0x4d04, 0xf0}, {0x4d05, 0xa2}, - {0x5000, 0xfd}, - {0x5001, 0x01}, - {0x5040, 0x39}, - {0x5041, 0x10}, - {0x5042, 0x10}, - {0x5043, 0x84}, - {0x5044, 0x62}, - {0x5180, 0x00}, - {0x5181, 0x10}, - {0x5182, 0x02}, - {0x5183, 0x0f}, - {0x5200, 0x1b}, - {0x520b, 0x07}, - {0x520c, 0x0f}, - {0x5300, 0x04}, - {0x5301, 0x0C}, - {0x5302, 0x0C}, - {0x5303, 0x0f}, - {0x5304, 0x00}, - {0x5305, 0x70}, - {0x5306, 0x00}, - {0x5307, 0x80}, - {0x5308, 0x00}, - {0x5309, 0xa5}, - {0x530a, 0x00}, - {0x530b, 0xd3}, - {0x530c, 0x00}, - {0x530d, 0xf0}, - {0x530e, 0x01}, - {0x530f, 0x10}, - {0x5310, 0x01}, - {0x5311, 0x20}, - {0x5312, 0x01}, - {0x5313, 0x20}, - {0x5314, 0x01}, - {0x5315, 0x20}, - {0x5316, 0x08}, - {0x5317, 0x08}, - {0x5318, 0x10}, - {0x5319, 0x88}, - {0x531a, 0x88}, - {0x531b, 0xa9}, - {0x531c, 0xaa}, - {0x531d, 0x0a}, - {0x5405, 0x02}, - {0x5406, 0x67}, - {0x5407, 0x01}, - {0x5408, 0x4a}, - {0x0100, 0x01}, - {REG_NULL, 0x00}, -}; - -/* - * Xclk 24Mhz - * max_framerate 30fps - * mipi_datarate per lane 1080Mbps - */ -static const struct regval ov13855_4224x3136_30fps_regs[] = { - {0x0103, 0x01}, - {0x0300, 0x02}, - {0x0301, 0x00}, - {0x0302, 0x5a}, - {0x0303, 0x00}, - {0x0304, 0x00}, - {0x0305, 0x01}, - {0x030b, 0x06}, - {0x030c, 0x02}, - {0x030d, 0x88}, - {0x0312, 0x11}, - {0x3022, 0x01}, - {0x3012, 0x40}, - {0x3013, 0x72}, - {0x3016, 0x72}, - {0x301b, 0xF0}, - {0x301f, 0xd0}, - {0x3106, 0x15}, - {0x3107, 0x23}, - {0x3500, 0x00}, - {0x3501, 0x80}, - {0x3502, 0x00}, - {0x3508, 0x02}, - {0x3509, 0x00}, - {0x350a, 0x00}, - {0x350e, 0x00}, - {0x3510, 0x00}, - {0x3511, 0x02}, - {0x3512, 0x00}, - {0x3600, 0x2b}, - {0x3601, 0x52}, - {0x3602, 0x60}, - {0x3612, 0x05}, - {0x3613, 0xa4}, - {0x3620, 0x80}, - {0x3621, 0x10}, - {0x3622, 0x30}, - {0x3624, 0x1c}, - {0x3640, 0x10}, - {0x3641, 0x70}, - {0x3660, 0x04}, - {0x3661, 0x80}, - {0x3662, 0x12}, - {0x3664, 0x73}, - {0x3665, 0xa7}, - {0x366e, 0xff}, - {0x366f, 0xf4}, - {0x3674, 0x00}, - {0x3679, 0x0c}, - {0x367f, 0x01}, - {0x3680, 0x0c}, - {0x3681, 0x50}, - {0x3682, 0x50}, - {0x3683, 0xa9}, - {0x3684, 0xa9}, - {0x3706, 0x40}, - {0x3709, 0x5f}, - {0x3714, 0x24}, - {0x371a, 0x3e}, - {0x3737, 0x04}, - {0x3738, 0xcc}, - {0x3739, 0x12}, - {0x373d, 0x26}, - {0x3764, 0x20}, - {0x3765, 0x20}, - {0x37a1, 0x36}, - {0x37a8, 0x3b}, - {0x37ab, 0x31}, - {0x37c2, 0x04}, - {0x37c3, 0xf1}, - {0x37c5, 0x00}, - {0x37d8, 0x03}, - {0x37d9, 0x0c}, - {0x37da, 0xc2}, - {0x37dc, 0x02}, - {0x37e0, 0x00}, - {0x37e1, 0x0a}, - {0x37e2, 0x14}, - {0x37e3, 0x04}, - {0x37e4, 0x2A}, - {0x37e5, 0x03}, - {0x37e6, 0x04}, - {0x3800, 0x00}, - {0x3801, 0x00}, - {0x3802, 0x00}, - {0x3803, 0x08}, - {0x3804, 0x10}, - {0x3805, 0x9f}, - {0x3806, 0x0c}, - {0x3807, 0x57}, - {0x3808, 0x10}, - {0x3809, 0x80}, - {0x380a, 0x0c}, - {0x380b, 0x40}, - {0x380c, 0x04}, - {0x380d, 0x62}, - {0x380e, 0x0c}, - {0x380f, 0x8e}, - {0x3811, 0x10}, - {0x3813, 0x08}, - {0x3814, 0x01}, - {0x3815, 0x01}, - {0x3816, 0x01}, - {0x3817, 0x01}, - {0x3820, 0xa8}, - {0x3821, 0x00}, - {0x3822, 0xd2}, - {0x3823, 0x18}, - {0x3826, 0x11}, - {0x3827, 0x1c}, - {0x3829, 0x03}, - {0x3832, 0x00}, - {0x3c80, 0x00}, - {0x3c87, 0x01}, - {0x3c8c, 0x19}, - {0x3c8d, 0x1c}, - {0x3c90, 0x00}, - {0x3c91, 0x00}, - {0x3c92, 0x00}, - {0x3c93, 0x00}, - {0x3c94, 0x40}, - {0x3c95, 0x54}, - {0x3c96, 0x34}, - {0x3c97, 0x04}, - {0x3c98, 0x00}, - {0x3d8c, 0x73}, - {0x3d8d, 0xc0}, - {0x3f00, 0x0b}, - {0x3f03, 0x00}, - {0x4001, 0xe0}, - {0x4008, 0x00}, - {0x4009, 0x0f}, - {0x4011, 0xf0}, - {0x4017, 0x08}, - {0x4050, 0x04}, - {0x4051, 0x0b}, - {0x4052, 0x00}, - {0x4053, 0x80}, - {0x4054, 0x00}, - {0x4055, 0x80}, - {0x4056, 0x00}, - {0x4057, 0x80}, - {0x4058, 0x00}, - {0x4059, 0x80}, - {0x405e, 0x00}, - {0x4500, 0x07}, - {0x4503, 0x00}, - {0x450a, 0x04}, - {0x4800, 0x60}, - {0x4809, 0x04}, - {0x480c, 0x12}, - {0x481f, 0x30}, - {0x4833, 0x10}, - {0x4837, 0x0e}, - {0x4902, 0x01}, - {0x4d00, 0x03}, - {0x4d01, 0xc9}, - {0x4d02, 0xbc}, - {0x4d03, 0xd7}, - {0x4d04, 0xf0}, - {0x4d05, 0xa2}, {0x5000, 0xff}, - {0x5001, 0x07}, - {0x5040, 0x39}, + {0x5041, 0x10}, {0x5042, 0x10}, {0x5043, 0x84}, {0x5044, 0x62}, - {0x5180, 0x00}, - {0x5181, 0x10}, - {0x5182, 0x02}, - {0x5183, 0x0f}, - {0x5200, 0x1b}, - {0x520b, 0x07}, - {0x520c, 0x0f}, {0x5300, 0x04}, {0x5301, 0x0C}, {0x5302, 0x0C}, {0x5303, 0x0f}, - {0x5304, 0x00}, {0x5305, 0x70}, - {0x5306, 0x00}, {0x5307, 0x80}, - {0x5308, 0x00}, {0x5309, 0xa5}, - {0x530a, 0x00}, {0x530b, 0xd3}, - {0x530c, 0x00}, - {0x530d, 0xf0}, - {0x530e, 0x01}, - {0x530f, 0x10}, - {0x5310, 0x01}, - {0x5311, 0x20}, - {0x5312, 0x01}, - {0x5313, 0x20}, - {0x5314, 0x01}, - {0x5315, 0x20}, - {0x5316, 0x08}, - {0x5317, 0x08}, - {0x5318, 0x10}, {0x5319, 0x88}, {0x531a, 0x88}, {0x531b, 0xa9}, @@ -783,13 +466,7 @@ static const struct regval ov13855_4224x3136_30fps_regs[] = { {0x5406, 0x67}, {0x5407, 0x01}, {0x5408, 0x4a}, - {0x0100, 0x01}, - {0x0100, 0x00}, - {0x380c, 0x04}, - {0x380d, 0x62}, - {0x0303, 0x00}, - {0x4837, 0x0e}, - {0x0100, 0x01}, + {REG_NULL, 0x00}, }; @@ -799,7 +476,6 @@ static const struct regval ov13855_4224x3136_30fps_regs[] = { * mipi_datarate per lane 1080Mbps */ static const struct regval ov13855_4224x3136_15fps_regs[] = { - {0x0103, 0x01}, {0x0300, 0x02}, {0x0301, 0x00}, {0x0302, 0x5a}, @@ -1011,10 +687,235 @@ static const struct regval ov13855_4224x3136_15fps_regs[] = { {0x0100, 0x01}, {0x0100, 0x00}, {0x380c, 0x08}, - {0x380d, 0xC4}, + {0x380d, 0xc4}, {0x0303, 0x01}, {0x4837, 0x1c}, + //{0x0100, 0x01}, + {REG_NULL, 0x00}, +}; +#endif + +/* + * Xclk 24Mhz + * max_framerate 30fps + * mipi_datarate per lane 1080Mbps + */ +static const struct regval ov13855_4224x3136_30fps_regs[] = { + {0x0300, 0x02}, + {0x0301, 0x00}, + {0x0302, 0x5a}, + {0x0303, 0x00}, + {0x0304, 0x00}, + {0x0305, 0x01}, + {0x030b, 0x06}, + {0x030c, 0x02}, + {0x030d, 0x88}, + {0x0312, 0x11}, + {0x3022, 0x01}, + {0x3012, 0x40}, + {0x3013, 0x72}, + {0x3016, 0x72}, + {0x301b, 0xF0}, + {0x301f, 0xd0}, + {0x3106, 0x15}, + {0x3107, 0x23}, + {0x3500, 0x00}, + {0x3501, 0x80}, + {0x3502, 0x00}, + {0x3508, 0x02}, + {0x3509, 0x00}, + {0x350a, 0x00}, + {0x350e, 0x00}, + {0x3510, 0x00}, + {0x3511, 0x02}, + {0x3512, 0x00}, + {0x3600, 0x2b}, + {0x3601, 0x52}, + {0x3602, 0x60}, + {0x3612, 0x05}, + {0x3613, 0xa4}, + {0x3620, 0x80}, + {0x3621, 0x10}, + {0x3622, 0x30}, + {0x3624, 0x1c}, + {0x3640, 0x10}, + {0x3641, 0x70}, + {0x3660, 0x04}, + {0x3661, 0x80}, + {0x3662, 0x12}, + {0x3664, 0x73}, + {0x3665, 0xa7}, + {0x366e, 0xff}, + {0x366f, 0xf4}, + {0x3674, 0x00}, + {0x3679, 0x0c}, + {0x367f, 0x01}, + {0x3680, 0x0c}, + {0x3681, 0x50}, + {0x3682, 0x50}, + {0x3683, 0xa9}, + {0x3684, 0xa9}, + {0x3706, 0x40}, + {0x3709, 0x5f}, + {0x3714, 0x24}, + {0x371a, 0x3e}, + {0x3737, 0x04}, + {0x3738, 0xcc}, + {0x3739, 0x12}, + {0x373d, 0x26}, + {0x3764, 0x20}, + {0x3765, 0x20}, + {0x37a1, 0x36}, + {0x37a8, 0x3b}, + {0x37ab, 0x31}, + {0x37c2, 0x04}, + {0x37c3, 0xf1}, + {0x37c5, 0x00}, + {0x37d8, 0x03}, + {0x37d9, 0x0c}, + {0x37da, 0xc2}, + {0x37dc, 0x02}, + {0x37e0, 0x00}, + {0x37e1, 0x0a}, + {0x37e2, 0x14}, + {0x37e3, 0x04}, + {0x37e4, 0x2A}, + {0x37e5, 0x03}, + {0x37e6, 0x04}, + {0x3800, 0x00}, + {0x3801, 0x00}, + {0x3802, 0x00}, + {0x3803, 0x08}, + {0x3804, 0x10}, + {0x3805, 0x9f}, + {0x3806, 0x0c}, + {0x3807, 0x57}, + {0x3808, 0x10}, + {0x3809, 0x80}, + {0x380a, 0x0c}, + {0x380b, 0x40}, + {0x380c, 0x04}, + {0x380d, 0x62}, + {0x380e, 0x0c}, + {0x380f, 0x8e}, + {0x3811, 0x10}, + {0x3813, 0x08}, + {0x3814, 0x01}, + {0x3815, 0x01}, + {0x3816, 0x01}, + {0x3817, 0x01}, + {0x3820, 0xa8}, + {0x3821, 0x00}, + {0x3822, 0xd2}, + {0x3823, 0x18}, + {0x3826, 0x11}, + {0x3827, 0x1c}, + {0x3829, 0x03}, + {0x3832, 0x00}, + {0x3c80, 0x00}, + {0x3c87, 0x01}, + {0x3c8c, 0x19}, + {0x3c8d, 0x1c}, + {0x3c90, 0x00}, + {0x3c91, 0x00}, + {0x3c92, 0x00}, + {0x3c93, 0x00}, + {0x3c94, 0x40}, + {0x3c95, 0x54}, + {0x3c96, 0x34}, + {0x3c97, 0x04}, + {0x3c98, 0x00}, + {0x3d8c, 0x73}, + {0x3d8d, 0xc0}, + {0x3f00, 0x0b}, + {0x3f03, 0x00}, + {0x4001, 0xe0}, + {0x4008, 0x00}, + {0x4009, 0x0f}, + {0x4011, 0xf0}, + {0x4017, 0x08}, + {0x4050, 0x04}, + {0x4051, 0x0b}, + {0x4052, 0x00}, + {0x4053, 0x80}, + {0x4054, 0x00}, + {0x4055, 0x80}, + {0x4056, 0x00}, + {0x4057, 0x80}, + {0x4058, 0x00}, + {0x4059, 0x80}, + {0x405e, 0x00}, + {0x4500, 0x07}, + {0x4503, 0x00}, + {0x450a, 0x04}, + {0x4800, 0x60}, + {0x4809, 0x04}, + {0x480c, 0x12}, + {0x481f, 0x30}, + {0x4833, 0x10}, + {0x4837, 0x0e}, + {0x4902, 0x01}, + {0x4d00, 0x03}, + {0x4d01, 0xc9}, + {0x4d02, 0xbc}, + {0x4d03, 0xd7}, + {0x4d04, 0xf0}, + {0x4d05, 0xa2}, + {0x5000, 0xff}, + {0x5001, 0x07}, + {0x5040, 0x39}, + {0x5041, 0x10}, + {0x5042, 0x10}, + {0x5043, 0x84}, + {0x5044, 0x62}, + {0x5180, 0x00}, + {0x5181, 0x10}, + {0x5182, 0x02}, + {0x5183, 0x0f}, + {0x5200, 0x1b}, + {0x520b, 0x07}, + {0x520c, 0x0f}, + {0x5300, 0x04}, + {0x5301, 0x0C}, + {0x5302, 0x0C}, + {0x5303, 0x0f}, + {0x5304, 0x00}, + {0x5305, 0x70}, + {0x5306, 0x00}, + {0x5307, 0x80}, + {0x5308, 0x00}, + {0x5309, 0xa5}, + {0x530a, 0x00}, + {0x530b, 0xd3}, + {0x530c, 0x00}, + {0x530d, 0xf0}, + {0x530e, 0x01}, + {0x530f, 0x10}, + {0x5310, 0x01}, + {0x5311, 0x20}, + {0x5312, 0x01}, + {0x5313, 0x20}, + {0x5314, 0x01}, + {0x5315, 0x20}, + {0x5316, 0x08}, + {0x5317, 0x08}, + {0x5318, 0x10}, + {0x5319, 0x88}, + {0x531a, 0x88}, + {0x531b, 0xa9}, + {0x531c, 0xaa}, + {0x531d, 0x0a}, + {0x5405, 0x02}, + {0x5406, 0x67}, + {0x5407, 0x01}, + {0x5408, 0x4a}, {0x0100, 0x01}, + {0x0100, 0x00}, + {0x380c, 0x04}, + {0x380d, 0x62}, + {0x0303, 0x00}, + {0x4837, 0x0e}, + //{0x0100, 0x01}, {REG_NULL, 0x00}, }; @@ -1026,13 +927,28 @@ static const struct ov13855_mode supported_modes[] = { .numerator = 10000, .denominator = 300000, }, - .exp_def = 0x0c8a, + .exp_def = 0x0800, .hts_def = 0x0462, .vts_def = 0x0c8e, .bpp = 10, .reg_list = ov13855_4224x3136_30fps_regs, .link_freq_idx = 0, }, +#ifdef DEBUG + { + .width = 2112, + .height = 1568, + .max_fps = { + .numerator = 10000, + .denominator = 600000, + }, + .exp_def = 0x0400, + .hts_def = 0x0462, + .vts_def = 0x0c89, + .bpp = 10, + .reg_list = ov13855_2112x1568_60fps_regs, + .link_freq_idx = 1, + }, { .width = 4224, .height = 3136, @@ -1040,27 +956,14 @@ static const struct ov13855_mode supported_modes[] = { .numerator = 10000, .denominator = 150000, }, - .exp_def = 0x0c8a, - .hts_def = 0x0462, + .exp_def = 0x0800, + .hts_def = 0x08c4, .vts_def = 0x0c8e, .bpp = 10, .reg_list = ov13855_4224x3136_15fps_regs, .link_freq_idx = 0, }, - { - .width = 2112, - .height = 1568, - .max_fps = { - .numerator = 10000, - .denominator = 300000, - }, - .exp_def = 0x0644, - .hts_def = 0x08c4, - .vts_def = 0x0648, - .bpp = 10, - .reg_list = ov13855_2112x1568_30fps_regs, - .link_freq_idx = 1, - }, +#endif }; static const s64 link_freq_items[] = { @@ -1216,6 +1119,7 @@ static int ov13855_set_fmt(struct v4l2_subdev *sd, __v4l2_ctrl_modify_range(ov13855->vblank, vblank_def, OV13855_VTS_MAX - mode->height, 1, vblank_def); + __v4l2_ctrl_s_ctrl(ov13855->vblank, vblank_def); pixel_rate = (u32)link_freq_items[mode->link_freq_idx] / mode->bpp * 2 * lane_num; __v4l2_ctrl_s_ctrl_int64(ov13855->pixel_rate, @@ -1446,6 +1350,12 @@ static int ov13855_s_stream(struct v4l2_subdev *sd, int on) struct i2c_client *client = ov13855->client; int ret = 0; + dev_info(&client->dev, "%s: on: %d, %dx%d@%d\n", __func__, on, + ov13855->cur_mode->width, + ov13855->cur_mode->height, + DIV_ROUND_CLOSEST(ov13855->cur_mode->max_fps.denominator, + ov13855->cur_mode->max_fps.numerator)); + mutex_lock(&ov13855->mutex); on = !!on; if (on == ov13855->streaming)