Skip to content

Commit

Permalink
media: bcm2835-unicam: fix format on s_selection
Browse files Browse the repository at this point in the history
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 <varmavinaym@gmail.com>
  • Loading branch information
vvarma committed Jan 7, 2024
1 parent d3f5b3b commit cb734fd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/media/platform/bcm2835/bcm2835-unicam.c
Original file line number Diff line number Diff line change
Expand Up @@ -1570,6 +1570,7 @@ static int unicam_g_edid(struct file *file, void *priv, struct v4l2_edid *edid)
static int unicam_s_selection(struct file *file, void *priv,
struct v4l2_selection *sel)
{
int ret;
struct unicam_node *node = video_drvdata(file);
struct unicam_device *dev = node->dev;
struct v4l2_subdev_selection sdsel = {
Expand All @@ -1582,8 +1583,12 @@ static int unicam_s_selection(struct file *file, void *priv,
if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;

return v4l2_subdev_call_state_active(dev->sensor, pad, set_selection,
&sdsel);
ret = v4l2_subdev_call_state_active(dev->sensor, pad, set_selection,
&sdsel);
if (ret < 0)
return ret;
node->v_fmt.fmt.pix.bytesperline = 0;
return unicam_reset_format(node);
}

static int unicam_g_selection(struct file *file, void *priv,
Expand Down

0 comments on commit cb734fd

Please sign in to comment.