diff options
-rw-r--r-- | drivers/media/video/saa7134/saa7134-core.c | 1 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-tvaudio.c | 79 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134.h | 1 |
3 files changed, 41 insertions, 40 deletions
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index f5e43d375d2a..cbddd35f1618 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -1235,6 +1235,7 @@ static int saa7134_resume(struct pci_dev *pci_dev) | |||
1235 | saa7134_set_tvnorm_hw(dev); | 1235 | saa7134_set_tvnorm_hw(dev); |
1236 | saa7134_tvaudio_setmute(dev); | 1236 | saa7134_tvaudio_setmute(dev); |
1237 | saa7134_tvaudio_setvolume(dev, dev->ctl_volume); | 1237 | saa7134_tvaudio_setvolume(dev, dev->ctl_volume); |
1238 | saa7134_tvaudio_init(dev); | ||
1238 | saa7134_tvaudio_do_scan(dev); | 1239 | saa7134_tvaudio_do_scan(dev); |
1239 | saa7134_enable_i2s(dev); | 1240 | saa7134_enable_i2s(dev); |
1240 | saa7134_hw_enable2(dev); | 1241 | saa7134_hw_enable2(dev); |
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index f8e304c76232..4e9810469ae3 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c | |||
@@ -163,32 +163,6 @@ static struct saa7134_tvaudio tvaudio[] = { | |||
163 | 163 | ||
164 | /* ------------------------------------------------------------------ */ | 164 | /* ------------------------------------------------------------------ */ |
165 | 165 | ||
166 | static void tvaudio_init(struct saa7134_dev *dev) | ||
167 | { | ||
168 | int clock = saa7134_boards[dev->board].audio_clock; | ||
169 | |||
170 | if (UNSET != audio_clock_override) | ||
171 | clock = audio_clock_override; | ||
172 | |||
173 | /* init all audio registers */ | ||
174 | saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x00); | ||
175 | if (need_resched()) | ||
176 | schedule(); | ||
177 | else | ||
178 | udelay(10); | ||
179 | |||
180 | saa_writeb(SAA7134_AUDIO_CLOCK0, clock & 0xff); | ||
181 | saa_writeb(SAA7134_AUDIO_CLOCK1, (clock >> 8) & 0xff); | ||
182 | saa_writeb(SAA7134_AUDIO_CLOCK2, (clock >> 16) & 0xff); | ||
183 | /* frame locked audio is mandatory for NICAM */ | ||
184 | saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x01); | ||
185 | |||
186 | saa_writeb(SAA7134_NICAM_ERROR_LOW, 0x14); | ||
187 | saa_writeb(SAA7134_NICAM_ERROR_HIGH, 0x50); | ||
188 | saa_writeb(SAA7134_MONITOR_SELECT, 0xa0); | ||
189 | saa_writeb(SAA7134_FM_DEMATRIX, 0x80); | ||
190 | } | ||
191 | |||
192 | static u32 tvaudio_carr2reg(u32 carrier) | 166 | static u32 tvaudio_carr2reg(u32 carrier) |
193 | { | 167 | { |
194 | u64 a = carrier; | 168 | u64 a = carrier; |
@@ -517,9 +491,13 @@ static int tvaudio_thread(void *data) | |||
517 | dev->thread.scan1 = dev->thread.scan2; | 491 | dev->thread.scan1 = dev->thread.scan2; |
518 | dprintk("tvaudio thread scan start [%d]\n",dev->thread.scan1); | 492 | dprintk("tvaudio thread scan start [%d]\n",dev->thread.scan1); |
519 | dev->tvaudio = NULL; | 493 | dev->tvaudio = NULL; |
520 | tvaudio_init(dev); | 494 | |
495 | saa_writeb(SAA7134_MONITOR_SELECT, 0xa0); | ||
496 | saa_writeb(SAA7134_FM_DEMATRIX, 0x80); | ||
497 | |||
521 | if (dev->ctl_automute) | 498 | if (dev->ctl_automute) |
522 | dev->automute = 1; | 499 | dev->automute = 1; |
500 | |||
523 | mute_input_7134(dev); | 501 | mute_input_7134(dev); |
524 | 502 | ||
525 | /* give the tuner some time */ | 503 | /* give the tuner some time */ |
@@ -784,27 +762,15 @@ static int mute_input_7133(struct saa7134_dev *dev) | |||
784 | static int tvaudio_thread_ddep(void *data) | 762 | static int tvaudio_thread_ddep(void *data) |
785 | { | 763 | { |
786 | struct saa7134_dev *dev = data; | 764 | struct saa7134_dev *dev = data; |
787 | u32 value, norms, clock; | 765 | u32 value, norms; |
788 | 766 | ||
789 | 767 | ||
790 | set_freezable(); | 768 | set_freezable(); |
791 | |||
792 | clock = saa7134_boards[dev->board].audio_clock; | ||
793 | if (UNSET != audio_clock_override) | ||
794 | clock = audio_clock_override; | ||
795 | saa_writel(0x598 >> 2, clock); | ||
796 | |||
797 | /* unmute */ | ||
798 | saa_dsp_writel(dev, 0x474 >> 2, 0x00); | ||
799 | saa_dsp_writel(dev, 0x450 >> 2, 0x00); | ||
800 | |||
801 | for (;;) { | 769 | for (;;) { |
802 | tvaudio_sleep(dev,-1); | 770 | tvaudio_sleep(dev,-1); |
803 | if (kthread_should_stop()) | 771 | if (kthread_should_stop()) |
804 | goto done; | 772 | goto done; |
805 | |||
806 | restart: | 773 | restart: |
807 | |||
808 | try_to_freeze(); | 774 | try_to_freeze(); |
809 | 775 | ||
810 | dev->thread.scan1 = dev->thread.scan2; | 776 | dev->thread.scan1 = dev->thread.scan2; |
@@ -978,6 +944,38 @@ int saa7134_tvaudio_getstereo(struct saa7134_dev *dev) | |||
978 | return retval; | 944 | return retval; |
979 | } | 945 | } |
980 | 946 | ||
947 | void saa7134_tvaudio_init(struct saa7134_dev *dev) | ||
948 | { | ||
949 | int clock = saa7134_boards[dev->board].audio_clock; | ||
950 | |||
951 | if (UNSET != audio_clock_override) | ||
952 | clock = audio_clock_override; | ||
953 | |||
954 | switch (dev->pci->device) { | ||
955 | case PCI_DEVICE_ID_PHILIPS_SAA7134: | ||
956 | /* init all audio registers */ | ||
957 | saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x00); | ||
958 | if (need_resched()) | ||
959 | schedule(); | ||
960 | else | ||
961 | udelay(10); | ||
962 | |||
963 | saa_writeb(SAA7134_AUDIO_CLOCK0, clock & 0xff); | ||
964 | saa_writeb(SAA7134_AUDIO_CLOCK1, (clock >> 8) & 0xff); | ||
965 | saa_writeb(SAA7134_AUDIO_CLOCK2, (clock >> 16) & 0xff); | ||
966 | /* frame locked audio is mandatory for NICAM */ | ||
967 | saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x01); | ||
968 | saa_writeb(SAA7134_NICAM_ERROR_LOW, 0x14); | ||
969 | saa_writeb(SAA7134_NICAM_ERROR_HIGH, 0x50); | ||
970 | break; | ||
971 | case PCI_DEVICE_ID_PHILIPS_SAA7133: | ||
972 | case PCI_DEVICE_ID_PHILIPS_SAA7135: | ||
973 | saa_writel(0x598 >> 2, clock); | ||
974 | saa_dsp_writel(dev, 0x474 >> 2, 0x00); | ||
975 | saa_dsp_writel(dev, 0x450 >> 2, 0x00); | ||
976 | } | ||
977 | } | ||
978 | |||
981 | int saa7134_tvaudio_init2(struct saa7134_dev *dev) | 979 | int saa7134_tvaudio_init2(struct saa7134_dev *dev) |
982 | { | 980 | { |
983 | int (*my_thread)(void *data) = NULL; | 981 | int (*my_thread)(void *data) = NULL; |
@@ -994,6 +992,7 @@ int saa7134_tvaudio_init2(struct saa7134_dev *dev) | |||
994 | 992 | ||
995 | dev->thread.thread = NULL; | 993 | dev->thread.thread = NULL; |
996 | if (my_thread) { | 994 | if (my_thread) { |
995 | saa7134_tvaudio_init(dev); | ||
997 | /* start tvaudio thread */ | 996 | /* start tvaudio thread */ |
998 | dev->thread.thread = kthread_run(my_thread, dev, "%s", dev->name); | 997 | dev->thread.thread = kthread_run(my_thread, dev, "%s", dev->name); |
999 | if (IS_ERR(dev->thread.thread)) { | 998 | if (IS_ERR(dev->thread.thread)) { |
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index a531e3c6c941..5c5b07413076 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -678,6 +678,7 @@ void saa7134_tvaudio_setinput(struct saa7134_dev *dev, | |||
678 | void saa7134_tvaudio_setvolume(struct saa7134_dev *dev, int level); | 678 | void saa7134_tvaudio_setvolume(struct saa7134_dev *dev, int level); |
679 | int saa7134_tvaudio_getstereo(struct saa7134_dev *dev); | 679 | int saa7134_tvaudio_getstereo(struct saa7134_dev *dev); |
680 | 680 | ||
681 | void saa7134_tvaudio_init(struct saa7134_dev *dev); | ||
681 | int saa7134_tvaudio_init2(struct saa7134_dev *dev); | 682 | int saa7134_tvaudio_init2(struct saa7134_dev *dev); |
682 | int saa7134_tvaudio_fini(struct saa7134_dev *dev); | 683 | int saa7134_tvaudio_fini(struct saa7134_dev *dev); |
683 | int saa7134_tvaudio_do_scan(struct saa7134_dev *dev); | 684 | int saa7134_tvaudio_do_scan(struct saa7134_dev *dev); |