From 54ac005adcda1a9e4566df6fa87acd4a1c135b80 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Thu, 6 Sep 2007 23:02:23 -0300 Subject: V4L/DVB (6185): cx88-alsa: Add mute controls, change control names Add two mute controls. One mutes everything, the other just mutes the analog pass-through output. Rename the existing volume control. The controls are now: Playback Volume Playback Switch Capture Switch These names might seem odd, but I believe they are more correct. The previous "Capture Volume" control didn't actually effect the volume of the captured audio. Instead it controls the volume of the analog pass-thought output. It appears that pass-through controls like this are usually considered to be in the playback direction, not capture. For example, "CAPTURE feedback Playback Volume" is the name used for a control that appears to have the same effect in the ca0106 driver. We only have one volume control, so we can omit the "CAPTURE feedback" part. If someone where to add PCM playback support to the driver, then this would be the volume control. Signed-off-by: Trent Piepho Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88-alsa.c | 80 ++++++++++++++++++++++++++++++------ 1 file changed, 67 insertions(+), 13 deletions(-) diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c index 141dadf..6cf8609 100644 --- a/drivers/media/video/cx88/cx88-alsa.c +++ b/drivers/media/video/cx88/cx88-alsa.c @@ -82,6 +82,7 @@ typedef struct cx88_audio_dev snd_cx88_card_t; + /**************************************************************************** Module global static vars ****************************************************************************/ @@ -545,8 +546,8 @@ static int __devinit snd_cx88_pcm(snd_cx88_card_t *chip, int device, char *name) /**************************************************************************** CONTROL INTERFACE ****************************************************************************/ -static int snd_cx88_capture_volume_info(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_info *info) +static int snd_cx88_volume_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *info) { info->type = SNDRV_CTL_ELEM_TYPE_INTEGER; info->count = 2; @@ -556,9 +557,8 @@ static int snd_cx88_capture_volume_info(struct snd_kcontrol *kcontrol, return 0; } -/* OK - TODO: test it */ -static int snd_cx88_capture_volume_get(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *value) +static int snd_cx88_volume_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *value) { snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol); struct cx88_core *core=chip->core; @@ -573,8 +573,8 @@ static int snd_cx88_capture_volume_get(struct snd_kcontrol *kcontrol, } /* OK - TODO: test it */ -static int snd_cx88_capture_volume_put(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *value) +static int snd_cx88_volume_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *value) { snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol); struct cx88_core *core=chip->core; @@ -605,14 +605,62 @@ static int snd_cx88_capture_volume_put(struct snd_kcontrol *kcontrol, return changed; } -static struct snd_kcontrol_new snd_cx88_capture_volume = { +static struct snd_kcontrol_new snd_cx88_volume = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "Capture Volume", - .info = snd_cx88_capture_volume_info, - .get = snd_cx88_capture_volume_get, - .put = snd_cx88_capture_volume_put, + .name = "Playback Volume", + .info = snd_cx88_volume_info, + .get = snd_cx88_volume_get, + .put = snd_cx88_volume_put, }; +static int snd_cx88_switch_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *value) +{ + snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol); + struct cx88_core *core = chip->core; + u32 bit = kcontrol->private_value; + + value->value.integer.value[0] = !(cx_read(AUD_VOL_CTL) & bit); + return 0; +} + +static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *value) +{ + snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol); + struct cx88_core *core = chip->core; + u32 bit = kcontrol->private_value; + int ret = 0; + u32 vol; + + spin_lock_irq(&chip->reg_lock); + vol = cx_read(AUD_VOL_CTL); + if (value->value.integer.value[0] != !(vol & bit)) { + vol ^= bit; + cx_write(AUD_VOL_CTL, vol); + ret = 1; + } + spin_unlock_irq(&chip->reg_lock); + return ret; +} + +static struct snd_kcontrol_new snd_cx88_dac_switch = { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "Playback Switch", + .info = snd_ctl_boolean_mono_info, + .get = snd_cx88_switch_get, + .put = snd_cx88_switch_put, + .private_value = (1<<8), +}; + +static struct snd_kcontrol_new snd_cx88_source_switch = { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "Capture Switch", + .info = snd_ctl_boolean_mono_info, + .get = snd_cx88_switch_get, + .put = snd_cx88_switch_put, + .private_value = (1<<6), +}; /**************************************************************************** Basic Flow for Sound Devices @@ -762,7 +810,13 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci, if (err < 0) goto error; - err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_capture_volume, chip)); + err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_volume, chip)); + if (err < 0) + goto error; + err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_dac_switch, chip)); + if (err < 0) + goto error; + err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_source_switch, chip)); if (err < 0) goto error; -- cgit v1.1 From bbaccc04459d5cedb342228084223143fbc285e5 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Thu, 6 Sep 2007 23:02:25 -0300 Subject: V4L/DVB (6187): cx88-alsa: Add TLV support Lets mixer apps display a dB range for the volume control. Signed-off-by: Trent Piepho Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88-alsa.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c index 6cf8609..40ffd7a 100644 --- a/drivers/media/video/cx88/cx88-alsa.c +++ b/drivers/media/video/cx88/cx88-alsa.c @@ -39,6 +39,7 @@ #include #include #include +#include #include "cx88.h" #include "cx88-reg.h" @@ -605,12 +606,17 @@ static int snd_cx88_volume_put(struct snd_kcontrol *kcontrol, return changed; } +static const DECLARE_TLV_DB_SCALE(snd_cx88_db_scale, -6300, 100, 0); + static struct snd_kcontrol_new snd_cx88_volume = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | + SNDRV_CTL_ELEM_ACCESS_TLV_READ, .name = "Playback Volume", .info = snd_cx88_volume_info, .get = snd_cx88_volume_get, .put = snd_cx88_volume_put, + .tlv.p = snd_cx88_db_scale, }; static int snd_cx88_switch_get(struct snd_kcontrol *kcontrol, -- cgit v1.1 From 786e9d4c3fdc3c913f1a735bcb979bfd62b275be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pekka=20Sepp=C3=A4nen?= Date: Mon, 15 Oct 2007 10:16:21 -0300 Subject: V4L/DVB (6319): radio-gemtek: fix 'VID_HARDWARE_GEMTEK' undeclared MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove obsolete V4L v1 reference. Thanks to Ingo Molnar for pointing this issue. Signed-off-by: Pekka Seppänen Signed-off-by: Mauro Carvalho Chehab --- drivers/media/radio/radio-gemtek.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/radio/radio-gemtek.c b/drivers/media/radio/radio-gemtek.c index 0c963db..5e4b9dd 100644 --- a/drivers/media/radio/radio-gemtek.c +++ b/drivers/media/radio/radio-gemtek.c @@ -554,7 +554,6 @@ static struct video_device gemtek_radio = { .owner = THIS_MODULE, .name = "GemTek Radio card", .type = VID_TYPE_TUNER, - .hardware = VID_HARDWARE_GEMTEK, .fops = &gemtek_fops, .vidioc_querycap = vidioc_querycap, .vidioc_g_tuner = vidioc_g_tuner, -- cgit v1.1 From 22c4a4e98ece0eaff13b3d0ac73c5283013eb6b1 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 15 Oct 2007 12:09:17 -0300 Subject: V4L/DVB (6320): v4l core: remove the unused .hardware V4L1 field struct video_device used to define a .hardware field. While initialized on severl drivers, this field is never used inside V4L. However, drivers using it need to include the old V4L1 header. This seems to cause compilation troubles with some random configs. Better just to remove it from all drivers. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/radio/miropcm20-radio.c | 1 - drivers/media/video/arv.c | 1 - drivers/media/video/bt8xx/bttv-driver.c | 3 -- drivers/media/video/bw-qcam.c | 1 - drivers/media/video/c-qcam.c | 1 - drivers/media/video/cpia.c | 5 --- drivers/media/video/cpia2/cpia2_v4l.c | 5 --- drivers/media/video/cx88/cx88-video.c | 1 - drivers/media/video/em28xx/em28xx-video.c | 2 -- drivers/media/video/et61x251/et61x251_core.c | 1 - drivers/media/video/meye.c | 1 - drivers/media/video/ov511.c | 1 - drivers/media/video/planb.c | 1 - drivers/media/video/pms.c | 1 - drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 3 -- drivers/media/video/pwc/pwc-if.c | 1 - drivers/media/video/saa7134/saa7134-empress.c | 1 - drivers/media/video/saa7134/saa7134-video.c | 3 -- drivers/media/video/se401.c | 1 - drivers/media/video/sn9c102/sn9c102_core.c | 1 - drivers/media/video/stradis.c | 1 - drivers/media/video/stv680.c | 1 - drivers/media/video/usbvideo/usbvideo.c | 1 - drivers/media/video/usbvideo/vicam.c | 1 - drivers/media/video/usbvision/usbvision-video.c | 3 -- drivers/media/video/videocodec.c | 4 +-- drivers/media/video/vivi.c | 1 - drivers/media/video/w9966.c | 1 - drivers/media/video/w9968cf.c | 1 - drivers/media/video/zc0301/zc0301_core.c | 1 - drivers/media/video/zoran_card.c | 10 ++++-- drivers/media/video/zoran_driver.c | 2 -- include/linux/videodev.h | 42 ------------------------- include/media/v4l2-dev.h | 1 - sound/i2c/other/tea575x-tuner.c | 1 - 35 files changed, 10 insertions(+), 96 deletions(-) diff --git a/drivers/media/radio/miropcm20-radio.c b/drivers/media/radio/miropcm20-radio.c index c7c9d1d..3ae56fe 100644 --- a/drivers/media/radio/miropcm20-radio.c +++ b/drivers/media/radio/miropcm20-radio.c @@ -229,7 +229,6 @@ static struct video_device pcm20_radio = { .owner = THIS_MODULE, .name = "Miro PCM 20 radio", .type = VID_TYPE_TUNER, - .hardware = VID_HARDWARE_RTRACK, .fops = &pcm20_fops, .priv = &pcm20_unit }; diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c index 19e9929..c94a4d0 100644 --- a/drivers/media/video/arv.c +++ b/drivers/media/video/arv.c @@ -755,7 +755,6 @@ static struct video_device ar_template = { .owner = THIS_MODULE, .name = "Colour AR VGA", .type = VID_TYPE_CAPTURE, - .hardware = VID_HARDWARE_ARV, .fops = &ar_fops, .release = ar_release, .minor = -1, diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 7a332b3..9feeb636 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c @@ -3877,7 +3877,6 @@ static struct video_device bttv_video_template = .name = "UNSET", .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER| VID_TYPE_CLIPPING|VID_TYPE_SCALES, - .hardware = VID_HARDWARE_BT848, .fops = &bttv_fops, .minor = -1, }; @@ -3886,7 +3885,6 @@ static struct video_device bttv_vbi_template = { .name = "bt848/878 vbi", .type = VID_TYPE_TUNER|VID_TYPE_TELETEXT, - .hardware = VID_HARDWARE_BT848, .fops = &bttv_fops, .minor = -1, }; @@ -4034,7 +4032,6 @@ static struct video_device radio_template = { .name = "bt848/878 radio", .type = VID_TYPE_TUNER, - .hardware = VID_HARDWARE_BT848, .fops = &radio_fops, .minor = -1, }; diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c index 7f7e3d3..5842352 100644 --- a/drivers/media/video/bw-qcam.c +++ b/drivers/media/video/bw-qcam.c @@ -899,7 +899,6 @@ static struct video_device qcam_template= .owner = THIS_MODULE, .name = "Connectix Quickcam", .type = VID_TYPE_CAPTURE, - .hardware = VID_HARDWARE_QCAM_BW, .fops = &qcam_fops, }; diff --git a/drivers/media/video/c-qcam.c b/drivers/media/video/c-qcam.c index f76c6a6..cf1546b 100644 --- a/drivers/media/video/c-qcam.c +++ b/drivers/media/video/c-qcam.c @@ -699,7 +699,6 @@ static struct video_device qcam_template= .owner = THIS_MODULE, .name = "Colour QuickCam", .type = VID_TYPE_CAPTURE, - .hardware = VID_HARDWARE_QCAM_C, .fops = &qcam_fops, }; diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c index a1d02e5..7c630f5 100644 --- a/drivers/media/video/cpia.c +++ b/drivers/media/video/cpia.c @@ -65,10 +65,6 @@ MODULE_PARM_DESC(colorspace_conv, #define ABOUT "V4L-Driver for Vision CPiA based cameras" -#ifndef VID_HARDWARE_CPIA -#define VID_HARDWARE_CPIA 24 /* FIXME -> from linux/videodev.h */ -#endif - #define CPIA_MODULE_CPIA (0<<5) #define CPIA_MODULE_SYSTEM (1<<5) #define CPIA_MODULE_VP_CTRL (5<<5) @@ -3804,7 +3800,6 @@ static struct video_device cpia_template = { .owner = THIS_MODULE, .name = "CPiA Camera", .type = VID_TYPE_CAPTURE, - .hardware = VID_HARDWARE_CPIA, .fops = &cpia_fops, }; diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c index e3aaba1..e378abe 100644 --- a/drivers/media/video/cpia2/cpia2_v4l.c +++ b/drivers/media/video/cpia2/cpia2_v4l.c @@ -86,10 +86,6 @@ MODULE_LICENSE("GPL"); #define ABOUT "V4L-Driver for Vision CPiA2 based cameras" -#ifndef VID_HARDWARE_CPIA2 -#error "VID_HARDWARE_CPIA2 should have been defined in linux/videodev.h" -#endif - struct control_menu_info { int value; char name[32]; @@ -1942,7 +1938,6 @@ static struct video_device cpia2_template = { .type= VID_TYPE_CAPTURE, .type2 = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING, - .hardware= VID_HARDWARE_CPIA2, .minor= -1, .fops= &fops_template, .release= video_device_release, diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 231ae6c..5ee05f8 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -1675,7 +1675,6 @@ static struct video_device cx8800_radio_template = { .name = "cx8800-radio", .type = VID_TYPE_TUNER, - .hardware = 0, .fops = &radio_fops, .minor = -1, .vidioc_querycap = radio_querycap, diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index e467682..a4c2a90 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -1617,7 +1617,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, /* Fills VBI device info */ dev->vbi_dev->type = VFL_TYPE_VBI; - dev->vbi_dev->hardware = 0; dev->vbi_dev->fops = &em28xx_v4l_fops; dev->vbi_dev->minor = -1; dev->vbi_dev->dev = &dev->udev->dev; @@ -1629,7 +1628,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, dev->vdev->type = VID_TYPE_CAPTURE; if (dev->has_tuner) dev->vdev->type |= VID_TYPE_TUNER; - dev->vdev->hardware = 0; dev->vdev->fops = &em28xx_v4l_fops; dev->vdev->minor = -1; dev->vdev->dev = &dev->udev->dev; diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c index d5fef4c0..d19d73b 100644 --- a/drivers/media/video/et61x251/et61x251_core.c +++ b/drivers/media/video/et61x251/et61x251_core.c @@ -2585,7 +2585,6 @@ et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) strcpy(cam->v4ldev->name, "ET61X[12]51 PC Camera"); cam->v4ldev->owner = THIS_MODULE; cam->v4ldev->type = VID_TYPE_CAPTURE | VID_TYPE_SCALES; - cam->v4ldev->hardware = 0; cam->v4ldev->fops = &et61x251_fops; cam->v4ldev->minor = video_nr[dev_nr]; cam->v4ldev->release = video_device_release; diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c index 6928392..c311632 100644 --- a/drivers/media/video/meye.c +++ b/drivers/media/video/meye.c @@ -1762,7 +1762,6 @@ static struct video_device meye_template = { .owner = THIS_MODULE, .name = "meye", .type = VID_TYPE_CAPTURE, - .hardware = VID_HARDWARE_MEYE, .fops = &meye_fops, .release = video_device_release, .minor = -1, diff --git a/drivers/media/video/ov511.c b/drivers/media/video/ov511.c index b8d4ac0..d55d580 100644 --- a/drivers/media/video/ov511.c +++ b/drivers/media/video/ov511.c @@ -4668,7 +4668,6 @@ static struct video_device vdev_template = { .owner = THIS_MODULE, .name = "OV511 USB Camera", .type = VID_TYPE_CAPTURE, - .hardware = VID_HARDWARE_OV511, .fops = &ov511_fops, .release = video_device_release, .minor = -1, diff --git a/drivers/media/video/planb.c b/drivers/media/video/planb.c index 0ef73d9..ce4b2f9 100644 --- a/drivers/media/video/planb.c +++ b/drivers/media/video/planb.c @@ -2013,7 +2013,6 @@ static struct video_device planb_template= .owner = THIS_MODULE, .name = PLANB_DEVICE_NAME, .type = VID_TYPE_OVERLAY, - .hardware = VID_HARDWARE_PLANB, .open = planb_open, .close = planb_close, .read = planb_read, diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c index b5a67f0..6820c2a 100644 --- a/drivers/media/video/pms.c +++ b/drivers/media/video/pms.c @@ -895,7 +895,6 @@ static struct video_device pms_template= .owner = THIS_MODULE, .name = "Mediavision PMS", .type = VID_TYPE_CAPTURE, - .hardware = VID_HARDWARE_PMS, .fops = &pms_fops, }; diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index 4563b3d..7a596ea 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c @@ -1121,15 +1121,12 @@ static const struct file_operations vdev_fops = { }; -#define VID_HARDWARE_PVRUSB2 38 /* FIXME : need a good value */ - static struct video_device vdev_template = { .owner = THIS_MODULE, .type = VID_TYPE_CAPTURE | VID_TYPE_TUNER, .type2 = (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VBI_CAPTURE | V4L2_CAP_TUNER | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE), - .hardware = VID_HARDWARE_PVRUSB2, .fops = &vdev_fops, }; diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index 950da25..7300ace 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c @@ -166,7 +166,6 @@ static struct video_device pwc_template = { .owner = THIS_MODULE, .name = "Philips Webcam", /* Filled in later */ .type = VID_TYPE_CAPTURE, - .hardware = VID_HARDWARE_PWC, .release = video_device_release, .fops = &pwc_fops, .minor = -1, diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index 34ca874d..0a7d943 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c @@ -342,7 +342,6 @@ static struct video_device saa7134_empress_template = .name = "saa7134-empress", .type = 0 /* FIXME */, .type2 = 0 /* FIXME */, - .hardware = 0, .fops = &ts_fops, .minor = -1, }; diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 471b927..2b089777 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c @@ -2352,7 +2352,6 @@ struct video_device saa7134_video_template = .name = "saa7134-video", .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER| VID_TYPE_CLIPPING|VID_TYPE_SCALES, - .hardware = 0, .fops = &video_fops, .minor = -1, }; @@ -2361,7 +2360,6 @@ struct video_device saa7134_vbi_template = { .name = "saa7134-vbi", .type = VID_TYPE_TUNER|VID_TYPE_TELETEXT, - .hardware = 0, .fops = &video_fops, .minor = -1, }; @@ -2370,7 +2368,6 @@ struct video_device saa7134_radio_template = { .name = "saa7134-radio", .type = VID_TYPE_TUNER, - .hardware = 0, .fops = &radio_fops, .minor = -1, }; diff --git a/drivers/media/video/se401.c b/drivers/media/video/se401.c index 93fb04e..d5d7d6c 100644 --- a/drivers/media/video/se401.c +++ b/drivers/media/video/se401.c @@ -1231,7 +1231,6 @@ static struct video_device se401_template = { .owner = THIS_MODULE, .name = "se401 USB camera", .type = VID_TYPE_CAPTURE, - .hardware = VID_HARDWARE_SE401, .fops = &se401_fops, }; diff --git a/drivers/media/video/sn9c102/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c index 6991e06..5118479 100644 --- a/drivers/media/video/sn9c102/sn9c102_core.c +++ b/drivers/media/video/sn9c102/sn9c102_core.c @@ -3319,7 +3319,6 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) strcpy(cam->v4ldev->name, "SN9C1xx PC Camera"); cam->v4ldev->owner = THIS_MODULE; cam->v4ldev->type = VID_TYPE_CAPTURE | VID_TYPE_SCALES; - cam->v4ldev->hardware = 0; cam->v4ldev->fops = &sn9c102_fops; cam->v4ldev->minor = video_nr[dev_nr]; cam->v4ldev->release = video_device_release; diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c index eb22046..3fb85af 100644 --- a/drivers/media/video/stradis.c +++ b/drivers/media/video/stradis.c @@ -1917,7 +1917,6 @@ static const struct file_operations saa_fops = { static struct video_device saa_template = { .name = "SAA7146A", .type = VID_TYPE_CAPTURE | VID_TYPE_OVERLAY, - .hardware = VID_HARDWARE_SAA7146, .fops = &saa_fops, .minor = -1, }; diff --git a/drivers/media/video/stv680.c b/drivers/media/video/stv680.c index 9e009a7..afc32aa 100644 --- a/drivers/media/video/stv680.c +++ b/drivers/media/video/stv680.c @@ -1398,7 +1398,6 @@ static struct video_device stv680_template = { .owner = THIS_MODULE, .name = "STV0680 USB camera", .type = VID_TYPE_CAPTURE, - .hardware = VID_HARDWARE_SE401, .fops = &stv680_fops, .release = video_device_release, .minor = -1, diff --git a/drivers/media/video/usbvideo/usbvideo.c b/drivers/media/video/usbvideo/usbvideo.c index 37ce36b..fb434b5 100644 --- a/drivers/media/video/usbvideo/usbvideo.c +++ b/drivers/media/video/usbvideo/usbvideo.c @@ -952,7 +952,6 @@ static const struct file_operations usbvideo_fops = { static const struct video_device usbvideo_template = { .owner = THIS_MODULE, .type = VID_TYPE_CAPTURE, - .hardware = VID_HARDWARE_CPIA, .fops = &usbvideo_fops, }; diff --git a/drivers/media/video/usbvideo/vicam.c b/drivers/media/video/usbvideo/vicam.c index db3c9e3..da1ba02 100644 --- a/drivers/media/video/usbvideo/vicam.c +++ b/drivers/media/video/usbvideo/vicam.c @@ -1074,7 +1074,6 @@ static struct video_device vicam_template = { .owner = THIS_MODULE, .name = "ViCam-based USB Camera", .type = VID_TYPE_CAPTURE, - .hardware = VID_HARDWARE_VICAM, .fops = &vicam_fops, .minor = -1, }; diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index e2f3c01..36e689f 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c @@ -1400,7 +1400,6 @@ static const struct file_operations usbvision_fops = { static struct video_device usbvision_video_template = { .owner = THIS_MODULE, .type = VID_TYPE_TUNER | VID_TYPE_CAPTURE, - .hardware = VID_HARDWARE_USBVISION, .fops = &usbvision_fops, .name = "usbvision-video", .release = video_device_release, @@ -1455,7 +1454,6 @@ static struct video_device usbvision_radio_template= { .owner = THIS_MODULE, .type = VID_TYPE_TUNER, - .hardware = VID_HARDWARE_USBVISION, .fops = &usbvision_radio_fops, .name = "usbvision-radio", .release = video_device_release, @@ -1492,7 +1490,6 @@ static struct video_device usbvision_vbi_template= { .owner = THIS_MODULE, .type = VID_TYPE_TUNER, - .hardware = VID_HARDWARE_USBVISION, .fops = &usbvision_vbi_fops, .release = video_device_release, .name = "usbvision-vbi", diff --git a/drivers/media/video/videocodec.c b/drivers/media/video/videocodec.c index f2bbd7a..87951ec 100644 --- a/drivers/media/video/videocodec.c +++ b/drivers/media/video/videocodec.c @@ -86,8 +86,8 @@ videocodec_attach (struct videocodec_master *master) } dprintk(2, - "videocodec_attach: '%s', type: %x, flags %lx, magic %lx\n", - master->name, master->type, master->flags, master->magic); + "videocodec_attach: '%s', flags %lx, magic %lx\n", + master->name, master->flags, master->magic); if (!h) { dprintk(1, diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index b532aa2..ee73dc7 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c @@ -1119,7 +1119,6 @@ static const struct file_operations vivi_fops = { static struct video_device vivi = { .name = "vivi", .type = VID_TYPE_CAPTURE, - .hardware = 0, .fops = &vivi_fops, .minor = -1, // .release = video_device_release, diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c index 4736640..08aaae0 100644 --- a/drivers/media/video/w9966.c +++ b/drivers/media/video/w9966.c @@ -196,7 +196,6 @@ static struct video_device w9966_template = { .owner = THIS_MODULE, .name = W9966_DRIVERNAME, .type = VID_TYPE_CAPTURE | VID_TYPE_SCALES, - .hardware = VID_HARDWARE_W9966, .fops = &w9966_fops, }; diff --git a/drivers/media/video/w9968cf.c b/drivers/media/video/w9968cf.c index 9e7f3e6..2ae1430 100644 --- a/drivers/media/video/w9968cf.c +++ b/drivers/media/video/w9968cf.c @@ -3549,7 +3549,6 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) strcpy(cam->v4ldev->name, symbolic(camlist, mod_id)); cam->v4ldev->owner = THIS_MODULE; cam->v4ldev->type = VID_TYPE_CAPTURE | VID_TYPE_SCALES; - cam->v4ldev->hardware = VID_HARDWARE_W9968CF; cam->v4ldev->fops = &w9968cf_fops; cam->v4ldev->minor = video_nr[dev_nr]; cam->v4ldev->release = video_device_release; diff --git a/drivers/media/video/zc0301/zc0301_core.c b/drivers/media/video/zc0301/zc0301_core.c index 08a93c3..2c5665c 100644 --- a/drivers/media/video/zc0301/zc0301_core.c +++ b/drivers/media/video/zc0301/zc0301_core.c @@ -1985,7 +1985,6 @@ zc0301_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) strcpy(cam->v4ldev->name, "ZC0301[P] PC Camera"); cam->v4ldev->owner = THIS_MODULE; cam->v4ldev->type = VID_TYPE_CAPTURE | VID_TYPE_SCALES; - cam->v4ldev->hardware = 0; cam->v4ldev->fops = &zc0301_fops; cam->v4ldev->minor = video_nr[dev_nr]; cam->v4ldev->release = video_device_release; diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c index 48da36a..6e0ac4c 100644 --- a/drivers/media/video/zoran_card.c +++ b/drivers/media/video/zoran_card.c @@ -1235,8 +1235,14 @@ zoran_setup_videocodec (struct zoran *zr, return m; } - m->magic = 0L; /* magic not used */ - m->type = VID_HARDWARE_ZR36067; + /* magic and type are unused for master struct. Makes sense only at + codec structs. + In the past, .type were initialized to the old V4L1 .hardware + value, as VID_HARDWARE_ZR36067 + */ + m->magic = 0L; + m->type = 0; + m->flags = CODEC_FLAG_ENCODER | CODEC_FLAG_DECODER; strncpy(m->name, ZR_DEVNAME(zr), sizeof(m->name)); m->data = zr; diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index 419e5af..dd3d7d2 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c @@ -60,7 +60,6 @@ #include #define MAP_NR(x) virt_to_page(x) -#define ZORAN_HARDWARE VID_HARDWARE_ZR36067 #define ZORAN_VID_TYPE ( \ VID_TYPE_CAPTURE | \ VID_TYPE_OVERLAY | \ @@ -4659,7 +4658,6 @@ struct video_device zoran_template __devinitdata = { #ifdef CONFIG_VIDEO_V4L2 .type2 = ZORAN_V4L2_VID_FLAGS, #endif - .hardware = ZORAN_HARDWARE, .fops = &zoran_fops, .release = &zoran_vdev_release, .minor = -1 diff --git a/include/linux/videodev.h b/include/linux/videodev.h index 8dba97a..52e3d5f 100644 --- a/include/linux/videodev.h +++ b/include/linux/videodev.h @@ -294,48 +294,6 @@ struct video_code #define VID_PLAY_RESET 13 #define VID_PLAY_END_MARK 14 - - -#define VID_HARDWARE_BT848 1 -#define VID_HARDWARE_QCAM_BW 2 -#define VID_HARDWARE_PMS 3 -#define VID_HARDWARE_QCAM_C 4 -#define VID_HARDWARE_PSEUDO 5 -#define VID_HARDWARE_SAA5249 6 -#define VID_HARDWARE_AZTECH 7 -#define VID_HARDWARE_SF16MI 8 -#define VID_HARDWARE_RTRACK 9 -#define VID_HARDWARE_ZOLTRIX 10 -#define VID_HARDWARE_SAA7146 11 -#define VID_HARDWARE_VIDEUM 12 /* Reserved for Winnov videum */ -#define VID_HARDWARE_RTRACK2 13 -#define VID_HARDWARE_PERMEDIA2 14 /* Reserved for Permedia2 */ -#define VID_HARDWARE_RIVA128 15 /* Reserved for RIVA 128 */ -#define VID_HARDWARE_PLANB 16 /* PowerMac motherboard video-in */ -#define VID_HARDWARE_BROADWAY 17 /* Broadway project */ -#define VID_HARDWARE_GEMTEK 18 -#define VID_HARDWARE_TYPHOON 19 -#define VID_HARDWARE_VINO 20 /* SGI Indy Vino */ -#define VID_HARDWARE_CADET 21 /* Cadet radio */ -#define VID_HARDWARE_TRUST 22 /* Trust FM Radio */ -#define VID_HARDWARE_TERRATEC 23 /* TerraTec ActiveRadio */ -#define VID_HARDWARE_CPIA 24 -#define VID_HARDWARE_ZR36120 25 /* Zoran ZR36120/ZR36125 */ -#define VID_HARDWARE_ZR36067 26 /* Zoran ZR36067/36060 */ -#define VID_HARDWARE_OV511 27 -#define VID_HARDWARE_ZR356700 28 /* Zoran 36700 series */ -#define VID_HARDWARE_W9966 29 -#define VID_HARDWARE_SE401 30 /* SE401 USB webcams */ -#define VID_HARDWARE_PWC 31 /* Philips webcams */ -#define VID_HARDWARE_MEYE 32 /* Sony Vaio MotionEye cameras */ -#define VID_HARDWARE_CPIA2 33 -#define VID_HARDWARE_VICAM 34 -#define VID_HARDWARE_SF16FMR2 35 -#define VID_HARDWARE_W9968CF 36 -#define VID_HARDWARE_SAA7114H 37 -#define VID_HARDWARE_SN9C102 38 -#define VID_HARDWARE_ARV 39 - #endif /* CONFIG_VIDEO_V4L1_COMPAT */ #endif /* __LINUX_VIDEODEV_H */ diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index e75d5e6..4c5d66e 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h @@ -94,7 +94,6 @@ struct video_device char name[32]; int type; /* v4l1 */ int type2; /* v4l2 */ - int hardware; int minor; int debug; /* Activates debug level*/ diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index fe31bb5..37c47fb 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c @@ -189,7 +189,6 @@ void snd_tea575x_init(struct snd_tea575x *tea) tea->vd.owner = tea->card->module; strcpy(tea->vd.name, tea->tea5759 ? "TEA5759 radio" : "TEA5757 radio"); tea->vd.type = VID_TYPE_TUNER; - tea->vd.hardware = VID_HARDWARE_RTRACK; /* FIXME: assign new number */ tea->vd.release = snd_tea575x_release; video_set_drvdata(&tea->vd, tea); tea->vd.fops = &tea->fops; -- cgit v1.1 From 3bcc95760c9ee7adb8509173b78914339baa7f4f Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 11 Oct 2007 06:38:18 -0300 Subject: V4L/DVB (6321): Remove obsolete VIDIOC_S/G_MPEGCOMP ioctls Remove the obsolete VIDIOC_G_MPEGCOMP and VIDIOC_S_MPEGCOMP ioctls from the V4L2 API as per the removal schedule (October 2007). Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88-blackbird.c | 57 ------------- drivers/media/video/saa7134/saa6752hs.c | 111 -------------------------- drivers/media/video/saa7134/saa7134-empress.c | 11 --- drivers/media/video/v4l2-common.c | 2 - drivers/media/video/videodev.c | 42 ---------- include/linux/videodev2.h | 92 --------------------- include/media/v4l2-dev.h | 4 - 7 files changed, 319 deletions(-) diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index 6d6f504..f33f0b4 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c @@ -527,44 +527,6 @@ static void blackbird_codec_settings(struct cx8802_dev *dev) cx2341x_update(dev, blackbird_mbox_func, NULL, &dev->params); } -static struct v4l2_mpeg_compression default_mpeg_params = { - .st_type = V4L2_MPEG_PS_2, - .st_bitrate = { - .mode = V4L2_BITRATE_CBR, - .min = 0, - .target = 0, - .max = 0 - }, - .ts_pid_pmt = 16, - .ts_pid_audio = 260, - .ts_pid_video = 256, - .ts_pid_pcr = 259, - .ps_size = 0, - .au_type = V4L2_MPEG_AU_2_II, - .au_bitrate = { - .mode = V4L2_BITRATE_CBR, - .min = 224, - .target = 224, - .max = 224 - }, - .au_sample_rate = 48000, - .au_pesid = 0, - .vi_type = V4L2_MPEG_VI_2, - .vi_aspect_ratio = V4L2_MPEG_ASPECT_4_3, - .vi_bitrate = { - .mode = V4L2_BITRATE_CBR, - .min = 4000, - .target = 4500, - .max = 6000 - }, - .vi_frame_rate = 25, - .vi_frames_per_gop = 12, - .vi_bframes_count = 2, - .vi_pesid = 0, - .closed_gops = 1, - .pulldown = 0 -}; - static int blackbird_initialize_codec(struct cx8802_dev *dev) { struct cx88_core *core = dev->core; @@ -852,23 +814,6 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) return videobuf_streamoff(&fh->mpegq); } -static int vidioc_g_mpegcomp (struct file *file, void *fh, - struct v4l2_mpeg_compression *f) -{ - printk(KERN_WARNING "VIDIOC_G_MPEGCOMP is obsolete. " - "Replace with VIDIOC_G_EXT_CTRLS!"); - memcpy(f,&default_mpeg_params,sizeof(*f)); - return 0; -} - -static int vidioc_s_mpegcomp (struct file *file, void *fh, - struct v4l2_mpeg_compression *f) -{ - printk(KERN_WARNING "VIDIOC_S_MPEGCOMP is obsolete. " - "Replace with VIDIOC_S_EXT_CTRLS!"); - return 0; -} - static int vidioc_g_ext_ctrls (struct file *file, void *priv, struct v4l2_ext_controls *f) { @@ -1216,8 +1161,6 @@ static struct video_device cx8802_mpeg_template = .vidioc_dqbuf = vidioc_dqbuf, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, - .vidioc_g_mpegcomp = vidioc_g_mpegcomp, - .vidioc_s_mpegcomp = vidioc_s_mpegcomp, .vidioc_g_ext_ctrls = vidioc_g_ext_ctrls, .vidioc_s_ext_ctrls = vidioc_s_ext_ctrls, .vidioc_try_ext_ctrls = vidioc_try_ext_ctrls, diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index 57f1f5d..002e70a 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c @@ -71,7 +71,6 @@ static const struct v4l2_format v4l2_format_table[] = struct saa6752hs_state { struct i2c_client client; - struct v4l2_mpeg_compression old_params; struct saa6752hs_mpeg_params params; enum saa6752hs_videoformat video_format; v4l2_std_id standard; @@ -161,35 +160,6 @@ static struct saa6752hs_mpeg_params param_defaults = .au_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_256K, }; -static struct v4l2_mpeg_compression old_param_defaults = -{ - .st_type = V4L2_MPEG_TS_2, - .st_bitrate = { - .mode = V4L2_BITRATE_CBR, - .target = 7000, - }, - - .ts_pid_pmt = 16, - .ts_pid_video = 260, - .ts_pid_audio = 256, - .ts_pid_pcr = 259, - - .vi_type = V4L2_MPEG_VI_2, - .vi_aspect_ratio = V4L2_MPEG_ASPECT_4_3, - .vi_bitrate = { - .mode = V4L2_BITRATE_VBR, - .target = 4000, - .max = 6000, - }, - - .au_type = V4L2_MPEG_AU_2_II, - .au_bitrate = { - .mode = V4L2_BITRATE_CBR, - .target = 256, - }, - -}; - /* ---------------------------------------------------------------------- */ static int saa6752hs_chip_command(struct i2c_client* client, @@ -362,74 +332,6 @@ static void saa6752hs_set_subsampling(struct i2c_client* client, } -static void saa6752hs_old_set_params(struct i2c_client* client, - struct v4l2_mpeg_compression* params) -{ - struct saa6752hs_state *h = i2c_get_clientdata(client); - - /* check PIDs */ - if (params->ts_pid_pmt <= MPEG_PID_MAX) { - h->old_params.ts_pid_pmt = params->ts_pid_pmt; - h->params.ts_pid_pmt = params->ts_pid_pmt; - } - if (params->ts_pid_pcr <= MPEG_PID_MAX) { - h->old_params.ts_pid_pcr = params->ts_pid_pcr; - h->params.ts_pid_pcr = params->ts_pid_pcr; - } - if (params->ts_pid_video <= MPEG_PID_MAX) { - h->old_params.ts_pid_video = params->ts_pid_video; - h->params.ts_pid_video = params->ts_pid_video; - } - if (params->ts_pid_audio <= MPEG_PID_MAX) { - h->old_params.ts_pid_audio = params->ts_pid_audio; - h->params.ts_pid_audio = params->ts_pid_audio; - } - - /* check bitrate parameters */ - if ((params->vi_bitrate.mode == V4L2_BITRATE_CBR) || - (params->vi_bitrate.mode == V4L2_BITRATE_VBR)) { - h->old_params.vi_bitrate.mode = params->vi_bitrate.mode; - h->params.vi_bitrate_mode = (params->vi_bitrate.mode == V4L2_BITRATE_VBR) ? - V4L2_MPEG_VIDEO_BITRATE_MODE_VBR : V4L2_MPEG_VIDEO_BITRATE_MODE_CBR; - } - if (params->vi_bitrate.mode != V4L2_BITRATE_NONE) - h->old_params.st_bitrate.target = params->st_bitrate.target; - if (params->vi_bitrate.mode != V4L2_BITRATE_NONE) - h->old_params.vi_bitrate.target = params->vi_bitrate.target; - if (params->vi_bitrate.mode == V4L2_BITRATE_VBR) - h->old_params.vi_bitrate.max = params->vi_bitrate.max; - if (params->au_bitrate.mode != V4L2_BITRATE_NONE) - h->old_params.au_bitrate.target = params->au_bitrate.target; - - /* aspect ratio */ - if (params->vi_aspect_ratio == V4L2_MPEG_ASPECT_4_3 || - params->vi_aspect_ratio == V4L2_MPEG_ASPECT_16_9) { - h->old_params.vi_aspect_ratio = params->vi_aspect_ratio; - if (params->vi_aspect_ratio == V4L2_MPEG_ASPECT_4_3) - h->params.vi_aspect = V4L2_MPEG_VIDEO_ASPECT_4x3; - else - h->params.vi_aspect = V4L2_MPEG_VIDEO_ASPECT_16x9; - } - - /* range checks */ - if (h->old_params.st_bitrate.target > MPEG_TOTAL_TARGET_BITRATE_MAX) - h->old_params.st_bitrate.target = MPEG_TOTAL_TARGET_BITRATE_MAX; - if (h->old_params.vi_bitrate.target > MPEG_VIDEO_TARGET_BITRATE_MAX) - h->old_params.vi_bitrate.target = MPEG_VIDEO_TARGET_BITRATE_MAX; - if (h->old_params.vi_bitrate.max > MPEG_VIDEO_MAX_BITRATE_MAX) - h->old_params.vi_bitrate.max = MPEG_VIDEO_MAX_BITRATE_MAX; - h->params.vi_bitrate = params->vi_bitrate.target; - h->params.vi_bitrate_peak = params->vi_bitrate.max; - if (h->old_params.au_bitrate.target <= 256) { - h->old_params.au_bitrate.target = 256; - h->params.au_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_256K; - } - else { - h->old_params.au_bitrate.target = 384; - h->params.au_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_384K; - } -} - static int handle_ctrl(struct saa6752hs_mpeg_params *params, struct v4l2_ext_control *ctrl, unsigned int cmd) { @@ -697,7 +599,6 @@ static int saa6752hs_attach(struct i2c_adapter *adap, int addr, int kind) return -ENOMEM; h->client = client_template; h->params = param_defaults; - h->old_params = old_param_defaults; h->client.adapter = adap; h->client.addr = addr; @@ -734,23 +635,11 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg) { struct saa6752hs_state *h = i2c_get_clientdata(client); struct v4l2_ext_controls *ctrls = arg; - struct v4l2_mpeg_compression *old_params = arg; struct saa6752hs_mpeg_params params; int err = 0; int i; switch (cmd) { - case VIDIOC_S_MPEGCOMP: - if (NULL == old_params) { - /* apply settings and start encoder */ - saa6752hs_init(client); - break; - } - saa6752hs_old_set_params(client, old_params); - /* fall through */ - case VIDIOC_G_MPEGCOMP: - *old_params = h->old_params; - break; case VIDIOC_S_EXT_CTRLS: if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG) return -EINVAL; diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index 0a7d943..75d0c5b 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c @@ -284,17 +284,6 @@ static int ts_do_ioctl(struct inode *inode, struct file *file, case VIDIOC_S_CTRL: return saa7134_common_ioctl(dev, cmd, arg); - case VIDIOC_S_MPEGCOMP: - printk(KERN_WARNING "VIDIOC_S_MPEGCOMP is obsolete. " - "Replace with VIDIOC_S_EXT_CTRLS!"); - saa7134_i2c_call_clients(dev, VIDIOC_S_MPEGCOMP, arg); - ts_init_encoder(dev); - return 0; - case VIDIOC_G_MPEGCOMP: - printk(KERN_WARNING "VIDIOC_G_MPEGCOMP is obsolete. " - "Replace with VIDIOC_G_EXT_CTRLS!"); - saa7134_i2c_call_clients(dev, VIDIOC_G_MPEGCOMP, arg); - return 0; case VIDIOC_S_EXT_CTRLS: /* count == 0 is abused in saa6752hs.c, so that special case is handled here explicitly. */ diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 3212492..1141b4b 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c @@ -317,8 +317,6 @@ static const char *v4l2_ioctls[] = { [_IOC_NR(VIDIOC_ENUM_FMT)] = "VIDIOC_ENUM_FMT", [_IOC_NR(VIDIOC_G_FMT)] = "VIDIOC_G_FMT", [_IOC_NR(VIDIOC_S_FMT)] = "VIDIOC_S_FMT", - [_IOC_NR(VIDIOC_G_MPEGCOMP)] = "VIDIOC_G_MPEGCOMP", - [_IOC_NR(VIDIOC_S_MPEGCOMP)] = "VIDIOC_S_MPEGCOMP", [_IOC_NR(VIDIOC_REQBUFS)] = "VIDIOC_REQBUFS", [_IOC_NR(VIDIOC_QUERYBUF)] = "VIDIOC_QUERYBUF", [_IOC_NR(VIDIOC_G_FBUF)] = "VIDIOC_G_FBUF", diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c index 8d8e517..9611c39 100644 --- a/drivers/media/video/videodev.c +++ b/drivers/media/video/videodev.c @@ -1313,48 +1313,6 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ret=vfd->vidioc_cropcap(file, fh, p); break; } - case VIDIOC_G_MPEGCOMP: - { - struct v4l2_mpeg_compression *p=arg; - - /*FIXME: Several fields not shown */ - if (!vfd->vidioc_g_mpegcomp) - break; - ret=vfd->vidioc_g_mpegcomp(file, fh, p); - if (!ret) - dbgarg (cmd, "ts_pid_pmt=%d, ts_pid_audio=%d," - " ts_pid_video=%d, ts_pid_pcr=%d, " - "ps_size=%d, au_sample_rate=%d, " - "au_pesid=%c, vi_frame_rate=%d, " - "vi_frames_per_gop=%d, " - "vi_bframes_count=%d, vi_pesid=%c\n", - p->ts_pid_pmt,p->ts_pid_audio, - p->ts_pid_video,p->ts_pid_pcr, - p->ps_size, p->au_sample_rate, - p->au_pesid, p->vi_frame_rate, - p->vi_frames_per_gop, - p->vi_bframes_count, p->vi_pesid); - break; - } - case VIDIOC_S_MPEGCOMP: - { - struct v4l2_mpeg_compression *p=arg; - /*FIXME: Several fields not shown */ - if (!vfd->vidioc_s_mpegcomp) - break; - dbgarg (cmd, "ts_pid_pmt=%d, ts_pid_audio=%d, " - "ts_pid_video=%d, ts_pid_pcr=%d, ps_size=%d, " - "au_sample_rate=%d, au_pesid=%c, " - "vi_frame_rate=%d, vi_frames_per_gop=%d, " - "vi_bframes_count=%d, vi_pesid=%c\n", - p->ts_pid_pmt,p->ts_pid_audio, p->ts_pid_video, - p->ts_pid_pcr, p->ps_size, p->au_sample_rate, - p->au_pesid, p->vi_frame_rate, - p->vi_frames_per_gop, p->vi_bframes_count, - p->vi_pesid); - ret=vfd->vidioc_s_mpegcomp(file, fh, p); - break; - } case VIDIOC_G_JPEGCOMP: { struct v4l2_jpegcompression *p=arg; diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 1f503e9..439474f 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -441,94 +441,6 @@ struct v4l2_timecode #define V4L2_TC_USERBITS_8BITCHARS 0x0008 /* The above is based on SMPTE timecodes */ -#ifdef __KERNEL__ -/* - * M P E G C O M P R E S S I O N P A R A M E T E R S - * - * ### WARNING: This experimental MPEG compression API is obsolete. - * ### It is replaced by the MPEG controls API. - * ### This old API will disappear in the near future! - * - */ -enum v4l2_bitrate_mode { - V4L2_BITRATE_NONE = 0, /* not specified */ - V4L2_BITRATE_CBR, /* constant bitrate */ - V4L2_BITRATE_VBR, /* variable bitrate */ -}; -struct v4l2_bitrate { - /* rates are specified in kbit/sec */ - enum v4l2_bitrate_mode mode; - __u32 min; - __u32 target; /* use this one for CBR */ - __u32 max; -}; - -enum v4l2_mpeg_streamtype { - V4L2_MPEG_SS_1, /* MPEG-1 system stream */ - V4L2_MPEG_PS_2, /* MPEG-2 program stream */ - V4L2_MPEG_TS_2, /* MPEG-2 transport stream */ - V4L2_MPEG_PS_DVD, /* MPEG-2 program stream with DVD header fixups */ -}; -enum v4l2_mpeg_audiotype { - V4L2_MPEG_AU_2_I, /* MPEG-2 layer 1 */ - V4L2_MPEG_AU_2_II, /* MPEG-2 layer 2 */ - V4L2_MPEG_AU_2_III, /* MPEG-2 layer 3 */ - V4L2_MPEG_AC3, /* AC3 */ - V4L2_MPEG_LPCM, /* LPCM */ -}; -enum v4l2_mpeg_videotype { - V4L2_MPEG_VI_1, /* MPEG-1 */ - V4L2_MPEG_VI_2, /* MPEG-2 */ -}; -enum v4l2_mpeg_aspectratio { - V4L2_MPEG_ASPECT_SQUARE = 1, /* square pixel */ - V4L2_MPEG_ASPECT_4_3 = 2, /* 4 : 3 */ - V4L2_MPEG_ASPECT_16_9 = 3, /* 16 : 9 */ - V4L2_MPEG_ASPECT_1_221 = 4, /* 1 : 2,21 */ -}; - -struct v4l2_mpeg_compression { - /* general */ - enum v4l2_mpeg_streamtype st_type; - struct v4l2_bitrate st_bitrate; - - /* transport streams */ - __u16 ts_pid_pmt; - __u16 ts_pid_audio; - __u16 ts_pid_video; - __u16 ts_pid_pcr; - - /* program stream */ - __u16 ps_size; - __u16 reserved_1; /* align */ - - /* audio */ - enum v4l2_mpeg_audiotype au_type; - struct v4l2_bitrate au_bitrate; - __u32 au_sample_rate; - __u8 au_pesid; - __u8 reserved_2[3]; /* align */ - - /* video */ - enum v4l2_mpeg_videotype vi_type; - enum v4l2_mpeg_aspectratio vi_aspect_ratio; - struct v4l2_bitrate vi_bitrate; - __u32 vi_frame_rate; - __u16 vi_frames_per_gop; - __u16 vi_bframes_count; - __u8 vi_pesid; - __u8 reserved_3[3]; /* align */ - - /* misc flags */ - __u32 closed_gops:1; - __u32 pulldown:1; - __u32 reserved_4:30; /* align */ - - /* I don't expect the above being perfect yet ;) */ - __u32 reserved_5[8]; -}; -#endif - struct v4l2_jpegcompression { int quality; @@ -1420,10 +1332,6 @@ struct v4l2_chip_ident { #define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc) #define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format) #define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format) -#ifdef __KERNEL__ -#define VIDIOC_G_MPEGCOMP _IOR ('V', 6, struct v4l2_mpeg_compression) -#define VIDIOC_S_MPEGCOMP _IOW ('V', 7, struct v4l2_mpeg_compression) -#endif #define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers) #define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer) #define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer) diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index 4c5d66e..c544c6f 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h @@ -271,10 +271,6 @@ struct video_device int (*vidioc_s_crop) (struct file *file, void *fh, struct v4l2_crop *a); /* Compression ioctls */ - int (*vidioc_g_mpegcomp) (struct file *file, void *fh, - struct v4l2_mpeg_compression *a); - int (*vidioc_s_mpegcomp) (struct file *file, void *fh, - struct v4l2_mpeg_compression *a); int (*vidioc_g_jpegcomp) (struct file *file, void *fh, struct v4l2_jpegcompression *a); int (*vidioc_s_jpegcomp) (struct file *file, void *fh, -- cgit v1.1 From 475d5263114d55eb9024e6ab4b6ea74e28386970 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Mon, 15 Oct 2007 13:07:30 -0300 Subject: V4L/DVB (6323): V4L: cinergyT2, remove bad usage of ERESTARTSYS cinergyT2, remove bad usage of ERESTARTSYS test of cinergyt2->disconnect_pending doesn't ensure pending signal and so ERESTARTSYS would reach userspace, which is not permitted. Change it to EAGAIN. Signed-off-by: Jiri Slaby Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/cinergyT2/cinergyT2.c | 42 +++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c index a05e5c1..db08b0a 100644 --- a/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/drivers/media/dvb/cinergyT2/cinergyT2.c @@ -345,7 +345,9 @@ static int cinergyt2_start_feed(struct dvb_demux_feed *dvbdmxfeed) struct dvb_demux *demux = dvbdmxfeed->demux; struct cinergyt2 *cinergyt2 = demux->priv; - if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) + if (cinergyt2->disconnect_pending) + return -EAGAIN; + if (mutex_lock_interruptible(&cinergyt2->sem)) return -ERESTARTSYS; if (cinergyt2->streaming == 0) @@ -361,7 +363,9 @@ static int cinergyt2_stop_feed(struct dvb_demux_feed *dvbdmxfeed) struct dvb_demux *demux = dvbdmxfeed->demux; struct cinergyt2 *cinergyt2 = demux->priv; - if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) + if (cinergyt2->disconnect_pending) + return -EAGAIN; + if (mutex_lock_interruptible(&cinergyt2->sem)) return -ERESTARTSYS; if (--cinergyt2->streaming == 0) @@ -481,12 +485,16 @@ static int cinergyt2_open (struct inode *inode, struct file *file) { struct dvb_device *dvbdev = file->private_data; struct cinergyt2 *cinergyt2 = dvbdev->priv; - int err = -ERESTARTSYS; + int err = -EAGAIN; - if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->wq_sem)) + if (cinergyt2->disconnect_pending) + goto out; + err = mutex_lock_interruptible(&cinergyt2->wq_sem); + if (err) goto out; - if (mutex_lock_interruptible(&cinergyt2->sem)) + err = mutex_lock_interruptible(&cinergyt2->sem); + if (err) goto out_unlock1; if ((err = dvb_generic_open(inode, file))) @@ -550,7 +558,9 @@ static unsigned int cinergyt2_poll (struct file *file, struct poll_table_struct struct cinergyt2 *cinergyt2 = dvbdev->priv; unsigned int mask = 0; - if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) + if (cinergyt2->disconnect_pending) + return -EAGAIN; + if (mutex_lock_interruptible(&cinergyt2->sem)) return -ERESTARTSYS; poll_wait(file, &cinergyt2->poll_wq, wait); @@ -625,7 +635,9 @@ static int cinergyt2_ioctl (struct inode *inode, struct file *file, if (copy_from_user(&p, (void __user*) arg, sizeof(p))) return -EFAULT; - if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) + if (cinergyt2->disconnect_pending) + return -EAGAIN; + if (mutex_lock_interruptible(&cinergyt2->sem)) return -ERESTARTSYS; param->cmd = CINERGYT2_EP1_SET_TUNER_PARAMETERS; @@ -996,7 +1008,9 @@ static int cinergyt2_suspend (struct usb_interface *intf, pm_message_t state) { struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf); - if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->wq_sem)) + if (cinergyt2->disconnect_pending) + return -EAGAIN; + if (mutex_lock_interruptible(&cinergyt2->wq_sem)) return -ERESTARTSYS; cinergyt2_suspend_rc(cinergyt2); @@ -1017,16 +1031,18 @@ static int cinergyt2_resume (struct usb_interface *intf) { struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf); struct dvbt_set_parameters_msg *param = &cinergyt2->param; - int err = -ERESTARTSYS; + int err = -EAGAIN; - if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->wq_sem)) + if (cinergyt2->disconnect_pending) + goto out; + err = mutex_lock_interruptible(&cinergyt2->wq_sem); + if (err) goto out; - if (mutex_lock_interruptible(&cinergyt2->sem)) + err = mutex_lock_interruptible(&cinergyt2->sem); + if (err) goto out_unlock1; - err = 0; - if (!cinergyt2->sleeping) { cinergyt2_sleep(cinergyt2, 0); cinergyt2_command(cinergyt2, (char *) param, sizeof(*param), NULL, 0); -- cgit v1.1 From a13625c518ca6fd3ff7cb3b66d8023f843a745a3 Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Sat, 13 Oct 2007 05:54:54 -0300 Subject: V4L/DVB (6324): fix videobuf_cgmbuf export As videobuf_cgmbuf is defined only if CONFIG_VIDEO_V4L1_COMPAT is enabled, move the EXPORT_SYMBOL_GPL declaration inside the #ifdef block. Fixes compilation for x86_64 defconfig. Signed-off-by: Pekka Enberg Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/videobuf-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index 5599a36..89a44f1 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c @@ -967,6 +967,7 @@ int videobuf_cgmbuf(struct videobuf_queue *q, return 0; } +EXPORT_SYMBOL_GPL(videobuf_cgmbuf); #endif /* --------------------------------------------------------------------- */ @@ -985,7 +986,6 @@ EXPORT_SYMBOL_GPL(videobuf_reqbufs); EXPORT_SYMBOL_GPL(videobuf_querybuf); EXPORT_SYMBOL_GPL(videobuf_qbuf); EXPORT_SYMBOL_GPL(videobuf_dqbuf); -EXPORT_SYMBOL_GPL(videobuf_cgmbuf); EXPORT_SYMBOL_GPL(videobuf_streamon); EXPORT_SYMBOL_GPL(videobuf_streamoff); -- cgit v1.1 From fcf94c89af8acccb14ce37b1c9e8dd6bd32a999d Mon Sep 17 00:00:00 2001 From: Florin Malita Date: Sat, 13 Oct 2007 11:49:52 -0300 Subject: V4L/DVB (6325): Double-free in cx23885_initdev Both cx23885_initdev and cx23885_dev_setup free the device in their error path so a failure in the latter causes a double-free. Since cx23885_dev_setup is only called from cx23885_initdev, it should be safe to remove its deallocation and leave the cleanup up to the allocating function. Coverity CID 1922. Signed-off-by: Florin Malita CC: Steven Toth Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx23885/cx23885-core.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c index af16505..3cdd136 100644 --- a/drivers/media/video/cx23885/cx23885-core.c +++ b/drivers/media/video/cx23885/cx23885-core.c @@ -793,7 +793,7 @@ static int cx23885_dev_setup(struct cx23885_dev *dev) dev->pci->subsystem_device); cx23885_devcount--; - goto fail_free; + return -ENODEV; } /* PCIe stuff */ @@ -835,10 +835,6 @@ static int cx23885_dev_setup(struct cx23885_dev *dev) } return 0; - -fail_free: - kfree(dev); - return -ENODEV; } void cx23885_dev_unregister(struct cx23885_dev *dev) -- cgit v1.1 From 1419683d85367df90079fb5535865ac0841ebbea Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 14 Oct 2007 18:11:53 -0300 Subject: V4L/DVB (6326): tuner-core.c: fe_has_signal() can return uninitialized value Initialize strength to zero. Thanks to Adrian Bunk, who spotted this with the Coverity checker. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/tuner-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 9484308..6a77760 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -113,7 +113,7 @@ static void fe_standby(struct tuner *t) static int fe_has_signal(struct tuner *t) { struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops; - u16 strength; + u16 strength = 0; if (fe_tuner_ops->get_rf_strength) fe_tuner_ops->get_rf_strength(&t->fe, &strength); -- cgit v1.1 From 7e7f05ca156d34b80e53105e4ef9bc1497a68439 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sun, 14 Oct 2007 14:51:37 -0300 Subject: V4L/DVB (6328): ivtv: fix NULL dereference We shouldn't dereference "itv" when we know it's NULL... Spotted by the Coverity checker. Signed-off-by: Adrian Bunk Reviewed-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtv-fileops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c index da50fa4..0e0605c 100644 --- a/drivers/media/video/ivtv/ivtv-fileops.c +++ b/drivers/media/video/ivtv/ivtv-fileops.c @@ -947,7 +947,7 @@ int ivtv_v4l2_open(struct inode *inode, struct file *filp) if (itv == NULL) { /* Couldn't find a device registered on that minor, shouldn't happen! */ - IVTV_WARN("No ivtv device found on minor %d\n", minor); + printk(KERN_WARNING "No ivtv device found on minor %d\n", minor); return -ENXIO; } -- cgit v1.1 From c458473ebf31755373ca2f8063c9ec9744205924 Mon Sep 17 00:00:00 2001 From: Maxim Levitsky Date: Fri, 12 Oct 2007 00:57:15 -0300 Subject: V4L/DVB (6329): Additional Fixes for saa7134 suspend/resume Fixes few more problems I found in my saa7134 resume code: * Race between IRQ handler and .suspend()/.resume() functions * Removes timeout timers on active buffers - those buffers will be recaptured after resume * Adds suspend/resume for IR code - probably necessary if using polling mode * Adds #ifdef CONFIG_PM overs suspend code * Runs a quirk in set_tvnorm in suspend/resume too * Rearranges the order of calls in saa7134_resume to be exactly as in saa7134_initdev thus the card is initialized in exactly the same way * Since DMA audio capture suspend/resume isn't yet supported, avoid re-enabling it on resume for now Signed-off-by: Maxim Levitsky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/saa7134/saa7134-core.c | 42 ++++++++++++++++++++++----- drivers/media/video/saa7134/saa7134-input.c | 4 +-- drivers/media/video/saa7134/saa7134-tvaudio.c | 2 +- drivers/media/video/saa7134/saa7134-video.c | 25 ++++++++++------ drivers/media/video/saa7134/saa7134.h | 6 ++-- 5 files changed, 57 insertions(+), 22 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 1a4a244..410242a 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -429,7 +429,7 @@ int saa7134_set_dmabits(struct saa7134_dev *dev) assert_spin_locked(&dev->slock); - if (dev->inresume) + if (dev->insuspend) return 0; /* video capture -- dma 0 + video task A */ @@ -563,6 +563,9 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id) unsigned long report,status; int loop, handled = 0; + if (dev->insuspend) + goto out; + for (loop = 0; loop < 10; loop++) { report = saa_readl(SAA7134_IRQ_REPORT); status = saa_readl(SAA7134_IRQ_STATUS); @@ -1163,6 +1166,7 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev) kfree(dev); } +#ifdef CONFIG_PM static int saa7134_suspend(struct pci_dev *pci_dev , pm_message_t state) { @@ -1176,6 +1180,17 @@ static int saa7134_suspend(struct pci_dev *pci_dev , pm_message_t state) saa_writel(SAA7134_IRQ2, 0); saa_writel(SAA7134_MAIN_CTRL, 0); + synchronize_irq(pci_dev->irq); + dev->insuspend = 1; + + /* Disable timeout timers - if we have active buffers, we will + fill them on resume*/ + + del_timer(&dev->video_q.timeout); + del_timer(&dev->vbi_q.timeout); + del_timer(&dev->ts_q.timeout); + saa7134_ir_stop(dev); + pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state)); pci_save_state(pci_dev); @@ -1194,24 +1209,27 @@ static int saa7134_resume(struct pci_dev *pci_dev) /* Do things that are done in saa7134_initdev , except of initializing memory structures.*/ - dev->inresume = 1; saa7134_board_init1(dev); + /* saa7134_hwinit1 */ if (saa7134_boards[dev->board].video_out) saa7134_videoport_init(dev); - if (card_has_mpeg(dev)) saa7134_ts_init_hw(dev); - + if (dev->remote) + saa7134_ir_start(dev, dev->remote); saa7134_hw_enable1(dev); - saa7134_set_decoder(dev); - saa7134_i2c_call_clients(dev, VIDIOC_S_STD, &dev->tvnorm->id); + + saa7134_board_init2(dev); - saa7134_hw_enable2(dev); + /*saa7134_hwinit2*/ + saa7134_set_tvnorm_hw(dev); saa7134_tvaudio_setmute(dev); saa7134_tvaudio_setvolume(dev, dev->ctl_volume); + saa7134_tvaudio_do_scan(dev); saa7134_enable_i2s(dev); + saa7134_hw_enable2(dev); /*resume unfinished buffer(s)*/ spin_lock_irqsave(&dev->slock, flags); @@ -1219,13 +1237,19 @@ static int saa7134_resume(struct pci_dev *pci_dev) saa7134_buffer_requeue(dev, &dev->vbi_q); saa7134_buffer_requeue(dev, &dev->ts_q); + /* FIXME: Disable DMA audio sound - temporary till proper support + is implemented*/ + + dev->dmasound.dma_running = 0; + /* start DMA now*/ - dev->inresume = 0; + dev->insuspend = 0; saa7134_set_dmabits(dev); spin_unlock_irqrestore(&dev->slock, flags); return 0; } +#endif /* ----------------------------------------------------------- */ @@ -1262,8 +1286,10 @@ static struct pci_driver saa7134_pci_driver = { .id_table = saa7134_pci_tbl, .probe = saa7134_initdev, .remove = __devexit_p(saa7134_finidev), +#ifdef CONFIG_PM .suspend = saa7134_suspend, .resume = saa7134_resume +#endif }; static int saa7134_init(void) diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 80d2644..d4907ce 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -159,7 +159,7 @@ static void saa7134_input_timer(unsigned long data) mod_timer(&ir->timer, jiffies + msecs_to_jiffies(ir->polling)); } -static void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir) +void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir) { if (ir->polling) { setup_timer(&ir->timer, saa7134_input_timer, @@ -182,7 +182,7 @@ static void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir) } } -static void saa7134_ir_stop(struct saa7134_dev *dev) +void saa7134_ir_stop(struct saa7134_dev *dev) { if (dev->remote->polling) del_timer_sync(&dev->remote->timer); diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index 1b9e39a..976318d 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c @@ -231,7 +231,7 @@ static void mute_input_7134(struct saa7134_dev *dev) } if (dev->hw_mute == mute && - dev->hw_input == in && !dev->inresume) { + dev->hw_input == in && !dev->insuspend) { dprintk("mute/input: nothing to do [mute=%d,input=%s]\n", mute,in->name); return; diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 2b089777..3b9ffb4 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c @@ -560,15 +560,8 @@ void set_tvnorm(struct saa7134_dev *dev, struct saa7134_tvnorm *norm) dev->crop_current = dev->crop_defrect; - saa7134_set_decoder(dev); + saa7134_set_tvnorm_hw(dev); - if (card_in(dev, dev->ctl_input).tv) { - if ((card(dev).tuner_type == TUNER_PHILIPS_TDA8290) - && ((card(dev).tuner_config == 1) - || (card(dev).tuner_config == 2))) - saa7134_set_gpio(dev, 22, 5); - saa7134_i2c_call_clients(dev, VIDIOC_S_STD, &norm->id); - } } static void video_mux(struct saa7134_dev *dev, int input) @@ -579,7 +572,8 @@ static void video_mux(struct saa7134_dev *dev, int input) saa7134_tvaudio_setinput(dev, &card_in(dev, input)); } -void saa7134_set_decoder(struct saa7134_dev *dev) + +static void saa7134_set_decoder(struct saa7134_dev *dev) { int luma_control, sync_control, mux; @@ -630,6 +624,19 @@ void saa7134_set_decoder(struct saa7134_dev *dev) saa_writeb(SAA7134_RAW_DATA_OFFSET, 0x80); } +void saa7134_set_tvnorm_hw(struct saa7134_dev *dev) +{ + saa7134_set_decoder(dev); + + if (card_in(dev, dev->ctl_input).tv) { + if ((card(dev).tuner_type == TUNER_PHILIPS_TDA8290) + && ((card(dev).tuner_config == 1) + || (card(dev).tuner_config == 2))) + saa7134_set_gpio(dev, 22, 5); + saa7134_i2c_call_clients(dev, VIDIOC_S_STD, &dev->tvnorm->id); + } +} + static void set_h_prescale(struct saa7134_dev *dev, int task, int prescale) { static const struct { diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 28ec680..fe0a843 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -524,7 +524,7 @@ struct saa7134_dev { unsigned int hw_mute; int last_carrier; int nosignal; - unsigned int inresume; + unsigned int insuspend; /* SAA7134_MPEG_* */ struct saa7134_ts ts; @@ -632,7 +632,7 @@ extern struct video_device saa7134_radio_template; void set_tvnorm(struct saa7134_dev *dev, struct saa7134_tvnorm *norm); int saa7134_videoport_init(struct saa7134_dev *dev); -void saa7134_set_decoder(struct saa7134_dev *dev); +void saa7134_set_tvnorm_hw(struct saa7134_dev *dev); int saa7134_common_ioctl(struct saa7134_dev *dev, unsigned int cmd, void *arg); @@ -706,6 +706,8 @@ int saa7134_input_init1(struct saa7134_dev *dev); void saa7134_input_fini(struct saa7134_dev *dev); void saa7134_input_irq(struct saa7134_dev *dev); void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir); +void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir); +void saa7134_ir_stop(struct saa7134_dev *dev); /* -- cgit v1.1 From ea63d0b11ebb296b3daca4fcb74931604ee3ce78 Mon Sep 17 00:00:00 2001 From: Maxim Levitsky Date: Sat, 13 Oct 2007 05:35:33 -0300 Subject: V4L/DVB (6330): V4L: saa7134: Fix interaction between tvaudio thread and the freezer make tvaudio thread freezeable, and add proper support for that Signed-off-by: Maxim Levitsky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/saa7134/saa7134-tvaudio.c | 30 ++++++++++++++++++++------- drivers/media/video/saa7134/saa7134.h | 1 + 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index 976318d..f8e304c 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include "saa7134-reg.h" @@ -502,13 +503,17 @@ static int tvaudio_thread(void *data) unsigned int i, audio, nscan; int max1,max2,carrier,rx,mode,lastmode,default_carrier; - allow_signal(SIGTERM); + + set_freezable(); + for (;;) { tvaudio_sleep(dev,-1); - if (kthread_should_stop() || signal_pending(current)) + if (kthread_should_stop()) goto done; restart: + try_to_freeze(); + dev->thread.scan1 = dev->thread.scan2; dprintk("tvaudio thread scan start [%d]\n",dev->thread.scan1); dev->tvaudio = NULL; @@ -612,9 +617,12 @@ static int tvaudio_thread(void *data) lastmode = 42; for (;;) { + + try_to_freeze(); + if (tvaudio_sleep(dev,5000)) goto restart; - if (kthread_should_stop() || signal_pending(current)) + if (kthread_should_stop()) break; if (UNSET == dev->thread.mode) { rx = tvaudio_getstereo(dev,&tvaudio[i]); @@ -630,6 +638,7 @@ static int tvaudio_thread(void *data) } done: + dev->thread.stopped = 1; return 0; } @@ -777,7 +786,8 @@ static int tvaudio_thread_ddep(void *data) struct saa7134_dev *dev = data; u32 value, norms, clock; - allow_signal(SIGTERM); + + set_freezable(); clock = saa7134_boards[dev->board].audio_clock; if (UNSET != audio_clock_override) @@ -790,10 +800,13 @@ static int tvaudio_thread_ddep(void *data) for (;;) { tvaudio_sleep(dev,-1); - if (kthread_should_stop() || signal_pending(current)) + if (kthread_should_stop()) goto done; restart: + + try_to_freeze(); + dev->thread.scan1 = dev->thread.scan2; dprintk("tvaudio thread scan start [%d]\n",dev->thread.scan1); @@ -870,6 +883,7 @@ static int tvaudio_thread_ddep(void *data) } done: + dev->thread.stopped = 1; return 0; } @@ -997,7 +1011,7 @@ int saa7134_tvaudio_init2(struct saa7134_dev *dev) int saa7134_tvaudio_fini(struct saa7134_dev *dev) { /* shutdown tvaudio thread */ - if (dev->thread.thread) + if (dev->thread.thread && !dev->thread.stopped) kthread_stop(dev->thread.thread); saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x07, 0x00); /* LINE1 */ @@ -1013,7 +1027,9 @@ int saa7134_tvaudio_do_scan(struct saa7134_dev *dev) } else if (dev->thread.thread) { dev->thread.mode = UNSET; dev->thread.scan2++; - wake_up_process(dev->thread.thread); + + if (!dev->insuspend && !dev->thread.stopped) + wake_up_process(dev->thread.thread); } else { dev->automute = 0; saa7134_tvaudio_setmute(dev); diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index fe0a843..66a390c 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -333,6 +333,7 @@ struct saa7134_thread { unsigned int scan1; unsigned int scan2; unsigned int mode; + unsigned int stopped; }; /* buffer for one video/vbi/ts frame */ -- cgit v1.1 From 7717cbedd90381f4e60b1e230dfdfd7565c7efda Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Sun, 14 Oct 2007 02:52:16 -0300 Subject: V4L/DVB (6332): cx88: Only include the blackbird fields if blackbird is selected Add some ifdefs around fields only used for blackbird support, similar to the way the dvb fields are only included with dvb support. Signed-off-by: Trent Piepho Reviewed-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88-mpeg.c | 8 ++++++-- drivers/media/video/cx88/cx88.h | 10 ++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index a652f29..1b14182 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c @@ -79,7 +79,8 @@ static int cx8802_start_dma(struct cx8802_dev *dev, { struct cx88_core *core = dev->core; - dprintk(1, "cx8802_start_dma w: %d, h: %d, f: %d\n", dev->width, dev->height, buf->vb.field); + dprintk(1, "cx8802_start_dma w: %d, h: %d, f: %d\n", + buf->vb.width, buf->vb.height, buf->vb.field); /* setup fifo + format */ cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH28], @@ -572,6 +573,8 @@ int cx8802_resume_common(struct pci_dev *pci_dev) return 0; } +#if defined(CONFIG_VIDEO_CX88_BLACKBIRD) || \ + defined(CONFIG_VIDEO_CX88_BLACKBIRD_MODULE) struct cx8802_dev * cx8802_get_device(struct inode *inode) { int minor = iminor(inode); @@ -586,6 +589,8 @@ struct cx8802_dev * cx8802_get_device(struct inode *inode) return NULL; } +EXPORT_SYMBOL(cx8802_get_device); +#endif struct cx8802_driver * cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board_type btype) { @@ -901,7 +906,6 @@ EXPORT_SYMBOL(cx8802_fini_common); EXPORT_SYMBOL(cx8802_register_driver); EXPORT_SYMBOL(cx8802_unregister_driver); -EXPORT_SYMBOL(cx8802_get_device); EXPORT_SYMBOL(cx8802_get_driver); /* ----------------------------------------------------------- */ /* diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 42e0a9b..43ba75b 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -453,11 +453,17 @@ struct cx8802_dev { /* for blackbird only */ struct list_head devlist; +#if defined(CONFIG_VIDEO_CX88_BLACKBIRD) || \ + defined(CONFIG_VIDEO_CX88_BLACKBIRD_MODULE) struct video_device *mpeg_dev; u32 mailbox; int width; int height; + /* mpeg params */ + struct cx2341x_mpeg_params params; +#endif + #if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE) /* for dvb only */ struct videobuf_dvb dvb; @@ -467,13 +473,9 @@ struct cx8802_dev { /* for switching modulation types */ unsigned char ts_gen_cntrl; - /* mpeg params */ - struct cx2341x_mpeg_params params; - /* List of attached drivers */ struct cx8802_driver drvlist; struct work_struct request_module_wk; - }; /* ----------------------------------------------------------- */ -- cgit v1.1 From f0ad90975bc9ff6cd7361b452b31dab7a90084fc Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Sun, 14 Oct 2007 02:52:16 -0300 Subject: V4L/DVB (6333): cx88: Change void* card_priv to struct vp3054_i2c_state card_priv was only used to store a pointer to the vp3054 state struct. There's no need to use a void * since it doesn't have multiple types. Make the field conditional on VP3045 support. It was already conditional on DVB support, but it's only used if VP3045 support is on, so that makes for a better option to check. Signed-off-by: Trent Piepho Reviewed-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88-dvb.c | 3 ++- drivers/media/video/cx88/cx88-vp3054-i2c.c | 16 ++++++++-------- drivers/media/video/cx88/cx88.h | 6 +++++- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index d16e5c6..fce19ca 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -475,8 +475,9 @@ static int dvb_register(struct cx8802_dev *dev) break; case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: #if defined(CONFIG_VIDEO_CX88_VP3054) || (defined(CONFIG_VIDEO_CX88_VP3054_MODULE) && defined(MODULE)) + /* MT352 is on a secondary I2C bus made from some GPIO lines */ dev->dvb.frontend = dvb_attach(mt352_attach, &dntv_live_dvbt_pro_config, - &((struct vp3054_i2c_state *)dev->card_priv)->adap); + &dev->vp3054->adap); if (dev->dvb.frontend != NULL) { dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, &dev->core->i2c_adap, DVB_PLL_FMD1216ME); diff --git a/drivers/media/video/cx88/cx88-vp3054-i2c.c b/drivers/media/video/cx88/cx88-vp3054-i2c.c index 77c3788..6ce5af4 100644 --- a/drivers/media/video/cx88/cx88-vp3054-i2c.c +++ b/drivers/media/video/cx88/cx88-vp3054-i2c.c @@ -41,7 +41,7 @@ static void vp3054_bit_setscl(void *data, int state) { struct cx8802_dev *dev = data; struct cx88_core *core = dev->core; - struct vp3054_i2c_state *vp3054_i2c = dev->card_priv; + struct vp3054_i2c_state *vp3054_i2c = dev->vp3054; if (state) { vp3054_i2c->state |= 0x0001; /* SCL high */ @@ -58,7 +58,7 @@ static void vp3054_bit_setsda(void *data, int state) { struct cx8802_dev *dev = data; struct cx88_core *core = dev->core; - struct vp3054_i2c_state *vp3054_i2c = dev->card_priv; + struct vp3054_i2c_state *vp3054_i2c = dev->vp3054; if (state) { vp3054_i2c->state |= 0x0002; /* SDA high */ @@ -113,10 +113,10 @@ int vp3054_i2c_probe(struct cx8802_dev *dev) if (core->boardnr != CX88_BOARD_DNTV_LIVE_DVB_T_PRO) return 0; - dev->card_priv = kzalloc(sizeof(*vp3054_i2c), GFP_KERNEL); - if (dev->card_priv == NULL) + vp3054_i2c = kzalloc(sizeof(*vp3054_i2c), GFP_KERNEL); + if (vp3054_i2c == NULL) return -ENOMEM; - vp3054_i2c = dev->card_priv; + dev->vp3054 = vp3054_i2c; memcpy(&vp3054_i2c->algo, &vp3054_i2c_algo_template, sizeof(vp3054_i2c->algo)); @@ -139,8 +139,8 @@ int vp3054_i2c_probe(struct cx8802_dev *dev) if (0 != rc) { printk("%s: vp3054_i2c register FAILED\n", core->name); - kfree(dev->card_priv); - dev->card_priv = NULL; + kfree(dev->vp3054); + dev->vp3054 = NULL; } return rc; @@ -148,7 +148,7 @@ int vp3054_i2c_probe(struct cx8802_dev *dev) void vp3054_i2c_remove(struct cx8802_dev *dev) { - struct vp3054_i2c_state *vp3054_i2c = dev->card_priv; + struct vp3054_i2c_state *vp3054_i2c = dev->vp3054; if (vp3054_i2c == NULL || dev->core->boardnr != CX88_BOARD_DNTV_LIVE_DVB_T_PRO) diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 43ba75b..2e0911b 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -467,8 +467,12 @@ struct cx8802_dev { #if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE) /* for dvb only */ struct videobuf_dvb dvb; +#endif - void *card_priv; +#if defined(CONFIG_VIDEO_CX88_VP3054) || \ + defined(CONFIG_VIDEO_CX88_VP3054_MODULE) + /* For VP3045 secondary I2C bus support */ + struct vp3054_i2c_state *vp3054; #endif /* for switching modulation types */ unsigned char ts_gen_cntrl; -- cgit v1.1 From 081c2fc8b9cdd13a2436e8510889293874a33340 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Sun, 14 Oct 2007 02:52:17 -0300 Subject: V4L/DVB (6334): cx88: Change (struct cx8802_dev)->drvlist to a list_head and fix bugs It was a struct cx8802_driver for no apparent reason. Nothing uses a cx8802_driver in the cx8802_dev struct. The only field that was used was devlist, a list_head. The code in cx8802_remove() that removed any loaded sub-drivers was broken. It would delete the current list entry, but didn't use list_for_each_safe. It also called list_del() on the list _head_ inside the list_for_each loop? It would crash if it was run, which I don't think can ever happen. Since the cx8802 sub-drivers use the cx8802 driver, they have to be unloaded first. So there isn't any way for a sub-driver to still be loaded when cx8802_remove() is called... Except maybe with PCI hot-plug, if one removes the PCI card while the drivers are loaded? So I left some code in to handle that if it's actually possible. It will remove the sub-drivers from the device cx8802_remove() was called on, and only that device. If one has two DVB cards and unplugs one, there is no reason to unload the DVB drivers for both cards. I have no way to test this, but it can't be worse than what was there before. cx8802_get_driver() is passed a cx8802_dev pointer and looks for the requested driver on that device. It first loops over the cx8802 device list looking for the device it was passed, which is pointless. It doesn't need to find the device pointer in the list, as it already has the pointer. The list_head in the cx8802_driver struct, which joins all the _drivers_ attached to a device, was named devlist. Changed that to drvlist, since the devlist is used for a list of _devices_ in other cx8802 structs. Signed-off-by: Trent Piepho Reviewed-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88-mpeg.c | 60 +++++++++++++++++------------------- drivers/media/video/cx88/cx88.h | 8 +++-- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index 1b14182..11d9865 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c @@ -594,24 +594,14 @@ EXPORT_SYMBOL(cx8802_get_device); struct cx8802_driver * cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board_type btype) { - struct cx8802_dev *h = NULL; - struct cx8802_driver *d = NULL; + struct cx8802_driver *d; struct list_head *list; - struct list_head *list2; - - list_for_each(list,&cx8802_devlist) { - h = list_entry(list, struct cx8802_dev, devlist); - if (h != dev) - continue; - list_for_each(list2, &h->drvlist.devlist) { - d = list_entry(list2, struct cx8802_driver, devlist); + list_for_each(list, &dev->drvlist) { + d = list_entry(list, struct cx8802_driver, drvlist); - /* only unregister the correct driver type */ - if (d->type_id == btype) { - return d; - } - } + if (d->type_id == btype) + return d; } return NULL; @@ -717,7 +707,7 @@ int cx8802_register_driver(struct cx8802_driver *drv) if (err == 0) { i++; mutex_lock(&drv->core->lock); - list_add_tail(&driver->devlist,&h->drvlist.devlist); + list_add_tail(&driver->drvlist, &h->drvlist); mutex_unlock(&drv->core->lock); } else { printk(KERN_ERR @@ -757,8 +747,8 @@ int cx8802_unregister_driver(struct cx8802_driver *drv) h->pci->subsystem_device, h->core->board.name, h->core->boardnr); - list_for_each_safe(list2, q, &h->drvlist.devlist) { - d = list_entry(list2, struct cx8802_driver, devlist); + list_for_each_safe(list2, q, &h->drvlist) { + d = list_entry(list2, struct cx8802_driver, drvlist); /* only unregister the correct driver type */ if (d->type_id != drv->type_id) @@ -772,7 +762,6 @@ int cx8802_unregister_driver(struct cx8802_driver *drv) } else printk(KERN_ERR "%s/2: cx8802 driver remove " "failed (%d)\n", h->core->name, err); - } } @@ -810,7 +799,7 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, if (err != 0) goto fail_free; - INIT_LIST_HEAD(&dev->drvlist.devlist); + INIT_LIST_HEAD(&dev->drvlist); list_add_tail(&dev->devlist,&cx8802_devlist); /* Maintain a reference so cx88-video can query the 8802 device. */ @@ -830,23 +819,32 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, static void __devexit cx8802_remove(struct pci_dev *pci_dev) { struct cx8802_dev *dev; - struct cx8802_driver *h; - struct list_head *list; dev = pci_get_drvdata(pci_dev); dprintk( 1, "%s\n", __FUNCTION__); - list_for_each(list,&dev->drvlist.devlist) { - h = list_entry(list, struct cx8802_driver, devlist); - dprintk( 1, " ->driver\n"); - if (h->remove == NULL) { - printk(KERN_ERR "%s .. skipping driver, no probe function\n", __FUNCTION__); - continue; + if (!list_empty(&dev->drvlist)) { + struct list_head *list, *tmp; + struct cx8802_driver *drv; + int err; + + printk(KERN_WARNING "%s/2: Trying to remove cx8802 driver " + "while cx8802 sub-drivers still loaded?!\n", + dev->core->name); + + list_for_each_safe(list, tmp, &dev->drvlist) { + drv = list_entry(list, struct cx8802_driver, drvlist); + + err = drv->remove(drv); + if (err == 0) { + mutex_lock(&drv->core->lock); + list_del(list); + mutex_unlock(&drv->core->lock); + } else + printk(KERN_ERR "%s/2: cx8802 driver remove " + "failed (%d)\n", dev->core->name, err); } - printk(KERN_INFO "%s .. Removing driver type %d\n", __FUNCTION__, h->type_id); - cx8802_unregister_driver(h); - list_del(&dev->drvlist.devlist); } /* Destroy any 8802 reference. */ diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 2e0911b..eb296bd 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -412,7 +412,9 @@ struct cx8802_suspend_state { struct cx8802_driver { struct cx88_core *core; - struct list_head devlist; + + /* List of drivers attached to device */ + struct list_head drvlist; /* Type of driver and access required */ enum cx88_board_type type_id; @@ -478,8 +480,8 @@ struct cx8802_dev { unsigned char ts_gen_cntrl; /* List of attached drivers */ - struct cx8802_driver drvlist; - struct work_struct request_module_wk; + struct list_head drvlist; + struct work_struct request_module_wk; }; /* ----------------------------------------------------------- */ -- cgit v1.1 From 89a47942f0facc4664d982005ac03d8dcb9635c1 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Sun, 14 Oct 2007 02:52:17 -0300 Subject: V4L/DVB (6335): cx8802: Replace list_for_each+list_entry with list_for_each_entry Less code and more efficient. Got ride of a variable that counted the number of devices in cx8802_unregister_driver() but was never used. Looked leftover from a cut&paste. Signed-off-by: Trent Piepho Reviewed-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88-mpeg.c | 85 ++++++++++++------------------------ 1 file changed, 29 insertions(+), 56 deletions(-) diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index 11d9865..d4858e4 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c @@ -178,7 +178,6 @@ static int cx8802_restart_queue(struct cx8802_dev *dev, struct cx88_dmaqueue *q) { struct cx88_buffer *buf; - struct list_head *item; dprintk( 1, "cx8802_restart_queue\n" ); if (list_empty(&q->active)) @@ -224,10 +223,8 @@ static int cx8802_restart_queue(struct cx8802_dev *dev, dprintk(2,"restart_queue [%p/%d]: restart dma\n", buf, buf->vb.i); cx8802_start_dma(dev, q, buf); - list_for_each(item,&q->active) { - buf = list_entry(item, struct cx88_buffer, vb.queue); + list_for_each_entry(buf, &q->active, vb.queue) buf->count = q->count++; - } mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); return 0; } @@ -578,14 +575,11 @@ int cx8802_resume_common(struct pci_dev *pci_dev) struct cx8802_dev * cx8802_get_device(struct inode *inode) { int minor = iminor(inode); - struct cx8802_dev *h = NULL; - struct list_head *list; + struct cx8802_dev *dev; - list_for_each(list,&cx8802_devlist) { - h = list_entry(list, struct cx8802_dev, devlist); - if (h->mpeg_dev && h->mpeg_dev->minor == minor) - return h; - } + list_for_each_entry(dev, &cx8802_devlist, devlist) + if (dev->mpeg_dev && dev->mpeg_dev->minor == minor) + return dev; return NULL; } @@ -595,14 +589,10 @@ EXPORT_SYMBOL(cx8802_get_device); struct cx8802_driver * cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board_type btype) { struct cx8802_driver *d; - struct list_head *list; - - list_for_each(list, &dev->drvlist) { - d = list_entry(list, struct cx8802_driver, drvlist); + list_for_each_entry(d, &dev->drvlist, drvlist) if (d->type_id == btype) return d; - } return NULL; } @@ -666,10 +656,9 @@ static int cx8802_check_driver(struct cx8802_driver *drv) int cx8802_register_driver(struct cx8802_driver *drv) { - struct cx8802_dev *h; + struct cx8802_dev *dev; struct cx8802_driver *driver; - struct list_head *list; - int err = 0, i = 0; + int err, i = 0; printk(KERN_INFO "cx88/2: registering cx8802 driver, type: %s access: %s\n", @@ -681,14 +670,12 @@ int cx8802_register_driver(struct cx8802_driver *drv) return err; } - list_for_each(list,&cx8802_devlist) { - h = list_entry(list, struct cx8802_dev, devlist); - + list_for_each_entry(dev, &cx8802_devlist, devlist) { printk(KERN_INFO "%s/2: subsystem: %04x:%04x, board: %s [card=%d]\n", - h->core->name, h->pci->subsystem_vendor, - h->pci->subsystem_device, h->core->board.name, - h->core->boardnr); + dev->core->name, dev->pci->subsystem_vendor, + dev->pci->subsystem_device, dev->core->board.name, + dev->core->boardnr); /* Bring up a new struct for each driver instance */ driver = kzalloc(sizeof(*drv),GFP_KERNEL); @@ -696,7 +683,7 @@ int cx8802_register_driver(struct cx8802_driver *drv) return -ENOMEM; /* Snapshot of the driver registration data */ - drv->core = h->core; + drv->core = dev->core; drv->suspend = cx8802_suspend_common; drv->resume = cx8802_resume_common; drv->request_acquire = cx8802_request_acquire; @@ -707,49 +694,38 @@ int cx8802_register_driver(struct cx8802_driver *drv) if (err == 0) { i++; mutex_lock(&drv->core->lock); - list_add_tail(&driver->drvlist, &h->drvlist); + list_add_tail(&driver->drvlist, &dev->drvlist); mutex_unlock(&drv->core->lock); } else { printk(KERN_ERR "%s/2: cx8802 probe failed, err = %d\n", - h->core->name, err); + dev->core->name, err); } } - if (i == 0) - err = -ENODEV; - else - err = 0; - return err; + return i ? 0 : -ENODEV; } int cx8802_unregister_driver(struct cx8802_driver *drv) { - struct cx8802_dev *h; - struct cx8802_driver *d; - struct list_head *list; - struct list_head *list2, *q; - int err = 0, i = 0; + struct cx8802_dev *dev; + struct cx8802_driver *d, *dtmp; + int err = 0; printk(KERN_INFO "cx88/2: unregistering cx8802 driver, type: %s access: %s\n", drv->type_id == CX88_MPEG_DVB ? "dvb" : "blackbird", drv->hw_access == CX8802_DRVCTL_SHARED ? "shared" : "exclusive"); - list_for_each(list,&cx8802_devlist) { - i++; - h = list_entry(list, struct cx8802_dev, devlist); - + list_for_each_entry(dev, &cx8802_devlist, devlist) { printk(KERN_INFO "%s/2: subsystem: %04x:%04x, board: %s [card=%d]\n", - h->core->name, h->pci->subsystem_vendor, - h->pci->subsystem_device, h->core->board.name, - h->core->boardnr); - - list_for_each_safe(list2, q, &h->drvlist) { - d = list_entry(list2, struct cx8802_driver, drvlist); + dev->core->name, dev->pci->subsystem_vendor, + dev->pci->subsystem_device, dev->core->board.name, + dev->core->boardnr); + list_for_each_entry_safe(d, dtmp, &dev->drvlist, drvlist) { /* only unregister the correct driver type */ if (d->type_id != drv->type_id) continue; @@ -757,11 +733,11 @@ int cx8802_unregister_driver(struct cx8802_driver *drv) err = d->remove(d); if (err == 0) { mutex_lock(&drv->core->lock); - list_del(list2); + list_del(&d->drvlist); mutex_unlock(&drv->core->lock); } else printk(KERN_ERR "%s/2: cx8802 driver remove " - "failed (%d)\n", h->core->name, err); + "failed (%d)\n", dev->core->name, err); } } @@ -825,21 +801,18 @@ static void __devexit cx8802_remove(struct pci_dev *pci_dev) dprintk( 1, "%s\n", __FUNCTION__); if (!list_empty(&dev->drvlist)) { - struct list_head *list, *tmp; - struct cx8802_driver *drv; + struct cx8802_driver *drv, *tmp; int err; printk(KERN_WARNING "%s/2: Trying to remove cx8802 driver " "while cx8802 sub-drivers still loaded?!\n", dev->core->name); - list_for_each_safe(list, tmp, &dev->drvlist) { - drv = list_entry(list, struct cx8802_driver, drvlist); - + list_for_each_entry_safe(drv, tmp, &dev->drvlist, drvlist) { err = drv->remove(drv); if (err == 0) { mutex_lock(&drv->core->lock); - list_del(list); + list_del(&drv->drvlist); mutex_unlock(&drv->core->lock); } else printk(KERN_ERR "%s/2: cx8802 driver remove " -- cgit v1.1 From a04036a3129e09a9b9097de2b1f77dd82a6e9ac3 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Fri, 5 Oct 2007 11:28:09 -0300 Subject: V4L/DVB (6336): cx8802: Plug memory leak when unregistering a driver When a cx8802 sub-driver was unregistered, the struct cx8802_driver, which was kmalloc()ed by cx8802_register_driver(), was deleted from the list of drivers, but never freed. Signed-off-by: Trent Piepho Reviewed-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88-mpeg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index d4858e4..448c673 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c @@ -735,6 +735,7 @@ int cx8802_unregister_driver(struct cx8802_driver *drv) mutex_lock(&drv->core->lock); list_del(&d->drvlist); mutex_unlock(&drv->core->lock); + kfree(d); } else printk(KERN_ERR "%s/2: cx8802 driver remove " "failed (%d)\n", dev->core->name, err); @@ -817,6 +818,7 @@ static void __devexit cx8802_remove(struct pci_dev *pci_dev) } else printk(KERN_ERR "%s/2: cx8802 driver remove " "failed (%d)\n", dev->core->name, err); + kfree(drv); } } -- cgit v1.1 From af3420b4495914a1a889ae7de0220c793461ba1f Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Fri, 12 Oct 2007 06:18:30 -0300 Subject: V4L/DVB (6338): ivtv: fix incorrect EBUSY return Trying to open the radio when a capture is in progress will make it impossible to open the radio again since the radio stream wasn't released. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtv-fileops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c index 0e0605c..24fcbb8 100644 --- a/drivers/media/video/ivtv/ivtv-fileops.c +++ b/drivers/media/video/ivtv/ivtv-fileops.c @@ -892,6 +892,7 @@ static int ivtv_serialized_open(struct ivtv_stream *s, struct file *filp) if (atomic_read(&itv->capturing) > 0) { /* switching to radio while capture is in progress is not polite */ + ivtv_release_stream(s); kfree(item); return -EBUSY; } -- cgit v1.1 From 4339ab93657cce9ca0e4678053ddcb68149d48fd Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Fri, 12 Oct 2007 06:20:09 -0300 Subject: V4L/DVB (6339): ivtv: set the video color to black instead of green when capturing from the radio Thanks-to: Martin Dauskardt Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtv-streams.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index fd13598..ff4cb16 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c @@ -478,7 +478,8 @@ int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s) s->buffers_stolen = 0; /* mute/unmute video */ - ivtv_vapi(itv, CX2341X_ENC_MUTE_VIDEO, 1, test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) ? 1 : 0); + ivtv_vapi(itv, CX2341X_ENC_MUTE_VIDEO, 1, + test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) ? 0x00808001 : 0); /* Clear Streamoff flags in case left from last capture */ clear_bit(IVTV_F_S_STREAMOFF, &s->s_flags); -- cgit v1.1 From 6659e3ed559db2e730947268f9d57869b7a9016c Mon Sep 17 00:00:00 2001 From: Ian Armstrong Date: Fri, 12 Oct 2007 08:15:41 -0300 Subject: V4L/DVB (6340): ivtvfb: screen mode change sometimes goes wrong This patch partially reverts a previous change that caused the CX2341X_OSD_SET_PIXEL_FORMAT firmware calls to be skipped when the pixel format of the framebuffer wasn't altered by FBIOPUT_VSCREENINFO. Unfortunately, another firmware call on the PVR350 sometimes scrambles the display when trying to adjust the framebuffer settings. This patch re-enables the CX2341X_OSD_SET_PIXEL_FORMAT calls to try and prevent this from occurring. Signed-off-by: Ian Armstrong Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtvfb.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/media/video/ivtv/ivtvfb.c b/drivers/media/video/ivtv/ivtvfb.c index 9684048..0abca6b 100644 --- a/drivers/media/video/ivtv/ivtvfb.c +++ b/drivers/media/video/ivtv/ivtvfb.c @@ -166,9 +166,6 @@ struct osd_info { unsigned long fb_end_aligned_physaddr; #endif - /* Current osd mode */ - int osd_mode; - /* Store the buffer offset */ int set_osd_coords_x; int set_osd_coords_y; @@ -470,13 +467,11 @@ static int ivtvfb_set_var(struct ivtv *itv, struct fb_var_screeninfo *var) IVTVFB_DEBUG_WARN("ivtvfb_set_var - Invalid bpp\n"); } - /* Change osd mode if needed. - Although rare, things can go wrong. The extra mode - change seems to help... */ - if (osd_mode != -1 && osd_mode != oi->osd_mode) { + /* Set video mode. Although rare, the display can become scrambled even + if we don't change mode. Always 'bounce' to osd_mode via mode 0 */ + if (osd_mode != -1) { ivtv_vapi(itv, CX2341X_OSD_SET_PIXEL_FORMAT, 1, 0); ivtv_vapi(itv, CX2341X_OSD_SET_PIXEL_FORMAT, 1, osd_mode); - oi->osd_mode = osd_mode; } oi->bits_per_pixel = var->bits_per_pixel; @@ -882,9 +877,6 @@ static int ivtvfb_init_vidmode(struct ivtv *itv) oi->bits_per_pixel = osd_depth; oi->bytes_per_pixel = oi->bits_per_pixel / 8; - /* Invalidate current osd mode to force a mode switch later */ - oi->osd_mode = -1; - /* Horizontal size & position */ if (osd_xres > 720) osd_xres = 720; -- cgit v1.1 From 34ca7d3791c6a467ff6810a149bdf78be086c23a Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Fri, 12 Oct 2007 12:39:36 -0300 Subject: V4L/DVB (6341): ivtv: fix resizing MPEG1 streams Resizing an MPEG 1 stream would cut off the right half of the image due to a missing divide by 2 in VIDIOC_S_FMT. Also did some minor cleanup in this part of the code. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtv-ioctl.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 206eee7..fd6826f 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c @@ -555,6 +555,7 @@ static int ivtv_try_or_set_fmt(struct ivtv *itv, int streamtype, /* set window size */ if (fmt->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { + struct cx2341x_mpeg_params *p = &itv->params; int w = fmt->fmt.pix.width; int h = fmt->fmt.pix.height; @@ -566,17 +567,19 @@ static int ivtv_try_or_set_fmt(struct ivtv *itv, int streamtype, fmt->fmt.pix.width = w; fmt->fmt.pix.height = h; - if (!set_fmt || (itv->params.width == w && itv->params.height == h)) + if (!set_fmt || (p->width == w && p->height == h)) return 0; if (atomic_read(&itv->capturing) > 0) return -EBUSY; - itv->params.width = w; - itv->params.height = h; + p->width = w; + p->height = h; if (w != 720 || h != (itv->is_50hz ? 576 : 480)) - itv->params.video_temporal_filter = 0; + p->video_temporal_filter = 0; else - itv->params.video_temporal_filter = 8; + p->video_temporal_filter = 8; + if (p->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1) + fmt->fmt.pix.width /= 2; itv->video_dec_func(itv, VIDIOC_S_FMT, fmt); return ivtv_get_fmt(itv, streamtype, fmt); } -- cgit v1.1 From 18e16f9c954c6a931ee97584014c826255e0bdaa Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 13 Oct 2007 05:54:48 -0300 Subject: V4L/DVB (6342): ivtv: fix circular locking (bug 9037) If you try to access the video device from within an udev rule, then you get into a circular locking situation. Changed the driver to postpone the registration of the devices until everything else has been fully initialized, so that the newly created device can be used immediately. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtv-driver.c | 11 ++-- drivers/media/video/ivtv/ivtv-streams.c | 100 ++++++++++++++++++-------------- drivers/media/video/ivtv/ivtv-streams.h | 1 + 3 files changed, 65 insertions(+), 47 deletions(-) diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index fd7a932..6d2dd87 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c @@ -1003,8 +1003,6 @@ static int __devinit ivtv_probe(struct pci_dev *dev, IVTV_DEBUG_INFO("base addr: 0x%08x\n", itv->base_addr); - mutex_lock(&itv->serialize_lock); - /* PCI Device Setup */ if ((retval = ivtv_setup_pci(itv, dev, pci_id)) != 0) { if (retval == -EIO) @@ -1064,7 +1062,7 @@ static int __devinit ivtv_probe(struct pci_dev *dev, IVTV_DEBUG_INFO("activating i2c...\n"); if (init_ivtv_i2c(itv)) { IVTV_ERR("Could not initialize i2c\n"); - goto free_irq; + goto free_io; } IVTV_DEBUG_INFO("Active card count: %d.\n", ivtv_cards_active); @@ -1176,7 +1174,11 @@ static int __devinit ivtv_probe(struct pci_dev *dev, IVTV_ERR("Failed to register irq %d\n", retval); goto free_streams; } - mutex_unlock(&itv->serialize_lock); + retval = ivtv_streams_register(itv); + if (retval) { + IVTV_ERR("Error %d registering devices\n", retval); + goto free_irq; + } IVTV_INFO("Initialized card #%d: %s\n", itv->num, itv->card_name); return 0; @@ -1195,7 +1197,6 @@ static int __devinit ivtv_probe(struct pci_dev *dev, release_mem_region(itv->base_addr + IVTV_DECODER_OFFSET, IVTV_DECODER_SIZE); free_workqueue: destroy_workqueue(itv->irq_work_queues); - mutex_unlock(&itv->serialize_lock); err: if (retval == 0) retval = -ENODEV; diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index ff4cb16..6c954b3 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c @@ -166,10 +166,9 @@ static void ivtv_stream_init(struct ivtv *itv, int type) ivtv_queue_init(&s->q_io); } -static int ivtv_reg_dev(struct ivtv *itv, int type) +static int ivtv_prep_dev(struct ivtv *itv, int type) { struct ivtv_stream *s = &itv->streams[type]; - int vfl_type = ivtv_stream_info[type].vfl_type; int minor_offset = ivtv_stream_info[type].minor_offset; int minor; @@ -187,15 +186,12 @@ static int ivtv_reg_dev(struct ivtv *itv, int type) if (type >= IVTV_DEC_STREAM_TYPE_MPG && !(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) return 0; - if (minor_offset >= 0) - /* card number + user defined offset + device offset */ - minor = itv->num + ivtv_first_minor + minor_offset; - else - minor = -1; + /* card number + user defined offset + device offset */ + minor = itv->num + ivtv_first_minor + minor_offset; /* User explicitly selected 0 buffers for these streams, so don't create them. */ - if (minor >= 0 && ivtv_stream_info[type].dma != PCI_DMA_NONE && + if (ivtv_stream_info[type].dma != PCI_DMA_NONE && itv->options.kilobytes[type] == 0) { IVTV_INFO("Disabled %s device\n", ivtv_stream_info[type].name); return 0; @@ -223,21 +219,53 @@ static int ivtv_reg_dev(struct ivtv *itv, int type) s->v4l2dev->fops = ivtv_stream_info[type].fops; s->v4l2dev->release = video_device_release; - if (minor >= 0) { - /* Register device. First try the desired minor, then any free one. */ - if (video_register_device(s->v4l2dev, vfl_type, minor) && - video_register_device(s->v4l2dev, vfl_type, -1)) { - IVTV_ERR("Couldn't register v4l2 device for %s minor %d\n", - s->name, minor); - video_device_release(s->v4l2dev); - s->v4l2dev = NULL; - return -ENOMEM; - } + return 0; +} + +/* Initialize v4l2 variables and prepare v4l2 devices */ +int ivtv_streams_setup(struct ivtv *itv) +{ + int type; + + /* Setup V4L2 Devices */ + for (type = 0; type < IVTV_MAX_STREAMS; type++) { + /* Prepare device */ + if (ivtv_prep_dev(itv, type)) + break; + + if (itv->streams[type].v4l2dev == NULL) + continue; + + /* Allocate Stream */ + if (ivtv_stream_alloc(&itv->streams[type])) + break; } - else { - /* Don't register a 'hidden' stream (OSD) */ - IVTV_INFO("Created framebuffer stream for %s\n", s->name); + if (type == IVTV_MAX_STREAMS) return 0; + + /* One or more streams could not be initialized. Clean 'em all up. */ + ivtv_streams_cleanup(itv); + return -ENOMEM; +} + +static int ivtv_reg_dev(struct ivtv *itv, int type) +{ + struct ivtv_stream *s = &itv->streams[type]; + int vfl_type = ivtv_stream_info[type].vfl_type; + int minor; + + if (s->v4l2dev == NULL) + return 0; + + minor = s->v4l2dev->minor; + /* Register device. First try the desired minor, then any free one. */ + if (video_register_device(s->v4l2dev, vfl_type, minor) && + video_register_device(s->v4l2dev, vfl_type, -1)) { + IVTV_ERR("Couldn't register v4l2 device for %s minor %d\n", + s->name, minor); + video_device_release(s->v4l2dev); + s->v4l2dev = NULL; + return -ENOMEM; } switch (vfl_type) { @@ -262,27 +290,18 @@ static int ivtv_reg_dev(struct ivtv *itv, int type) return 0; } -/* Initialize v4l2 variables and register v4l2 devices */ -int ivtv_streams_setup(struct ivtv *itv) +/* Register v4l2 devices */ +int ivtv_streams_register(struct ivtv *itv) { int type; + int err = 0; - /* Setup V4L2 Devices */ - for (type = 0; type < IVTV_MAX_STREAMS; type++) { - /* Register Device */ - if (ivtv_reg_dev(itv, type)) - break; - - if (itv->streams[type].v4l2dev == NULL) - continue; + /* Register V4L2 devices */ + for (type = 0; type < IVTV_MAX_STREAMS; type++) + err |= ivtv_reg_dev(itv, type); - /* Allocate Stream */ - if (ivtv_stream_alloc(&itv->streams[type])) - break; - } - if (type == IVTV_MAX_STREAMS) { + if (err == 0) return 0; - } /* One or more streams could not be initialized. Clean 'em all up. */ ivtv_streams_cleanup(itv); @@ -303,11 +322,8 @@ void ivtv_streams_cleanup(struct ivtv *itv) continue; ivtv_stream_free(&itv->streams[type]); - /* Free Device */ - if (vdev->minor == -1) /* 'Hidden' never registered stream (OSD) */ - video_device_release(vdev); - else /* All others, just unregister. */ - video_unregister_device(vdev); + /* Unregister device */ + video_unregister_device(vdev); } } diff --git a/drivers/media/video/ivtv/ivtv-streams.h b/drivers/media/video/ivtv/ivtv-streams.h index 8f5f5b1..3d76a41 100644 --- a/drivers/media/video/ivtv/ivtv-streams.h +++ b/drivers/media/video/ivtv/ivtv-streams.h @@ -22,6 +22,7 @@ #define IVTV_STREAMS_H int ivtv_streams_setup(struct ivtv *itv); +int ivtv_streams_register(struct ivtv *itv); void ivtv_streams_cleanup(struct ivtv *itv); /* Capture related */ -- cgit v1.1 From d343d7f9792ac1790757cb35a419b8b0b5210917 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 14 Oct 2007 11:17:14 -0300 Subject: V4L/DVB (6343): ivtvfb: check return value of unregister_framebuffer Prevent unloading the framebuffer if it is still in use. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtvfb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/ivtv/ivtvfb.c b/drivers/media/video/ivtv/ivtvfb.c index 0abca6b..4a7512d 100644 --- a/drivers/media/video/ivtv/ivtvfb.c +++ b/drivers/media/video/ivtv/ivtvfb.c @@ -1169,9 +1169,12 @@ static void ivtvfb_cleanup(void) for (i = 0; i < ivtv_cards_active; i++) { itv = ivtv_cards[i]; if (itv && (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) && itv->osd_info) { + if (unregister_framebuffer(&itv->osd_info->ivtvfb_info)) { + IVTVFB_WARN("Framebuffer %d is in use, cannot unload\n", i); + return; + } IVTVFB_DEBUG_INFO("Unregister framebuffer %d\n", i); ivtvfb_blank(FB_BLANK_POWERDOWN, &itv->osd_info->ivtvfb_info); - unregister_framebuffer(&itv->osd_info->ivtvfb_info); ivtvfb_release_buffers(itv); itv->osd_video_pbase = 0; } -- cgit v1.1 From 0bfeb04a9f3ad9ad8c9bbba062231ff1a76e4465 Mon Sep 17 00:00:00 2001 From: Ian Armstrong Date: Sun, 14 Oct 2007 13:08:02 -0300 Subject: V4L/DVB (6345): ivtvfb: YUV handling of an image which is not visible in the display area When the ivtvfb module is loaded, the YUV output is relative to the framebuffer output. When a virtual screen size is used, the output area for the YUV may actually be off screen. To prevent the hardware from crashing, the current driver will ignore an off-screen position and leave the output visible at the last on-screen position. This may not be desirable, so this patch will switch off the YUV output should the image move off-screen, and re-enable it should the image move on-screen again. Signed-off-by: Ian Armstrong Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtv-yuv.c | 22 ++++++++++++---------- drivers/media/video/ivtv/ivtv-yuv.h | 1 + 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/media/video/ivtv/ivtv-yuv.c b/drivers/media/video/ivtv/ivtv-yuv.c index e2288f2..13c3582 100644 --- a/drivers/media/video/ivtv/ivtv-yuv.c +++ b/drivers/media/video/ivtv/ivtv-yuv.c @@ -710,7 +710,7 @@ static u32 ivtv_yuv_window_setup (struct ivtv *itv, struct yuv_frame_info *windo /* If there's nothing to safe to display, we may as well stop now */ if ((int)window->dst_w <= 2 || (int)window->dst_h <= 2 || (int)window->src_w <= 2 || (int)window->src_h <= 2) { - return 0; + return IVTV_YUV_UPDATE_INVALID; } /* Ensure video remains inside OSD area */ @@ -791,7 +791,7 @@ static u32 ivtv_yuv_window_setup (struct ivtv *itv, struct yuv_frame_info *windo /* Check again. If there's nothing to safe to display, stop now */ if ((int)window->dst_w <= 2 || (int)window->dst_h <= 2 || (int)window->src_w <= 2 || (int)window->src_h <= 2) { - return 0; + return IVTV_YUV_UPDATE_INVALID; } /* Both x offset & width are linked, so they have to be done together */ @@ -840,12 +840,17 @@ void ivtv_yuv_work_handler (struct ivtv *itv) if (!(yuv_update = ivtv_yuv_window_setup (itv, &window))) return; - /* Update horizontal settings */ - if (yuv_update & IVTV_YUV_UPDATE_HORIZONTAL) - ivtv_yuv_handle_horizontal(itv, &window); + if (yuv_update & IVTV_YUV_UPDATE_INVALID) { + write_reg(0x01008080, 0x2898); + } else if (yuv_update) { + write_reg(0x00108080, 0x2898); - if (yuv_update & IVTV_YUV_UPDATE_VERTICAL) - ivtv_yuv_handle_vertical(itv, &window); + if (yuv_update & IVTV_YUV_UPDATE_HORIZONTAL) + ivtv_yuv_handle_horizontal(itv, &window); + + if (yuv_update & IVTV_YUV_UPDATE_VERTICAL) + ivtv_yuv_handle_vertical(itv, &window); + } memcpy(&itv->yuv_info.old_frame_info, &window, sizeof (itv->yuv_info.old_frame_info)); } @@ -936,9 +941,6 @@ static void ivtv_yuv_init (struct ivtv *itv) IVTV_DEBUG_WARN ("Failed to allocate yuv blanking buffer\n"); } - IVTV_DEBUG_WARN("Enable video output\n"); - write_reg_sync(0x00108080, 0x2898); - /* Enable YUV decoder output */ write_reg_sync(0x01, IVTV_REG_VDM); diff --git a/drivers/media/video/ivtv/ivtv-yuv.h b/drivers/media/video/ivtv/ivtv-yuv.h index f7215ee..3b966f0 100644 --- a/drivers/media/video/ivtv/ivtv-yuv.h +++ b/drivers/media/video/ivtv/ivtv-yuv.h @@ -34,6 +34,7 @@ #define IVTV_YUV_UPDATE_HORIZONTAL 0x01 #define IVTV_YUV_UPDATE_VERTICAL 0x02 +#define IVTV_YUV_UPDATE_INVALID 0x04 extern const u32 yuv_offset[4]; -- cgit v1.1 From 195b1252517d504391d29f71b789d4c1c9f605e0 Mon Sep 17 00:00:00 2001 From: Ian Armstrong Date: Sun, 14 Oct 2007 13:12:28 -0300 Subject: V4L/DVB (6346): ivtvfb: YUV output size fix when ivtvfb is not loaded If the ivtvfb module isn't loaded, the valid YUV output area should be set to full-screen. This patch fixes the case where the valid output area was not reset when the output broadcast format was changed from NTSC to PAL. This resulted in output being limited to the top 480 lines of the display. Signed-off-by: Ian Armstrong Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtv-yuv.c | 138 +++++++++++++++++++----------------- 1 file changed, 72 insertions(+), 66 deletions(-) diff --git a/drivers/media/video/ivtv/ivtv-yuv.c b/drivers/media/video/ivtv/ivtv-yuv.c index 13c3582..9091c48 100644 --- a/drivers/media/video/ivtv/ivtv-yuv.c +++ b/drivers/media/video/ivtv/ivtv-yuv.c @@ -857,95 +857,101 @@ void ivtv_yuv_work_handler (struct ivtv *itv) static void ivtv_yuv_init (struct ivtv *itv) { + struct yuv_playback_info *yi = &itv->yuv_info; + IVTV_DEBUG_YUV("ivtv_yuv_init\n"); /* Take a snapshot of the current register settings */ - itv->yuv_info.reg_2834 = read_reg(0x02834); - itv->yuv_info.reg_2838 = read_reg(0x02838); - itv->yuv_info.reg_283c = read_reg(0x0283c); - itv->yuv_info.reg_2840 = read_reg(0x02840); - itv->yuv_info.reg_2844 = read_reg(0x02844); - itv->yuv_info.reg_2848 = read_reg(0x02848); - itv->yuv_info.reg_2854 = read_reg(0x02854); - itv->yuv_info.reg_285c = read_reg(0x0285c); - itv->yuv_info.reg_2864 = read_reg(0x02864); - itv->yuv_info.reg_2870 = read_reg(0x02870); - itv->yuv_info.reg_2874 = read_reg(0x02874); - itv->yuv_info.reg_2898 = read_reg(0x02898); - itv->yuv_info.reg_2890 = read_reg(0x02890); - - itv->yuv_info.reg_289c = read_reg(0x0289c); - itv->yuv_info.reg_2918 = read_reg(0x02918); - itv->yuv_info.reg_291c = read_reg(0x0291c); - itv->yuv_info.reg_2920 = read_reg(0x02920); - itv->yuv_info.reg_2924 = read_reg(0x02924); - itv->yuv_info.reg_2928 = read_reg(0x02928); - itv->yuv_info.reg_292c = read_reg(0x0292c); - itv->yuv_info.reg_2930 = read_reg(0x02930); - itv->yuv_info.reg_2934 = read_reg(0x02934); - itv->yuv_info.reg_2938 = read_reg(0x02938); - itv->yuv_info.reg_293c = read_reg(0x0293c); - itv->yuv_info.reg_2940 = read_reg(0x02940); - itv->yuv_info.reg_2944 = read_reg(0x02944); - itv->yuv_info.reg_2948 = read_reg(0x02948); - itv->yuv_info.reg_294c = read_reg(0x0294c); - itv->yuv_info.reg_2950 = read_reg(0x02950); - itv->yuv_info.reg_2954 = read_reg(0x02954); - itv->yuv_info.reg_2958 = read_reg(0x02958); - itv->yuv_info.reg_295c = read_reg(0x0295c); - itv->yuv_info.reg_2960 = read_reg(0x02960); - itv->yuv_info.reg_2964 = read_reg(0x02964); - itv->yuv_info.reg_2968 = read_reg(0x02968); - itv->yuv_info.reg_296c = read_reg(0x0296c); - itv->yuv_info.reg_2970 = read_reg(0x02970); - - itv->yuv_info.v_filter_1 = -1; - itv->yuv_info.v_filter_2 = -1; - itv->yuv_info.h_filter = -1; + yi->reg_2834 = read_reg(0x02834); + yi->reg_2838 = read_reg(0x02838); + yi->reg_283c = read_reg(0x0283c); + yi->reg_2840 = read_reg(0x02840); + yi->reg_2844 = read_reg(0x02844); + yi->reg_2848 = read_reg(0x02848); + yi->reg_2854 = read_reg(0x02854); + yi->reg_285c = read_reg(0x0285c); + yi->reg_2864 = read_reg(0x02864); + yi->reg_2870 = read_reg(0x02870); + yi->reg_2874 = read_reg(0x02874); + yi->reg_2898 = read_reg(0x02898); + yi->reg_2890 = read_reg(0x02890); + + yi->reg_289c = read_reg(0x0289c); + yi->reg_2918 = read_reg(0x02918); + yi->reg_291c = read_reg(0x0291c); + yi->reg_2920 = read_reg(0x02920); + yi->reg_2924 = read_reg(0x02924); + yi->reg_2928 = read_reg(0x02928); + yi->reg_292c = read_reg(0x0292c); + yi->reg_2930 = read_reg(0x02930); + yi->reg_2934 = read_reg(0x02934); + yi->reg_2938 = read_reg(0x02938); + yi->reg_293c = read_reg(0x0293c); + yi->reg_2940 = read_reg(0x02940); + yi->reg_2944 = read_reg(0x02944); + yi->reg_2948 = read_reg(0x02948); + yi->reg_294c = read_reg(0x0294c); + yi->reg_2950 = read_reg(0x02950); + yi->reg_2954 = read_reg(0x02954); + yi->reg_2958 = read_reg(0x02958); + yi->reg_295c = read_reg(0x0295c); + yi->reg_2960 = read_reg(0x02960); + yi->reg_2964 = read_reg(0x02964); + yi->reg_2968 = read_reg(0x02968); + yi->reg_296c = read_reg(0x0296c); + yi->reg_2970 = read_reg(0x02970); + + yi->v_filter_1 = -1; + yi->v_filter_2 = -1; + yi->h_filter = -1; /* Set some valid size info */ - itv->yuv_info.osd_x_offset = read_reg(0x02a04) & 0x00000FFF; - itv->yuv_info.osd_y_offset = (read_reg(0x02a04) >> 16) & 0x00000FFF; + yi->osd_x_offset = read_reg(0x02a04) & 0x00000FFF; + yi->osd_y_offset = (read_reg(0x02a04) >> 16) & 0x00000FFF; /* Bit 2 of reg 2878 indicates current decoder output format 0 : NTSC 1 : PAL */ if (read_reg(0x2878) & 4) - itv->yuv_info.decode_height = 576; + yi->decode_height = 576; else - itv->yuv_info.decode_height = 480; - - /* If no visible size set, assume full size */ - if (!itv->yuv_info.osd_vis_w) - itv->yuv_info.osd_vis_w = 720 - itv->yuv_info.osd_x_offset; + yi->decode_height = 480; - if (!itv->yuv_info.osd_vis_h) { - itv->yuv_info.osd_vis_h = itv->yuv_info.decode_height - itv->yuv_info.osd_y_offset; + if (!itv->osd_info) { + yi->osd_vis_w = 720 - yi->osd_x_offset; + yi->osd_vis_h = yi->decode_height - yi->osd_y_offset; } else { - /* If output video standard has changed, requested height may - not be legal */ - if (itv->yuv_info.osd_vis_h + itv->yuv_info.osd_y_offset > itv->yuv_info.decode_height) { - IVTV_DEBUG_WARN("Clipping yuv output - fb size (%d) exceeds video standard limit (%d)\n", - itv->yuv_info.osd_vis_h + itv->yuv_info.osd_y_offset, - itv->yuv_info.decode_height); - itv->yuv_info.osd_vis_h = itv->yuv_info.decode_height - itv->yuv_info.osd_y_offset; + /* If no visible size set, assume full size */ + if (!yi->osd_vis_w) + yi->osd_vis_w = 720 - yi->osd_x_offset; + + if (!yi->osd_vis_h) + yi->osd_vis_h = yi->decode_height - yi->osd_y_offset; + else { + /* If output video standard has changed, requested height may + not be legal */ + if (yi->osd_vis_h + yi->osd_y_offset > yi->decode_height) { + IVTV_DEBUG_WARN("Clipping yuv output - fb size (%d) exceeds video standard limit (%d)\n", + yi->osd_vis_h + yi->osd_y_offset, + yi->decode_height); + yi->osd_vis_h = yi->decode_height - yi->osd_y_offset; + } } } /* We need a buffer for blanking when Y plane is offset - non-fatal if we can't get one */ - itv->yuv_info.blanking_ptr = kzalloc(720*16,GFP_KERNEL); - if (itv->yuv_info.blanking_ptr) { - itv->yuv_info.blanking_dmaptr = pci_map_single(itv->dev, itv->yuv_info.blanking_ptr, 720*16, PCI_DMA_TODEVICE); - } + yi->blanking_ptr = kzalloc(720*16, GFP_KERNEL); + if (yi->blanking_ptr) + yi->blanking_dmaptr = pci_map_single(itv->dev, yi->blanking_ptr, 720*16, PCI_DMA_TODEVICE); else { - itv->yuv_info.blanking_dmaptr = 0; - IVTV_DEBUG_WARN ("Failed to allocate yuv blanking buffer\n"); + yi->blanking_dmaptr = 0; + IVTV_DEBUG_WARN("Failed to allocate yuv blanking buffer\n"); } /* Enable YUV decoder output */ write_reg_sync(0x01, IVTV_REG_VDM); set_bit(IVTV_F_I_DECODING_YUV, &itv->i_flags); - atomic_set(&itv->yuv_info.next_dma_frame,0); + atomic_set(&yi->next_dma_frame, 0); } int ivtv_yuv_prep_frame(struct ivtv *itv, struct ivtv_dma_frame *args) -- cgit v1.1 From 254d6eb1159f7398273fe35e7499f905a903f38d Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 14 Oct 2007 17:19:37 -0300 Subject: V4L/DVB (6347): ivtv: fix video mute when radio is used When the radio is active the video should be muted when a capture starts. However, this was done at the wrong time and the mute settings were overwritten when cx2341x_update was called. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtv-streams.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index 6c954b3..aa03e61 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c @@ -441,6 +441,7 @@ int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s) { u32 data[CX2341X_MBOX_MAX_DATA]; struct ivtv *itv = s->itv; + struct cx2341x_mpeg_params *p = &itv->params; int captype = 0, subtype = 0; int enable_passthrough = 0; @@ -461,7 +462,7 @@ int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s) } itv->mpg_data_received = itv->vbi_data_inserted = 0; itv->dualwatch_jiffies = jiffies; - itv->dualwatch_stereo_mode = itv->params.audio_properties & 0x0300; + itv->dualwatch_stereo_mode = p->audio_properties & 0x0300; itv->search_pack_header = 0; break; @@ -493,10 +494,6 @@ int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s) s->subtype = subtype; s->buffers_stolen = 0; - /* mute/unmute video */ - ivtv_vapi(itv, CX2341X_ENC_MUTE_VIDEO, 1, - test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) ? 0x00808001 : 0); - /* Clear Streamoff flags in case left from last capture */ clear_bit(IVTV_F_S_STREAMOFF, &s->s_flags); @@ -553,7 +550,12 @@ int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s) itv->pgm_info_offset, itv->pgm_info_num); /* Setup API for Stream */ - cx2341x_update(itv, ivtv_api_func, NULL, &itv->params); + cx2341x_update(itv, ivtv_api_func, NULL, p); + + /* mute if capturing radio */ + if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags)) + ivtv_vapi(itv, CX2341X_ENC_MUTE_VIDEO, 1, + 1 | (p->video_mute_yuv << 8)); } /* Vsync Setup */ @@ -602,6 +604,7 @@ static int ivtv_setup_v4l2_decode_stream(struct ivtv_stream *s) { u32 data[CX2341X_MBOX_MAX_DATA]; struct ivtv *itv = s->itv; + struct cx2341x_mpeg_params *p = &itv->params; int datatype; if (s->v4l2dev == NULL) @@ -640,7 +643,7 @@ static int ivtv_setup_v4l2_decode_stream(struct ivtv_stream *s) break; } if (ivtv_vapi(itv, CX2341X_DEC_SET_DECODER_SOURCE, 4, datatype, - itv->params.width, itv->params.height, itv->params.audio_properties)) { + p->width, p->height, p->audio_properties)) { IVTV_DEBUG_WARN("Couldn't initialize decoder source\n"); } return 0; -- cgit v1.1 From 2f7362ef9bc9c41436c7f44212a2dcf12dddffbf Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 14 Oct 2007 17:27:56 -0300 Subject: V4L/DVB (6348): ivtv: undo video mute when closing the radio Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtv-fileops.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c index 24fcbb8..a200a8a 100644 --- a/drivers/media/video/ivtv/ivtv-fileops.c +++ b/drivers/media/video/ivtv/ivtv-fileops.c @@ -822,6 +822,11 @@ int ivtv_v4l2_close(struct inode *inode, struct file *filp) crystal_freq.flags = 0; ivtv_saa7115(itv, VIDIOC_INT_S_CRYSTAL_FREQ, &crystal_freq); } + if (atomic_read(&itv->capturing) > 0) { + /* Undo video mute */ + ivtv_vapi(itv, CX2341X_ENC_MUTE_VIDEO, 1, + itv->params.video_mute | (itv->params.video_mute_yuv << 8)); + } /* Done! Unmute and continue. */ ivtv_unmute(itv); ivtv_release_stream(s); -- cgit v1.1 From e7222ca9b4e6c6cdabedd8d33da59263ace85a02 Mon Sep 17 00:00:00 2001 From: Florin Malita Date: Mon, 15 Oct 2007 12:59:18 -0300 Subject: V4L/DVB (6350): V4L: possible leak in em28xx_init_isoc Coverity (CID 1929) spotted the following: if a transfer buffer allocation fails, the last allocated urb is leaked (it hasn't been stored in dev->urb[] yet so em28xx_uninit_isoc misses it). The patch also includes a small typo fix. Signed-off-by: Florin Malita Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index d3282ec..d56484f 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -648,7 +648,7 @@ void em28xx_uninit_isoc(struct em28xx *dev) */ int em28xx_init_isoc(struct em28xx *dev) { - /* change interface to 3 which allowes the biggest packet sizes */ + /* change interface to 3 which allows the biggest packet sizes */ int i, errCode; const int sb_size = EM28XX_NUM_PACKETS * dev->max_pkt_size; @@ -673,6 +673,7 @@ int em28xx_init_isoc(struct em28xx *dev) ("unable to allocate %i bytes for transfer buffer %i\n", sb_size, i); em28xx_uninit_isoc(dev); + usb_free_urb(urb); return -ENOMEM; } memset(dev->transfer_buffer[i], 0, sb_size); -- cgit v1.1 From 415a1975923722f729211a9efca550c60c519bf3 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Mon, 15 Oct 2007 20:39:25 -0300 Subject: V4L/DVB (6352): ir-kbd-i2c: Missing break statement Someone added a new case without adding a break to the one before it. Thanks to Margus for spotting this. Signed-off-by: Trent Piepho Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ir-kbd-i2c.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index d98dd0d..29779d8b 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -528,6 +528,7 @@ static int ir_probe(struct i2c_adapter *adap) break; case I2C_HW_B_CX2388x: probe = probe_cx88; + break; case I2C_HW_B_CX23885: probe = probe_cx23885; break; -- cgit v1.1 From a39a8ed7beaafe02ce154dfd227f7d734a9f34dc Mon Sep 17 00:00:00 2001 From: Marco Schluessler Date: Tue, 16 Oct 2007 08:25:42 -0300 Subject: V4L/DVB (6356): "while (!ca->wakeup)" breaks the CAM initialisation Signed-off-by: Marco Schluessler Signed-off-by: Oliver Endriss Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-core/dvb_ca_en50221.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index 084a508..89437fd 100644 --- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c @@ -972,7 +972,7 @@ static int dvb_ca_en50221_thread(void *data) /* main loop */ while (!kthread_should_stop()) { /* sleep for a bit */ - while (!ca->wakeup) { + if (!ca->wakeup) { set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(ca->delay); if (kthread_should_stop()) -- cgit v1.1 From 9a607f01b044dd83aa6daf6edad1e98cfc8c33ba Mon Sep 17 00:00:00 2001 From: Mike Isely Date: Sun, 14 Oct 2007 18:18:12 -0300 Subject: V4L/DVB (6357): pvrusb2: Improve encoder chip health tracking This is a minor change to help with tracking the viability of the encoder chip within the PVR USB2 device. Signed-off-by: Mike Isely Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pvrusb2/pvrusb2-encoder.c | 6 ++++++ drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h | 11 ++++++----- drivers/media/video/pvrusb2/pvrusb2-hdw.c | 3 +++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/media/video/pvrusb2/pvrusb2-encoder.c b/drivers/media/video/pvrusb2/pvrusb2-encoder.c index 20b6144..205087a 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-encoder.c +++ b/drivers/media/video/pvrusb2/pvrusb2-encoder.c @@ -209,6 +209,11 @@ static int pvr2_encoder_cmd(void *ctxt, LOCK_TAKE(hdw->ctl_lock); do { + if (!hdw->flag_encoder_ok) { + ret = -EIO; + break; + } + retry_flag = 0; try_count++; ret = 0; @@ -273,6 +278,7 @@ static int pvr2_encoder_cmd(void *ctxt, ret = -EBUSY; } if (ret) { + hdw->flag_encoder_ok = 0; pvr2_trace( PVR2_TRACE_ERROR_LEGS, "Giving up on command." diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h index 985d9ae..f873994 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h @@ -225,11 +225,12 @@ struct pvr2_hdw { unsigned int cmd_debug_write_len; // unsigned int cmd_debug_read_len; // - int flag_ok; // device in known good state - int flag_disconnected; // flag_ok == 0 due to disconnect - int flag_init_ok; // true if structure is fully initialized - int flag_streaming_enabled; // true if streaming should be on - int fw1_state; // current situation with fw1 + int flag_ok; /* device in known good state */ + int flag_disconnected; /* flag_ok == 0 due to disconnect */ + int flag_init_ok; /* true if structure is fully initialized */ + int flag_streaming_enabled; /* true if streaming should be on */ + int fw1_state; /* current situation with fw1 */ + int flag_encoder_ok; /* True if encoder is healthy */ int flag_decoder_is_tuned; diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 27b12b4b..402c5948 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -1248,6 +1248,8 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw) time we configure the encoder, then we'll fully configure it. */ hdw->enc_cur_valid = 0; + hdw->flag_encoder_ok = 0; + /* First prepare firmware loading */ ret |= pvr2_write_register(hdw, 0x0048, 0xffffffff); /*interrupt mask*/ ret |= pvr2_hdw_gpio_chg_dir(hdw,0xffffffff,0x00000088); /*gpio dir*/ @@ -1346,6 +1348,7 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw) pvr2_trace(PVR2_TRACE_ERROR_LEGS, "firmware2 upload post-proc failure"); } else { + hdw->flag_encoder_ok = !0; hdw->subsys_enabled_mask |= (1< Date: Thu, 11 Oct 2007 14:06:37 -0300 Subject: V4L/DVB (6378): DiB0700-device: Using 1.10 firmware As for most of the users the 1.10 firmware is an improvement we should use this firmware always now. Signed-off-by: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/dib0700_devices.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index e8c4a86..58452b5 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -828,7 +828,7 @@ MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table); #define DIB0700_DEFAULT_DEVICE_PROPERTIES \ .caps = DVB_USB_IS_AN_I2C_ADAPTER, \ .usb_ctrl = DEVICE_SPECIFIC, \ - .firmware = "dvb-usb-dib0700-03-pre1.fw", \ + .firmware = "dvb-usb-dib0700-1.10.fw", \ .download_firmware = dib0700_download_firmware, \ .no_reconnect = 1, \ .size_of_priv = sizeof(struct dib0700_state), \ -- cgit v1.1 From 148af72009f0ad4b9af5fb3b0f518ac2d33986e1 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 17 Oct 2007 15:11:23 -0200 Subject: V4L/DVB (6378a): Removal of VIDIOC_[G|S]_MPEGCOMP from feature-removal-schedule.txt Signed-off-by: Mauro Carvalho Chehab --- Documentation/feature-removal-schedule.txt | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 6b0f963..9b447fb 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt @@ -14,18 +14,6 @@ Who: Jiri Slaby --------------------------- -What: V4L2 VIDIOC_G_MPEGCOMP and VIDIOC_S_MPEGCOMP -When: October 2007 -Why: Broken attempt to set MPEG compression parameters. These ioctls are - not able to implement the wide variety of parameters that can be set - by hardware MPEG encoders. A new MPEG control mechanism was created - in kernel 2.6.18 that replaces these ioctls. See the V4L2 specification - (section 1.9: Extended controls) for more information on this topic. -Who: Hans Verkuil and - Mauro Carvalho Chehab - ---------------------------- - What: dev->power.power_state When: July 2007 Why: Broken design for runtime control over driver power states, confusing -- cgit v1.1 From 11a5a10e0adec22e535dd1e76e5c8a1b265692f0 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 17 Oct 2007 15:32:36 -0200 Subject: V4L/DVB (6378b): Updates info about the removal of V4L1 at feature-removal-schedule.txt Signed-off-by: Mauro Carvalho Chehab --- Documentation/feature-removal-schedule.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 9b447fb..6bb9be5 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt @@ -37,10 +37,10 @@ Who: David Miller --------------------------- What: Video4Linux API 1 ioctls and video_decoder.h from Video devices. -When: December 2006 -Files: include/linux/video_decoder.h -Check: include/linux/video_decoder.h -Why: V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6 +When: December 2008 +Files: include/linux/video_decoder.h include/linux/videodev.h +Check: include/linux/video_decoder.h include/linux/videodev.h +Why: V4L1 AP1 was replaced by V4L2 API during migration from 2.4 to 2.6 series. The old API have lots of drawbacks and don't provide enough means to work with all video and audio standards. The newer API is already available on the main drivers and should be used instead. @@ -49,7 +49,9 @@ Why: V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6 Decoder iocts are using internally to allow video drivers to communicate with video decoders. This should also be improved to allow V4L2 calls being translated into compatible internal ioctls. -Who: Mauro Carvalho Chehab + Compatibility ioctls will be provided, for a while, via + v4l1-compat module. +Who: Mauro Carvalho Chehab --------------------------- -- cgit v1.1 From 0938e3194ae53d0b22f4031cfe4738e62308c7ce Mon Sep 17 00:00:00 2001 From: Pedro Date: Wed, 17 Oct 2007 17:58:40 -0300 Subject: V4L/DVB (6379): patch which improves GotView Saa7135 remote control improve GoTView PCI7135 remote control working under linux. Acked-by: Hermann Pitton Acked-by: Nickolay V. Shmyrev Signed-off-by: Eugene M. Roginskii Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/ir-keymaps.c | 70 ++++++++++++++--------------- drivers/media/video/saa7134/saa7134-input.c | 25 +++++++++-- 2 files changed, 57 insertions(+), 38 deletions(-) diff --git a/drivers/media/common/ir-keymaps.c b/drivers/media/common/ir-keymaps.c index aefcf28..185e8a8 100644 --- a/drivers/media/common/ir-keymaps.c +++ b/drivers/media/common/ir-keymaps.c @@ -1074,41 +1074,41 @@ EXPORT_SYMBOL_GPL(ir_codes_manli); /* Mike Baikov */ IR_KEYTAB_TYPE ir_codes_gotview7135[IR_KEYTAB_SIZE] = { - [ 0x21 ] = KEY_POWER, - [ 0x69 ] = KEY_TV, - [ 0x33 ] = KEY_0, - [ 0x51 ] = KEY_1, - [ 0x31 ] = KEY_2, - [ 0x71 ] = KEY_3, - [ 0x3b ] = KEY_4, - [ 0x58 ] = KEY_5, - [ 0x41 ] = KEY_6, - [ 0x48 ] = KEY_7, - [ 0x30 ] = KEY_8, - [ 0x53 ] = KEY_9, - [ 0x73 ] = KEY_AGAIN, /* LOOP */ - [ 0x0a ] = KEY_AUDIO, - [ 0x61 ] = KEY_PRINT, /* PREVIEW */ - [ 0x7a ] = KEY_VIDEO, - [ 0x20 ] = KEY_CHANNELUP, - [ 0x40 ] = KEY_CHANNELDOWN, - [ 0x18 ] = KEY_VOLUMEDOWN, - [ 0x50 ] = KEY_VOLUMEUP, - [ 0x10 ] = KEY_MUTE, - [ 0x4a ] = KEY_SEARCH, - [ 0x7b ] = KEY_SHUFFLE, /* SNAPSHOT */ - [ 0x22 ] = KEY_RECORD, - [ 0x62 ] = KEY_STOP, - [ 0x78 ] = KEY_PLAY, - [ 0x39 ] = KEY_REWIND, - [ 0x59 ] = KEY_PAUSE, - [ 0x19 ] = KEY_FORWARD, - [ 0x09 ] = KEY_ZOOM, - - [ 0x52 ] = KEY_F21, /* LIVE TIMESHIFT */ - [ 0x1a ] = KEY_F22, /* MIN TIMESHIFT */ - [ 0x3a ] = KEY_F23, /* TIMESHIFT */ - [ 0x70 ] = KEY_F24, /* NORMAL TIMESHIFT */ + [ 0x11 ] = KEY_POWER, + [ 0x35 ] = KEY_TV, + [ 0x1b ] = KEY_0, + [ 0x29 ] = KEY_1, + [ 0x19 ] = KEY_2, + [ 0x39 ] = KEY_3, + [ 0x1f ] = KEY_4, + [ 0x2c ] = KEY_5, + [ 0x21 ] = KEY_6, + [ 0x24 ] = KEY_7, + [ 0x18 ] = KEY_8, + [ 0x2b ] = KEY_9, + [ 0x3b ] = KEY_AGAIN, /* LOOP */ + [ 0x06 ] = KEY_AUDIO, + [ 0x31 ] = KEY_PRINT, /* PREVIEW */ + [ 0x3e ] = KEY_VIDEO, + [ 0x10 ] = KEY_CHANNELUP, + [ 0x20 ] = KEY_CHANNELDOWN, + [ 0x0c ] = KEY_VOLUMEDOWN, + [ 0x28 ] = KEY_VOLUMEUP, + [ 0x08 ] = KEY_MUTE, + [ 0x26 ] = KEY_SEARCH, /*SCAN*/ + [ 0x3f ] = KEY_SHUFFLE, /* SNAPSHOT */ + [ 0x12 ] = KEY_RECORD, + [ 0x32 ] = KEY_STOP, + [ 0x3c ] = KEY_PLAY, + [ 0x1d ] = KEY_REWIND, + [ 0x2d ] = KEY_PAUSE, + [ 0x0d ] = KEY_FORWARD, + [ 0x05 ] = KEY_ZOOM, /*FULL*/ + + [ 0x2a ] = KEY_F21, /* LIVE TIMESHIFT */ + [ 0x0e ] = KEY_F22, /* MIN TIMESHIFT */ + [ 0x1e ] = KEY_F23, /* TIMESHIFT */ + [ 0x38 ] = KEY_F24, /* NORMAL TIMESHIFT */ }; EXPORT_SYMBOL_GPL(ir_codes_gotview7135); diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index d4907ce..3abaa1b 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -44,6 +44,14 @@ module_param(ir_rc5_remote_gap, int, 0644); static int ir_rc5_key_timeout = 115; module_param(ir_rc5_key_timeout, int, 0644); +static int repeat_delay = 500; +module_param(repeat_delay, int, 0644); +MODULE_PARM_DESC(repeat_delay, "delay before key repeat started"); +static int repeat_period = 33; +module_param(repeat_period, int, 0644); +MODULE_PARM_DESC(repeat_period, "repeat period between" + "keypresses when key is down"); + #define dprintk(fmt, arg...) if (ir_debug) \ printk(KERN_DEBUG "%s/ir: " fmt, dev->name , ## arg) #define i2cdprintk(fmt, arg...) if (ir_debug) \ @@ -59,6 +67,13 @@ static int build_key(struct saa7134_dev *dev) struct card_ir *ir = dev->remote; u32 gpio, data; + /* here comes the additional handshake steps for some cards */ + switch (dev->board) { + case SAA7134_BOARD_GOTVIEW_7135: + saa_setb(SAA7134_GPIO_GPSTATUS1, 0x80); + saa_clearb(SAA7134_GPIO_GPSTATUS1, 0x80); + break; + } /* rising SAA7134_GPIO_GPRESCAN reads the status */ saa_clearb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN); saa_setb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN); @@ -285,10 +300,10 @@ int saa7134_input_init1(struct saa7134_dev *dev) break; case SAA7134_BOARD_GOTVIEW_7135: ir_codes = ir_codes_gotview7135; - mask_keycode = 0x0003EC; - mask_keyup = 0x008000; + mask_keycode = 0x0003CC; mask_keydown = 0x000010; - polling = 50; // ms + polling = 5; /* ms */ + saa_setb(SAA7134_GPIO_GPMODE1, 0x80); break; case SAA7134_BOARD_VIDEOMATE_TV_PVR: case SAA7134_BOARD_VIDEOMATE_GOLD_PLUS: @@ -386,6 +401,10 @@ int saa7134_input_init1(struct saa7134_dev *dev) if (err) goto err_out_stop; + /* the remote isn't as bouncy as a keyboard */ + ir->dev->rep[REP_DELAY] = repeat_delay; + ir->dev->rep[REP_PERIOD] = repeat_period; + return 0; err_out_stop: -- cgit v1.1 From 6b1ec9da152c03106aa92fa045f5cf9b7912597c Mon Sep 17 00:00:00 2001 From: Ian Armstrong Date: Wed, 17 Oct 2007 15:09:56 -0300 Subject: V4L/DVB (6380): ivtvfb: Removal of the 'osd_compat' module option Due to changes in the core ivtv driver as of release 1.0, the osd_compat module option has been rendered obsolete. This patch removes the option and all code associated with it. Signed-off-by: Ian Armstrong Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtvfb.c | 73 ++++++++++----------------------------- 1 file changed, 18 insertions(+), 55 deletions(-) diff --git a/drivers/media/video/ivtv/ivtvfb.c b/drivers/media/video/ivtv/ivtvfb.c index 4a7512d..52ffd15 100644 --- a/drivers/media/video/ivtv/ivtvfb.c +++ b/drivers/media/video/ivtv/ivtvfb.c @@ -55,7 +55,6 @@ static int ivtvfb_card_id = -1; static int ivtvfb_debug = 0; static int osd_laced; -static int osd_compat; static int osd_depth; static int osd_upper; static int osd_left; @@ -65,7 +64,6 @@ static int osd_xres; module_param(ivtvfb_card_id, int, 0444); module_param_named(debug,ivtvfb_debug, int, 0644); module_param(osd_laced, bool, 0444); -module_param(osd_compat, bool, 0444); module_param(osd_depth, int, 0444); module_param(osd_upper, int, 0444); module_param(osd_left, int, 0444); @@ -80,12 +78,6 @@ MODULE_PARM_DESC(debug, "Debug level (bitmask). Default: errors only\n" "\t\t\t(debug = 3 gives full debugging)"); -MODULE_PARM_DESC(osd_compat, - "Compatibility mode - Display size is locked (use for old X drivers)\n" - "\t\t\t0=off\n" - "\t\t\t1=on\n" - "\t\t\tdefault off"); - /* Why upper, left, xres, yres, depth, laced ? To match terminology used by fbset. Why start at 1 for left & upper coordinate ? Because X doesn't allow 0 */ @@ -574,14 +566,6 @@ static int _ivtvfb_check_var(struct fb_var_screeninfo *var, struct ivtv *itv) osd_height_limit = 480; } - /* Check the bits per pixel */ - if (osd_compat) { - if (var->bits_per_pixel != 32) { - IVTVFB_DEBUG_WARN("Invalid colour mode: %d\n", var->bits_per_pixel); - return -EINVAL; - } - } - if (var->bits_per_pixel == 8 || var->bits_per_pixel == 32) { var->transp.offset = 24; var->transp.length = 8; @@ -633,32 +617,20 @@ static int _ivtvfb_check_var(struct fb_var_screeninfo *var, struct ivtv *itv) } /* Check the resolution */ - if (osd_compat) { - if (var->xres != oi->ivtvfb_defined.xres || - var->yres != oi->ivtvfb_defined.yres || - var->xres_virtual != oi->ivtvfb_defined.xres_virtual || - var->yres_virtual != oi->ivtvfb_defined.yres_virtual) { - IVTVFB_DEBUG_WARN("Invalid resolution: %dx%d (virtual %dx%d)\n", - var->xres, var->yres, var->xres_virtual, var->yres_virtual); - return -EINVAL; - } + if (var->xres > IVTV_OSD_MAX_WIDTH || var->yres > osd_height_limit) { + IVTVFB_DEBUG_WARN("Invalid resolution: %dx%d\n", + var->xres, var->yres); + return -EINVAL; } - else { - if (var->xres > IVTV_OSD_MAX_WIDTH || var->yres > osd_height_limit) { - IVTVFB_DEBUG_WARN("Invalid resolution: %dx%d\n", - var->xres, var->yres); - return -EINVAL; - } - /* Max horizontal size is 1023 @ 32bpp, 2046 & 16bpp, 4092 @ 8bpp */ - if (var->xres_virtual > 4095 / (var->bits_per_pixel / 8) || - var->xres_virtual * var->yres_virtual * (var->bits_per_pixel / 8) > oi->video_buffer_size || - var->xres_virtual < var->xres || - var->yres_virtual < var->yres) { - IVTVFB_DEBUG_WARN("Invalid virtual resolution: %dx%d\n", - var->xres_virtual, var->yres_virtual); - return -EINVAL; - } + /* Max horizontal size is 1023 @ 32bpp, 2046 & 16bpp, 4092 @ 8bpp */ + if (var->xres_virtual > 4095 / (var->bits_per_pixel / 8) || + var->xres_virtual * var->yres_virtual * (var->bits_per_pixel / 8) > oi->video_buffer_size || + var->xres_virtual < var->xres || + var->yres_virtual < var->yres) { + IVTVFB_DEBUG_WARN("Invalid virtual resolution: %dx%d\n", + var->xres_virtual, var->yres_virtual); + return -EINVAL; } /* Some extra checks if in 8 bit mode */ @@ -872,14 +844,15 @@ static int ivtvfb_init_vidmode(struct ivtv *itv) /* Color mode */ - if (osd_compat) osd_depth = 32; - if (osd_depth != 8 && osd_depth != 16 && osd_depth != 32) osd_depth = 8; + if (osd_depth != 8 && osd_depth != 16 && osd_depth != 32) + osd_depth = 8; oi->bits_per_pixel = osd_depth; oi->bytes_per_pixel = oi->bits_per_pixel / 8; /* Horizontal size & position */ - if (osd_xres > 720) osd_xres = 720; + if (osd_xres > 720) + osd_xres = 720; /* Must be a multiple of 4 for 8bpp & 2 for 16bpp */ if (osd_depth == 8) @@ -887,10 +860,7 @@ static int ivtvfb_init_vidmode(struct ivtv *itv) else if (osd_depth == 16) osd_xres &= ~1; - if (osd_xres) - start_window.width = osd_xres; - else - start_window.width = osd_compat ? 720: 640; + start_window.width = osd_xres ? osd_xres : 640; /* Check horizontal start (osd_left). */ if (osd_left && osd_left + start_window.width > 721) { @@ -913,10 +883,7 @@ static int ivtvfb_init_vidmode(struct ivtv *itv) if (osd_yres > max_height) osd_yres = max_height; - if (osd_yres) - start_window.height = osd_yres; - else - start_window.height = osd_compat ? max_height : (itv->is_50hz ? 480 : 400); + start_window.height = osd_yres ? osd_yres : itv->is_50hz ? 480 : 400; /* Check vertical start (osd_upper). */ if (osd_upper + start_window.height > max_height + 1) { @@ -1119,10 +1086,6 @@ static int ivtvfb_init_card(struct ivtv *itv) /* Enable the osd */ ivtvfb_blank(FB_BLANK_UNBLANK, &itv->osd_info->ivtvfb_info); - /* Note if we're running in compatibility mode */ - if (osd_compat) - IVTVFB_INFO("Running in compatibility mode. Display resize & mode change disabled\n"); - /* Allocate DMA */ ivtv_udma_alloc(itv); return 0; -- cgit v1.1 From f40aa808bad19a079a0e122e326d6970df141afb Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Thu, 18 Oct 2007 14:58:11 -0300 Subject: V4L/DVB (6382): saa7134: fix NULL dereference at suspend time for cards without IR receiver Calling saa7134_ir_stop at suspend is no good idea for saa7134 cards without remote control. Signed-off-by: Matthias Schwarzott Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/saa7134/saa7134-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 410242a..a499eea 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -1189,7 +1189,9 @@ static int saa7134_suspend(struct pci_dev *pci_dev , pm_message_t state) del_timer(&dev->video_q.timeout); del_timer(&dev->vbi_q.timeout); del_timer(&dev->ts_q.timeout); - saa7134_ir_stop(dev); + + if (dev->remote) + saa7134_ir_stop(dev); pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state)); pci_save_state(pci_dev); -- cgit v1.1