Commit ecb73774 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Linus Torvalds

V4L/DVB (3545): Fixed no_overlay option and quirks on saa7134 driver

Some chipsets have several problems when pci to pci transfers are activated
on overlay mode. the option no_overlay allows disabling such feature of
the driver, in favor of keeping the system stable.
The default is to use pcipci_fail flag defined on drivers/pci/quirks.c.
It also allows the user to override it by forcing disable overlay or forcing
enable. Forcing enable may generate PCI transfer corruption, including disk
mass corruption, so should be used with care.
Added a text description to this option and make messages looks the same at
both bttv and saa7134 drivers.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 08f1d0b9
...@@ -66,8 +66,8 @@ static unsigned int latency = UNSET; ...@@ -66,8 +66,8 @@ static unsigned int latency = UNSET;
module_param(latency, int, 0444); module_param(latency, int, 0444);
MODULE_PARM_DESC(latency,"pci latency timer"); MODULE_PARM_DESC(latency,"pci latency timer");
static int no_overlay=-1; int saa7134_no_overlay=-1;
module_param(no_overlay, int, 0444); module_param_named(no_overlay, saa7134_no_overlay, int, 0444);
MODULE_PARM_DESC(no_overlay,"allow override overlay default (0 disables, 1 enables)" MODULE_PARM_DESC(no_overlay,"allow override overlay default (0 disables, 1 enables)"
" [some VIA/SIS chipsets are known to have problem with overlay]"); " [some VIA/SIS chipsets are known to have problem with overlay]");
...@@ -843,11 +843,11 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, ...@@ -843,11 +843,11 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
printk(KERN_INFO "%s: quirk: this driver and your " printk(KERN_INFO "%s: quirk: this driver and your "
"chipset may not work together" "chipset may not work together"
" in overlay mode.\n",dev->name); " in overlay mode.\n",dev->name);
if (!no_overlay) { if (!saa7134_no_overlay) {
printk(KERN_INFO "%s: quirk: overlay " printk(KERN_INFO "%s: quirk: overlay "
"mode will be disabled.\n", "mode will be disabled.\n",
dev->name); dev->name);
no_overlay = 1; saa7134_no_overlay = 1;
} else { } else {
printk(KERN_INFO "%s: quirk: overlay " printk(KERN_INFO "%s: quirk: overlay "
"mode will be forced. Use this" "mode will be forced. Use this"
...@@ -957,6 +957,11 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, ...@@ -957,6 +957,11 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
v4l2_prio_init(&dev->prio); v4l2_prio_init(&dev->prio);
/* register v4l devices */ /* register v4l devices */
if (saa7134_no_overlay <= 0) {
saa7134_video_template.type |= VID_TYPE_OVERLAY;
} else {
printk("bttv: Overlay support disabled.\n");
}
dev->video_dev = vdev_init(dev,&saa7134_video_template,"video"); dev->video_dev = vdev_init(dev,&saa7134_video_template,"video");
err = video_register_device(dev->video_dev,VFL_TYPE_GRABBER, err = video_register_device(dev->video_dev,VFL_TYPE_GRABBER,
video_nr[dev->nr]); video_nr[dev->nr]);
......
...@@ -1462,6 +1462,10 @@ static int saa7134_g_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh, ...@@ -1462,6 +1462,10 @@ static int saa7134_g_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
f->fmt.pix.height * f->fmt.pix.bytesperline; f->fmt.pix.height * f->fmt.pix.bytesperline;
return 0; return 0;
case V4L2_BUF_TYPE_VIDEO_OVERLAY: case V4L2_BUF_TYPE_VIDEO_OVERLAY:
if (saa7134_no_overlay > 0) {
printk ("V4L2_BUF_TYPE_VIDEO_OVERLAY: no_overlay\n");
return -EINVAL;
}
f->fmt.win = fh->win; f->fmt.win = fh->win;
return 0; return 0;
case V4L2_BUF_TYPE_VBI_CAPTURE: case V4L2_BUF_TYPE_VBI_CAPTURE:
...@@ -1526,6 +1530,10 @@ static int saa7134_try_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh, ...@@ -1526,6 +1530,10 @@ static int saa7134_try_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
return 0; return 0;
} }
case V4L2_BUF_TYPE_VIDEO_OVERLAY: case V4L2_BUF_TYPE_VIDEO_OVERLAY:
if (saa7134_no_overlay > 0) {
printk ("V4L2_BUF_TYPE_VIDEO_OVERLAY: no_overlay\n");
return -EINVAL;
}
err = verify_preview(dev,&f->fmt.win); err = verify_preview(dev,&f->fmt.win);
if (0 != err) if (0 != err)
return err; return err;
...@@ -1556,6 +1564,10 @@ static int saa7134_s_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh, ...@@ -1556,6 +1564,10 @@ static int saa7134_s_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
fh->cap.field = f->fmt.pix.field; fh->cap.field = f->fmt.pix.field;
return 0; return 0;
case V4L2_BUF_TYPE_VIDEO_OVERLAY: case V4L2_BUF_TYPE_VIDEO_OVERLAY:
if (saa7134_no_overlay > 0) {
printk ("V4L2_BUF_TYPE_VIDEO_OVERLAY: no_overlay\n");
return -EINVAL;
}
err = verify_preview(dev,&f->fmt.win); err = verify_preview(dev,&f->fmt.win);
if (0 != err) if (0 != err)
return err; return err;
...@@ -1715,11 +1727,13 @@ static int video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1715,11 +1727,13 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
cap->version = SAA7134_VERSION_CODE; cap->version = SAA7134_VERSION_CODE;
cap->capabilities = cap->capabilities =
V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_CAPTURE |
V4L2_CAP_VIDEO_OVERLAY |
V4L2_CAP_VBI_CAPTURE | V4L2_CAP_VBI_CAPTURE |
V4L2_CAP_READWRITE | V4L2_CAP_READWRITE |
V4L2_CAP_STREAMING | V4L2_CAP_STREAMING |
V4L2_CAP_TUNER; V4L2_CAP_TUNER;
if (saa7134_no_overlay <= 0) {
cap->capabilities |= V4L2_CAP_VIDEO_OVERLAY;
}
if ((tuner_type == TUNER_ABSENT) || (tuner_type == UNSET)) if ((tuner_type == TUNER_ABSENT) || (tuner_type == UNSET))
cap->capabilities &= ~V4L2_CAP_TUNER; cap->capabilities &= ~V4L2_CAP_TUNER;
...@@ -1970,6 +1984,10 @@ static int video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1970,6 +1984,10 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
switch (type) { switch (type) {
case V4L2_BUF_TYPE_VIDEO_CAPTURE: case V4L2_BUF_TYPE_VIDEO_CAPTURE:
case V4L2_BUF_TYPE_VIDEO_OVERLAY: case V4L2_BUF_TYPE_VIDEO_OVERLAY:
if (saa7134_no_overlay > 0) {
printk ("V4L2_BUF_TYPE_VIDEO_OVERLAY: no_overlay\n");
return -EINVAL;
}
if (index >= FORMATS) if (index >= FORMATS)
return -EINVAL; return -EINVAL;
if (f->type == V4L2_BUF_TYPE_VIDEO_OVERLAY && if (f->type == V4L2_BUF_TYPE_VIDEO_OVERLAY &&
...@@ -2030,6 +2048,11 @@ static int video_do_ioctl(struct inode *inode, struct file *file, ...@@ -2030,6 +2048,11 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
int *on = arg; int *on = arg;
if (*on) { if (*on) {
if (saa7134_no_overlay > 0) {
printk ("no_overlay\n");
return -EINVAL;
}
if (!res_get(dev,fh,RESOURCE_OVERLAY)) if (!res_get(dev,fh,RESOURCE_OVERLAY))
return -EBUSY; return -EBUSY;
spin_lock_irqsave(&dev->slock,flags); spin_lock_irqsave(&dev->slock,flags);
...@@ -2281,7 +2304,7 @@ static struct file_operations radio_fops = ...@@ -2281,7 +2304,7 @@ static struct file_operations radio_fops =
struct video_device saa7134_video_template = struct video_device saa7134_video_template =
{ {
.name = "saa7134-video", .name = "saa7134-video",
.type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|VID_TYPE_OVERLAY| .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|
VID_TYPE_CLIPPING|VID_TYPE_SCALES, VID_TYPE_CLIPPING|VID_TYPE_SCALES,
.hardware = 0, .hardware = 0,
.fops = &video_fops, .fops = &video_fops,
......
...@@ -557,6 +557,7 @@ struct saa7134_dev { ...@@ -557,6 +557,7 @@ struct saa7134_dev {
/* saa7134-core.c */ /* saa7134-core.c */
extern struct list_head saa7134_devlist; extern struct list_head saa7134_devlist;
extern int saa7134_no_overlay;
void saa7134_track_gpio(struct saa7134_dev *dev, char *msg); void saa7134_track_gpio(struct saa7134_dev *dev, char *msg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment