mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-27 17:18:59 +00:00
d6d8851d12
Manually rebased: bcm27xx/patches-5.15/950-0421-Support-RPi-DPI-interface-in-mode6-for-18-bit-color.patch bcm27xx/patches-5.15/950-0706-media-i2c-imx219-Scale-the-pixel-clock-rate-for-the-.patch ramips/patches-5.15/810-uvc-add-iPassion-iP2970-support.patch Removed upstreamed: bcm27xx/patches-5.15/950-0707-drm-vc4-For-DPI-MEDIA_BUS_FMT_RGB565_1X16-is-mode-1-.patch[1] bcm27xx/patches-5.15/950-0596-drm-vc4-dpi-Add-option-for-inverting-pixel-clock-and.patch[2] ipq807x/0006-v5.16-arm64-dts-qcom-Fix-IPQ8074-PCIe-PHY-nodes.patch [3] ipq807x/0034-v6.1-arm64-dts-qcom-ipq8074-fix-PCIe-PHY-serdes-size.patch [4] ipq807x/0103-arm64-dts-qcom-ipq8074-fix-Gen2-PCIe-QMP-PHY.patch [5] ipq807x/0104-arm64-dts-qcom-ipq8074-fix-Gen3-PCIe-QMP-PHY.patch [6] ipq807x/0105-arm64-dts-qcom-ipq8074-correct-Gen2-PCIe-ranges.patch [7] ipq807x/0108-arm64-dts-qcom-ipq8074-fix-Gen3-PCIe-node.patch [8] ipq807x/0109-arm64-dts-qcom-ipq8074-correct-PCIe-QMP-PHY-output-c.patch [9] ipq807x/0132-arm64-dts-qcom-ipq8074-correct-USB3-QMP-PHY-s-clock-.patch [10] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.99&id=d2991e6b30020e286f2dd9d3b4f43548c547caa6 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/gpu/drm/vc4/vc4_dpi.c?h=v5.15.100&id=8e04aaffb6de5f1ae61de7b671c1531172ccf429 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/arch/arm64/boot/dts/qcom/ipq8074.dtsi?h=v5.15.99&id=a55a645aa303a3f7ec37db69822d5420657626da 4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/arch/arm64/boot/dts/qcom/ipq8074.dtsi?h=v5.15.99&id=d9df682bcea57fa25f37bbf17eae56fa05662635 5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/arch/arm64/boot/dts/qcom/ipq8074.dtsi?h=v5.15.99&id=7e6eeb5fb3aa9e5feffdb6e137dcc06f5f6410e1 6. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/arch/arm64/boot/dts/qcom/ipq8074.dtsi?h=v5.15.99&id=e88204931d9a60634cd50bbc679f045439c4b91d 7. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/arch/arm64/boot/dts/qcom/ipq8074.dtsi?h=v5.15.99&id=1563af0f28afd3b6d64ac79a2aecced3969c90bf 8. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/arch/arm64/boot/dts/qcom/ipq8074.dtsi?h=v5.15.99&id=feb8c71f015d416f1afe90e1f62cf51e47376c67 9. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/arch/arm64/boot/dts/qcom/ipq8074.dtsi?h=v5.15.99&id=69c7a270357a7d50ffd3471b14c60250041200e3 10. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/arch/arm64/boot/dts/qcom/ipq8074.dtsi?h=v5.15.99&id=dd3d021ae5471d98adf81f1e897431c8657d0a18 Build system: x86_64 Build-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3 Run-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia <therealgraysky@proton.me> Tested-by: Robert Marko <robimarko@gmail.com> #ipq807x/Dynalink WRX36 Tested-by: Stefan Lippers-Hollmann <s.l-h@gmx.de> #ipq807x/ax3600, x86_64/FW-7543B, ath79/tl-wdr3600, ipq806x/g10, ipq806x/nbg6817
130 lines
4.1 KiB
Diff
130 lines
4.1 KiB
Diff
From 055e3d70b0227e26d58b2efc4561eb21a3fbf640 Mon Sep 17 00:00:00 2001
|
|
From: Naushir Patuck <naush@raspberrypi.com>
|
|
Date: Tue, 8 Feb 2022 13:49:11 +0000
|
|
Subject: [PATCH] media: i2c: imx219: Scale the pixel clock rate for
|
|
the 640x480 mode
|
|
|
|
The 640x480 mode uses a special binning mode for high framerate operation where
|
|
the pixel rate is effectively doubled. Account for this when setting up the
|
|
pixel clock rate, and applying the vblank and exposure controls.
|
|
|
|
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
|
|
---
|
|
drivers/media/i2c/imx219.c | 33 ++++++++++++++++++++++++++-------
|
|
1 file changed, 26 insertions(+), 7 deletions(-)
|
|
|
|
--- a/drivers/media/i2c/imx219.c
|
|
+++ b/drivers/media/i2c/imx219.c
|
|
@@ -162,6 +162,9 @@ struct imx219_mode {
|
|
|
|
/* 2x2 binning is used */
|
|
bool binning;
|
|
+
|
|
+ /* Relative pixel clock rate factor for the mode. */
|
|
+ unsigned int rate_factor;
|
|
};
|
|
|
|
static const struct imx219_reg imx219_common_regs[] = {
|
|
@@ -402,6 +405,7 @@ static const struct imx219_mode supporte
|
|
.regs = mode_3280x2464_regs,
|
|
},
|
|
.binning = false,
|
|
+ .rate_factor = 1,
|
|
},
|
|
{
|
|
/* 1080P 30fps cropped */
|
|
@@ -419,6 +423,7 @@ static const struct imx219_mode supporte
|
|
.regs = mode_1920_1080_regs,
|
|
},
|
|
.binning = false,
|
|
+ .rate_factor = 1,
|
|
},
|
|
{
|
|
/* 2x2 binned 30fps mode */
|
|
@@ -436,6 +441,7 @@ static const struct imx219_mode supporte
|
|
.regs = mode_1640_1232_regs,
|
|
},
|
|
.binning = true,
|
|
+ .rate_factor = 1,
|
|
},
|
|
{
|
|
/* 640x480 30fps mode */
|
|
@@ -453,6 +459,11 @@ static const struct imx219_mode supporte
|
|
.regs = mode_640_480_regs,
|
|
},
|
|
.binning = true,
|
|
+ /*
|
|
+ * This mode uses a special 2x2 binning that doubles the
|
|
+ * the internal pixel clock rate.
|
|
+ */
|
|
+ .rate_factor = 2,
|
|
},
|
|
};
|
|
|
|
@@ -675,7 +686,8 @@ static int imx219_set_ctrl(struct v4l2_c
|
|
break;
|
|
case V4L2_CID_EXPOSURE:
|
|
ret = imx219_write_reg(imx219, IMX219_REG_EXPOSURE,
|
|
- IMX219_REG_VALUE_16BIT, ctrl->val);
|
|
+ IMX219_REG_VALUE_16BIT,
|
|
+ ctrl->val / imx219->mode->rate_factor);
|
|
break;
|
|
case V4L2_CID_DIGITAL_GAIN:
|
|
ret = imx219_write_reg(imx219, IMX219_REG_DIGITAL_GAIN,
|
|
@@ -695,7 +707,8 @@ static int imx219_set_ctrl(struct v4l2_c
|
|
case V4L2_CID_VBLANK:
|
|
ret = imx219_write_reg(imx219, IMX219_REG_VTS,
|
|
IMX219_REG_VALUE_16BIT,
|
|
- imx219->mode->height + ctrl->val);
|
|
+ (imx219->mode->height + ctrl->val) /
|
|
+ imx219->mode->rate_factor);
|
|
break;
|
|
case V4L2_CID_TEST_PATTERN_RED:
|
|
ret = imx219_write_reg(imx219, IMX219_REG_TESTP_RED,
|
|
@@ -867,7 +880,7 @@ static int imx219_set_pad_format(struct
|
|
struct imx219 *imx219 = to_imx219(sd);
|
|
const struct imx219_mode *mode;
|
|
struct v4l2_mbus_framefmt *framefmt;
|
|
- int exposure_max, exposure_def, hblank;
|
|
+ int exposure_max, exposure_def, hblank, pixel_rate;
|
|
unsigned int i;
|
|
|
|
if (fmt->pad >= NUM_PADS)
|
|
@@ -928,6 +941,12 @@ static int imx219_set_pad_format(struct
|
|
hblank = IMX219_PPL_DEFAULT - mode->width;
|
|
__v4l2_ctrl_modify_range(imx219->hblank, hblank, hblank,
|
|
1, hblank);
|
|
+
|
|
+ /* Scale the pixel rate based on the mode specific factor */
|
|
+ pixel_rate =
|
|
+ IMX219_PIXEL_RATE * imx219->mode->rate_factor;
|
|
+ __v4l2_ctrl_modify_range(imx219->pixel_rate, pixel_rate,
|
|
+ pixel_rate, 1, pixel_rate);
|
|
}
|
|
} else {
|
|
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
|
|
@@ -1315,7 +1334,7 @@ static int imx219_init_controls(struct i
|
|
struct v4l2_ctrl_handler *ctrl_hdlr;
|
|
unsigned int height = imx219->mode->height;
|
|
struct v4l2_fwnode_device_properties props;
|
|
- int exposure_max, exposure_def, hblank;
|
|
+ int exposure_max, exposure_def, hblank, pixel_rate;
|
|
int i, ret;
|
|
|
|
ctrl_hdlr = &imx219->ctrl_handler;
|
|
@@ -1327,11 +1346,11 @@ static int imx219_init_controls(struct i
|
|
ctrl_hdlr->lock = &imx219->mutex;
|
|
|
|
/* By default, PIXEL_RATE is read only */
|
|
+ pixel_rate = IMX219_PIXEL_RATE * imx219->mode->rate_factor;
|
|
imx219->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &imx219_ctrl_ops,
|
|
V4L2_CID_PIXEL_RATE,
|
|
- IMX219_PIXEL_RATE,
|
|
- IMX219_PIXEL_RATE, 1,
|
|
- IMX219_PIXEL_RATE);
|
|
+ pixel_rate, pixel_rate,
|
|
+ 1, pixel_rate);
|
|
|
|
imx219->link_freq =
|
|
v4l2_ctrl_new_int_menu(ctrl_hdlr, &imx219_ctrl_ops,
|