v4l2: ov5640 support multi stream on
authorliuxl0327 <liuxl0327@starfivetech.com>
Mon, 21 Mar 2022 05:58:07 +0000 (13:58 +0800)
committermason.huo <mason.huo@starfivetech.com>
Fri, 1 Jul 2022 07:05:37 +0000 (15:05 +0800)
Signed-off-by: mason.huo <mason.huo@starfivetech.com>
drivers/media/platform/starfive/v4l2_driver/ov5640.c [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index b125694..b71bf65
@@ -258,7 +258,7 @@ struct ov5640_dev {
        u32 ae_low, ae_high, ae_target;
 
        bool pending_mode_change;
-       bool streaming;
+       int streaming;
 };
 
 static inline struct ov5640_dev *to_ov5640_dev(struct v4l2_subdev *sd)
@@ -2957,9 +2957,11 @@ static int ov5640_s_stream(struct v4l2_subdev *sd, int enable)
                else
                        ret = ov5640_set_stream_dvp(sensor, enable);
 
-               if (!ret)
-                       sensor->streaming = enable;
+               if (ret)
+                       goto out;
        }
+       sensor->streaming += enable ? 1 : -1;
+       WARN_ON(sensor->streaming < 0);
 out:
        mutex_unlock(&sensor->lock);
        return ret;