v4l2: Fixed vin line stream_out not change except WR.
authorchanghuang.liang <changhuang.liang@starfivetech.com>
Mon, 10 Oct 2022 12:18:20 +0000 (20:18 +0800)
committermason.huo <mason.huo@starfivetech.com>
Thu, 27 Oct 2022 05:55:41 +0000 (13:55 +0800)
Fixed vin line stream_out not change except WR.

Signed-off-by: changhuang.liang <changhuang.liang@starfivetech.com>
drivers/media/platform/starfive/v4l2_driver/stf_vin.c

index ca60869..0c3c5e4 100644 (file)
@@ -623,23 +623,25 @@ static int vin_set_stream(struct v4l2_subdev *sd, int enable)
        }
        mutex_unlock(&dummy_buffer->stream_lock);
 
-       if (line->id == VIN_LINE_WR) {
-               mutex_lock(&line->stream_lock);
-               if (enable) {
-                       if (line->stream_count == 0) {
+       mutex_lock(&line->stream_lock);
+       if (enable) {
+               if (line->stream_count == 0) {
+                       if (line->id == VIN_LINE_WR) {
                                vin_dev->hw_ops->vin_wr_irq_enable(vin_dev, 1);
                                vin_dev->hw_ops->vin_wr_stream_set(vin_dev, 1);
                        }
-                       line->stream_count++;
-               } else {
-                       if (line->stream_count == 1) {
+               }
+               line->stream_count++;
+       } else {
+               if (line->stream_count == 1) {
+                       if (line->id == VIN_LINE_WR) {
                                vin_dev->hw_ops->vin_wr_irq_enable(vin_dev, 0);
                                vin_dev->hw_ops->vin_wr_stream_set(vin_dev, 0);
                        }
-                       line->stream_count--;
                }
-               mutex_unlock(&line->stream_lock);
+               line->stream_count--;
        }
+       mutex_unlock(&line->stream_lock);
 
        if (enable)
                vin_enable_output(line);