]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/media/video/em28xx/em28xx-video.c
V4L/DVB (7617): Removes a manual mode setup
[karo-tx-linux.git] / drivers / media / video / em28xx / em28xx-video.c
index fb533fda2198308200975716176166aba62b1809..8996175cc95075bca9c42c89501a2adc51bd12fc 100644 (file)
@@ -391,8 +391,6 @@ buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size)
        if (*count < EM28XX_MIN_BUF)
                *count = EM28XX_MIN_BUF;
 
-       dev->mode = EM28XX_ANALOG_MODE;
-
        /* Ask tuner to go to analog mode */
        memset(&f, 0, sizeof(f));
        f.frequency = dev->ctl_freq;
@@ -461,7 +459,7 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
        if (urb_init) {
                rc = em28xx_init_isoc(dev, EM28XX_NUM_PACKETS,
                                      EM28XX_NUM_BUFS, dev->max_pkt_size,
-                                     em28xx_isoc_copy, EM28XX_ANALOG_CAPTURE);
+                                     em28xx_isoc_copy);
                if (rc < 0)
                        goto fail;
        }
@@ -1534,8 +1532,8 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp)
        em28xx_videodbg("open minor=%d type=%s users=%d\n",
                                minor, v4l2_type_names[fh_type], dev->users);
 
-       fh = kzalloc(sizeof(struct em28xx_fh), GFP_KERNEL);
 
+       fh = kzalloc(sizeof(struct em28xx_fh), GFP_KERNEL);
        if (!fh) {
                em28xx_errdev("em28xx-video.c: Out of memory?!\n");
                return -ENOMEM;
@@ -1552,9 +1550,15 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp)
                dev->hscale = 0;
                dev->vscale = 0;
 
+               em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
                em28xx_set_alternate(dev);
                em28xx_resolution_set(dev);
 
+               /* Needed, since GPIO might have disabled power of
+                  some i2c device
+                */
+               em28xx_config_i2c(dev);
+
        }
        if (fh->radio) {
                em28xx_videodbg("video_open: setting radio device\n");
@@ -1568,6 +1572,7 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp)
                        sizeof(struct em28xx_buffer), fh);
 
        mutex_unlock(&dev->lock);
+
        return errCode;
 }
 
@@ -1647,6 +1652,7 @@ static int em28xx_v4l2_close(struct inode *inode, struct file *filp)
 
                /* do this before setting alternate! */
                em28xx_uninit_isoc(dev);
+               em28xx_set_mode(dev, EM28XX_MODE_UNDEFINED);
 
                /* set alternate 0 */
                dev->alt = 0;