|
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
|
@@ -244,7 +248,6 @@ static const struct reg_value ov7251_setting_vga[] = {
|
244 | 248 | { 0x3662, 0x01 },
|
245 | 249 | { 0x3663, 0x70 },
|
246 | 250 | { 0x3664, 0x50 },
|
247 |
| - { 0x3666, 0x0a }, |
248 | 251 | { 0x3669, 0x1a },
|
249 | 252 | { 0x366a, 0x00 },
|
250 | 253 | { 0x366b, 0x50 },
|
@@ -309,9 +312,8 @@ static const struct reg_value ov7251_setting_vga[] = {
|
309 | 312 | { 0x3c00, 0x89 },
|
310 | 313 | { 0x3c01, 0x63 },
|
311 | 314 | { 0x3c02, 0x01 },
|
312 |
| - { 0x3c03, 0x00 }, |
313 | 315 | { 0x3c04, 0x00 },
|
314 |
| - { 0x3c05, 0x03 }, |
| 316 | + { 0x3c05, 0x01 }, |
315 | 317 | { 0x3c06, 0x00 },
|
316 | 318 | { 0x3c07, 0x06 },
|
317 | 319 | { 0x3c0c, 0x01 },
|
@@ -341,6 +343,16 @@ static const struct reg_value ov7251_setting_vga[] = {
|
341 | 343 | { 0x5001, 0x80 },
|
342 | 344 | };
|
343 | 345 |
|
| 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 | + |
344 | 356 | static const unsigned long supported_xclk_rates[] = {
|
345 | 357 | [OV7251_19_2_MHZ] = 19200000,
|
346 | 358 | [OV7251_24_MHZ] = 24000000,
|
@@ -1065,6 +1077,23 @@ static int ov7251_s_stream(struct v4l2_subdev *subdev, int enable)
|
1065 | 1077 | dev_err(ov7251->dev, "could not sync v4l2 controls\n");
|
1066 | 1078 | goto err_power_down;
|
1067 | 1079 | }
|
| 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 | + |
1068 | 1097 | ret = ov7251_write_reg(ov7251, OV7251_SC_MODE_SELECT,
|
1069 | 1098 | OV7251_SC_MODE_SELECT_STREAMING);
|
1070 | 1099 | if (ret)
|
|
0 commit comments