@@ -1747,26 +1747,45 @@ static void imx519_stop_streaming(struct imx519 *imx519)
1747
1747
pm_runtime_put (& client -> dev );
1748
1748
}
1749
1749
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 )
1751
1753
{
1752
1754
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 );
1757
1755
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 ;
1762
1762
1763
1763
/* 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 );
1766
1766
1767
- v4l2_subdev_unlock_state (state );
1767
+ return imx519_start_streaming (imx519 );
1768
+ }
1768
1769
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 ;
1770
1789
}
1771
1790
1772
1791
/* Power/clock management functions */
@@ -1863,22 +1882,19 @@ static const struct v4l2_subdev_core_ops imx519_core_ops = {
1863
1882
.unsubscribe_event = v4l2_event_subdev_unsubscribe ,
1864
1883
};
1865
1884
1866
- static const struct v4l2_subdev_video_ops imx519_video_ops = {
1867
- .s_stream = imx519_set_stream ,
1868
- };
1869
-
1870
1885
static const struct v4l2_subdev_pad_ops imx519_pad_ops = {
1871
1886
.enum_mbus_code = imx519_enum_mbus_code ,
1872
1887
.get_fmt = v4l2_subdev_get_fmt ,
1873
1888
.set_fmt = imx519_set_pad_format ,
1874
1889
.get_selection = imx519_get_selection ,
1875
1890
.enum_frame_size = imx519_enum_frame_size ,
1876
1891
.get_frame_desc = imx519_get_frame_desc ,
1892
+ .enable_streams = imx519_enable_streams ,
1893
+ .disable_streams = imx519_disable_streams ,
1877
1894
};
1878
1895
1879
1896
static const struct v4l2_subdev_ops imx519_subdev_ops = {
1880
1897
.core = & imx519_core_ops ,
1881
- .video = & imx519_video_ops ,
1882
1898
.pad = & imx519_pad_ops ,
1883
1899
};
1884
1900
0 commit comments