summaryrefslogtreecommitdiff
path: root/drivers/media/i2c/ov5640.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2018-03-11 11:34:41 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2018-04-04 06:12:53 -0400
commit19ad26f9e6e1decdde6d48fe1849a06a103b0f09 (patch)
tree12d2b1d470681cfb200b9298eb6a7d89d2e50204 /drivers/media/i2c/ov5640.c
parent4996c3d4cfce30ed30160c511b43d9b491445d7c (diff)
media: ov5640: add missing output pixel format setting
The output pixel format changed by set_fmt() pad operation is not correctly applied. It is intended to be restored by calling ov5640_set_framefmt() when the video stream is started. However, when the device is powered on by s_power subdev operation before the video stream is started, the current output mode setting is restored by ov5640_restore_mode() that also clears pending_mode_change flag in ov5640_set_mode(). So ov5640_set_framefmt() isn't called as intended and the output pixel format is not restored. This change adds the missing output pixel format setting in the ov5640_restore_mode() that is called when the device is powered on. Cc: Steve Longerbeam <slongerbeam@gmail.com> Cc: Hugues Fruchet <hugues.fruchet@st.com> Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/i2c/ov5640.c')
-rw-r--r--drivers/media/i2c/ov5640.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
index 271e8624292e..852026baa2e7 100644
--- a/drivers/media/i2c/ov5640.c
+++ b/drivers/media/i2c/ov5640.c
@@ -1641,6 +1641,9 @@ static int ov5640_set_mode(struct ov5640_dev *sensor,
return 0;
}
+static int ov5640_set_framefmt(struct ov5640_dev *sensor,
+ struct v4l2_mbus_framefmt *format);
+
/* restore the last set video mode after chip power-on */
static int ov5640_restore_mode(struct ov5640_dev *sensor)
{
@@ -1652,7 +1655,11 @@ static int ov5640_restore_mode(struct ov5640_dev *sensor)
return ret;
/* now restore the last capture mode */
- return ov5640_set_mode(sensor, &ov5640_mode_init_data);
+ ret = ov5640_set_mode(sensor, &ov5640_mode_init_data);
+ if (ret < 0)
+ return ret;
+
+ return ov5640_set_framefmt(sensor, &sensor->fmt);
}
static void ov5640_power(struct ov5640_dev *sensor, bool enable)