[media] saa7134: Get rid of struct saa7134_input.tv field
[cascardo/linux.git] / drivers / media / pci / saa7134 / saa7134-video.c
index a63c136..9debfb5 100644 (file)
@@ -409,7 +409,8 @@ static void set_tvnorm(struct saa7134_dev *dev, struct saa7134_tvnorm *norm)
 
 static void video_mux(struct saa7134_dev *dev, int input)
 {
-       video_dbg("video input = %d [%s]\n", input, card_in(dev, input).name);
+       video_dbg("video input = %d [%s]\n",
+                 input, saa7134_input_name[card_in(dev, input).type]);
        dev->ctl_input = input;
        set_tvnorm(dev, dev->tvnorm);
        saa7134_tvaudio_setinput(dev, &card_in(dev, input));
@@ -478,8 +479,7 @@ void saa7134_set_tvnorm_hw(struct saa7134_dev *dev)
 {
        saa7134_set_decoder(dev);
 
-       if (card_in(dev, dev->ctl_input).tv)
-               saa_call_all(dev, video, s_std, dev->tvnorm->id);
+       saa_call_all(dev, video, s_std, dev->tvnorm->id);
        /* Set the correct norm for the saa6752hs. This function
           does nothing if there is no saa6752hs. */
        saa_call_empress(dev, video, s_std, dev->tvnorm->id);
@@ -1381,13 +1381,19 @@ int saa7134_enum_input(struct file *file, void *priv, struct v4l2_input *i)
        n = i->index;
        if (n >= SAA7134_INPUT_MAX)
                return -EINVAL;
-       if (NULL == card_in(dev, i->index).name)
+       if (card_in(dev, i->index).type == SAA7134_NO_INPUT)
                return -EINVAL;
        i->index = n;
-       i->type  = V4L2_INPUT_TYPE_CAMERA;
-       strcpy(i->name, card_in(dev, n).name);
-       if (card_in(dev, n).tv)
+       strcpy(i->name, saa7134_input_name[card_in(dev, n).type]);
+       switch (card_in(dev, n).type) {
+       case SAA7134_INPUT_TV:
+       case SAA7134_INPUT_TV_MONO:
                i->type = V4L2_INPUT_TYPE_TUNER;
+               break;
+       default:
+               i->type  = V4L2_INPUT_TYPE_CAMERA;
+               break;
+       }
        if (n == dev->ctl_input) {
                int v1 = saa_readb(SAA7134_STATUS_VIDEO1);
                int v2 = saa_readb(SAA7134_STATUS_VIDEO2);
@@ -1419,7 +1425,7 @@ int saa7134_s_input(struct file *file, void *priv, unsigned int i)
 
        if (i >= SAA7134_INPUT_MAX)
                return -EINVAL;
-       if (NULL == card_in(dev, i).name)
+       if (card_in(dev, i).type == SAA7134_NO_INPUT)
                return -EINVAL;
        video_mux(dev, i);
        return 0;
@@ -1656,12 +1662,13 @@ int saa7134_g_tuner(struct file *file, void *priv,
                return -EINVAL;
        memset(t, 0, sizeof(*t));
        for (n = 0; n < SAA7134_INPUT_MAX; n++) {
-               if (card_in(dev, n).tv)
+               if (card_in(dev, n).type == SAA7134_INPUT_TV ||
+                   card_in(dev, n).type == SAA7134_INPUT_TV_MONO)
                        break;
        }
        if (n == SAA7134_INPUT_MAX)
                return -EINVAL;
-       if (NULL != card_in(dev, n).name) {
+       if (card_in(dev, n).type != SAA7134_NO_INPUT) {
                strcpy(t->name, "Television");
                t->type = V4L2_TUNER_ANALOG_TV;
                saa_call_all(dev, tuner, g_tuner, t);
@@ -1906,6 +1913,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
        .vidioc_querybuf                = vb2_ioctl_querybuf,
        .vidioc_qbuf                    = vb2_ioctl_qbuf,
        .vidioc_dqbuf                   = vb2_ioctl_dqbuf,
+       .vidioc_expbuf                  = vb2_ioctl_expbuf,
        .vidioc_s_std                   = saa7134_s_std,
        .vidioc_g_std                   = saa7134_g_std,
        .vidioc_querystd                = saa7134_querystd,
@@ -2089,7 +2097,7 @@ int saa7134_video_init1(struct saa7134_dev *dev)
         * USERPTR support is a no-go unless the application knows about these
         * limitations and has special support for this.
         */
-       q->io_modes = VB2_MMAP | VB2_READ;
+       q->io_modes = VB2_MMAP | VB2_DMABUF | VB2_READ;
        if (saa7134_userptr)
                q->io_modes |= VB2_USERPTR;
        q->drv_priv = &dev->video_q;