ee4079cd647f6b77f6dee533d3b82724e2bdb151
[openwrt/staging/blocktrron.git] /
1 From e1b03ea9e84320e6bf36a1486abaebbceadd7fc7 Mon Sep 17 00:00:00 2001
2 From: Ben Benson <ben.benson@raspberrypi.com>
3 Date: Fri, 21 Jul 2023 15:59:51 +0100
4 Subject: [PATCH] drivers: media: imx296: Updated imx296 driver for external
5 trigger
6
7 Updated imx296 driver to support external trigger mode via XTR pin.
8 Added module parameter to control this mode.
9
10 Signed-off-by: Ben Benson <ben.benson@raspberrypi.com>
11 ---
12 drivers/media/i2c/imx296.c | 10 ++++++++++
13 1 file changed, 10 insertions(+)
14
15 --- a/drivers/media/i2c/imx296.c
16 +++ b/drivers/media/i2c/imx296.c
17 @@ -20,6 +20,10 @@
18 #include <media/v4l2-fwnode.h>
19 #include <media/v4l2-subdev.h>
20
21 +static int trigger_mode;
22 +module_param(trigger_mode, int, 0644);
23 +MODULE_PARM_DESC(trigger_mode, "Set trigger mode: 0=default, 1=XTRIG");
24 +
25 #define IMX296_PIXEL_ARRAY_WIDTH 1456
26 #define IMX296_PIXEL_ARRAY_HEIGHT 1088
27
28 @@ -645,6 +649,12 @@ static int imx296_stream_on(struct imx29
29
30 imx296_write(sensor, IMX296_CTRL00, 0, &ret);
31 usleep_range(2000, 5000);
32 +
33 + if (trigger_mode == 1) {
34 + imx296_write(sensor, IMX296_CTRL0B, IMX296_CTRL0B_TRIGEN, &ret);
35 + imx296_write(sensor, IMX296_LOWLAGTRG, IMX296_LOWLAGTRG_FAST, &ret);
36 + }
37 +
38 imx296_write(sensor, IMX296_CTRL0A, 0, &ret);
39
40 /* vflip and hflip cannot change during streaming */