Commit 745d4612 authored by Lad Prabhakar's avatar Lad Prabhakar Committed by Mauro Carvalho Chehab

media: i2c: imx219: Move out locking/unlocking of vflip and hflip controls from imx219_set_stream

Move out locking/unlocking of vflip and hflip controls from
imx219_set_stream() to the imx219_start_streaming()/
imx219_stop_streaming() respectively.

This fixes an issue in resume callback error path where streaming is
stopped and the controls are left in locked state.

Fixes: 1283b3b8 ("media: i2c: Add driver for Sony IMX219 sensor")
Reported-by: default avatarPavel Machek <pavel@denx.de>
Signed-off-by: default avatarLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 15786f7b
...@@ -1056,8 +1056,16 @@ static int imx219_start_streaming(struct imx219 *imx219) ...@@ -1056,8 +1056,16 @@ static int imx219_start_streaming(struct imx219 *imx219)
return ret; return ret;
/* set stream on register */ /* set stream on register */
return imx219_write_reg(imx219, IMX219_REG_MODE_SELECT, ret = imx219_write_reg(imx219, IMX219_REG_MODE_SELECT,
IMX219_REG_VALUE_08BIT, IMX219_MODE_STREAMING); IMX219_REG_VALUE_08BIT, IMX219_MODE_STREAMING);
if (ret)
return ret;
/* vflip and hflip cannot change during streaming */
__v4l2_ctrl_grab(imx219->vflip, true);
__v4l2_ctrl_grab(imx219->hflip, true);
return 0;
} }
static void imx219_stop_streaming(struct imx219 *imx219) static void imx219_stop_streaming(struct imx219 *imx219)
...@@ -1070,6 +1078,9 @@ static void imx219_stop_streaming(struct imx219 *imx219) ...@@ -1070,6 +1078,9 @@ static void imx219_stop_streaming(struct imx219 *imx219)
IMX219_REG_VALUE_08BIT, IMX219_MODE_STANDBY); IMX219_REG_VALUE_08BIT, IMX219_MODE_STANDBY);
if (ret) if (ret)
dev_err(&client->dev, "%s failed to set stream\n", __func__); dev_err(&client->dev, "%s failed to set stream\n", __func__);
__v4l2_ctrl_grab(imx219->vflip, false);
__v4l2_ctrl_grab(imx219->hflip, false);
} }
static int imx219_set_stream(struct v4l2_subdev *sd, int enable) static int imx219_set_stream(struct v4l2_subdev *sd, int enable)
...@@ -1105,10 +1116,6 @@ static int imx219_set_stream(struct v4l2_subdev *sd, int enable) ...@@ -1105,10 +1116,6 @@ static int imx219_set_stream(struct v4l2_subdev *sd, int enable)
imx219->streaming = enable; imx219->streaming = enable;
/* vflip and hflip cannot change during streaming */
__v4l2_ctrl_grab(imx219->vflip, enable);
__v4l2_ctrl_grab(imx219->hflip, enable);
mutex_unlock(&imx219->mutex); mutex_unlock(&imx219->mutex);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment