mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-27 17:18:59 +00:00
8c405cdccc
The patches were generated from the RPi repo with the following command: git format-patch v6.6.34..rpi-6.1.y Some patches needed rebasing and, as usual, the applied and reverted, wireless drivers, Github workflows, READMEs and defconfigs patches were removed. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
78 lines
2.8 KiB
Diff
78 lines
2.8 KiB
Diff
From 074f41ba54c77a607898ee9cba6994215912f640 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Erik=20Bot=C3=B6?= <erik.boto@gmail.com>
|
|
Date: Fri, 9 Feb 2024 18:37:46 +0100
|
|
Subject: [PATCH 0969/1085] imx477: make trigger-mode more configurable
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Allow trigger-mode to be overridden using device tree so that it can be
|
|
set per camera. Previously the mode could only be changed using a module
|
|
parameter, which would then affect all cameras.
|
|
|
|
Signed-off-by: Erik Botö <erik.boto@gmail.com>
|
|
---
|
|
drivers/media/i2c/imx477.c | 19 ++++++++++++++-----
|
|
1 file changed, 14 insertions(+), 5 deletions(-)
|
|
|
|
--- a/drivers/media/i2c/imx477.c
|
|
+++ b/drivers/media/i2c/imx477.c
|
|
@@ -1124,6 +1124,9 @@ struct imx477 {
|
|
/* Current mode */
|
|
const struct imx477_mode *mode;
|
|
|
|
+ /* Trigger mode */
|
|
+ int trigger_mode_of;
|
|
+
|
|
/*
|
|
* Mutex for serialized access:
|
|
* Protect sensor module set pad format and start/stop streaming safely.
|
|
@@ -1711,7 +1714,7 @@ static int imx477_start_streaming(struct
|
|
struct i2c_client *client = v4l2_get_subdevdata(&imx477->sd);
|
|
const struct imx477_reg_list *reg_list;
|
|
const struct imx477_reg_list *extra_regs;
|
|
- int ret;
|
|
+ int ret, tm;
|
|
|
|
if (!imx477->common_regs_written) {
|
|
ret = imx477_write_regs(imx477, mode_common_regs,
|
|
@@ -1748,14 +1751,15 @@ static int imx477_start_streaming(struct
|
|
return ret;
|
|
|
|
/* Set vsync trigger mode: 0=standalone, 1=source, 2=sink */
|
|
+ tm = (imx477->trigger_mode_of >= 0) ? imx477->trigger_mode_of : trigger_mode;
|
|
imx477_write_reg(imx477, IMX477_REG_MC_MODE,
|
|
- IMX477_REG_VALUE_08BIT, (trigger_mode > 0) ? 1 : 0);
|
|
+ IMX477_REG_VALUE_08BIT, (tm > 0) ? 1 : 0);
|
|
imx477_write_reg(imx477, IMX477_REG_MS_SEL,
|
|
- IMX477_REG_VALUE_08BIT, (trigger_mode <= 1) ? 1 : 0);
|
|
+ IMX477_REG_VALUE_08BIT, (tm <= 1) ? 1 : 0);
|
|
imx477_write_reg(imx477, IMX477_REG_XVS_IO_CTRL,
|
|
- IMX477_REG_VALUE_08BIT, (trigger_mode == 1) ? 1 : 0);
|
|
+ IMX477_REG_VALUE_08BIT, (tm == 1) ? 1 : 0);
|
|
imx477_write_reg(imx477, IMX477_REG_EXTOUT_EN,
|
|
- IMX477_REG_VALUE_08BIT, (trigger_mode == 1) ? 1 : 0);
|
|
+ IMX477_REG_VALUE_08BIT, (tm == 1) ? 1 : 0);
|
|
|
|
/* set stream on register */
|
|
return imx477_write_reg(imx477, IMX477_REG_MODE_SELECT,
|
|
@@ -2187,6 +2191,7 @@ static int imx477_probe(struct i2c_clien
|
|
struct imx477 *imx477;
|
|
const struct of_device_id *match;
|
|
int ret;
|
|
+ u32 tm_of;
|
|
|
|
imx477 = devm_kzalloc(&client->dev, sizeof(*imx477), GFP_KERNEL);
|
|
if (!imx477)
|
|
@@ -2204,6 +2209,10 @@ static int imx477_probe(struct i2c_clien
|
|
if (imx477_check_hwcfg(dev))
|
|
return -EINVAL;
|
|
|
|
+ /* Default the trigger mode from OF to -1, which means invalid */
|
|
+ ret = of_property_read_u32(dev->of_node, "trigger-mode", &tm_of);
|
|
+ imx477->trigger_mode_of = (ret == 0) ? tm_of : -1;
|
|
+
|
|
/* Get system clock (xclk) */
|
|
imx477->xclk = devm_clk_get(dev, NULL);
|
|
if (IS_ERR(imx477->xclk)) {
|