Lines Matching +full:rx +full:- +full:input +full:- +full:m

1 // SPDX-License-Identifier: GPL-2.0-or-later
7 * (c) 2001-03 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
11 #include "saa7134-reg.h"
22 /* ------------------------------------------------------------------ */
37 … clock tick fine tuning for cards with audio crystal that's slightly off (range [-1024 .. 1024])");
49 /* ------------------------------------------------------------------ */
78 .name = "PAL-B/G FM-stereo",
84 .name = "PAL-D/K1 FM-stereo",
90 .name = "PAL-D/K2 FM-stereo",
96 .name = "PAL-D/K3 FM-stereo",
102 .name = "PAL-B/G NICAM",
108 .name = "PAL-I NICAM",
114 .name = "PAL-D/K NICAM",
120 .name = "SECAM-L NICAM",
126 .name = "SECAM-D/K NICAM",
132 .name = "NTSC-A2 FM-stereo",
138 .name = "NTSC-M",
141 .carr2 = -1,
147 /* ------------------------------------------------------------------ */
161 if (-1 == secondary) in tvaudio_setcarrier()
179 in = dev->input; in mute_input_7134()
180 mute = (dev->ctl_mute || in mute_input_7134()
181 (dev->automute && (&card(dev).radio) != in)); in mute_input_7134()
184 * 7130 - we'll mute using some unconnected audio input in mute_input_7134()
185 * 7134 - we'll probably should switch external mux with gpio in mute_input_7134()
191 if (dev->hw_mute == mute && in mute_input_7134()
192 dev->hw_input == in && !dev->insuspend) { in mute_input_7134()
193 audio_dbg(1, "mute/input: nothing to do [mute=%d,input=%s]\n", in mute_input_7134()
194 mute, saa7134_input_name[in->type]); in mute_input_7134()
198 audio_dbg(1, "ctl_mute=%d automute=%d input=%s => mute=%d input=%s\n", in mute_input_7134()
199 dev->ctl_mute, dev->automute, in mute_input_7134()
200 saa7134_input_name[dev->input->type], mute, in mute_input_7134()
201 saa7134_input_name[in->type]); in mute_input_7134()
202 dev->hw_mute = mute; in mute_input_7134()
203 dev->hw_input = in; in mute_input_7134()
205 if (PCI_DEVICE_ID_PHILIPS_SAA7134 == dev->pci->device) in mute_input_7134()
214 switch (in->amux) { in mute_input_7134()
224 if (in->amux == TV) in mute_input_7134()
229 /* switch gpio-connected external audio mux */ in mute_input_7134()
235 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, in->gpio); in mute_input_7134()
236 saa7134_track_gpio(dev, saa7134_input_name[in->type]); in mute_input_7134()
245 if (dev->tvnorm->id == V4L2_STD_NTSC) { in tvaudio_setmode()
250 if (audio_clock_tweak > -1024 && audio_clock_tweak < 1024) in tvaudio_setmode()
255 note, audio->name, in tvaudio_setmode()
256 audio->carr1 / 1000, audio->carr1 % 1000, in tvaudio_setmode()
257 audio->carr2 / 1000, audio->carr2 % 1000, in tvaudio_setmode()
264 tvaudio_setcarrier(dev,audio->carr1,audio->carr2); in tvaudio_setmode()
266 switch (audio->mode) { in tvaudio_setmode()
304 if (dev->thread.scan1 == dev->thread.scan2 && in tvaudio_sleep()
314 return dev->thread.scan1 != dev->thread.scan2; in tvaudio_sleep()
321 if (!(dev->tvnorm->id & scan->std)) { in tvaudio_checkcarrier()
323 scan->carr / 1000, scan->carr % 1000, scan->name); in tvaudio_checkcarrier()
329 audio_dbg(1, "debug %d:", scan->carr); in tvaudio_checkcarrier()
330 for (i = -150; i <= 150; i += 30) { in tvaudio_checkcarrier()
331 tvaudio_setcarrier(dev,scan->carr+i,scan->carr+i); in tvaudio_checkcarrier()
334 return -1; in tvaudio_checkcarrier()
344 tvaudio_setcarrier(dev,scan->carr-90,scan->carr-90); in tvaudio_checkcarrier()
347 return -1; in tvaudio_checkcarrier()
350 tvaudio_setcarrier(dev,scan->carr+90,scan->carr+90); in tvaudio_checkcarrier()
353 return -1; in tvaudio_checkcarrier()
358 value = left > right ? left - right : right - left; in tvaudio_checkcarrier()
360 scan->carr / 1000, scan->carr % 1000, in tvaudio_checkcarrier()
361 scan->name, value, left, right); in tvaudio_checkcarrier()
369 int retval = -1; in tvaudio_getstereo()
371 switch (audio->mode) { in tvaudio_getstereo()
412 if (retval != -1) in tvaudio_getstereo()
440 switch (audio->mode) { in tvaudio_setstereo()
465 int max1,max2,carrier,rx,mode,lastmode,default_carrier; in tvaudio_thread() local
470 tvaudio_sleep(dev,-1); in tvaudio_thread()
477 dev->thread.scan1 = dev->thread.scan2; in tvaudio_thread()
479 dev->thread.scan1); in tvaudio_thread()
480 dev->tvaudio = NULL; in tvaudio_thread()
485 if (dev->ctl_automute) in tvaudio_thread()
486 dev->automute = 1; in tvaudio_thread()
500 if (!(dev->tvnorm->id & mainscan[i].std)) in tvaudio_thread()
508 /* only one candidate -- skip scan ;) */ in tvaudio_thread()
509 audio_dbg(1, "only one main carrier candidate - skipping scan\n"); in tvaudio_thread()
518 if (dev->thread.scan1 != dev->thread.scan2) in tvaudio_thread()
535 dev->tvnorm->name, carrier/1000, carrier%1000, in tvaudio_thread()
537 dev->last_carrier = carrier; in tvaudio_thread()
538 dev->automute = 0; in tvaudio_thread()
540 } else if (0 != dev->last_carrier) { in tvaudio_thread()
541 /* no carrier -- try last detected one as fallback */ in tvaudio_thread()
542 carrier = dev->last_carrier; in tvaudio_thread()
545 dev->automute = 1; in tvaudio_thread()
548 /* no carrier + no fallback -- use default */ in tvaudio_thread()
552 dev->automute = 1; in tvaudio_thread()
559 if (dev->tvnorm->id != UNSET && in tvaudio_thread()
560 !(dev->tvnorm->id & tvaudio[i].std)) in tvaudio_thread()
570 if (-1 != tvaudio_getstereo(dev,&tvaudio[i])) { in tvaudio_thread()
581 dev->tvaudio = &tvaudio[audio]; in tvaudio_thread()
592 if (UNSET == dev->thread.mode) { in tvaudio_thread()
593 rx = tvaudio_getstereo(dev, &tvaudio[audio]); in tvaudio_thread()
594 mode = saa7134_tvaudio_rx2mode(rx); in tvaudio_thread()
596 mode = dev->thread.mode; in tvaudio_thread()
606 dev->thread.stopped = 1; in tvaudio_thread()
610 /* ------------------------------------------------------------------ */
617 [0x03] = "M (in progress)",
628 [0x0c] = "M Korea",
629 [0x0d] = "M BTSC ",
630 [0x0e] = "M EIAJ",
649 audio_dbg(2, "%s: resetting error bit\n", dev->name); in saa_dsp_reset_error_bit()
661 pr_warn("%s: dsp access error\n", dev->name); in saa_dsp_wait_bit()
663 return -EIO; in saa_dsp_wait_bit()
672 return -EIO; in saa_dsp_wait_bit()
676 count--; in saa_dsp_wait_bit()
719 switch (dev->input->amux) { in mute_input_7133()
733 if (dev->ctl_mute) { in mute_input_7133()
743 /* switch gpio-connected external audio mux */ in mute_input_7133()
747 if (card(dev).mute.type && dev->ctl_mute) in mute_input_7133()
750 in = dev->input; in mute_input_7133()
753 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, in->gpio); in mute_input_7133()
754 saa7134_track_gpio(dev, saa7134_input_name[in->type]); in mute_input_7133()
767 tvaudio_sleep(dev,-1); in tvaudio_thread_ddep()
773 dev->thread.scan1 = dev->thread.scan2; in tvaudio_thread_ddep()
775 dev->thread.scan1); in tvaudio_thread_ddep()
782 } else if (&card(dev).radio == dev->input) { in tvaudio_thread_ddep()
784 if (dev->tuner_type == TUNER_PHILIPS_TDA8290) { in tvaudio_thread_ddep()
794 if (dev->tvnorm->id & (V4L2_STD_B | V4L2_STD_GH)) in tvaudio_thread_ddep()
796 if (dev->tvnorm->id & V4L2_STD_PAL_I) in tvaudio_thread_ddep()
798 if (dev->tvnorm->id & V4L2_STD_DK) in tvaudio_thread_ddep()
800 if (dev->tvnorm->id & V4L2_STD_MN) in tvaudio_thread_ddep()
802 if (dev->tvnorm->id & (V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC)) in tvaudio_thread_ddep()
811 (norms & 0x40) ? " M" : ""); in tvaudio_thread_ddep()
851 dev->thread.stopped = 1; in tvaudio_thread_ddep()
855 /* ------------------------------------------------------------------ */
865 if (dev->pci->device == PCI_DEVICE_ID_PHILIPS_SAA7130) in saa7134_enable_i2s()
871 switch (dev->pci->device) { in saa7134_enable_i2s()
881 i2s_format = (dev->input->amux == TV) ? 0x00 : 0x01; in saa7134_enable_i2s()
895 int saa7134_tvaudio_rx2mode(u32 rx) in saa7134_tvaudio_rx2mode() argument
900 if (rx & V4L2_TUNER_SUB_STEREO) in saa7134_tvaudio_rx2mode()
902 else if (rx & V4L2_TUNER_SUB_LANG1) in saa7134_tvaudio_rx2mode()
904 else if (rx & V4L2_TUNER_SUB_LANG2) in saa7134_tvaudio_rx2mode()
911 switch (dev->pci->device) { in saa7134_tvaudio_setmute()
926 dev->input = in; in saa7134_tvaudio_setinput()
927 switch (dev->pci->device) { in saa7134_tvaudio_setinput()
942 switch (dev->pci->device) { in saa7134_tvaudio_setvolume()
955 switch (dev->pci->device) { in saa7134_tvaudio_getstereo()
957 if (dev->tvaudio) in saa7134_tvaudio_getstereo()
958 retval = tvaudio_getstereo(dev,dev->tvaudio); in saa7134_tvaudio_getstereo()
970 int clock = saa7134_boards[dev->board].audio_clock; in saa7134_tvaudio_init()
975 switch (dev->pci->device) { in saa7134_tvaudio_init()
1004 switch (dev->pci->device) { in saa7134_tvaudio_init2()
1014 dev->thread.thread = NULL; in saa7134_tvaudio_init2()
1015 dev->thread.scan1 = dev->thread.scan2 = 0; in saa7134_tvaudio_init2()
1019 dev->thread.thread = kthread_run(my_thread, dev, "%s", dev->name); in saa7134_tvaudio_init2()
1020 if (IS_ERR(dev->thread.thread)) { in saa7134_tvaudio_init2()
1022 dev->name); in saa7134_tvaudio_init2()
1033 dev->automute = 1; in saa7134_tvaudio_close()
1041 if (dev->thread.thread && !dev->thread.stopped) in saa7134_tvaudio_fini()
1042 kthread_stop(dev->thread.thread); in saa7134_tvaudio_fini()
1050 if (dev->input->amux != TV) { in saa7134_tvaudio_do_scan()
1052 dev->automute = 0; in saa7134_tvaudio_do_scan()
1054 } else if (dev->thread.thread) { in saa7134_tvaudio_do_scan()
1055 dev->thread.mode = UNSET; in saa7134_tvaudio_do_scan()
1056 dev->thread.scan2++; in saa7134_tvaudio_do_scan()
1058 if (!dev->insuspend && !dev->thread.stopped) in saa7134_tvaudio_do_scan()
1059 wake_up_process(dev->thread.thread); in saa7134_tvaudio_do_scan()
1061 dev->automute = 0; in saa7134_tvaudio_do_scan()