Skip to content

Commit e6a7eed

Browse files
committed
media: i2c: ov7251: Add module param to select ext trig mode
As there isn't currently a defined mechanism for selecting an external trigger mode on image sensors, copy the imx477 approach of using a module parameter to enable ext trig. Signed-off-by: Dave Stevenson <[email protected]>
1 parent c2e04f6 commit e6a7eed

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

drivers/media/i2c/ov7251.c

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
#include <media/v4l2-fwnode.h>
2424
#include <media/v4l2-subdev.h>
2525

26+
static int trigger_mode;
27+
module_param(trigger_mode, int, 0644);
28+
MODULE_PARM_DESC(trigger_mode, "Set vsync trigger mode: 0=standalone, (1=source - not implemented), 2=sink");
29+
2630
#define OV7251_SC_MODE_SELECT 0x0100
2731
#define OV7251_SC_MODE_SELECT_SW_STANDBY 0x0
2832
#define OV7251_SC_MODE_SELECT_STREAMING 0x1
@@ -244,7 +248,6 @@ static const struct reg_value ov7251_setting_vga[] = {
244248
{ 0x3662, 0x01 },
245249
{ 0x3663, 0x70 },
246250
{ 0x3664, 0x50 },
247-
{ 0x3666, 0x0a },
248251
{ 0x3669, 0x1a },
249252
{ 0x366a, 0x00 },
250253
{ 0x366b, 0x50 },
@@ -309,9 +312,8 @@ static const struct reg_value ov7251_setting_vga[] = {
309312
{ 0x3c00, 0x89 },
310313
{ 0x3c01, 0x63 },
311314
{ 0x3c02, 0x01 },
312-
{ 0x3c03, 0x00 },
313315
{ 0x3c04, 0x00 },
314-
{ 0x3c05, 0x03 },
316+
{ 0x3c05, 0x01 },
315317
{ 0x3c06, 0x00 },
316318
{ 0x3c07, 0x06 },
317319
{ 0x3c0c, 0x01 },
@@ -341,6 +343,16 @@ static const struct reg_value ov7251_setting_vga[] = {
341343
{ 0x5001, 0x80 },
342344
};
343345

346+
static const struct reg_value ov7251_ext_trig_on[] = {
347+
{ 0x3666, 0x00 },
348+
{ 0x3c03, 0x17 },
349+
};
350+
351+
static const struct reg_value ov7251_ext_trig_off[] = {
352+
{ 0x3666, 0x0a },
353+
{ 0x3c03, 0x00 },
354+
};
355+
344356
static const unsigned long supported_xclk_rates[] = {
345357
[OV7251_19_2_MHZ] = 19200000,
346358
[OV7251_24_MHZ] = 24000000,
@@ -1065,6 +1077,23 @@ static int ov7251_s_stream(struct v4l2_subdev *subdev, int enable)
10651077
dev_err(ov7251->dev, "could not sync v4l2 controls\n");
10661078
goto err_power_down;
10671079
}
1080+
1081+
/* Set vsync trigger mode */
1082+
switch (trigger_mode) {
1083+
case 2:
1084+
ov7251_set_register_array(ov7251,
1085+
ov7251_ext_trig_on,
1086+
ARRAY_SIZE(ov7251_ext_trig_on));
1087+
break;
1088+
case 0:
1089+
default:
1090+
/* case 1 for ext trig source currently not implemented */
1091+
ov7251_set_register_array(ov7251,
1092+
ov7251_ext_trig_off,
1093+
ARRAY_SIZE(ov7251_ext_trig_off));
1094+
break;
1095+
}
1096+
10681097
ret = ov7251_write_reg(ov7251, OV7251_SC_MODE_SELECT,
10691098
OV7251_SC_MODE_SELECT_STREAMING);
10701099
if (ret)

0 commit comments

Comments
 (0)