Skip to content

Commit a009a9c

Browse files
6by9popcornmix
authored andcommitted
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 b3c9c8e commit a009a9c

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
@@ -525,7 +529,6 @@ static const struct reg_value ov7251_setting_vga_90fps[] = {
525529
{ 0x3662, 0x01 },
526530
{ 0x3663, 0x70 },
527531
{ 0x3664, 0x50 },
528-
{ 0x3666, 0x0a },
529532
{ 0x3669, 0x1a },
530533
{ 0x366a, 0x00 },
531534
{ 0x366b, 0x50 },
@@ -592,9 +595,8 @@ static const struct reg_value ov7251_setting_vga_90fps[] = {
592595
{ 0x3c00, 0x89 },
593596
{ 0x3c01, 0x63 },
594597
{ 0x3c02, 0x01 },
595-
{ 0x3c03, 0x00 },
596598
{ 0x3c04, 0x00 },
597-
{ 0x3c05, 0x03 },
599+
{ 0x3c05, 0x01 },
598600
{ 0x3c06, 0x00 },
599601
{ 0x3c07, 0x06 },
600602
{ 0x3c0c, 0x01 },
@@ -624,6 +626,16 @@ static const struct reg_value ov7251_setting_vga_90fps[] = {
624626
{ 0x5001, 0x80 },
625627
};
626628

629+
static const struct reg_value ov7251_ext_trig_on[] = {
630+
{ 0x3666, 0x00 },
631+
{ 0x3c03, 0x17 },
632+
};
633+
634+
static const struct reg_value ov7251_ext_trig_off[] = {
635+
{ 0x3666, 0x0a },
636+
{ 0x3c03, 0x00 },
637+
};
638+
627639
static const unsigned long supported_xclk_rates[] = {
628640
[OV7251_19_2_MHZ] = 19200000,
629641
[OV7251_24_MHZ] = 24000000,
@@ -1372,6 +1384,23 @@ static int ov7251_s_stream(struct v4l2_subdev *subdev, int enable)
13721384
dev_err(ov7251->dev, "could not sync v4l2 controls\n");
13731385
goto err_power_down;
13741386
}
1387+
1388+
/* Set vsync trigger mode */
1389+
switch (trigger_mode) {
1390+
case 2:
1391+
ov7251_set_register_array(ov7251,
1392+
ov7251_ext_trig_on,
1393+
ARRAY_SIZE(ov7251_ext_trig_on));
1394+
break;
1395+
case 0:
1396+
default:
1397+
/* case 1 for ext trig source currently not implemented */
1398+
ov7251_set_register_array(ov7251,
1399+
ov7251_ext_trig_off,
1400+
ARRAY_SIZE(ov7251_ext_trig_off));
1401+
break;
1402+
}
1403+
13751404
ret = ov7251_write_reg(ov7251, OV7251_SC_MODE_SELECT,
13761405
OV7251_SC_MODE_SELECT_STREAMING);
13771406
if (ret)

0 commit comments

Comments
 (0)