]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
V4L/DVB (3700): Remove obsolete commands from tvp5150.c
authorHans Verkuil <hverkuil@xs4all.nl>
Sat, 1 Apr 2006 19:40:21 +0000 (16:40 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 2 Apr 2006 07:56:09 +0000 (04:56 -0300)
- Remove old DECODER_ commands from tvp5150.c, replacing them with newer
  ones if appropriate.
- Small VIDIOC_G_TUNER fixes in msp3400 and tuner.
- Fix VIDIOC_S_TUNER support in em28xx.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/em28xx/em28xx-video.c
drivers/media/video/msp3400-driver.c
drivers/media/video/tuner-core.c
drivers/media/video/tvp5150.c

index dfba33d0fa617ec41f3a8cf902e2af06d9421dac..daa2ac2e6b901776a8b01cab8495e3bd3e5fb2cc 100644 (file)
@@ -1141,26 +1141,16 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp,
        case VIDIOC_G_TUNER:
        {
                struct v4l2_tuner *t = arg;
-               int status = 0;
 
                if (0 != t->index)
                        return -EINVAL;
 
                memset(t, 0, sizeof(*t));
                strcpy(t->name, "Tuner");
-               t->type = V4L2_TUNER_ANALOG_TV;
-               t->capability = V4L2_TUNER_CAP_NORM;
-               t->rangehigh = 0xffffffffUL;    /* FIXME: set correct range */
-/*             t->signal = 0xffff;*/
-/*             em28xx_i2c_call_clients(dev,VIDIOC_G_TUNER,t);*/
-               /* No way to get signal strength? */
                mutex_lock(&dev->lock);
-               em28xx_i2c_call_clients(dev, DECODER_GET_STATUS,
-                                       &status);
+               /* let clients fill in the remainder of this struct */
+               em28xx_i2c_call_clients(dev, cmd, t);
                mutex_unlock(&dev->lock);
-               t->signal =
-                       (status & DECODER_STATUS_GOOD) != 0 ? 0xffff : 0;
-
                em28xx_videodbg("VIDIO_G_TUNER: signal=%x, afc=%x\n", t->signal,
                                t->afc);
                return 0;
@@ -1168,26 +1158,13 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp,
        case VIDIOC_S_TUNER:
        {
                struct v4l2_tuner *t = arg;
-               int status = 0;
 
                if (0 != t->index)
                        return -EINVAL;
-               memset(t, 0, sizeof(*t));
-               strcpy(t->name, "Tuner");
-               t->type = V4L2_TUNER_ANALOG_TV;
-               t->capability = V4L2_TUNER_CAP_NORM;
-               t->rangehigh = 0xffffffffUL;    /* FIXME: set correct range */
-/*             t->signal = 0xffff; */
-               /* No way to get signal strength? */
                mutex_lock(&dev->lock);
-               em28xx_i2c_call_clients(dev, DECODER_GET_STATUS,
-                                       &status);
+               /* let clients handle this */
+               em28xx_i2c_call_clients(dev, cmd, t);
                mutex_unlock(&dev->lock);
-               t->signal =
-                       (status & DECODER_STATUS_GOOD) != 0 ? 0xffff : 0;
-
-               em28xx_videodbg("VIDIO_S_TUNER: signal=%x, afc=%x\n",
-                               t->signal, t->afc);
                return 0;
        }
        case VIDIOC_G_FREQUENCY:
index a82a26aa1e48b5a9e846f7f4fccc3ee86102158c..b806999d6e0fc69e11c01c2accf67ba4a38562d5 100644 (file)
@@ -703,7 +703,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
                        msp_detect_stereo(client);
                vt->audmode    = state->audmode;
                vt->rxsubchans = state->rxsubchans;
-               vt->capability = V4L2_TUNER_CAP_STEREO |
+               vt->capability |= V4L2_TUNER_CAP_STEREO |
                        V4L2_TUNER_CAP_LANG1 | V4L2_TUNER_CAP_LANG2;
                break;
        }
index d68137f2eb8c3eb0b24dba961ac41f8bb8d76be8..1013b4de89a278c21ebf017a452e7cf73716b226 100644 (file)
@@ -744,6 +744,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
                        switch_v4l2();
 
                        tuner->type = t->mode;
+                       if (t->mode == V4L2_TUNER_ANALOG_TV)
+                               tuner->capability |= V4L2_TUNER_CAP_NORM;
                        if (t->mode != V4L2_TUNER_RADIO) {
                                tuner->rangelow = tv_range[0] * 16;
                                tuner->rangehigh = tv_range[1] * 16;
index 1055423aa2b91c47ca3dab80cee20e7670f60473..dab4973bcf8261f4e5cd3eac842bec218e76f388 100644 (file)
@@ -858,7 +858,6 @@ static int tvp5150_command(struct i2c_client *c,
 
        case 0:
        case VIDIOC_INT_RESET:
-       case DECODER_INIT:
                tvp5150_reset(c);
                break;
        case VIDIOC_S_STD:
@@ -957,99 +956,15 @@ static int tvp5150_command(struct i2c_client *c,
 #endif
 
        case VIDIOC_LOG_STATUS:
-       case DECODER_DUMP:
                dump_reg(c);
                break;
 
-       case DECODER_GET_CAPABILITIES:
+       case VIDIOC_G_TUNER:
                {
-                       struct video_decoder_capability *cap = arg;
-
-                       cap->flags = VIDEO_DECODER_PAL |
-                           VIDEO_DECODER_NTSC |
-                           VIDEO_DECODER_SECAM |
-                           VIDEO_DECODER_AUTO | VIDEO_DECODER_CCIR;
-                       cap->inputs = 3;
-                       cap->outputs = 1;
-                       break;
-               }
-       case DECODER_GET_STATUS:
-               {
-                       int *iarg = arg;
-                       int status;
-                       int res=0;
-                       status = tvp5150_read(c, 0x88);
-                       if(status&0x08){
-                               res |= DECODER_STATUS_COLOR;
-                       }
-                       if(status&0x04 && status&0x02){
-                               res |= DECODER_STATUS_GOOD;
-                       }
-                       *iarg=res;
-                       break;
-               }
-
-       case DECODER_SET_GPIO:
-               break;
-
-       case DECODER_SET_VBI_BYPASS:
-               break;
-
-       case DECODER_SET_NORM:
-               {
-                       int *iarg = arg;
-
-                       switch (*iarg) {
-
-                       case VIDEO_MODE_NTSC:
-                               break;
-
-                       case VIDEO_MODE_PAL:
-                               break;
-
-                       case VIDEO_MODE_SECAM:
-                               break;
-
-                       case VIDEO_MODE_AUTO:
-                               break;
-
-                       default:
-                               return -EINVAL;
-
-                       }
-                       decoder->norm = *iarg;
-                       break;
-               }
-       case DECODER_SET_INPUT:
-               {
-                       int *iarg = arg;
-                       if (*iarg < 0 || *iarg > 3) {
-                               return -EINVAL;
-                       }
-
-                       decoder->input = *iarg;
-                       tvp5150_selmux(c, decoder->input);
-
-                       break;
-               }
-       case DECODER_SET_OUTPUT:
-               {
-                       int *iarg = arg;
-
-                       /* not much choice of outputs */
-                       if (*iarg != 0) {
-                               return -EINVAL;
-                       }
-                       break;
-               }
-       case DECODER_ENABLE_OUTPUT:
-               {
-                       int *iarg = arg;
-
-                       decoder->enable = (*iarg != 0);
-
-                       tvp5150_selmux(c, decoder->input);
+                       struct v4l2_tuner *vt = arg;
+                       int status = tvp5150_read(c, 0x88);
 
+                       vt->signal = ((status & 0x04) && (status & 0x02)) ? 0xffff : 0x0;
                        break;
                }
        case VIDIOC_QUERYCTRL:
@@ -1095,35 +1010,6 @@ static int tvp5150_command(struct i2c_client *c,
                        return -EINVAL;
                }
 
-       case DECODER_SET_PICTURE:
-               {
-                       struct video_picture *pic = arg;
-                       if (decoder->bright != pic->brightness) {
-                               /* We want 0 to 255 we get 0-65535 */
-                               decoder->bright = pic->brightness;
-                               tvp5150_write(c, TVP5150_BRIGHT_CTL,
-                                             decoder->bright >> 8);
-                       }
-                       if (decoder->contrast != pic->contrast) {
-                               /* We want 0 to 255 we get 0-65535 */
-                               decoder->contrast = pic->contrast;
-                               tvp5150_write(c, TVP5150_CONTRAST_CTL,
-                                             decoder->contrast >> 8);
-                       }
-                       if (decoder->sat != pic->colour) {
-                               /* We want 0 to 255 we get 0-65535 */
-                               decoder->sat = pic->colour;
-                               tvp5150_write(c, TVP5150_SATURATION_CTL,
-                                             decoder->contrast >> 8);
-                       }
-                       if (decoder->hue != pic->hue) {
-                               /* We want -128 to 127 we get 0-65535 */
-                               decoder->hue = pic->hue;
-                               tvp5150_write(c, TVP5150_HUE_CTL,
-                                             (decoder->hue - 32768) >> 8);
-                       }
-                       break;
-               }
        default:
                return -EINVAL;
        }