media: i2c: imx296: Replace streaming flag with runtime PM check
The streaming flag in the driver private structure is used for the sole purpose of gating register writes when setting a V4L2 control. This is better handled by checking if the sensor is powered up using the runtime PM API. Do so and drop the streaming flag. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tommaso Merciai <tomm.merciai@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
parent
b2b5905aa5
commit
def13c37e7
@ -201,8 +201,6 @@ struct imx296 {
|
||||
const struct imx296_clk_params *clk_params;
|
||||
bool mono;
|
||||
|
||||
bool streaming;
|
||||
|
||||
struct v4l2_subdev subdev;
|
||||
struct media_pad pad;
|
||||
|
||||
@ -321,7 +319,7 @@ static int imx296_s_ctrl(struct v4l2_ctrl *ctrl)
|
||||
unsigned int vmax;
|
||||
int ret = 0;
|
||||
|
||||
if (!sensor->streaming)
|
||||
if (!pm_runtime_get_if_in_use(sensor->dev))
|
||||
return 0;
|
||||
|
||||
state = v4l2_subdev_get_locked_active_state(&sensor->subdev);
|
||||
@ -376,6 +374,8 @@ static int imx296_s_ctrl(struct v4l2_ctrl *ctrl)
|
||||
break;
|
||||
}
|
||||
|
||||
pm_runtime_put(sensor->dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -607,8 +607,6 @@ static int imx296_s_stream(struct v4l2_subdev *sd, int enable)
|
||||
pm_runtime_mark_last_busy(sensor->dev);
|
||||
pm_runtime_put_autosuspend(sensor->dev);
|
||||
|
||||
sensor->streaming = false;
|
||||
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
@ -620,13 +618,6 @@ static int imx296_s_stream(struct v4l2_subdev *sd, int enable)
|
||||
if (ret < 0)
|
||||
goto err_pm;
|
||||
|
||||
/*
|
||||
* Set streaming to true to ensure __v4l2_ctrl_handler_setup() will set
|
||||
* the controls. The flag is reset to false further down if an error
|
||||
* occurs.
|
||||
*/
|
||||
sensor->streaming = true;
|
||||
|
||||
ret = __v4l2_ctrl_handler_setup(&sensor->ctrls);
|
||||
if (ret < 0)
|
||||
goto err_pm;
|
||||
@ -646,7 +637,6 @@ err_pm:
|
||||
* likely has no other chance to recover.
|
||||
*/
|
||||
pm_runtime_put_sync(sensor->dev);
|
||||
sensor->streaming = false;
|
||||
|
||||
goto unlock;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user