|
49 | 49 | #include <linux/device.h> |
50 | 50 | #include <linux/dma-mapping.h> |
51 | 51 | #include <linux/err.h> |
| 52 | +#include <linux/gpio/consumer.h> |
52 | 53 | #include <linux/init.h> |
53 | 54 | #include <linux/interrupt.h> |
54 | 55 | #include <linux/io.h> |
@@ -543,6 +544,8 @@ struct unicam_device { |
543 | 544 | struct v4l2_device v4l2_dev; |
544 | 545 | struct media_device mdev; |
545 | 546 |
|
| 547 | + struct gpio_desc *sync_gpio; |
| 548 | + |
546 | 549 | /* parent device */ |
547 | 550 | struct platform_device *pdev; |
548 | 551 | /* subdevice async Notifier */ |
@@ -943,6 +946,8 @@ static irqreturn_t unicam_isr(int irq, void *dev) |
943 | 946 | if (fe) { |
944 | 947 | bool inc_seq = unicam->frame_started; |
945 | 948 |
|
| 949 | + if (unicam->sync_gpio) |
| 950 | + gpiod_set_value(unicam->sync_gpio, 0); |
946 | 951 | /* |
947 | 952 | * Ensure we have swapped buffers already as we can't |
948 | 953 | * stop the peripheral. If no buffer is available, use a |
@@ -1003,6 +1008,10 @@ static irqreturn_t unicam_isr(int irq, void *dev) |
1003 | 1008 | * aka frame start. |
1004 | 1009 | */ |
1005 | 1010 | ts = ktime_get_ns(); |
| 1011 | + |
| 1012 | + if (unicam->sync_gpio) |
| 1013 | + gpiod_set_value(unicam->sync_gpio, 1); |
| 1014 | + |
1006 | 1015 | for (i = 0; i < ARRAY_SIZE(unicam->node); i++) { |
1007 | 1016 | if (!unicam->node[i].streaming) |
1008 | 1017 | continue; |
@@ -3407,6 +3416,9 @@ static int unicam_probe(struct platform_device *pdev) |
3407 | 3416 | goto err_unicam_put; |
3408 | 3417 | } |
3409 | 3418 |
|
| 3419 | + unicam->sync_gpio = devm_gpiod_get_optional(&pdev->dev, "sync", |
| 3420 | + GPIOD_OUT_LOW); |
| 3421 | + |
3410 | 3422 | ret = platform_get_irq(pdev, 0); |
3411 | 3423 | if (ret <= 0) { |
3412 | 3424 | dev_err(&pdev->dev, "No IRQ resource\n"); |
|
0 commit comments