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
7 Updated imx296 driver to support external trigger mode via XTR pin.
8 Added module parameter to control this mode.
10 Signed-off-by: Ben Benson <ben.benson@raspberrypi.com>
12 drivers/media/i2c/imx296.c | 10 ++++++++++
13 1 file changed, 10 insertions(+)
15 --- a/drivers/media/i2c/imx296.c
16 +++ b/drivers/media/i2c/imx296.c
18 #include <media/v4l2-fwnode.h>
19 #include <media/v4l2-subdev.h>
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");
25 #define IMX296_PIXEL_ARRAY_WIDTH 1456
26 #define IMX296_PIXEL_ARRAY_HEIGHT 1088
28 @@ -645,6 +649,12 @@ static int imx296_stream_on(struct imx29
30 imx296_write(sensor, IMX296_CTRL00, 0, &ret);
31 usleep_range(2000, 5000);
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);
38 imx296_write(sensor, IMX296_CTRL0A, 0, &ret);
40 /* vflip and hflip cannot change during streaming */