提交 7d497f8a 编写于 作者: M Mauro Carvalho Chehab

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: NMauro Carvalho Chehab <mchehab@infradead.org>
上级 cb77d010
...@@ -52,7 +52,6 @@ struct em28xx_board em28xx_boards[] = { ...@@ -52,7 +52,6 @@ struct em28xx_board em28xx_boards[] = {
.name = "Unknown EM2800 video grabber", .name = "Unknown EM2800 video grabber",
.is_em2800 = 1, .is_em2800 = 1,
.vchannels = 2, .vchannels = 2,
.norm = VIDEO_MODE_PAL,
.tda9887_conf = TDA9887_PRESENT, .tda9887_conf = TDA9887_PRESENT,
.has_tuner = 1, .has_tuner = 1,
.decoder = EM28XX_SAA7113, .decoder = EM28XX_SAA7113,
...@@ -74,7 +73,6 @@ struct em28xx_board em28xx_boards[] = { ...@@ -74,7 +73,6 @@ struct em28xx_board em28xx_boards[] = {
.name = "Kworld PVR TV 2800 RF", .name = "Kworld PVR TV 2800 RF",
.is_em2800 = 0, .is_em2800 = 0,
.vchannels = 2, .vchannels = 2,
.norm = VIDEO_MODE_PAL,
.tda9887_conf = TDA9887_PRESENT, .tda9887_conf = TDA9887_PRESENT,
.has_tuner = 1, .has_tuner = 1,
.decoder = EM28XX_SAA7113, .decoder = EM28XX_SAA7113,
...@@ -91,7 +89,6 @@ struct em28xx_board em28xx_boards[] = { ...@@ -91,7 +89,6 @@ struct em28xx_board em28xx_boards[] = {
[EM2820_BOARD_TERRATEC_CINERGY_250] = { [EM2820_BOARD_TERRATEC_CINERGY_250] = {
.name = "Terratec Cinergy 250 USB", .name = "Terratec Cinergy 250 USB",
.vchannels = 3, .vchannels = 3,
.norm = VIDEO_MODE_PAL,
.tuner_type = TUNER_LG_PAL_NEW_TAPC, .tuner_type = TUNER_LG_PAL_NEW_TAPC,
.tda9887_conf = TDA9887_PRESENT, .tda9887_conf = TDA9887_PRESENT,
.has_tuner = 1, .has_tuner = 1,
...@@ -113,7 +110,6 @@ struct em28xx_board em28xx_boards[] = { ...@@ -113,7 +110,6 @@ struct em28xx_board em28xx_boards[] = {
[EM2820_BOARD_PINNACLE_USB_2] = { [EM2820_BOARD_PINNACLE_USB_2] = {
.name = "Pinnacle PCTV USB 2", .name = "Pinnacle PCTV USB 2",
.vchannels = 3, .vchannels = 3,
.norm = VIDEO_MODE_PAL,
.tuner_type = TUNER_LG_PAL_NEW_TAPC, .tuner_type = TUNER_LG_PAL_NEW_TAPC,
.tda9887_conf = TDA9887_PRESENT, .tda9887_conf = TDA9887_PRESENT,
.has_tuner = 1, .has_tuner = 1,
...@@ -135,7 +131,6 @@ struct em28xx_board em28xx_boards[] = { ...@@ -135,7 +131,6 @@ struct em28xx_board em28xx_boards[] = {
[EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = { [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = {
.name = "Hauppauge WinTV USB 2", .name = "Hauppauge WinTV USB 2",
.vchannels = 3, .vchannels = 3,
.norm = VIDEO_MODE_NTSC,
.tuner_type = TUNER_PHILIPS_FM1236_MK3, .tuner_type = TUNER_PHILIPS_FM1236_MK3,
.tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE, .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE,
.has_tuner = 1, .has_tuner = 1,
...@@ -156,7 +151,6 @@ struct em28xx_board em28xx_boards[] = { ...@@ -156,7 +151,6 @@ struct em28xx_board em28xx_boards[] = {
[EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = { [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
.name = "Hauppauge WinTV HVR 900/950", .name = "Hauppauge WinTV HVR 900/950",
.vchannels = 3, .vchannels = 3,
.norm = VIDEO_MODE_PAL,
.tda9887_conf = TDA9887_PRESENT, .tda9887_conf = TDA9887_PRESENT,
.tuner_type = TUNER_XC2028, .tuner_type = TUNER_XC2028,
.has_tuner = 1, .has_tuner = 1,
...@@ -178,7 +172,6 @@ struct em28xx_board em28xx_boards[] = { ...@@ -178,7 +172,6 @@ struct em28xx_board em28xx_boards[] = {
[EM2880_BOARD_TERRATEC_HYBRID_XS] = { [EM2880_BOARD_TERRATEC_HYBRID_XS] = {
.name = "Terratec Hybrid XS", .name = "Terratec Hybrid XS",
.vchannels = 3, .vchannels = 3,
.norm = VIDEO_MODE_PAL,
.tda9887_conf = TDA9887_PRESENT, .tda9887_conf = TDA9887_PRESENT,
.has_tuner = 1, .has_tuner = 1,
.tuner_type = TUNER_XC2028, .tuner_type = TUNER_XC2028,
...@@ -202,7 +195,6 @@ struct em28xx_board em28xx_boards[] = { ...@@ -202,7 +195,6 @@ struct em28xx_board em28xx_boards[] = {
[EM2880_BOARD_TERRATEC_PRODIGY_XS] = { [EM2880_BOARD_TERRATEC_PRODIGY_XS] = {
.name = "Terratec Prodigy XS", .name = "Terratec Prodigy XS",
.vchannels = 3, .vchannels = 3,
.norm = VIDEO_MODE_PAL,
.tda9887_conf = TDA9887_PRESENT, .tda9887_conf = TDA9887_PRESENT,
.has_tuner = 1, .has_tuner = 1,
.tuner_type = TUNER_XC2028, .tuner_type = TUNER_XC2028,
...@@ -224,7 +216,6 @@ struct em28xx_board em28xx_boards[] = { ...@@ -224,7 +216,6 @@ struct em28xx_board em28xx_boards[] = {
[EM2820_BOARD_MSI_VOX_USB_2] = { [EM2820_BOARD_MSI_VOX_USB_2] = {
.name = "MSI VOX USB 2.0", .name = "MSI VOX USB 2.0",
.vchannels = 3, .vchannels = 3,
.norm = VIDEO_MODE_PAL,
.tuner_type = TUNER_LG_PAL_NEW_TAPC, .tuner_type = TUNER_LG_PAL_NEW_TAPC,
.tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE, .tda9887_conf = TDA9887_PRESENT|TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE,
.has_tuner = 1, .has_tuner = 1,
...@@ -247,7 +238,6 @@ struct em28xx_board em28xx_boards[] = { ...@@ -247,7 +238,6 @@ struct em28xx_board em28xx_boards[] = {
.name = "Terratec Cinergy 200 USB", .name = "Terratec Cinergy 200 USB",
.is_em2800 = 1, .is_em2800 = 1,
.vchannels = 3, .vchannels = 3,
.norm = VIDEO_MODE_PAL,
.tuner_type = TUNER_LG_PAL_NEW_TAPC, .tuner_type = TUNER_LG_PAL_NEW_TAPC,
.tda9887_conf = TDA9887_PRESENT, .tda9887_conf = TDA9887_PRESENT,
.has_tuner = 1, .has_tuner = 1,
...@@ -270,7 +260,6 @@ struct em28xx_board em28xx_boards[] = { ...@@ -270,7 +260,6 @@ struct em28xx_board em28xx_boards[] = {
.name = "Leadtek Winfast USB II", .name = "Leadtek Winfast USB II",
.is_em2800 = 1, .is_em2800 = 1,
.vchannels = 3, .vchannels = 3,
.norm = VIDEO_MODE_PAL,
.tuner_type = TUNER_LG_PAL_NEW_TAPC, .tuner_type = TUNER_LG_PAL_NEW_TAPC,
.tda9887_conf = TDA9887_PRESENT, .tda9887_conf = TDA9887_PRESENT,
.has_tuner = 1, .has_tuner = 1,
...@@ -293,7 +282,6 @@ struct em28xx_board em28xx_boards[] = { ...@@ -293,7 +282,6 @@ struct em28xx_board em28xx_boards[] = {
.name = "Kworld USB2800", .name = "Kworld USB2800",
.is_em2800 = 1, .is_em2800 = 1,
.vchannels = 3, .vchannels = 3,
.norm = VIDEO_MODE_PAL,
.tuner_type = TUNER_PHILIPS_ATSC, .tuner_type = TUNER_PHILIPS_ATSC,
.tda9887_conf = TDA9887_PRESENT, .tda9887_conf = TDA9887_PRESENT,
.has_tuner = 1, .has_tuner = 1,
...@@ -315,7 +303,6 @@ struct em28xx_board em28xx_boards[] = { ...@@ -315,7 +303,6 @@ struct em28xx_board em28xx_boards[] = {
[EM2820_BOARD_PINNACLE_DVC_90] = { [EM2820_BOARD_PINNACLE_DVC_90] = {
.name = "Pinnacle Dazzle DVC 90", .name = "Pinnacle Dazzle DVC 90",
.vchannels = 3, .vchannels = 3,
.norm = VIDEO_MODE_PAL,
.has_tuner = 0, .has_tuner = 0,
.decoder = EM28XX_SAA7113, .decoder = EM28XX_SAA7113,
.input = {{ .input = {{
...@@ -332,7 +319,6 @@ struct em28xx_board em28xx_boards[] = { ...@@ -332,7 +319,6 @@ struct em28xx_board em28xx_boards[] = {
.name = "V-Gear PocketTV", .name = "V-Gear PocketTV",
.is_em2800 = 1, .is_em2800 = 1,
.vchannels = 3, .vchannels = 3,
.norm = VIDEO_MODE_PAL,
.tuner_type = TUNER_LG_PAL_NEW_TAPC, .tuner_type = TUNER_LG_PAL_NEW_TAPC,
.tda9887_conf = TDA9887_PRESENT, .tda9887_conf = TDA9887_PRESENT,
.has_tuner = 1, .has_tuner = 1,
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/video_decoder.h>
#include "em28xx.h" #include "em28xx.h"
#include "tuner-xc2028.h" #include "tuner-xc2028.h"
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/version.h> #include <linux/version.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/video_decoder.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include "em28xx.h" #include "em28xx.h"
...@@ -77,29 +76,6 @@ MODULE_PARM_DESC(video_debug,"enable debug messages [video]"); ...@@ -77,29 +76,6 @@ MODULE_PARM_DESC(video_debug,"enable debug messages [video]");
/* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS */ /* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS */
static unsigned long em28xx_devused; static unsigned long em28xx_devused;
/* supported tv norms */
static struct em28xx_tvnorm tvnorms[] = {
{
.name = "PAL",
.id = V4L2_STD_PAL,
.mode = VIDEO_MODE_PAL,
}, {
.name = "NTSC",
.id = V4L2_STD_NTSC,
.mode = VIDEO_MODE_NTSC,
}, {
.name = "SECAM",
.id = V4L2_STD_SECAM,
.mode = VIDEO_MODE_SECAM,
}, {
.name = "PAL-M",
.id = V4L2_STD_PAL_M,
.mode = VIDEO_MODE_PAL,
}
};
#define TVNORMS ARRAY_SIZE(tvnorms)
/* supported controls */ /* supported controls */
/* Common to all boards */ /* Common to all boards */
static struct v4l2_queryctrl em28xx_qctrl[] = { static struct v4l2_queryctrl em28xx_qctrl[] = {
...@@ -536,27 +512,14 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm) ...@@ -536,27 +512,14 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm)
struct em28xx_fh *fh = priv; struct em28xx_fh *fh = priv;
struct em28xx *dev = fh->dev; struct em28xx *dev = fh->dev;
struct v4l2_format f; struct v4l2_format f;
unsigned int i;
int rc; int rc;
rc = check_dev(dev); rc = check_dev(dev);
if (rc < 0) if (rc < 0)
return rc; return rc;
for (i = 0; i < TVNORMS; i++)
if (*norm == tvnorms[i].id)
break;
if (i == TVNORMS)
for (i = 0; i < TVNORMS; i++)
if (*norm & tvnorms[i].id)
break;
if (i == TVNORMS)
return -EINVAL;
*norm = tvnorms[i].id;
mutex_lock(&dev->lock); mutex_lock(&dev->lock);
dev->tvnorm = &tvnorms[i]; dev->norm = *norm;
mutex_unlock(&dev->lock); mutex_unlock(&dev->lock);
/* Adjusts width/height, if needed */ /* Adjusts width/height, if needed */
...@@ -575,7 +538,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm) ...@@ -575,7 +538,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm)
get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale); get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale);
em28xx_resolution_set(dev); em28xx_resolution_set(dev);
em28xx_i2c_call_clients(dev, VIDIOC_S_STD, &dev->tvnorm->id); em28xx_i2c_call_clients(dev, VIDIOC_S_STD, &dev->norm);
mutex_unlock(&dev->lock); mutex_unlock(&dev->lock);
return 0; return 0;
...@@ -615,8 +578,7 @@ static int vidioc_enum_input(struct file *file, void *priv, ...@@ -615,8 +578,7 @@ static int vidioc_enum_input(struct file *file, void *priv,
(EM28XX_VMUX_CABLE == INPUT(n)->type)) (EM28XX_VMUX_CABLE == INPUT(n)->type))
i->type = V4L2_INPUT_TYPE_TUNER; i->type = V4L2_INPUT_TYPE_TUNER;
for (n = 0; n < ARRAY_SIZE(tvnorms); n++) i->std = dev->vdev->tvnorms;
i->std |= tvnorms[n].id;
return 0; return 0;
} }
...@@ -1643,7 +1605,7 @@ static const struct video_device em28xx_video_template = { ...@@ -1643,7 +1605,7 @@ static const struct video_device em28xx_video_template = {
.vidioc_s_frequency = vidioc_s_frequency, .vidioc_s_frequency = vidioc_s_frequency,
.tvnorms = V4L2_STD_ALL, .tvnorms = V4L2_STD_ALL,
.current_norm = V4L2_STD_NTSC_M, .current_norm = V4L2_STD_PAL,
}; };
...@@ -1658,7 +1620,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, ...@@ -1658,7 +1620,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
{ {
struct em28xx *dev = *devhandle; struct em28xx *dev = *devhandle;
int retval = -ENOMEM; int retval = -ENOMEM;
int errCode, i; int errCode;
unsigned int maxh, maxw; unsigned int maxh, maxw;
dev->udev = udev; dev->udev = udev;
...@@ -1694,15 +1656,8 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, ...@@ -1694,15 +1656,8 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
/* configure the device */ /* configure the device */
em28xx_config_i2c(dev); em28xx_config_i2c(dev);
for (i = 0; i < TVNORMS; i++) /* set default norm */
if (em28xx_boards[dev->model].norm == tvnorms[i].mode) dev->norm = em28xx_video_template.current_norm;
break;
if (i == TVNORMS)
i = 0;
dev->tvnorm = &tvnorms[i]; /* set default norm */
em28xx_videodbg("tvnorm=%s\n", dev->tvnorm->name);
maxw = norm_maxw(dev); maxw = norm_maxw(dev);
maxh = norm_maxh(dev); maxh = norm_maxh(dev);
...@@ -1737,7 +1692,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, ...@@ -1737,7 +1692,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
dev->vdev->dev = &dev->udev->dev; dev->vdev->dev = &dev->udev->dev;
snprintf(dev->vdev->name, sizeof(dev->vbi_dev->name), snprintf(dev->vdev->name, sizeof(dev->vbi_dev->name),
"%s#%d %s", "em28xx", dev->devno, "video"); "%s#%d %s", "em28xx", dev->devno, "video");
dev->vdev->current_norm = dev->tvnorm->id;
/* Allocate and fill vbi video_device struct */ /* Allocate and fill vbi video_device struct */
dev->vbi_dev = video_device_alloc(); dev->vbi_dev = video_device_alloc();
...@@ -1754,7 +1708,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, ...@@ -1754,7 +1708,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
dev->vbi_dev->dev = &dev->udev->dev; dev->vbi_dev->dev = &dev->udev->dev;
snprintf(dev->vbi_dev->name, sizeof(dev->vbi_dev->name), snprintf(dev->vbi_dev->name, sizeof(dev->vbi_dev->name),
"%s#%d %s", "em28xx", dev->devno, "vbi"); "%s#%d %s", "em28xx", dev->devno, "vbi");
dev->vbi_dev->current_norm = dev->tvnorm->id;
list_add_tail(&dev->devlist,&em28xx_devlist); list_add_tail(&dev->devlist,&em28xx_devlist);
......
...@@ -167,7 +167,6 @@ enum em28xx_decoder { ...@@ -167,7 +167,6 @@ enum em28xx_decoder {
struct em28xx_board { struct em28xx_board {
char *name; char *name;
int vchannels; int vchannels;
int norm;
int tuner_type; int tuner_type;
/* i2c flags */ /* i2c flags */
...@@ -203,14 +202,6 @@ enum em28xx_dev_state { ...@@ -203,14 +202,6 @@ enum em28xx_dev_state {
DEV_MISCONFIGURED = 0x04, DEV_MISCONFIGURED = 0x04,
}; };
/* tvnorms */
struct em28xx_tvnorm {
char *name;
v4l2_std_id id;
/* mode for saa7113h */
int mode;
};
/* main device struct */ /* main device struct */
struct em28xx { struct em28xx {
/* generic device properties */ /* generic device properties */
...@@ -239,7 +230,7 @@ struct em28xx { ...@@ -239,7 +230,7 @@ struct em28xx {
/* video for linux */ /* video for linux */
int users; /* user count for exclusive use */ int users; /* user count for exclusive use */
struct video_device *vdev; /* video for linux device struct */ struct video_device *vdev; /* video for linux device struct */
struct em28xx_tvnorm *tvnorm; /* selected tv norm */ v4l2_std_id norm; /* selected tv norm */
int ctl_freq; /* selected frequency */ int ctl_freq; /* selected frequency */
unsigned int ctl_input; /* selected input */ unsigned int ctl_input; /* selected input */
unsigned int ctl_ainput; /* slected audio input */ unsigned int ctl_ainput; /* slected audio input */
...@@ -522,18 +513,21 @@ inline static int em28xx_gamma_set(struct em28xx *dev, s32 val) ...@@ -522,18 +513,21 @@ inline static int em28xx_gamma_set(struct em28xx *dev, s32 val)
/*FIXME: maxw should be dependent of alt mode */ /*FIXME: maxw should be dependent of alt mode */
inline static unsigned int norm_maxw(struct em28xx *dev) inline static unsigned int norm_maxw(struct em28xx *dev)
{ {
switch(dev->model){ switch (dev->model) {
case (EM2820_BOARD_MSI_VOX_USB_2): return(640); case EM2820_BOARD_MSI_VOX_USB_2:
default: return(720); return 640;
default:
return 720;
} }
} }
inline static unsigned int norm_maxh(struct em28xx *dev) inline static unsigned int norm_maxh(struct em28xx *dev)
{ {
switch(dev->model){ switch (dev->model) {
case (EM2820_BOARD_MSI_VOX_USB_2): return(480); case EM2820_BOARD_MSI_VOX_USB_2:
default: return (dev->tvnorm->id & V4L2_STD_625_50) ? 576 : 480; return 480;
default:
return (dev->norm & V4L2_STD_625_50) ? 576 : 480;
} }
} }
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册