Skip to content

Commit f13b79a

Browse files
committed
media: bcm2835-unicam: fix format on s_selection
the selection API may update the subdev's format. In order to ensure that the `GET_FMT` ioctl calls remain in sync with the subdev's state, a call to reset_format is done at the end of the `s_selection` call. Signed-off-by: Vinay Varma <[email protected]>
1 parent 6e93264 commit f13b79a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/media/platform/bcm2835/bcm2835-unicam.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,6 +1570,7 @@ static int unicam_g_edid(struct file *file, void *priv, struct v4l2_edid *edid)
15701570
static int unicam_s_selection(struct file *file, void *priv,
15711571
struct v4l2_selection *sel)
15721572
{
1573+
int ret;
15731574
struct unicam_node *node = video_drvdata(file);
15741575
struct unicam_device *dev = node->dev;
15751576
struct v4l2_subdev_selection sdsel = {
@@ -1582,8 +1583,12 @@ static int unicam_s_selection(struct file *file, void *priv,
15821583
if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
15831584
return -EINVAL;
15841585

1585-
return v4l2_subdev_call_state_active(dev->sensor, pad, set_selection,
1586-
&sdsel);
1586+
ret = v4l2_subdev_call_state_active(dev->sensor, pad, set_selection,
1587+
&sdsel);
1588+
if (ret < 0)
1589+
return ret;
1590+
node->v_fmt.fmt.pix.bytesperline = 0;
1591+
return unicam_reset_format(node);
15871592
}
15881593

15891594
static int unicam_g_selection(struct file *file, void *priv,

0 commit comments

Comments
 (0)