|
23 | 23 | #include <media/v4l2-fwnode.h>
|
24 | 24 | #include <media/v4l2-subdev.h>
|
25 | 25 |
|
| 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 | + |
26 | 30 | #define OV7251_SC_MODE_SELECT 0x0100
|
27 | 31 | #define OV7251_SC_MODE_SELECT_SW_STANDBY 0x0
|
28 | 32 | #define OV7251_SC_MODE_SELECT_STREAMING 0x1
|
@@ -525,7 +529,6 @@ static const struct reg_value ov7251_setting_vga_90fps[] = {
|
525 | 529 | { 0x3662, 0x01 },
|
526 | 530 | { 0x3663, 0x70 },
|
527 | 531 | { 0x3664, 0x50 },
|
528 |
| - { 0x3666, 0x0a }, |
529 | 532 | { 0x3669, 0x1a },
|
530 | 533 | { 0x366a, 0x00 },
|
531 | 534 | { 0x366b, 0x50 },
|
@@ -592,9 +595,8 @@ static const struct reg_value ov7251_setting_vga_90fps[] = {
|
592 | 595 | { 0x3c00, 0x89 },
|
593 | 596 | { 0x3c01, 0x63 },
|
594 | 597 | { 0x3c02, 0x01 },
|
595 |
| - { 0x3c03, 0x00 }, |
596 | 598 | { 0x3c04, 0x00 },
|
597 |
| - { 0x3c05, 0x03 }, |
| 599 | + { 0x3c05, 0x01 }, |
598 | 600 | { 0x3c06, 0x00 },
|
599 | 601 | { 0x3c07, 0x06 },
|
600 | 602 | { 0x3c0c, 0x01 },
|
@@ -624,6 +626,16 @@ static const struct reg_value ov7251_setting_vga_90fps[] = {
|
624 | 626 | { 0x5001, 0x80 },
|
625 | 627 | };
|
626 | 628 |
|
| 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 | + |
627 | 639 | static const unsigned long supported_xclk_rates[] = {
|
628 | 640 | [OV7251_19_2_MHZ] = 19200000,
|
629 | 641 | [OV7251_24_MHZ] = 24000000,
|
@@ -1372,6 +1384,23 @@ static int ov7251_s_stream(struct v4l2_subdev *subdev, int enable)
|
1372 | 1384 | dev_err(ov7251->dev, "could not sync v4l2 controls\n");
|
1373 | 1385 | goto err_power_down;
|
1374 | 1386 | }
|
| 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 | + |
1375 | 1404 | ret = ov7251_write_reg(ov7251, OV7251_SC_MODE_SELECT,
|
1376 | 1405 | OV7251_SC_MODE_SELECT_STREAMING);
|
1377 | 1406 | if (ret)
|
|
0 commit comments