Skip to content

Commit 6b29605

Browse files
committed
media: i2c: imx519: Switch to .{enable,disable}_streams() operations
The .s_stream() operation is not compatible with streams, so switch to the .{enable,disable}_streams() operations. Signed-off-by: Jai Luthra <[email protected]>
1 parent 65b0808 commit 6b29605

File tree

1 file changed

+34
-18
lines changed

1 file changed

+34
-18
lines changed

drivers/media/i2c/imx519.c

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,26 +1747,45 @@ static void imx519_stop_streaming(struct imx519 *imx519)
17471747
pm_runtime_put(&client->dev);
17481748
}
17491749

1750-
static int imx519_set_stream(struct v4l2_subdev *sd, int enable)
1750+
static int imx519_enable_streams(struct v4l2_subdev *sd,
1751+
struct v4l2_subdev_state *state, u32 pad,
1752+
u64 streams_mask)
17511753
{
17521754
struct imx519 *imx519 = to_imx519(sd);
1753-
struct v4l2_subdev_state *state;
1754-
int ret = 0;
1755-
1756-
state = v4l2_subdev_lock_and_get_active_state(sd);
17571755

1758-
if (enable)
1759-
ret = imx519_start_streaming(imx519);
1760-
else
1761-
imx519_stop_streaming(imx519);
1756+
/*
1757+
* The image stream controls sensor streaming, as embedded data isn't
1758+
* controllable independently.
1759+
*/
1760+
if (!(streams_mask & BIT(IMX519_STREAM_IMAGE)))
1761+
return 0;
17621762

17631763
/* vflip and hflip cannot change during streaming */
1764-
__v4l2_ctrl_grab(imx519->vflip, enable);
1765-
__v4l2_ctrl_grab(imx519->hflip, enable);
1764+
__v4l2_ctrl_grab(imx519->vflip, true);
1765+
__v4l2_ctrl_grab(imx519->hflip, true);
17661766

1767-
v4l2_subdev_unlock_state(state);
1767+
return imx519_start_streaming(imx519);
1768+
}
17681769

1769-
return ret;
1770+
static int imx519_disable_streams(struct v4l2_subdev *sd,
1771+
struct v4l2_subdev_state *state, u32 pad,
1772+
u64 streams_mask)
1773+
{
1774+
struct imx519 *imx519 = to_imx519(sd);
1775+
1776+
/*
1777+
* The image stream controls sensor streaming, as embedded data isn't
1778+
* controllable independently.
1779+
*/
1780+
if (!(streams_mask & BIT(IMX519_STREAM_IMAGE)))
1781+
return 0;
1782+
1783+
__v4l2_ctrl_grab(imx519->vflip, false);
1784+
__v4l2_ctrl_grab(imx519->hflip, false);
1785+
1786+
imx519_stop_streaming(imx519);
1787+
1788+
return 0;
17701789
}
17711790

17721791
/* Power/clock management functions */
@@ -1863,22 +1882,19 @@ static const struct v4l2_subdev_core_ops imx519_core_ops = {
18631882
.unsubscribe_event = v4l2_event_subdev_unsubscribe,
18641883
};
18651884

1866-
static const struct v4l2_subdev_video_ops imx519_video_ops = {
1867-
.s_stream = imx519_set_stream,
1868-
};
1869-
18701885
static const struct v4l2_subdev_pad_ops imx519_pad_ops = {
18711886
.enum_mbus_code = imx519_enum_mbus_code,
18721887
.get_fmt = v4l2_subdev_get_fmt,
18731888
.set_fmt = imx519_set_pad_format,
18741889
.get_selection = imx519_get_selection,
18751890
.enum_frame_size = imx519_enum_frame_size,
18761891
.get_frame_desc = imx519_get_frame_desc,
1892+
.enable_streams = imx519_enable_streams,
1893+
.disable_streams = imx519_disable_streams,
18771894
};
18781895

18791896
static const struct v4l2_subdev_ops imx519_subdev_ops = {
18801897
.core = &imx519_core_ops,
1881-
.video = &imx519_video_ops,
18821898
.pad = &imx519_pad_ops,
18831899
};
18841900

0 commit comments

Comments
 (0)