]> nv-tegra.nvidia Code Review - linux-4.9.git/commitdiff
usbtuner: fix dvb functionality after v4l2 operation
authorMagdalena Grodzinska <mgrodzinska@nvidia.com>
Sat, 25 Aug 2018 01:19:10 +0000 (18:19 -0700)
committermobile promotions <svcmobile_promotions@nvidia.com>
Wed, 31 Oct 2018 21:59:50 +0000 (14:59 -0700)
Cameraserver calls v4l2_open to check the device type as
soon as a v4l2 device is registered, and then v4l2_close
if the device isn't a camera.

For cx231xx tuners, the device needs to stay in DIGITAL_MODE
for dvb_init, however, in v4l2_open the mode is switched to
ANALOG_MODE, which fails dvb_init. This patch fails v4l2_open
if it's called before dvb_init is done for cx231xx tuners.

For em28xx tuners, v4l2_close resets the usb interface alternate
to 0, which is supposed to be 1 for dvb function to work after
dvb_init. This patch skipped the usb interface reset after dvb_init
for em28xx tuners.

This change is applied only to cx231xx tuner.

Bug 1861283
Bug 2190055

Change-Id: I91eb7ae0e171529ed7c0cf0f07404afb33b32d53
Signed-off-by: Jean Huang <jeanh@nvidia.com>
Reviewed-on: http://git-master/r/1313562
(cherry picked from commit 84c023ba8c6ecada48dceeb86c3eaf7ea7806f63)
Signed-off-by: Magdalena Grodzinska <mgrodzinska@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1806532
(cherry picked from commit b19a0dba6742e0b133c3cc17c2a526dde6182282)
Reviewed-on: https://git-master.nvidia.com/r/1809391
(cherry picked from commit 615e5db2630d409c37712ba68ce7b3c9880f71ac)
Reviewed-on: https://git-master.nvidia.com/r/1938557
Tested-by: Vladislav Zhurba <vzhurba@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
drivers/media/usb/cx231xx/cx231xx-video.c

index a763d5ea43e0906a46fedad5704bbe5ab81ad838..b7f522d994e26a492d86fc45ed36ddd51eea3054 100644 (file)
@@ -1742,7 +1742,7 @@ static int radio_s_tuner(struct file *file, void *priv, const struct v4l2_tuner
  */
 static int cx231xx_v4l2_open(struct file *filp)
 {
-       int radio = 0;
+       int radio = 0, errCode = 0;
        struct video_device *vdev = video_devdata(filp);
        struct cx231xx *dev = video_drvdata(filp);
        struct cx231xx_fh *fh;
@@ -1764,14 +1764,12 @@ static int cx231xx_v4l2_open(struct file *filp)
                         video_device_node_name(vdev), v4l2_type_names[fh_type],
                         dev->users);
 
-#if 0
        errCode = cx231xx_set_mode(dev, CX231XX_ANALOG_MODE);
        if (errCode < 0) {
                dev_err(dev->dev,
                        "Device locked on digital mode. Can't open analog\n");
                return -EBUSY;
        }
-#endif
 
        fh = kzalloc(sizeof(struct cx231xx_fh), GFP_KERNEL);
        if (!fh)