Files
build/patch/kernel/archive/sunxi-5.17/patches.megous/media-ov5640-Add-HBLANK-and-VBLANK-controls.patch
The-going 9ebd3600c6 Sunxi 5.17 (#3687)
* Add 88 new patches to series. tag: orange-pi-5.17-20220409-0454

* Fix the applicability of patches.megous to the v5.17.3 kernel

* Fix series.conf. Disable the patch that is not being applied

* Add support for sun50i-h6-orangepi-3-lts

* Check the applicability in the series

* Move to a patches.armbian folder

* Bananapro: add AXP209 regulators

* fix-gpio-kconfig remove if EXPERT to allow normal build

* sunxi-5.17: Remove unused patches
2022-04-16 18:20:04 +03:00

81 lines
2.5 KiB
Diff

From 92658c98ffc439873900237451d2145dbab0e764 Mon Sep 17 00:00:00 2001
From: Benjamin Schaaf <ben.schaaf@gmail.com>
Date: Sat, 18 Dec 2021 22:16:59 +1100
Subject: [PATCH 058/456] media: ov5640: Add HBLANK and VBLANK controls
---
drivers/media/i2c/ov5640.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
index 81c355e6fa83..e392da8052c5 100644
--- a/drivers/media/i2c/ov5640.c
+++ b/drivers/media/i2c/ov5640.c
@@ -209,6 +209,8 @@ struct ov5640_mode_info {
struct ov5640_ctrls {
struct v4l2_ctrl_handler handler;
struct v4l2_ctrl *pixel_rate;
+ struct v4l2_ctrl *hblank;
+ struct v4l2_ctrl *vblank;
struct {
struct v4l2_ctrl *auto_exp;
struct v4l2_ctrl *exposure;
@@ -1567,6 +1569,16 @@ static u64 ov5640_calc_pixel_rate(struct ov5640_dev *sensor)
return rate;
}
+static s32 ov5640_calc_hblank(struct ov5640_dev *sensor)
+{
+ return sensor->current_mode->htot - sensor->current_mode->hact;
+}
+
+static s32 ov5640_calc_vblank(struct ov5640_dev *sensor)
+{
+ return sensor->current_mode->vtot - sensor->current_mode->vact;
+}
+
/*
* sensor changes between scaling and subsampling, go through
* exposure calculation
@@ -2302,7 +2314,11 @@ static int ov5640_set_fmt(struct v4l2_subdev *sd,
sensor->fmt = *mbus_fmt;
__v4l2_ctrl_s_ctrl_int64(sensor->ctrls.pixel_rate,
- ov5640_calc_pixel_rate(sensor));
+ ov5640_calc_pixel_rate(sensor));
+ __v4l2_ctrl_s_ctrl(sensor->ctrls.hblank,
+ ov5640_calc_hblank(sensor));
+ __v4l2_ctrl_s_ctrl(sensor->ctrls.vblank,
+ ov5640_calc_vblank(sensor));
}
out:
mutex_unlock(&sensor->lock);
@@ -2735,6 +2751,14 @@ static int ov5640_init_controls(struct ov5640_dev *sensor)
0, INT_MAX, 1,
ov5640_calc_pixel_rate(sensor));
+ ctrls->hblank = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_HBLANK,
+ 0, INT_MAX, 1,
+ ov5640_calc_hblank(sensor));
+
+ ctrls->vblank = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_VBLANK,
+ 0, INT_MAX, 1,
+ ov5640_calc_vblank(sensor));
+
/* Auto/manual white balance */
ctrls->auto_wb = v4l2_ctrl_new_std(hdl, ops,
V4L2_CID_AUTO_WHITE_BALANCE,
@@ -2783,6 +2807,8 @@ static int ov5640_init_controls(struct ov5640_dev *sensor)
}
ctrls->pixel_rate->flags |= V4L2_CTRL_FLAG_READ_ONLY;
+ ctrls->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
+ ctrls->vblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
ctrls->gain->flags |= V4L2_CTRL_FLAG_VOLATILE;
ctrls->exposure->flags |= V4L2_CTRL_FLAG_VOLATILE;
--
2.34.1