aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx
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
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')
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c14
-rw-r--r--drivers/media/video/em28xx/em28xx-i2c.c1
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c61
-rw-r--r--drivers/media/video/em28xx/em28xx.h28
4 files changed, 18 insertions, 86 deletions
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index a2c0794821ba..fd64058a04e2 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -52,7 +52,6 @@ struct em28xx_board em28xx_boards[] = {
52 .name = "Unknown EM2800 video grabber", 52 .name = "Unknown EM2800 video grabber",
53 .is_em2800 = 1, 53 .is_em2800 = 1,
54 .vchannels = 2, 54 .vchannels = 2,
55 .norm = VIDEO_MODE_PAL,
56 .tda9887_conf = TDA9887_PRESENT, 55 .tda9887_conf = TDA9887_PRESENT,
57 .has_tuner = 1, 56 .has_tuner = 1,
58 .decoder = EM28XX_SAA7113, 57 .decoder = EM28XX_SAA7113,
@@ -74,7 +73,6 @@ struct em28xx_board em28xx_boards[] = {
74 .name = "Kworld PVR TV 2800 RF", 73 .name = "Kworld PVR TV 2800 RF",
75 .is_em2800 = 0, 74 .is_em2800 = 0,
76 .vchannels = 2, 75 .vchannels = 2,
77 .norm = VIDEO_MODE_PAL,
78 .tda9887_conf = TDA9887_PRESENT, 76 .tda9887_conf = TDA9887_PRESENT,
79 .has_tuner = 1, 77 .has_tuner = 1,
80 .decoder = EM28XX_SAA7113, 78 .decoder = EM28XX_SAA7113,
@@ -91,7 +89,6 @@ struct em28xx_board em28xx_boards[] = {
91 [EM2820_BOARD_TERRATEC_CINERGY_250] = { 89 [EM2820_BOARD_TERRATEC_CINERGY_250] = {
92 .name = "Terratec Cinergy 250 USB", 90 .name = "Terratec Cinergy 250 USB",
93 .vchannels = 3, 91 .vchannels = 3,
94 .norm = VIDEO_MODE_PAL,
95 .tuner_type = TUNER_LG_PAL_NEW_TAPC, 92 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
96 .tda9887_conf = TDA9887_PRESENT, 93 .tda9887_conf = TDA9887_PRESENT,
97 .has_tuner = 1, 94 .has_tuner = 1,
@@ -113,7 +110,6 @@ struct em28xx_board em28xx_boards[] = {
113 [EM2820_BOARD_PINNACLE_USB_2] = { 110 [EM2820_BOARD_PINNACLE_USB_2] = {
114 .name = "Pinnacle PCTV USB 2", 111 .name = "Pinnacle PCTV USB 2",
115 .vchannels = 3, 112 .vchannels = 3,
116 .norm = VIDEO_MODE_PAL,
117 .tuner_type = TUNER_LG_PAL_NEW_TAPC, 113 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
118 .tda9887_conf = TDA9887_PRESENT, 114 .tda9887_conf = TDA9887_PRESENT,
119 .has_tuner = 1, 115 .has_tuner = 1,
@@ -135,7 +131,6 @@ struct em28xx_board em28xx_boards[] = {
135 [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = { 131 [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = {
136 .name = "Hauppauge WinTV USB 2", 132 .name = "Hauppauge WinTV USB 2",
137 .vchannels = 3, 133 .vchannels = 3,
138 .norm = VIDEO_MODE_NTSC,
139 .tuner_type = TUNER_PHILIPS_FM1236_MK3, 134 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
140 .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE, 135 .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE,
141 .has_tuner = 1, 136 .has_tuner = 1,
@@ -156,7 +151,6 @@ struct em28xx_board em28xx_boards[] = {
156 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = { 151 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
157 .name = "Hauppauge WinTV HVR 900/950", 152 .name = "Hauppauge WinTV HVR 900/950",
158 .vchannels = 3, 153 .vchannels = 3,
159 .norm = VIDEO_MODE_PAL,
160 .tda9887_conf = TDA9887_PRESENT, 154 .tda9887_conf = TDA9887_PRESENT,
161 .tuner_type = TUNER_XC2028, 155 .tuner_type = TUNER_XC2028,
162 .has_tuner = 1, 156 .has_tuner = 1,
@@ -178,7 +172,6 @@ struct em28xx_board em28xx_boards[] = {
178 [EM2880_BOARD_TERRATEC_HYBRID_XS] = { 172 [EM2880_BOARD_TERRATEC_HYBRID_XS] = {
179 .name = "Terratec Hybrid XS", 173 .name = "Terratec Hybrid XS",
180 .vchannels = 3, 174 .vchannels = 3,
181 .norm = VIDEO_MODE_PAL,
182 .tda9887_conf = TDA9887_PRESENT, 175 .tda9887_conf = TDA9887_PRESENT,
183 .has_tuner = 1, 176 .has_tuner = 1,
184 .tuner_type = TUNER_XC2028, 177 .tuner_type = TUNER_XC2028,
@@ -202,7 +195,6 @@ struct em28xx_board em28xx_boards[] = {
202 [EM2880_BOARD_TERRATEC_PRODIGY_XS] = { 195 [EM2880_BOARD_TERRATEC_PRODIGY_XS] = {
203 .name = "Terratec Prodigy XS", 196 .name = "Terratec Prodigy XS",
204 .vchannels = 3, 197 .vchannels = 3,
205 .norm = VIDEO_MODE_PAL,
206 .tda9887_conf = TDA9887_PRESENT, 198 .tda9887_conf = TDA9887_PRESENT,
207 .has_tuner = 1, 199 .has_tuner = 1,
208 .tuner_type = TUNER_XC2028, 200 .tuner_type = TUNER_XC2028,
@@ -224,7 +216,6 @@ struct em28xx_board em28xx_boards[] = {
224 [EM2820_BOARD_MSI_VOX_USB_2] = { 216 [EM2820_BOARD_MSI_VOX_USB_2] = {
225 .name = "MSI VOX USB 2.0", 217 .name = "MSI VOX USB 2.0",
226 .vchannels = 3, 218 .vchannels = 3,
227 .norm = VIDEO_MODE_PAL,
228 .tuner_type = TUNER_LG_PAL_NEW_TAPC, 219 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
229 .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE, 220 .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE,
230 .has_tuner = 1, 221 .has_tuner = 1,
@@ -247,7 +238,6 @@ struct em28xx_board em28xx_boards[] = {
247 .name = "Terratec Cinergy 200 USB", 238 .name = "Terratec Cinergy 200 USB",
248 .is_em2800 = 1, 239 .is_em2800 = 1,
249 .vchannels = 3, 240 .vchannels = 3,
250 .norm = VIDEO_MODE_PAL,
251 .tuner_type = TUNER_LG_PAL_NEW_TAPC, 241 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
252 .tda9887_conf = TDA9887_PRESENT, 242 .tda9887_conf = TDA9887_PRESENT,
253 .has_tuner = 1, 243 .has_tuner = 1,
@@ -270,7 +260,6 @@ struct em28xx_board em28xx_boards[] = {
270 .name = "Leadtek Winfast USB II", 260 .name = "Leadtek Winfast USB II",
271 .is_em2800 = 1, 261 .is_em2800 = 1,
272 .vchannels = 3, 262 .vchannels = 3,
273 .norm = VIDEO_MODE_PAL,
274 .tuner_type = TUNER_LG_PAL_NEW_TAPC, 263 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
275 .tda9887_conf = TDA9887_PRESENT, 264 .tda9887_conf = TDA9887_PRESENT,
276 .has_tuner = 1, 265 .has_tuner = 1,
@@ -293,7 +282,6 @@ struct em28xx_board em28xx_boards[] = {
293 .name = "Kworld USB2800", 282 .name = "Kworld USB2800",
294 .is_em2800 = 1, 283 .is_em2800 = 1,
295 .vchannels = 3, 284 .vchannels = 3,
296 .norm = VIDEO_MODE_PAL,
297 .tuner_type = TUNER_PHILIPS_ATSC, 285 .tuner_type = TUNER_PHILIPS_ATSC,
298 .tda9887_conf = TDA9887_PRESENT, 286 .tda9887_conf = TDA9887_PRESENT,
299 .has_tuner = 1, 287 .has_tuner = 1,
@@ -315,7 +303,6 @@ struct em28xx_board em28xx_boards[] = {
315 [EM2820_BOARD_PINNACLE_DVC_90] = { 303 [EM2820_BOARD_PINNACLE_DVC_90] = {
316 .name = "Pinnacle Dazzle DVC 90", 304 .name = "Pinnacle Dazzle DVC 90",
317 .vchannels = 3, 305 .vchannels = 3,
318 .norm = VIDEO_MODE_PAL,
319 .has_tuner = 0, 306 .has_tuner = 0,
320 .decoder = EM28XX_SAA7113, 307 .decoder = EM28XX_SAA7113,
321 .input = {{ 308 .input = {{
@@ -332,7 +319,6 @@ struct em28xx_board em28xx_boards[] = {
332 .name = "V-Gear PocketTV", 319 .name = "V-Gear PocketTV",
333 .is_em2800 = 1, 320 .is_em2800 = 1,
334 .vchannels = 3, 321 .vchannels = 3,
335 .norm = VIDEO_MODE_PAL,
336 .tuner_type = TUNER_LG_PAL_NEW_TAPC, 322 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
337 .tda9887_conf = TDA9887_PRESENT, 323 .tda9887_conf = TDA9887_PRESENT,
338 .has_tuner = 1, 324 .has_tuner = 1,
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
index acd853d217ea..cacd04d46e99 100644
--- a/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/drivers/media/video/em28xx/em28xx-i2c.c
@@ -25,7 +25,6 @@
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/usb.h> 26#include <linux/usb.h>
27#include <linux/i2c.h> 27#include <linux/i2c.h>
28#include <linux/video_decoder.h>
29 28
30#include "em28xx.h" 29#include "em28xx.h"
31#include "tuner-xc2028.h" 30#include "tuner-xc2028.h"
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
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
index f355075d50de..8d045867dac7 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -167,7 +167,6 @@ enum em28xx_decoder {
167struct em28xx_board { 167struct em28xx_board {
168 char *name; 168 char *name;
169 int vchannels; 169 int vchannels;
170 int norm;
171 int tuner_type; 170 int tuner_type;
172 171
173 /* i2c flags */ 172 /* i2c flags */
@@ -203,14 +202,6 @@ enum em28xx_dev_state {
203 DEV_MISCONFIGURED = 0x04, 202 DEV_MISCONFIGURED = 0x04,
204}; 203};
205 204
206/* tvnorms */
207struct em28xx_tvnorm {
208 char *name;
209 v4l2_std_id id;
210 /* mode for saa7113h */
211 int mode;
212};
213
214/* main device struct */ 205/* main device struct */
215struct em28xx { 206struct em28xx {
216 /* generic device properties */ 207 /* generic device properties */
@@ -239,7 +230,7 @@ struct em28xx {
239 /* video for linux */ 230 /* video for linux */
240 int users; /* user count for exclusive use */ 231 int users; /* user count for exclusive use */
241 struct video_device *vdev; /* video for linux device struct */ 232 struct video_device *vdev; /* video for linux device struct */
242 struct em28xx_tvnorm *tvnorm; /* selected tv norm */ 233 v4l2_std_id norm; /* selected tv norm */
243 int ctl_freq; /* selected frequency */ 234 int ctl_freq; /* selected frequency */
244 unsigned int ctl_input; /* selected input */ 235 unsigned int ctl_input; /* selected input */
245 unsigned int ctl_ainput; /* slected audio input */ 236 unsigned int ctl_ainput; /* slected audio input */
@@ -522,18 +513,21 @@ inline static int em28xx_gamma_set(struct em28xx *dev, s32 val)
522/*FIXME: maxw should be dependent of alt mode */ 513/*FIXME: maxw should be dependent of alt mode */
523inline static unsigned int norm_maxw(struct em28xx *dev) 514inline static unsigned int norm_maxw(struct em28xx *dev)
524{ 515{
525 switch(dev->model){ 516 switch (dev->model) {
526 case (EM2820_BOARD_MSI_VOX_USB_2): return(640); 517 case EM2820_BOARD_MSI_VOX_USB_2:
527 default: return(720); 518 return 640;
519 default:
520 return 720;
528 } 521 }
529} 522}
530 523
531inline static unsigned int norm_maxh(struct em28xx *dev) 524inline static unsigned int norm_maxh(struct em28xx *dev)
532{ 525{
533 switch(dev->model){ 526 switch (dev->model) {
534 case (EM2820_BOARD_MSI_VOX_USB_2): return(480); 527 case EM2820_BOARD_MSI_VOX_USB_2:
535 default: return (dev->tvnorm->id & V4L2_STD_625_50) ? 576 : 480; 528 return 480;
529 default:
530 return (dev->norm & V4L2_STD_625_50) ? 576 : 480;
536 } 531 }
537} 532}
538
539#endif 533#endif