aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx/em28xx-video.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-11-11 12:15:34 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:02:08 -0500
commit7d497f8afa80128bb99a425a6d7a766a863128a5 (patch)
treed264804a02bf1cd13ccfd3ef4c03de7c7a1b2191 /drivers/media/video/em28xx/em28xx-video.c
parentcb77d010221e66c63f4a71546fed73be9b12b9a3 (diff)
V4L/DVB (6587): Cleanup at tv norm selection
With the conversion to the vidio_ioctl2, tvnorms array is not required anymore. Also, removed some code from V4L1 time (VIDEO_MODE_foo), specied at the non-used video_decoder.h. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-video.c')
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c61
1 files changed, 7 insertions, 54 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index c4db1aebdcd7..c2901f13eb25 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -33,7 +33,6 @@
33#include <linux/i2c.h> 33#include <linux/i2c.h>
34#include <linux/version.h> 34#include <linux/version.h>
35#include <linux/mm.h> 35#include <linux/mm.h>
36#include <linux/video_decoder.h>
37#include <linux/mutex.h> 36#include <linux/mutex.h>
38 37
39#include "em28xx.h" 38#include "em28xx.h"
@@ -77,29 +76,6 @@ MODULE_PARM_DESC(video_debug,"enable debug messages [video]");
77/* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS */ 76/* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS */
78static unsigned long em28xx_devused; 77static unsigned long em28xx_devused;
79 78
80/* supported tv norms */
81static struct em28xx_tvnorm tvnorms[] = {
82 {
83 .name = "PAL",
84 .id = V4L2_STD_PAL,
85 .mode = VIDEO_MODE_PAL,
86 }, {
87 .name = "NTSC",
88 .id = V4L2_STD_NTSC,
89 .mode = VIDEO_MODE_NTSC,
90 }, {
91 .name = "SECAM",
92 .id = V4L2_STD_SECAM,
93 .mode = VIDEO_MODE_SECAM,
94 }, {
95 .name = "PAL-M",
96 .id = V4L2_STD_PAL_M,
97 .mode = VIDEO_MODE_PAL,
98 }
99};
100
101#define TVNORMS ARRAY_SIZE(tvnorms)
102
103/* supported controls */ 79/* supported controls */
104/* Common to all boards */ 80/* Common to all boards */
105static struct v4l2_queryctrl em28xx_qctrl[] = { 81static struct v4l2_queryctrl em28xx_qctrl[] = {
@@ -536,27 +512,14 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm)
536 struct em28xx_fh *fh = priv; 512 struct em28xx_fh *fh = priv;
537 struct em28xx *dev = fh->dev; 513 struct em28xx *dev = fh->dev;
538 struct v4l2_format f; 514 struct v4l2_format f;
539 unsigned int i;
540 int rc; 515 int rc;
541 516
542 rc = check_dev(dev); 517 rc = check_dev(dev);
543 if (rc < 0) 518 if (rc < 0)
544 return rc; 519 return rc;
545 520
546 for (i = 0; i < TVNORMS; i++)
547 if (*norm == tvnorms[i].id)
548 break;
549 if (i == TVNORMS)
550 for (i = 0; i < TVNORMS; i++)
551 if (*norm & tvnorms[i].id)
552 break;
553 if (i == TVNORMS)
554 return -EINVAL;
555
556 *norm = tvnorms[i].id;
557
558 mutex_lock(&dev->lock); 521 mutex_lock(&dev->lock);
559 dev->tvnorm = &tvnorms[i]; 522 dev->norm = *norm;
560 mutex_unlock(&dev->lock); 523 mutex_unlock(&dev->lock);
561 524
562 /* Adjusts width/height, if needed */ 525 /* Adjusts width/height, if needed */
@@ -575,7 +538,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm)
575 get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale); 538 get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale);
576 539
577 em28xx_resolution_set(dev); 540 em28xx_resolution_set(dev);
578 em28xx_i2c_call_clients(dev, VIDIOC_S_STD, &dev->tvnorm->id); 541 em28xx_i2c_call_clients(dev, VIDIOC_S_STD, &dev->norm);
579 542
580 mutex_unlock(&dev->lock); 543 mutex_unlock(&dev->lock);
581 return 0; 544 return 0;
@@ -615,8 +578,7 @@ static int vidioc_enum_input(struct file *file, void *priv,
615 (EM28XX_VMUX_CABLE == INPUT(n)->type)) 578 (EM28XX_VMUX_CABLE == INPUT(n)->type))
616 i->type = V4L2_INPUT_TYPE_TUNER; 579 i->type = V4L2_INPUT_TYPE_TUNER;
617 580
618 for (n = 0; n < ARRAY_SIZE(tvnorms); n++) 581 i->std = dev->vdev->tvnorms;
619 i->std |= tvnorms[n].id;
620 582
621 return 0; 583 return 0;
622} 584}
@@ -1643,7 +1605,7 @@ static const struct video_device em28xx_video_template = {
1643 .vidioc_s_frequency = vidioc_s_frequency, 1605 .vidioc_s_frequency = vidioc_s_frequency,
1644 1606
1645 .tvnorms = V4L2_STD_ALL, 1607 .tvnorms = V4L2_STD_ALL,
1646 .current_norm = V4L2_STD_NTSC_M, 1608 .current_norm = V4L2_STD_PAL,
1647}; 1609};
1648 1610
1649 1611
@@ -1658,7 +1620,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
1658{ 1620{
1659 struct em28xx *dev = *devhandle; 1621 struct em28xx *dev = *devhandle;
1660 int retval = -ENOMEM; 1622 int retval = -ENOMEM;
1661 int errCode, i; 1623 int errCode;
1662 unsigned int maxh, maxw; 1624 unsigned int maxh, maxw;
1663 1625
1664 dev->udev = udev; 1626 dev->udev = udev;
@@ -1694,15 +1656,8 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
1694 /* configure the device */ 1656 /* configure the device */
1695 em28xx_config_i2c(dev); 1657 em28xx_config_i2c(dev);
1696 1658
1697 for (i = 0; i < TVNORMS; i++) 1659 /* set default norm */
1698 if (em28xx_boards[dev->model].norm == tvnorms[i].mode) 1660 dev->norm = em28xx_video_template.current_norm;
1699 break;
1700 if (i == TVNORMS)
1701 i = 0;
1702
1703 dev->tvnorm = &tvnorms[i]; /* set default norm */
1704
1705 em28xx_videodbg("tvnorm=%s\n", dev->tvnorm->name);
1706 1661
1707 maxw = norm_maxw(dev); 1662 maxw = norm_maxw(dev);
1708 maxh = norm_maxh(dev); 1663 maxh = norm_maxh(dev);
@@ -1737,7 +1692,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
1737 dev->vdev->dev = &dev->udev->dev; 1692 dev->vdev->dev = &dev->udev->dev;
1738 snprintf(dev->vdev->name, sizeof(dev->vbi_dev->name), 1693 snprintf(dev->vdev->name, sizeof(dev->vbi_dev->name),
1739 "%s#%d %s", "em28xx", dev->devno, "video"); 1694 "%s#%d %s", "em28xx", dev->devno, "video");
1740 dev->vdev->current_norm = dev->tvnorm->id;
1741 1695
1742 /* Allocate and fill vbi video_device struct */ 1696 /* Allocate and fill vbi video_device struct */
1743 dev->vbi_dev = video_device_alloc(); 1697 dev->vbi_dev = video_device_alloc();
@@ -1754,7 +1708,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
1754 dev->vbi_dev->dev = &dev->udev->dev; 1708 dev->vbi_dev->dev = &dev->udev->dev;
1755 snprintf(dev->vbi_dev->name, sizeof(dev->vbi_dev->name), 1709 snprintf(dev->vbi_dev->name, sizeof(dev->vbi_dev->name),
1756 "%s#%d %s", "em28xx", dev->devno, "vbi"); 1710 "%s#%d %s", "em28xx", dev->devno, "vbi");
1757 dev->vbi_dev->current_norm = dev->tvnorm->id;
1758 1711
1759 list_add_tail(&dev->devlist,&em28xx_devlist); 1712 list_add_tail(&dev->devlist,&em28xx_devlist);
1760 1713