[media] em28xx: fix implementation of s_stream
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 26 Jan 2016 08:59:39 +0000 (06:59 -0200)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 26 Jan 2016 09:12:54 +0000 (07:12 -0200)
On em28xx driver, s_stream subdev ops was not implemented
properly. It was used only to disable stream, never enabling it.
That was the root cause of the regression when we added support
for s_stream on tvp5150 driver.

With that, we can get rid of the changes on tvp5150 side,
e. g. changeset 47de9bf8931e ('[media] tvp5150: Fix breakage for serial usage').

Tested video output on em2820+tvp5150 on WinTV USB2 and
video and/or vbi output on em288x+tvp5150 on HVR 950.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/usb/em28xx/em28xx-video.c

index 0e86ff4..6a015e8 100644 (file)
@@ -196,7 +196,6 @@ static void em28xx_wake_i2c(struct em28xx *dev)
        v4l2_device_call_all(v4l2_dev, 0, core,  reset, 0);
        v4l2_device_call_all(v4l2_dev, 0, video, s_routing,
                             INPUT(dev->ctl_input)->vmux, 0, 0);
-       v4l2_device_call_all(v4l2_dev, 0, video, s_stream, 0);
 }
 
 static int em28xx_colorlevels_set_default(struct em28xx *dev)
@@ -962,6 +961,9 @@ int em28xx_start_analog_streaming(struct vb2_queue *vq, unsigned int count)
                        f.type = V4L2_TUNER_ANALOG_TV;
                v4l2_device_call_all(&v4l2->v4l2_dev,
                                     0, tuner, s_frequency, &f);
+
+               /* Enable video stream at TV decoder */
+               v4l2_device_call_all(&v4l2->v4l2_dev, 0, video, s_stream, 1);
        }
 
        v4l2->streaming_users++;
@@ -981,6 +983,9 @@ static void em28xx_stop_streaming(struct vb2_queue *vq)
        res_free(dev, vq->type);
 
        if (v4l2->streaming_users-- == 1) {
+               /* Disable video stream at TV decoder */
+               v4l2_device_call_all(&v4l2->v4l2_dev, 0, video, s_stream, 0);
+
                /* Last active user, so shutdown all the URBS */
                em28xx_uninit_usb_xfer(dev, EM28XX_ANALOG_MODE);
        }
@@ -1013,6 +1018,9 @@ void em28xx_stop_vbi_streaming(struct vb2_queue *vq)
        res_free(dev, vq->type);
 
        if (v4l2->streaming_users-- == 1) {
+               /* Disable video stream at TV decoder */
+               v4l2_device_call_all(&v4l2->v4l2_dev, 0, video, s_stream, 0);
+
                /* Last active user, so shutdown all the URBS */
                em28xx_uninit_usb_xfer(dev, EM28XX_ANALOG_MODE);
        }