summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/saa7134/saa7134-video.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/saa7134/saa7134-video.c')
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-video.c127
1 files changed, 67 insertions, 60 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-video.c b/linux/drivers/media/video/saa7134/saa7134-video.c
index a6eeddb3d..e6e8b1eff 100644
--- a/linux/drivers/media/video/saa7134/saa7134-video.c
+++ b/linux/drivers/media/video/saa7134/saa7134-video.c
@@ -150,10 +150,65 @@ static struct saa7134_format formats[] = {
};
#define FORMATS ARRAY_SIZE(formats)
+#define NORM_625_50 \
+ .h_start = 0, \
+ .h_stop = 719, \
+ .video_v_start = 24, \
+ .video_v_stop = 311, \
+ .vbi_v_start = 7, \
+ .vbi_v_stop = 22, \
+ .src_timing = 4
+
+#define NORM_525_60 \
+ .h_start = 0, \
+ .h_stop = 703, \
+ .video_v_start = 22, \
+ .video_v_stop = 22+239, \
+ .vbi_v_start = 10, /* FIXME */ \
+ .vbi_v_stop = 21, /* FIXME */ \
+ .src_timing = 1
+
static struct saa7134_tvnorm tvnorms[] = {
{
- .name = "PAL",
+ .name = "PAL", /* autodetect */
.id = V4L2_STD_PAL,
+ NORM_625_50,
+
+ .sync_control = 0x18,
+ .luma_control = 0x40,
+ .chroma_ctrl1 = 0x81,
+ .chroma_gain = 0x2a,
+ .chroma_ctrl2 = 0x06,
+ .vgate_misc = 0x1c,
+
+ },{
+ .name = "PAL-BG",
+ .id = V4L2_STD_PAL_BG,
+ NORM_625_50,
+
+ .sync_control = 0x18,
+ .luma_control = 0x40,
+ .chroma_ctrl1 = 0x81,
+ .chroma_gain = 0x2a,
+ .chroma_ctrl2 = 0x06,
+ .vgate_misc = 0x1c,
+
+ },{
+ .name = "PAL-I",
+ .id = V4L2_STD_PAL_I,
+ NORM_625_50,
+
+ .sync_control = 0x18,
+ .luma_control = 0x40,
+ .chroma_ctrl1 = 0x81,
+ .chroma_gain = 0x2a,
+ .chroma_ctrl2 = 0x06,
+ .vgate_misc = 0x1c,
+
+ },{
+ .name = "PAL-DK",
+ .id = V4L2_STD_PAL_DK,
+ NORM_625_50,
.sync_control = 0x18,
.luma_control = 0x40,
@@ -162,16 +217,10 @@ static struct saa7134_tvnorm tvnorms[] = {
.chroma_ctrl2 = 0x06,
.vgate_misc = 0x1c,
- .h_start = 0,
- .h_stop = 719,
- .video_v_start = 24,
- .video_v_stop = 311,
- .vbi_v_start = 7,
- .vbi_v_stop = 22,
- .src_timing = 4,
},{
.name = "NTSC",
.id = V4L2_STD_NTSC,
+ NORM_525_60,
.sync_control = 0x59,
.luma_control = 0x40,
@@ -180,16 +229,10 @@ static struct saa7134_tvnorm tvnorms[] = {
.chroma_ctrl2 = 0x0e,
.vgate_misc = 0x18,
- .h_start = 0,
- .h_stop = 703,
- .video_v_start = 22,
- .video_v_stop = 22+239,
- .vbi_v_start = 10, /* FIXME */
- .vbi_v_stop = 21, /* FIXME */
- .src_timing = 1,
},{
.name = "SECAM",
.id = V4L2_STD_SECAM,
+ NORM_625_50,
.sync_control = 0x18, /* old: 0x58, */
.luma_control = 0x1b,
@@ -198,16 +241,10 @@ static struct saa7134_tvnorm tvnorms[] = {
.chroma_ctrl2 = 0x00,
.vgate_misc = 0x1c,
- .h_start = 0,
- .h_stop = 719,
- .video_v_start = 24,
- .video_v_stop = 311,
- .vbi_v_start = 7,
- .vbi_v_stop = 22,
- .src_timing = 4,
},{
.name = "PAL-M",
.id = V4L2_STD_PAL_M,
+ NORM_525_60,
.sync_control = 0x59,
.luma_control = 0x40,
@@ -216,16 +253,10 @@ static struct saa7134_tvnorm tvnorms[] = {
.chroma_ctrl2 = 0x0e,
.vgate_misc = 0x18,
- .h_start = 0,
- .h_stop = 719,
- .video_v_start = 22,
- .video_v_stop = 22+240,
- .vbi_v_start = 10, /* FIXME */
- .vbi_v_stop = 21, /* FIXME */
- .src_timing = 1,
},{
.name = "PAL-Nc",
.id = V4L2_STD_PAL_Nc,
+ NORM_625_50,
.sync_control = 0x18,
.luma_control = 0x40,
@@ -234,35 +265,6 @@ static struct saa7134_tvnorm tvnorms[] = {
.chroma_ctrl2 = 0x06,
.vgate_misc = 0x1c,
- .h_start = 0,
- .h_stop = 719,
- .video_v_start = 24,
- .video_v_stop = 311,
- .vbi_v_start = 7,
- .vbi_v_stop = 22,
- .src_timing = 4,
-#if 0
- },{
- .name = "AUTO",
- .id = V4L2_STD_PAL|V4L2_STD_NTSC|V4L2_STD_SECAM,
- .width = 768,
- .height = 576,
-
- .sync_control = 0x98,
- .luma_control = 0x40,
- .chroma_ctrl1 = 0x8b,
- .chroma_gain = 0x00,
- .chroma_ctrl2 = 0x00,
- .vgate_misc = 0x18,
-
- .h_start = 0,
- .h_stop = 719,
- .video_v_start = 24,
- .video_v_stop = 311,
- .vbi_v_start = 7,
- .vbi_v_stop = 22,
- .src_timing = 4,
-#endif
}
};
#define TVNORMS ARRAY_SIZE(tvnorms)
@@ -1680,10 +1682,14 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
v4l2_std_id *id = arg;
unsigned int i;
- for(i = 0; i < TVNORMS; i++)
- if (*id & tvnorms[i].id)
+ for (i = 0; i < TVNORMS; i++)
+ if (*id == tvnorms[i].id)
break;
if (i == TVNORMS)
+ for (i = 0; i < TVNORMS; i++)
+ if (*id & tvnorms[i].id)
+ break;
+ if (i == TVNORMS)
return -EINVAL;
down(&dev->lock);
@@ -1695,6 +1701,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
spin_unlock_irqrestore(&dev->slock,flags);
} else
set_tvnorm(dev,&tvnorms[i]);
+ saa7134_tvaudio_do_scan(dev);
up(&dev->lock);
return 0;
}