aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHartmut Hackmann <hartmut.hackmann@t-online.de>2006-10-02 18:55:07 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-10-04 07:04:30 -0400
commit17b10a73e697da71faa3e54e35421aca4531aa9b (patch)
tree242a5e440ec9522127abdfd9d27cf083caeaef08 /drivers
parent39666962a3c598f221bc99e835d9d6046a700d85 (diff)
V4L/DVB (4701): Saa713x audio fixes
This change fixes the following issues: - resolve the SECAM D/K vs SECAM-L sound conflict It is now possible to select the SECAM version either by the VIDEOIOC_S_STD IO control or by the new secam= insmod option. The driver now adapts its audio standard search list to the selected standard. - don't trigger a sound standard search when a LINE input is selected. Signed-off-by: Hartmut Hackmann <hartmut.hackmann@t-online.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/saa7134/saa7134-tvaudio.c93
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c57
-rw-r--r--drivers/media/video/saa7134/saa7134.h1
3 files changed, 95 insertions, 56 deletions
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c
index d31220d20495..dd759d6d8d25 100644
--- a/drivers/media/video/saa7134/saa7134-tvaudio.c
+++ b/drivers/media/video/saa7134/saa7134-tvaudio.c
@@ -72,12 +72,12 @@ static struct mainscan {
72 int carr; 72 int carr;
73} mainscan[] = { 73} mainscan[] = {
74 { 74 {
75 .name = "M", 75 .name = "MN",
76 .std = V4L2_STD_NTSC | V4L2_STD_PAL_M, 76 .std = V4L2_STD_MN,
77 .carr = 4500, 77 .carr = 4500,
78 },{ 78 },{
79 .name = "BG", 79 .name = "BGH",
80 .std = V4L2_STD_PAL_BG, 80 .std = V4L2_STD_B | V4L2_STD_GH,
81 .carr = 5500, 81 .carr = 5500,
82 },{ 82 },{
83 .name = "I", 83 .name = "I",
@@ -85,7 +85,7 @@ static struct mainscan {
85 .carr = 6000, 85 .carr = 6000,
86 },{ 86 },{
87 .name = "DKL", 87 .name = "DKL",
88 .std = V4L2_STD_PAL_DK | V4L2_STD_SECAM, 88 .std = V4L2_STD_DK | V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC,
89 .carr = 6500, 89 .carr = 6500,
90 } 90 }
91}; 91};
@@ -93,76 +93,70 @@ static struct mainscan {
93static struct saa7134_tvaudio tvaudio[] = { 93static struct saa7134_tvaudio tvaudio[] = {
94 { 94 {
95 .name = "PAL-B/G FM-stereo", 95 .name = "PAL-B/G FM-stereo",
96 .std = V4L2_STD_PAL, 96 .std = V4L2_STD_PAL_BG,
97 .mode = TVAUDIO_FM_BG_STEREO, 97 .mode = TVAUDIO_FM_BG_STEREO,
98 .carr1 = 5500, 98 .carr1 = 5500,
99 .carr2 = 5742, 99 .carr2 = 5742,
100 },{ 100 },{
101 .name = "PAL-D/K1 FM-stereo", 101 .name = "PAL-D/K1 FM-stereo",
102 .std = V4L2_STD_PAL, 102 .std = V4L2_STD_PAL_DK,
103 .carr1 = 6500, 103 .carr1 = 6500,
104 .carr2 = 6258, 104 .carr2 = 6258,
105 .mode = TVAUDIO_FM_BG_STEREO, 105 .mode = TVAUDIO_FM_BG_STEREO,
106 },{ 106 },{
107 .name = "PAL-D/K2 FM-stereo", 107 .name = "PAL-D/K2 FM-stereo",
108 .std = V4L2_STD_PAL, 108 .std = V4L2_STD_PAL_DK,
109 .carr1 = 6500, 109 .carr1 = 6500,
110 .carr2 = 6742, 110 .carr2 = 6742,
111 .mode = TVAUDIO_FM_BG_STEREO, 111 .mode = TVAUDIO_FM_BG_STEREO,
112 },{ 112 },{
113 .name = "PAL-D/K3 FM-stereo", 113 .name = "PAL-D/K3 FM-stereo",
114 .std = V4L2_STD_PAL, 114 .std = V4L2_STD_PAL_DK,
115 .carr1 = 6500, 115 .carr1 = 6500,
116 .carr2 = 5742, 116 .carr2 = 5742,
117 .mode = TVAUDIO_FM_BG_STEREO, 117 .mode = TVAUDIO_FM_BG_STEREO,
118 },{ 118 },{
119 .name = "PAL-B/G NICAM", 119 .name = "PAL-B/G NICAM",
120 .std = V4L2_STD_PAL, 120 .std = V4L2_STD_PAL_BG,
121 .carr1 = 5500, 121 .carr1 = 5500,
122 .carr2 = 5850, 122 .carr2 = 5850,
123 .mode = TVAUDIO_NICAM_FM, 123 .mode = TVAUDIO_NICAM_FM,
124 },{ 124 },{
125 .name = "PAL-I NICAM", 125 .name = "PAL-I NICAM",
126 .std = V4L2_STD_PAL, 126 .std = V4L2_STD_PAL_I,
127 .carr1 = 6000, 127 .carr1 = 6000,
128 .carr2 = 6552, 128 .carr2 = 6552,
129 .mode = TVAUDIO_NICAM_FM, 129 .mode = TVAUDIO_NICAM_FM,
130 },{ 130 },{
131 .name = "PAL-D/K NICAM", 131 .name = "PAL-D/K NICAM",
132 .std = V4L2_STD_PAL, 132 .std = V4L2_STD_PAL_DK,
133 .carr1 = 6500, 133 .carr1 = 6500,
134 .carr2 = 5850, 134 .carr2 = 5850,
135 .mode = TVAUDIO_NICAM_FM, 135 .mode = TVAUDIO_NICAM_FM,
136 },{ 136 },{
137 .name = "SECAM-L NICAM", 137 .name = "SECAM-L NICAM",
138 .std = V4L2_STD_SECAM, 138 .std = V4L2_STD_SECAM_L,
139 .carr1 = 6500, 139 .carr1 = 6500,
140 .carr2 = 5850, 140 .carr2 = 5850,
141 .mode = TVAUDIO_NICAM_AM, 141 .mode = TVAUDIO_NICAM_AM,
142 },{ 142 },{
143 .name = "SECAM-L MONO", 143 .name = "SECAM-D/K NICAM",
144 .std = V4L2_STD_SECAM, 144 .std = V4L2_STD_SECAM_DK,
145 .carr1 = 6500, 145 .carr1 = 6500,
146 .carr2 = -1, 146 .carr2 = 5850,
147 .mode = TVAUDIO_AM_MONO, 147 .mode = TVAUDIO_NICAM_FM,
148 },{ 148 },{
149 .name = "SECAM-D/K", 149 .name = "NTSC-A2 FM-stereo",
150 .std = V4L2_STD_SECAM, 150 .std = V4L2_STD_NTSC,
151 .carr1 = 6500, 151 .carr1 = 4500,
152 .carr2 = -1, 152 .carr2 = 4724,
153 .mode = TVAUDIO_FM_MONO, 153 .mode = TVAUDIO_FM_K_STEREO,
154 },{ 154 },{
155 .name = "NTSC-M", 155 .name = "NTSC-M",
156 .std = V4L2_STD_NTSC, 156 .std = V4L2_STD_NTSC,
157 .carr1 = 4500, 157 .carr1 = 4500,
158 .carr2 = -1, 158 .carr2 = -1,
159 .mode = TVAUDIO_FM_MONO, 159 .mode = TVAUDIO_FM_MONO,
160 },{
161 .name = "NTSC-A2 FM-stereo",
162 .std = V4L2_STD_NTSC,
163 .carr1 = 4500,
164 .carr2 = 4724,
165 .mode = TVAUDIO_FM_K_STEREO,
166 } 160 }
167}; 161};
168#define TVAUDIO (sizeof(tvaudio)/sizeof(struct saa7134_tvaudio)) 162#define TVAUDIO (sizeof(tvaudio)/sizeof(struct saa7134_tvaudio))
@@ -340,12 +334,6 @@ static void tvaudio_setmode(struct saa7134_dev *dev,
340 saa_writeb(SAA7134_STEREO_DAC_OUTPUT_SELECT, 0xa1); 334 saa_writeb(SAA7134_STEREO_DAC_OUTPUT_SELECT, 0xa1);
341 saa_writeb(SAA7134_NICAM_CONFIG, 0x00); 335 saa_writeb(SAA7134_NICAM_CONFIG, 0x00);
342 break; 336 break;
343 case TVAUDIO_AM_MONO:
344 saa_writeb(SAA7134_DEMODULATOR, 0x12);
345 saa_writeb(SAA7134_DCXO_IDENT_CTRL, 0x00);
346 saa_writeb(SAA7134_FM_DEEMPHASIS, 0x44);
347 saa_writeb(SAA7134_STEREO_DAC_OUTPUT_SELECT, 0xa0);
348 break;
349 case TVAUDIO_FM_SAT_STEREO: 337 case TVAUDIO_FM_SAT_STEREO:
350 /* not implemented (yet) */ 338 /* not implemented (yet) */
351 break; 339 break;
@@ -390,7 +378,6 @@ static int tvaudio_checkcarrier(struct saa7134_dev *dev, struct mainscan *scan)
390 } 378 }
391 printk("\n"); 379 printk("\n");
392 } 380 }
393
394 if (dev->tvnorm->id & scan->std) { 381 if (dev->tvnorm->id & scan->std) {
395 tvaudio_setcarrier(dev,scan->carr-90,scan->carr-90); 382 tvaudio_setcarrier(dev,scan->carr-90,scan->carr-90);
396 saa_readl(SAA7134_LEVEL_READOUT1 >> 2); 383 saa_readl(SAA7134_LEVEL_READOUT1 >> 2);
@@ -426,7 +413,6 @@ static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au
426 413
427 switch (audio->mode) { 414 switch (audio->mode) {
428 case TVAUDIO_FM_MONO: 415 case TVAUDIO_FM_MONO:
429 case TVAUDIO_AM_MONO:
430 return V4L2_TUNER_SUB_MONO; 416 return V4L2_TUNER_SUB_MONO;
431 case TVAUDIO_FM_K_STEREO: 417 case TVAUDIO_FM_K_STEREO:
432 case TVAUDIO_FM_BG_STEREO: 418 case TVAUDIO_FM_BG_STEREO:
@@ -495,7 +481,6 @@ static int tvaudio_setstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au
495 481
496 switch (audio->mode) { 482 switch (audio->mode) {
497 case TVAUDIO_FM_MONO: 483 case TVAUDIO_FM_MONO:
498 case TVAUDIO_AM_MONO:
499 /* nothing to do ... */ 484 /* nothing to do ... */
500 break; 485 break;
501 case TVAUDIO_FM_K_STEREO: 486 case TVAUDIO_FM_K_STEREO:
@@ -556,6 +541,7 @@ static int tvaudio_thread(void *data)
556 541
557 if (1 == nscan) { 542 if (1 == nscan) {
558 /* only one candidate -- skip scan ;) */ 543 /* only one candidate -- skip scan ;) */
544 dprintk("only one main carrier candidate - skipping scan\n");
559 max1 = 12345; 545 max1 = 12345;
560 carrier = default_carrier; 546 carrier = default_carrier;
561 } else { 547 } else {
@@ -603,7 +589,6 @@ static int tvaudio_thread(void *data)
603 dev->automute = 0; 589 dev->automute = 0;
604 saa_andorb(SAA7134_STEREO_DAC_OUTPUT_SELECT, 0x30, 0x00); 590 saa_andorb(SAA7134_STEREO_DAC_OUTPUT_SELECT, 0x30, 0x00);
605 saa7134_tvaudio_setmute(dev); 591 saa7134_tvaudio_setmute(dev);
606
607 /* find the exact tv audio norm */ 592 /* find the exact tv audio norm */
608 for (audio = UNSET, i = 0; i < TVAUDIO; i++) { 593 for (audio = UNSET, i = 0; i < TVAUDIO; i++) {
609 if (dev->tvnorm->id != UNSET && 594 if (dev->tvnorm->id != UNSET &&
@@ -611,7 +596,7 @@ static int tvaudio_thread(void *data)
611 continue; 596 continue;
612 if (tvaudio[i].carr1 != carrier) 597 if (tvaudio[i].carr1 != carrier)
613 continue; 598 continue;
614 599 /* Note: at least the primary carrier is right here */
615 if (UNSET == audio) 600 if (UNSET == audio)
616 audio = i; 601 audio = i;
617 tvaudio_setmode(dev,&tvaudio[i],"trying"); 602 tvaudio_setmode(dev,&tvaudio[i],"trying");
@@ -626,6 +611,7 @@ static int tvaudio_thread(void *data)
626 if (UNSET == audio) 611 if (UNSET == audio)
627 continue; 612 continue;
628 tvaudio_setmode(dev,&tvaudio[audio],"using"); 613 tvaudio_setmode(dev,&tvaudio[audio],"using");
614
629 tvaudio_setstereo(dev,&tvaudio[audio],V4L2_TUNER_MODE_MONO); 615 tvaudio_setstereo(dev,&tvaudio[audio],V4L2_TUNER_MODE_MONO);
630 dev->tvaudio = &tvaudio[audio]; 616 dev->tvaudio = &tvaudio[audio];
631 617
@@ -750,7 +736,6 @@ static int mute_input_7133(struct saa7134_dev *dev)
750 int mask; 736 int mask;
751 struct saa7134_input *in; 737 struct saa7134_input *in;
752 738
753 /* Hac 0506 route OSS sound simultanously */
754 xbarin = 0x03; 739 xbarin = 0x03;
755 switch (dev->input->amux) { 740 switch (dev->input->amux) {
756 case TV: 741 case TV:
@@ -834,18 +819,16 @@ static int tvaudio_thread_ddep(void *data)
834 } else { 819 } else {
835 /* (let chip) scan for sound carrier */ 820 /* (let chip) scan for sound carrier */
836 norms = 0; 821 norms = 0;
837 if (dev->tvnorm->id & V4L2_STD_PAL) { 822 if (dev->tvnorm->id & (V4L2_STD_B | V4L2_STD_GH))
838 dprintk("PAL scan\n"); 823 norms |= 0x04;
839 norms |= 0x2c; /* B/G + D/K + I */ 824 if (dev->tvnorm->id & V4L2_STD_PAL_I)
840 } 825 norms |= 0x20;
841 if (dev->tvnorm->id & V4L2_STD_NTSC) { 826 if (dev->tvnorm->id & V4L2_STD_DK)
842 dprintk("NTSC scan\n"); 827 norms |= 0x08;
843 norms |= 0x40; /* M */ 828 if (dev->tvnorm->id & V4L2_STD_MN)
844 } 829 norms |= 0x40;
845 if (dev->tvnorm->id & V4L2_STD_SECAM) { 830 if (dev->tvnorm->id & (V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC))
846 dprintk("SECAM scan\n"); 831 norms |= 0x10;
847 norms |= 0x18; /* L + D/K */
848 }
849 if (0 == norms) 832 if (0 == norms)
850 norms = 0x7c; /* all */ 833 norms = 0x7c; /* all */
851 dprintk("scanning:%s%s%s%s%s\n", 834 dprintk("scanning:%s%s%s%s%s\n",
@@ -1034,7 +1017,11 @@ int saa7134_tvaudio_fini(struct saa7134_dev *dev)
1034 1017
1035int saa7134_tvaudio_do_scan(struct saa7134_dev *dev) 1018int saa7134_tvaudio_do_scan(struct saa7134_dev *dev)
1036{ 1019{
1037 if (dev->thread.pid >= 0) { 1020 if (dev->input->amux != TV) {
1021 dprintk("sound IF not in use, skipping scan\n");
1022 dev->automute = 0;
1023 saa7134_tvaudio_setmute(dev);
1024 } else if (dev->thread.pid >= 0) {
1038 dev->thread.mode = UNSET; 1025 dev->thread.mode = UNSET;
1039 dev->thread.scan2++; 1026 dev->thread.scan2++;
1040 wake_up_interruptible(&dev->thread.wq); 1027 wake_up_interruptible(&dev->thread.wq);
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index 2c171af9a9f2..557530aef946 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -43,12 +43,16 @@ static unsigned int gbuffers = 8;
43static unsigned int noninterlaced = 1; 43static unsigned int noninterlaced = 1;
44static unsigned int gbufsize = 720*576*4; 44static unsigned int gbufsize = 720*576*4;
45static unsigned int gbufsize_max = 720*576*4; 45static unsigned int gbufsize_max = 720*576*4;
46static char secam[] = "--";
46module_param(video_debug, int, 0644); 47module_param(video_debug, int, 0644);
47MODULE_PARM_DESC(video_debug,"enable debug messages [video]"); 48MODULE_PARM_DESC(video_debug,"enable debug messages [video]");
48module_param(gbuffers, int, 0444); 49module_param(gbuffers, int, 0444);
49MODULE_PARM_DESC(gbuffers,"number of capture buffers, range 2-32"); 50MODULE_PARM_DESC(gbuffers,"number of capture buffers, range 2-32");
50module_param(noninterlaced, int, 0644); 51module_param(noninterlaced, int, 0644);
51MODULE_PARM_DESC(noninterlaced,"capture non interlaced video"); 52MODULE_PARM_DESC(noninterlaced,"capture non interlaced video");
53module_param_string(secam, secam, sizeof(secam), 0644);
54MODULE_PARM_DESC(secam, "force SECAM variant, either DK,L or Lc");
55
52 56
53#define dprintk(fmt, arg...) if (video_debug) \ 57#define dprintk(fmt, arg...) if (video_debug) \
54 printk(KERN_DEBUG "%s/video: " fmt, dev->name , ## arg) 58 printk(KERN_DEBUG "%s/video: " fmt, dev->name , ## arg)
@@ -279,7 +283,43 @@ static struct saa7134_tvnorm tvnorms[] = {
279 .id = V4L2_STD_SECAM, 283 .id = V4L2_STD_SECAM,
280 NORM_625_50, 284 NORM_625_50,
281 285
282 .sync_control = 0x18, /* old: 0x58, */ 286 .sync_control = 0x18,
287 .luma_control = 0x1b,
288 .chroma_ctrl1 = 0xd1,
289 .chroma_gain = 0x80,
290 .chroma_ctrl2 = 0x00,
291 .vgate_misc = 0x1c,
292
293 },{
294 .name = "SECAM-DK",
295 .id = V4L2_STD_SECAM_DK,
296 NORM_625_50,
297
298 .sync_control = 0x18,
299 .luma_control = 0x1b,
300 .chroma_ctrl1 = 0xd1,
301 .chroma_gain = 0x80,
302 .chroma_ctrl2 = 0x00,
303 .vgate_misc = 0x1c,
304
305 },{
306 .name = "SECAM-L",
307 .id = V4L2_STD_SECAM_L,
308 NORM_625_50,
309
310 .sync_control = 0x18,
311 .luma_control = 0x1b,
312 .chroma_ctrl1 = 0xd1,
313 .chroma_gain = 0x80,
314 .chroma_ctrl2 = 0x00,
315 .vgate_misc = 0x1c,
316
317 },{
318 .name = "SECAM-Lc",
319 .id = V4L2_STD_SECAM_LC,
320 NORM_625_50,
321
322 .sync_control = 0x18,
283 .luma_control = 0x1b, 323 .luma_control = 0x1b,
284 .chroma_ctrl1 = 0xd1, 324 .chroma_ctrl1 = 0xd1,
285 .chroma_gain = 0x80, 325 .chroma_gain = 0x80,
@@ -1769,6 +1809,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
1769 { 1809 {
1770 v4l2_std_id *id = arg; 1810 v4l2_std_id *id = arg;
1771 unsigned int i; 1811 unsigned int i;
1812 v4l2_std_id fixup;
1772 1813
1773 for (i = 0; i < TVNORMS; i++) 1814 for (i = 0; i < TVNORMS; i++)
1774 if (*id == tvnorms[i].id) 1815 if (*id == tvnorms[i].id)
@@ -1779,7 +1820,19 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
1779 break; 1820 break;
1780 if (i == TVNORMS) 1821 if (i == TVNORMS)
1781 return -EINVAL; 1822 return -EINVAL;
1782 1823 if (*id & V4L2_STD_SECAM) {
1824 if (secam[0] == 'L' || secam[0] == 'l')
1825 if (secam[1] == 'C' || secam[1] == 'c')
1826 fixup = V4L2_STD_SECAM_LC;
1827 else
1828 fixup = V4L2_STD_SECAM_L;
1829 else
1830 if (secam[0] == 'D' || secam[0] == 'd')
1831 fixup = V4L2_STD_SECAM_DK;
1832 for (i = 0; i < TVNORMS; i++)
1833 if (fixup == tvnorms[i].id)
1834 break;
1835 }
1783 mutex_lock(&dev->lock); 1836 mutex_lock(&dev->lock);
1784 if (res_check(fh, RESOURCE_OVERLAY)) { 1837 if (res_check(fh, RESOURCE_OVERLAY)) {
1785 spin_lock_irqsave(&dev->slock,flags); 1838 spin_lock_irqsave(&dev->slock,flags);
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index 701a90942108..4a20d253a07e 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -61,7 +61,6 @@ enum saa7134_tvaudio_mode {
61 TVAUDIO_FM_K_STEREO = 4, 61 TVAUDIO_FM_K_STEREO = 4,
62 TVAUDIO_NICAM_AM = 5, 62 TVAUDIO_NICAM_AM = 5,
63 TVAUDIO_NICAM_FM = 6, 63 TVAUDIO_NICAM_FM = 6,
64 TVAUDIO_AM_MONO = 7
65}; 64};
66 65
67enum saa7134_audio_in { 66enum saa7134_audio_in {