diff options
-rw-r--r-- | drivers/media/video/em28xx/em28xx-video.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 416b691c33c1..d40650655f74 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -886,10 +886,10 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i) | |||
886 | if (0 == INPUT(i)->type) | 886 | if (0 == INPUT(i)->type) |
887 | return -EINVAL; | 887 | return -EINVAL; |
888 | 888 | ||
889 | mutex_lock(&dev->lock); | 889 | dev->ctl_input = i; |
890 | |||
891 | video_mux(dev, i); | ||
892 | 890 | ||
891 | mutex_lock(&dev->lock); | ||
892 | video_mux(dev, dev->ctl_input); | ||
893 | mutex_unlock(&dev->lock); | 893 | mutex_unlock(&dev->lock); |
894 | return 0; | 894 | return 0; |
895 | } | 895 | } |
@@ -939,6 +939,12 @@ static int vidioc_s_audio(struct file *file, void *priv, struct v4l2_audio *a) | |||
939 | struct em28xx_fh *fh = priv; | 939 | struct em28xx_fh *fh = priv; |
940 | struct em28xx *dev = fh->dev; | 940 | struct em28xx *dev = fh->dev; |
941 | 941 | ||
942 | |||
943 | if (a->index >= MAX_EM28XX_INPUT) | ||
944 | return -EINVAL; | ||
945 | if (0 == INPUT(a->index)->type) | ||
946 | return -EINVAL; | ||
947 | |||
942 | mutex_lock(&dev->lock); | 948 | mutex_lock(&dev->lock); |
943 | 949 | ||
944 | dev->ctl_ainput = INPUT(a->index)->amux; | 950 | dev->ctl_ainput = INPUT(a->index)->amux; |
@@ -1957,9 +1963,22 @@ int em28xx_register_analog_devices(struct em28xx *dev) | |||
1957 | (EM28XX_VERSION_CODE >> 16) & 0xff, | 1963 | (EM28XX_VERSION_CODE >> 16) & 0xff, |
1958 | (EM28XX_VERSION_CODE >> 8) & 0xff, EM28XX_VERSION_CODE & 0xff); | 1964 | (EM28XX_VERSION_CODE >> 8) & 0xff, EM28XX_VERSION_CODE & 0xff); |
1959 | 1965 | ||
1966 | /* set default norm */ | ||
1967 | dev->norm = em28xx_video_template.current_norm; | ||
1968 | dev->width = norm_maxw(dev); | ||
1969 | dev->height = norm_maxh(dev); | ||
1970 | dev->interlaced = EM28XX_INTERLACED_DEFAULT; | ||
1971 | dev->hscale = 0; | ||
1972 | dev->vscale = 0; | ||
1973 | dev->ctl_input = 0; | ||
1974 | |||
1960 | /* Analog specific initialization */ | 1975 | /* Analog specific initialization */ |
1961 | dev->format = &format[0]; | 1976 | dev->format = &format[0]; |
1962 | video_mux(dev, 0); | 1977 | video_mux(dev, dev->ctl_input); |
1978 | |||
1979 | /* Audio defaults */ | ||
1980 | dev->mute = 1; | ||
1981 | dev->volume = 0x1f; | ||
1963 | 1982 | ||
1964 | /* enable vbi capturing */ | 1983 | /* enable vbi capturing */ |
1965 | 1984 | ||
@@ -1967,24 +1986,10 @@ int em28xx_register_analog_devices(struct em28xx *dev) | |||
1967 | /* em28xx_write_reg(dev, EM28XX_R0F_XCLK, 0x80); clk register */ | 1986 | /* em28xx_write_reg(dev, EM28XX_R0F_XCLK, 0x80); clk register */ |
1968 | em28xx_write_reg(dev, EM28XX_R11_VINCTRL, 0x51); | 1987 | em28xx_write_reg(dev, EM28XX_R11_VINCTRL, 0x51); |
1969 | 1988 | ||
1970 | dev->mute = 1; /* maybe not the right place... */ | ||
1971 | dev->volume = 0x1f; | ||
1972 | |||
1973 | em28xx_set_outfmt(dev); | 1989 | em28xx_set_outfmt(dev); |
1974 | em28xx_colorlevels_set_default(dev); | 1990 | em28xx_colorlevels_set_default(dev); |
1975 | em28xx_compression_disable(dev); | 1991 | em28xx_compression_disable(dev); |
1976 | 1992 | ||
1977 | /* set default norm */ | ||
1978 | dev->norm = em28xx_video_template.current_norm; | ||
1979 | dev->width = norm_maxw(dev); | ||
1980 | dev->height = norm_maxh(dev); | ||
1981 | dev->interlaced = EM28XX_INTERLACED_DEFAULT; | ||
1982 | dev->hscale = 0; | ||
1983 | dev->vscale = 0; | ||
1984 | |||
1985 | /* FIXME: This is a very bad hack! Not all devices have TV on input 2 */ | ||
1986 | dev->ctl_input = 2; | ||
1987 | |||
1988 | /* allocate and fill video video_device struct */ | 1993 | /* allocate and fill video video_device struct */ |
1989 | dev->vdev = em28xx_vdev_init(dev, &em28xx_video_template, "video"); | 1994 | dev->vdev = em28xx_vdev_init(dev, &em28xx_video_template, "video"); |
1990 | if (!dev->vdev) { | 1995 | if (!dev->vdev) { |