diff options
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-video.c')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-video.c | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 416b691c33c1..8e61b2ca9167 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; |
@@ -1950,6 +1956,7 @@ static struct video_device *em28xx_vdev_init(struct em28xx *dev, | |||
1950 | 1956 | ||
1951 | int em28xx_register_analog_devices(struct em28xx *dev) | 1957 | int em28xx_register_analog_devices(struct em28xx *dev) |
1952 | { | 1958 | { |
1959 | u8 val; | ||
1953 | int ret; | 1960 | int ret; |
1954 | 1961 | ||
1955 | printk(KERN_INFO "%s: v4l2 driver version %d.%d.%d\n", | 1962 | printk(KERN_INFO "%s: v4l2 driver version %d.%d.%d\n", |
@@ -1957,34 +1964,34 @@ int em28xx_register_analog_devices(struct em28xx *dev) | |||
1957 | (EM28XX_VERSION_CODE >> 16) & 0xff, | 1964 | (EM28XX_VERSION_CODE >> 16) & 0xff, |
1958 | (EM28XX_VERSION_CODE >> 8) & 0xff, EM28XX_VERSION_CODE & 0xff); | 1965 | (EM28XX_VERSION_CODE >> 8) & 0xff, EM28XX_VERSION_CODE & 0xff); |
1959 | 1966 | ||
1967 | /* set default norm */ | ||
1968 | dev->norm = em28xx_video_template.current_norm; | ||
1969 | dev->width = norm_maxw(dev); | ||
1970 | dev->height = norm_maxh(dev); | ||
1971 | dev->interlaced = EM28XX_INTERLACED_DEFAULT; | ||
1972 | dev->hscale = 0; | ||
1973 | dev->vscale = 0; | ||
1974 | dev->ctl_input = 0; | ||
1975 | |||
1960 | /* Analog specific initialization */ | 1976 | /* Analog specific initialization */ |
1961 | dev->format = &format[0]; | 1977 | dev->format = &format[0]; |
1962 | video_mux(dev, 0); | 1978 | video_mux(dev, dev->ctl_input); |
1979 | |||
1980 | /* Audio defaults */ | ||
1981 | dev->mute = 1; | ||
1982 | dev->volume = 0x1f; | ||
1963 | 1983 | ||
1964 | /* enable vbi capturing */ | 1984 | /* enable vbi capturing */ |
1965 | 1985 | ||
1966 | /* em28xx_write_reg(dev, EM28XX_R0E_AUDIOSRC, 0xc0); audio register */ | 1986 | /* em28xx_write_reg(dev, EM28XX_R0E_AUDIOSRC, 0xc0); audio register */ |
1967 | /* em28xx_write_reg(dev, EM28XX_R0F_XCLK, 0x80); clk register */ | 1987 | val = (u8)em28xx_read_reg(dev, EM28XX_R0F_XCLK); |
1988 | em28xx_write_reg(dev, EM28XX_R0F_XCLK, (EM28XX_XCLK_AUDIO_UNMUTE | val)); | ||
1968 | em28xx_write_reg(dev, EM28XX_R11_VINCTRL, 0x51); | 1989 | em28xx_write_reg(dev, EM28XX_R11_VINCTRL, 0x51); |
1969 | 1990 | ||
1970 | dev->mute = 1; /* maybe not the right place... */ | ||
1971 | dev->volume = 0x1f; | ||
1972 | |||
1973 | em28xx_set_outfmt(dev); | 1991 | em28xx_set_outfmt(dev); |
1974 | em28xx_colorlevels_set_default(dev); | 1992 | em28xx_colorlevels_set_default(dev); |
1975 | em28xx_compression_disable(dev); | 1993 | em28xx_compression_disable(dev); |
1976 | 1994 | ||
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 */ | 1995 | /* allocate and fill video video_device struct */ |
1989 | dev->vdev = em28xx_vdev_init(dev, &em28xx_video_template, "video"); | 1996 | dev->vdev = em28xx_vdev_init(dev, &em28xx_video_template, "video"); |
1990 | if (!dev->vdev) { | 1997 | if (!dev->vdev) { |