aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2006-03-17 18:54:32 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-21 11:54:02 -0500
commitecb73774e5f5b5f635a70073086c3f57b4ca4ae6 (patch)
treed8313c4007896c78dfe05884a7740cb048ffd62a
parent08f1d0b99f4e2203935d86640a7fec5c233b777c (diff)
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: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c13
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c27
-rw-r--r--drivers/media/video/saa7134/saa7134.h1
3 files changed, 35 insertions, 6 deletions
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index be85e0b0cbb0..58e568d7d2ee 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -66,8 +66,8 @@ static unsigned int latency = UNSET;
66module_param(latency, int, 0444); 66module_param(latency, int, 0444);
67MODULE_PARM_DESC(latency,"pci latency timer"); 67MODULE_PARM_DESC(latency,"pci latency timer");
68 68
69static int no_overlay=-1; 69int saa7134_no_overlay=-1;
70module_param(no_overlay, int, 0444); 70module_param_named(no_overlay, saa7134_no_overlay, int, 0444);
71MODULE_PARM_DESC(no_overlay,"allow override overlay default (0 disables, 1 enables)" 71MODULE_PARM_DESC(no_overlay,"allow override overlay default (0 disables, 1 enables)"
72 " [some VIA/SIS chipsets are known to have problem with overlay]"); 72 " [some VIA/SIS chipsets are known to have problem with overlay]");
73 73
@@ -843,11 +843,11 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
843 printk(KERN_INFO "%s: quirk: this driver and your " 843 printk(KERN_INFO "%s: quirk: this driver and your "
844 "chipset may not work together" 844 "chipset may not work together"
845 " in overlay mode.\n",dev->name); 845 " in overlay mode.\n",dev->name);
846 if (!no_overlay) { 846 if (!saa7134_no_overlay) {
847 printk(KERN_INFO "%s: quirk: overlay " 847 printk(KERN_INFO "%s: quirk: overlay "
848 "mode will be disabled.\n", 848 "mode will be disabled.\n",
849 dev->name); 849 dev->name);
850 no_overlay = 1; 850 saa7134_no_overlay = 1;
851 } else { 851 } else {
852 printk(KERN_INFO "%s: quirk: overlay " 852 printk(KERN_INFO "%s: quirk: overlay "
853 "mode will be forced. Use this" 853 "mode will be forced. Use this"
@@ -957,6 +957,11 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
957 v4l2_prio_init(&dev->prio); 957 v4l2_prio_init(&dev->prio);
958 958
959 /* register v4l devices */ 959 /* register v4l devices */
960 if (saa7134_no_overlay <= 0) {
961 saa7134_video_template.type |= VID_TYPE_OVERLAY;
962 } else {
963 printk("bttv: Overlay support disabled.\n");
964 }
960 dev->video_dev = vdev_init(dev,&saa7134_video_template,"video"); 965 dev->video_dev = vdev_init(dev,&saa7134_video_template,"video");
961 err = video_register_device(dev->video_dev,VFL_TYPE_GRABBER, 966 err = video_register_device(dev->video_dev,VFL_TYPE_GRABBER,
962 video_nr[dev->nr]); 967 video_nr[dev->nr]);
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index 600c3c7e3dca..57a11e71d996 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -1462,6 +1462,10 @@ static int saa7134_g_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
1462 f->fmt.pix.height * f->fmt.pix.bytesperline; 1462 f->fmt.pix.height * f->fmt.pix.bytesperline;
1463 return 0; 1463 return 0;
1464 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 1464 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
1465 if (saa7134_no_overlay > 0) {
1466 printk ("V4L2_BUF_TYPE_VIDEO_OVERLAY: no_overlay\n");
1467 return -EINVAL;
1468 }
1465 f->fmt.win = fh->win; 1469 f->fmt.win = fh->win;
1466 return 0; 1470 return 0;
1467 case V4L2_BUF_TYPE_VBI_CAPTURE: 1471 case V4L2_BUF_TYPE_VBI_CAPTURE:
@@ -1526,6 +1530,10 @@ static int saa7134_try_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
1526 return 0; 1530 return 0;
1527 } 1531 }
1528 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 1532 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
1533 if (saa7134_no_overlay > 0) {
1534 printk ("V4L2_BUF_TYPE_VIDEO_OVERLAY: no_overlay\n");
1535 return -EINVAL;
1536 }
1529 err = verify_preview(dev,&f->fmt.win); 1537 err = verify_preview(dev,&f->fmt.win);
1530 if (0 != err) 1538 if (0 != err)
1531 return err; 1539 return err;
@@ -1556,6 +1564,10 @@ static int saa7134_s_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
1556 fh->cap.field = f->fmt.pix.field; 1564 fh->cap.field = f->fmt.pix.field;
1557 return 0; 1565 return 0;
1558 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 1566 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
1567 if (saa7134_no_overlay > 0) {
1568 printk ("V4L2_BUF_TYPE_VIDEO_OVERLAY: no_overlay\n");
1569 return -EINVAL;
1570 }
1559 err = verify_preview(dev,&f->fmt.win); 1571 err = verify_preview(dev,&f->fmt.win);
1560 if (0 != err) 1572 if (0 != err)
1561 return err; 1573 return err;
@@ -1715,11 +1727,13 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
1715 cap->version = SAA7134_VERSION_CODE; 1727 cap->version = SAA7134_VERSION_CODE;
1716 cap->capabilities = 1728 cap->capabilities =
1717 V4L2_CAP_VIDEO_CAPTURE | 1729 V4L2_CAP_VIDEO_CAPTURE |
1718 V4L2_CAP_VIDEO_OVERLAY |
1719 V4L2_CAP_VBI_CAPTURE | 1730 V4L2_CAP_VBI_CAPTURE |
1720 V4L2_CAP_READWRITE | 1731 V4L2_CAP_READWRITE |
1721 V4L2_CAP_STREAMING | 1732 V4L2_CAP_STREAMING |
1722 V4L2_CAP_TUNER; 1733 V4L2_CAP_TUNER;
1734 if (saa7134_no_overlay <= 0) {
1735 cap->capabilities |= V4L2_CAP_VIDEO_OVERLAY;
1736 }
1723 1737
1724 if ((tuner_type == TUNER_ABSENT) || (tuner_type == UNSET)) 1738 if ((tuner_type == TUNER_ABSENT) || (tuner_type == UNSET))
1725 cap->capabilities &= ~V4L2_CAP_TUNER; 1739 cap->capabilities &= ~V4L2_CAP_TUNER;
@@ -1970,6 +1984,10 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
1970 switch (type) { 1984 switch (type) {
1971 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 1985 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
1972 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 1986 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
1987 if (saa7134_no_overlay > 0) {
1988 printk ("V4L2_BUF_TYPE_VIDEO_OVERLAY: no_overlay\n");
1989 return -EINVAL;
1990 }
1973 if (index >= FORMATS) 1991 if (index >= FORMATS)
1974 return -EINVAL; 1992 return -EINVAL;
1975 if (f->type == V4L2_BUF_TYPE_VIDEO_OVERLAY && 1993 if (f->type == V4L2_BUF_TYPE_VIDEO_OVERLAY &&
@@ -2030,6 +2048,11 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
2030 int *on = arg; 2048 int *on = arg;
2031 2049
2032 if (*on) { 2050 if (*on) {
2051 if (saa7134_no_overlay > 0) {
2052 printk ("no_overlay\n");
2053 return -EINVAL;
2054 }
2055
2033 if (!res_get(dev,fh,RESOURCE_OVERLAY)) 2056 if (!res_get(dev,fh,RESOURCE_OVERLAY))
2034 return -EBUSY; 2057 return -EBUSY;
2035 spin_lock_irqsave(&dev->slock,flags); 2058 spin_lock_irqsave(&dev->slock,flags);
@@ -2281,7 +2304,7 @@ static struct file_operations radio_fops =
2281struct video_device saa7134_video_template = 2304struct video_device saa7134_video_template =
2282{ 2305{
2283 .name = "saa7134-video", 2306 .name = "saa7134-video",
2284 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|VID_TYPE_OVERLAY| 2307 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|
2285 VID_TYPE_CLIPPING|VID_TYPE_SCALES, 2308 VID_TYPE_CLIPPING|VID_TYPE_SCALES,
2286 .hardware = 0, 2309 .hardware = 0,
2287 .fops = &video_fops, 2310 .fops = &video_fops,
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index 683e785c18bd..17ba34f30760 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -557,6 +557,7 @@ struct saa7134_dev {
557/* saa7134-core.c */ 557/* saa7134-core.c */
558 558
559extern struct list_head saa7134_devlist; 559extern struct list_head saa7134_devlist;
560extern int saa7134_no_overlay;
560 561
561void saa7134_track_gpio(struct saa7134_dev *dev, char *msg); 562void saa7134_track_gpio(struct saa7134_dev *dev, char *msg);
562 563