Skip to content

Commit 95c7d3b

Browse files
6by9popcornmix
authored andcommitted
media: i2c: imx296: Add OF option for vsync sink for XTRIG
Copying our downstream patch for imx477 that allows configuration of external synchronisation signals via DT, add the same to imx296. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
1 parent ef2e59c commit 95c7d3b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

drivers/media/i2c/imx296.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ struct imx296 {
205205

206206
const struct imx296_clk_params *clk_params;
207207
bool mono;
208+
int trigger_mode_of;
208209

209210
struct v4l2_subdev subdev;
210211
struct media_pad pad;
@@ -645,16 +646,17 @@ static int imx296_setup(struct imx296 *sensor, struct v4l2_subdev_state *state)
645646

646647
static int imx296_stream_on(struct imx296 *sensor)
647648
{
648-
int ret = 0;
649+
int ret = 0, tm;
649650

650651
imx296_write(sensor, IMX296_CTRL00, 0, &ret);
651652
usleep_range(2000, 5000);
652653

653654
/* external trigger mode: 0=normal, 1=triggered */
655+
tm = (sensor->trigger_mode_of >= 0) ? sensor->trigger_mode_of : trigger_mode;
654656
imx296_write(sensor, IMX296_CTRL0B,
655-
(trigger_mode == 1) ? IMX296_CTRL0B_TRIGEN : 0, &ret);
657+
(tm == 1) ? IMX296_CTRL0B_TRIGEN : 0, &ret);
656658
imx296_write(sensor, IMX296_LOWLAGTRG,
657-
(trigger_mode == 1) ? IMX296_LOWLAGTRG_FAST : 0, &ret);
659+
(tm == 1) ? IMX296_LOWLAGTRG_FAST : 0, &ret);
658660

659661
imx296_write(sensor, IMX296_CTRL0A, 0, &ret);
660662

@@ -1079,6 +1081,7 @@ static int imx296_probe(struct i2c_client *client)
10791081
unsigned long clk_rate;
10801082
struct imx296 *sensor;
10811083
unsigned int i;
1084+
u32 tm_of;
10821085
int ret;
10831086

10841087
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
@@ -1145,6 +1148,10 @@ static int imx296_probe(struct i2c_client *client)
11451148
if (ret < 0)
11461149
goto err_power;
11471150

1151+
/* Default the trigger mode from OF to -1, which means invalid */
1152+
ret = of_property_read_u32(client->dev.of_node, "trigger-mode", &tm_of);
1153+
sensor->trigger_mode_of = (ret == 0) ? tm_of : -1;
1154+
11481155
/* Initialize the V4L2 subdev. */
11491156
ret = imx296_subdev_init(sensor);
11501157
if (ret < 0)

0 commit comments

Comments
 (0)