media: v4l2_driver: Supplement the missing runtime pm get ops on more than once strea...
authorKevin.xie <kevin.xie@starfivetech.com>
Tue, 8 Nov 2022 08:37:45 +0000 (16:37 +0800)
committerChanghuang Liang <changhuang.liang@starfivetech.com>
Wed, 9 Nov 2022 01:25:26 +0000 (09:25 +0800)
For example, if we run stf_isp_ctrl & v4l2test at the same time,
s_stream for sensor will be called twice,
so that rpm should be got twice too.

Signed-off-by: Kevin.xie <kevin.xie@starfivetech.com>
drivers/media/platform/starfive/v4l2_driver/imx219_mipi.c

index 9bc20d1..7230fac 100644 (file)
@@ -1144,16 +1144,18 @@ static int imx219_set_stream(struct v4l2_subdev *sd, int enable)
        int ret = 0;
 
        mutex_lock(&imx219->mutex);
-       if (imx219->streaming && enable)
-               goto unlock;
 
        if (enable) {
                ret = pm_runtime_get_sync(&client->dev);
                if (ret < 0) {
                        pm_runtime_put_noidle(&client->dev);
+                       mutex_unlock(&imx219->mutex);
                        return ret;
                }
 
+               if (imx219->streaming)
+                       goto unlock;
+
                /*
                 * Apply default & customized values
                 * and then start streaming.