diff options
author | Álvaro Fernández Rojas <noltari@gmail.com> | 2022-05-16 23:40:32 +0200 |
---|---|---|
committer | Álvaro Fernández Rojas <noltari@gmail.com> | 2022-05-17 15:11:22 +0200 |
commit | 20ea6adbf199097c4f5f591ffee088340630dae4 (patch) | |
tree | d6719d95e136611a1c25bbf7789652d6d402779d /target/linux/bcm27xx/patches-5.15/950-0735-media-i2c-ov7251-Limit-exposure-based-on-VTS.patch | |
parent | bca05bd072180dc38ef740b37ded9572a6db1981 (diff) | |
download | upstream-20ea6adbf199097c4f5f591ffee088340630dae4.tar.gz upstream-20ea6adbf199097c4f5f591ffee088340630dae4.tar.bz2 upstream-20ea6adbf199097c4f5f591ffee088340630dae4.zip |
bcm27xx: add support for linux v5.15
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>
Diffstat (limited to 'target/linux/bcm27xx/patches-5.15/950-0735-media-i2c-ov7251-Limit-exposure-based-on-VTS.patch')
-rw-r--r-- | target/linux/bcm27xx/patches-5.15/950-0735-media-i2c-ov7251-Limit-exposure-based-on-VTS.patch | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-5.15/950-0735-media-i2c-ov7251-Limit-exposure-based-on-VTS.patch b/target/linux/bcm27xx/patches-5.15/950-0735-media-i2c-ov7251-Limit-exposure-based-on-VTS.patch new file mode 100644 index 0000000000..77686190e5 --- /dev/null +++ b/target/linux/bcm27xx/patches-5.15/950-0735-media-i2c-ov7251-Limit-exposure-based-on-VTS.patch @@ -0,0 +1,78 @@ +From 1c779e83e5f78cadcd8dfc6cfca33e7aeb323f27 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson <dave.stevenson@raspberrypi.com> +Date: Thu, 17 Feb 2022 16:44:33 +0000 +Subject: [PATCH] media: i2c: ov7251: Limit exposure based on VTS + +The maximum exposure is dictated by VTS, so compute it rather +than having the value in the mode table. + +Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> +--- + drivers/media/i2c/ov7251.c | 14 ++++++-------- + 1 file changed, 6 insertions(+), 8 deletions(-) + +--- a/drivers/media/i2c/ov7251.c ++++ b/drivers/media/i2c/ov7251.c +@@ -37,6 +37,8 @@ + #define OV7251_AEC_EXPO_2 0x3502 + #define OV7251_AEC_AGC_ADJ_0 0x350a + #define OV7251_AEC_AGC_ADJ_1 0x350b ++/* Exposure must be at least 20 lines shorter than VTS */ ++#define OV7251_EXPOSURE_OFFSET 20 + /* HTS is registers 0x380c and 0x380d */ + #define OV7251_HTS 0x3a0 + #define OV7251_VTS_HIGH 0x380e +@@ -82,7 +84,6 @@ struct ov7251_mode_info { + u32 height; + const struct reg_value *data; + u32 data_size; +- u16 exposure_max; + u16 exposure_def; + u16 vts; + struct v4l2_fract timeperframe; +@@ -348,7 +349,6 @@ static const struct ov7251_mode_info ov7 + .height = 480, + .data = ov7251_setting_vga, + .data_size = ARRAY_SIZE(ov7251_setting_vga), +- .exposure_max = 1704, + .exposure_def = 504, + .vts = 0x6bc, + .timeperframe = { +@@ -361,7 +361,6 @@ static const struct ov7251_mode_info ov7 + .height = 480, + .data = ov7251_setting_vga, + .data_size = ARRAY_SIZE(ov7251_setting_vga), +- .exposure_max = 840, + .exposure_def = 504, + .vts = 0x35c, + .timeperframe = { +@@ -374,7 +373,6 @@ static const struct ov7251_mode_info ov7 + .height = 480, + .data = ov7251_setting_vga, + .data_size = ARRAY_SIZE(ov7251_setting_vga), +- .exposure_max = 552, + .exposure_def = 504, + .vts = 0x23c, + .timeperframe = { +@@ -915,8 +913,8 @@ static int ov7251_set_format(struct v4l2 + h_blank, 1, h_blank); + __v4l2_ctrl_s_ctrl(ov7251->hblank, h_blank); + +- ret = __v4l2_ctrl_modify_range(ov7251->exposure, +- 1, new_mode->exposure_max, ++ ret = __v4l2_ctrl_modify_range(ov7251->exposure, 1, ++ new_mode->vts - OV7251_EXPOSURE_OFFSET, + 1, new_mode->exposure_def); + if (ret < 0) + goto exit; +@@ -1092,8 +1090,8 @@ static int ov7251_set_frame_interval(str + new_mode = ov7251_find_mode_by_ival(ov7251, &fi->interval); + + if (new_mode != ov7251->current_mode) { +- ret = __v4l2_ctrl_modify_range(ov7251->exposure, +- 1, new_mode->exposure_max, ++ ret = __v4l2_ctrl_modify_range(ov7251->exposure, 1, ++ new_mode->vts - OV7251_EXPOSURE_OFFSET, + 1, new_mode->exposure_def); + if (ret < 0) + goto exit; |