diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-core.c | 175 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-ts.c | 23 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-tvaudio.c | 4 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-video.c | 125 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134.h | 12 |
5 files changed, 244 insertions, 95 deletions
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index a1d986e01a30..7f5df32ed0e8 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
32 | #include <linux/mutex.h> | 32 | #include <linux/mutex.h> |
33 | #include <linux/dma-mapping.h> | 33 | #include <linux/dma-mapping.h> |
34 | #include <linux/pm.h> | ||
34 | 35 | ||
35 | #include "saa7134-reg.h" | 36 | #include "saa7134-reg.h" |
36 | #include "saa7134.h" | 37 | #include "saa7134.h" |
@@ -392,6 +393,38 @@ void saa7134_buffer_timeout(unsigned long data) | |||
392 | spin_unlock_irqrestore(&dev->slock,flags); | 393 | spin_unlock_irqrestore(&dev->slock,flags); |
393 | } | 394 | } |
394 | 395 | ||
396 | /* resends a current buffer in queue after resume */ | ||
397 | |||
398 | int saa7134_buffer_requeue(struct saa7134_dev *dev, | ||
399 | struct saa7134_dmaqueue *q) | ||
400 | { | ||
401 | struct saa7134_buf *buf , *next; | ||
402 | unsigned long flags; | ||
403 | |||
404 | spin_lock_irqsave(&dev->slock, flags); | ||
405 | |||
406 | buf = q->curr; | ||
407 | next = buf; | ||
408 | |||
409 | dprintk("buffer_requeue\n"); | ||
410 | |||
411 | if (!buf) { | ||
412 | spin_unlock_irqrestore(&dev->slock, flags); | ||
413 | return 0; | ||
414 | } | ||
415 | |||
416 | dprintk("buffer_requeue : resending active buffers \n"); | ||
417 | |||
418 | if (!list_empty(&q->queue)) | ||
419 | next = list_entry(q->queue.next, struct saa7134_buf, | ||
420 | vb.queue); | ||
421 | |||
422 | buf->activate(dev, buf, next); | ||
423 | spin_unlock_irqrestore(&dev->slock, flags); | ||
424 | |||
425 | return 0; | ||
426 | } | ||
427 | |||
395 | /* ------------------------------------------------------------------ */ | 428 | /* ------------------------------------------------------------------ */ |
396 | 429 | ||
397 | int saa7134_set_dmabits(struct saa7134_dev *dev) | 430 | int saa7134_set_dmabits(struct saa7134_dev *dev) |
@@ -647,6 +680,39 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id) | |||
647 | /* ------------------------------------------------------------------ */ | 680 | /* ------------------------------------------------------------------ */ |
648 | 681 | ||
649 | /* early init (no i2c, no irq) */ | 682 | /* early init (no i2c, no irq) */ |
683 | |||
684 | static int saa7134_hw_enable1(struct saa7134_dev *dev) | ||
685 | { | ||
686 | /* RAM FIFO config */ | ||
687 | saa_writel(SAA7134_FIFO_SIZE, 0x08070503); | ||
688 | saa_writel(SAA7134_THRESHOULD, 0x02020202); | ||
689 | |||
690 | /* enable audio + video processing */ | ||
691 | saa_writel(SAA7134_MAIN_CTRL, | ||
692 | SAA7134_MAIN_CTRL_VPLLE | | ||
693 | SAA7134_MAIN_CTRL_APLLE | | ||
694 | SAA7134_MAIN_CTRL_EXOSC | | ||
695 | SAA7134_MAIN_CTRL_EVFE1 | | ||
696 | SAA7134_MAIN_CTRL_EVFE2 | | ||
697 | SAA7134_MAIN_CTRL_ESFE | | ||
698 | SAA7134_MAIN_CTRL_EBDAC); | ||
699 | |||
700 | /* | ||
701 | * Initialize OSS _after_ enabling audio clock PLL and audio processing. | ||
702 | * OSS initialization writes to registers via the audio DSP; these | ||
703 | * writes will fail unless the audio clock has been started. At worst, | ||
704 | * audio will not work. | ||
705 | */ | ||
706 | |||
707 | /* enable peripheral devices */ | ||
708 | saa_writeb(SAA7134_SPECIAL_MODE, 0x01); | ||
709 | |||
710 | /* set vertical line numbering start (vbi needs this) */ | ||
711 | saa_writeb(SAA7134_SOURCE_TIMING2, 0x20); | ||
712 | |||
713 | return 0; | ||
714 | } | ||
715 | |||
650 | static int saa7134_hwinit1(struct saa7134_dev *dev) | 716 | static int saa7134_hwinit1(struct saa7134_dev *dev) |
651 | { | 717 | { |
652 | dprintk("hwinit1\n"); | 718 | dprintk("hwinit1\n"); |
@@ -663,44 +729,16 @@ static int saa7134_hwinit1(struct saa7134_dev *dev) | |||
663 | saa7134_ts_init1(dev); | 729 | saa7134_ts_init1(dev); |
664 | saa7134_input_init1(dev); | 730 | saa7134_input_init1(dev); |
665 | 731 | ||
666 | /* RAM FIFO config */ | 732 | saa7134_hw_enable1(dev); |
667 | saa_writel(SAA7134_FIFO_SIZE, 0x08070503); | ||
668 | saa_writel(SAA7134_THRESHOULD,0x02020202); | ||
669 | |||
670 | /* enable audio + video processing */ | ||
671 | saa_writel(SAA7134_MAIN_CTRL, | ||
672 | SAA7134_MAIN_CTRL_VPLLE | | ||
673 | SAA7134_MAIN_CTRL_APLLE | | ||
674 | SAA7134_MAIN_CTRL_EXOSC | | ||
675 | SAA7134_MAIN_CTRL_EVFE1 | | ||
676 | SAA7134_MAIN_CTRL_EVFE2 | | ||
677 | SAA7134_MAIN_CTRL_ESFE | | ||
678 | SAA7134_MAIN_CTRL_EBDAC); | ||
679 | |||
680 | /* | ||
681 | * Initialize OSS _after_ enabling audio clock PLL and audio processing. | ||
682 | * OSS initialization writes to registers via the audio DSP; these | ||
683 | * writes will fail unless the audio clock has been started. At worst, | ||
684 | * audio will not work. | ||
685 | */ | ||
686 | |||
687 | /* enable peripheral devices */ | ||
688 | saa_writeb(SAA7134_SPECIAL_MODE, 0x01); | ||
689 | |||
690 | /* set vertical line numbering start (vbi needs this) */ | ||
691 | saa_writeb(SAA7134_SOURCE_TIMING2, 0x20); | ||
692 | 733 | ||
693 | return 0; | 734 | return 0; |
694 | } | 735 | } |
695 | 736 | ||
696 | /* late init (with i2c + irq) */ | 737 | /* late init (with i2c + irq) */ |
697 | static int saa7134_hwinit2(struct saa7134_dev *dev) | 738 | static int saa7134_hw_enable2(struct saa7134_dev *dev) |
698 | { | 739 | { |
699 | unsigned int irq2_mask; | ||
700 | dprintk("hwinit2\n"); | ||
701 | 740 | ||
702 | saa7134_video_init2(dev); | 741 | unsigned int irq2_mask; |
703 | saa7134_tvaudio_init2(dev); | ||
704 | 742 | ||
705 | /* enable IRQ's */ | 743 | /* enable IRQ's */ |
706 | irq2_mask = | 744 | irq2_mask = |
@@ -726,6 +764,20 @@ static int saa7134_hwinit2(struct saa7134_dev *dev) | |||
726 | return 0; | 764 | return 0; |
727 | } | 765 | } |
728 | 766 | ||
767 | static int saa7134_hwinit2(struct saa7134_dev *dev) | ||
768 | { | ||
769 | |||
770 | dprintk("hwinit2\n"); | ||
771 | |||
772 | saa7134_video_init2(dev); | ||
773 | saa7134_tvaudio_init2(dev); | ||
774 | |||
775 | saa7134_hw_enable2(dev); | ||
776 | |||
777 | return 0; | ||
778 | } | ||
779 | |||
780 | |||
729 | /* shutdown */ | 781 | /* shutdown */ |
730 | static int saa7134_hwfini(struct saa7134_dev *dev) | 782 | static int saa7134_hwfini(struct saa7134_dev *dev) |
731 | { | 783 | { |
@@ -1118,6 +1170,65 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev) | |||
1118 | kfree(dev); | 1170 | kfree(dev); |
1119 | } | 1171 | } |
1120 | 1172 | ||
1173 | static int saa7134_suspend(struct pci_dev *pci_dev , pm_message_t state) | ||
1174 | { | ||
1175 | |||
1176 | /* Disable card's IRQs to prevent it from resuming computer */ | ||
1177 | |||
1178 | struct saa7134_dev *dev = pci_get_drvdata(pci_dev); | ||
1179 | |||
1180 | saa_writel(SAA7134_IRQ1, 0); | ||
1181 | saa_writel(SAA7134_IRQ2, 0); | ||
1182 | |||
1183 | |||
1184 | pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state)); | ||
1185 | pci_save_state(pci_dev); | ||
1186 | |||
1187 | return 0; | ||
1188 | } | ||
1189 | |||
1190 | static int saa7134_resume(struct pci_dev *pci_dev) | ||
1191 | { | ||
1192 | |||
1193 | struct saa7134_dev *dev = pci_get_drvdata(pci_dev); | ||
1194 | |||
1195 | pci_restore_state(pci_dev); | ||
1196 | pci_set_power_state(pci_dev, PCI_D0); | ||
1197 | |||
1198 | /* Do things that are done in saa7134_initdev , | ||
1199 | except of initializing memory structures.*/ | ||
1200 | |||
1201 | saa7134_board_init1(dev); | ||
1202 | |||
1203 | if (saa7134_boards[dev->board].video_out) | ||
1204 | saa7134_videoport_init(dev); | ||
1205 | |||
1206 | if (card_has_mpeg(dev)) | ||
1207 | saa7134_ts_init_hw(dev); | ||
1208 | |||
1209 | saa7134_hw_enable1(dev); | ||
1210 | |||
1211 | saa7134_set_decoder(dev); | ||
1212 | |||
1213 | saa7134_i2c_call_clients(dev, VIDIOC_S_STD, &dev->tvnorm->id); | ||
1214 | |||
1215 | saa7134_board_init2(dev); | ||
1216 | saa7134_hw_enable2(dev); | ||
1217 | |||
1218 | dev->force_mute_update = 1; | ||
1219 | saa7134_tvaudio_setmute(dev); | ||
1220 | dev->force_mute_update = 0; | ||
1221 | saa7134_tvaudio_setvolume(dev, dev->ctl_volume); | ||
1222 | saa7134_enable_i2s(dev); | ||
1223 | |||
1224 | /*recapture unfinished buffer(s)*/ | ||
1225 | saa7134_buffer_requeue(dev, &dev->video_q); | ||
1226 | saa7134_buffer_requeue(dev, &dev->vbi_q); | ||
1227 | saa7134_buffer_requeue(dev, &dev->ts_q); | ||
1228 | |||
1229 | return 0; | ||
1230 | } | ||
1231 | |||
1121 | /* ----------------------------------------------------------- */ | 1232 | /* ----------------------------------------------------------- */ |
1122 | 1233 | ||
1123 | int saa7134_ts_register(struct saa7134_mpeg_ops *ops) | 1234 | int saa7134_ts_register(struct saa7134_mpeg_ops *ops) |
@@ -1159,6 +1270,8 @@ static struct pci_driver saa7134_pci_driver = { | |||
1159 | .id_table = saa7134_pci_tbl, | 1270 | .id_table = saa7134_pci_tbl, |
1160 | .probe = saa7134_initdev, | 1271 | .probe = saa7134_initdev, |
1161 | .remove = __devexit_p(saa7134_finidev), | 1272 | .remove = __devexit_p(saa7134_finidev), |
1273 | .suspend = saa7134_suspend, | ||
1274 | .resume = saa7134_resume | ||
1162 | }; | 1275 | }; |
1163 | 1276 | ||
1164 | static int saa7134_init(void) | 1277 | static int saa7134_init(void) |
diff --git a/drivers/media/video/saa7134/saa7134-ts.c b/drivers/media/video/saa7134/saa7134-ts.c index 5b1d1dafb5a5..4b63ad3e8466 100644 --- a/drivers/media/video/saa7134/saa7134-ts.c +++ b/drivers/media/video/saa7134/saa7134-ts.c | |||
@@ -177,6 +177,22 @@ static unsigned int ts_nr_packets = 64; | |||
177 | module_param(ts_nr_packets, int, 0444); | 177 | module_param(ts_nr_packets, int, 0444); |
178 | MODULE_PARM_DESC(ts_nr_packets,"size of a ts buffers (in ts packets)"); | 178 | MODULE_PARM_DESC(ts_nr_packets,"size of a ts buffers (in ts packets)"); |
179 | 179 | ||
180 | int saa7134_ts_init_hw(struct saa7134_dev *dev) | ||
181 | { | ||
182 | /* deactivate TS softreset */ | ||
183 | saa_writeb(SAA7134_TS_SERIAL1, 0x00); | ||
184 | /* TSSOP high active, TSVAL high active, TSLOCK ignored */ | ||
185 | saa_writeb(SAA7134_TS_PARALLEL, 0xec); | ||
186 | saa_writeb(SAA7134_TS_PARALLEL_SERIAL, (TS_PACKET_SIZE-1)); | ||
187 | saa_writeb(SAA7134_TS_DMA0, ((dev->ts.nr_packets-1)&0xff)); | ||
188 | saa_writeb(SAA7134_TS_DMA1, (((dev->ts.nr_packets-1)>>8)&0xff)); | ||
189 | /* TSNOPIT=0, TSCOLAP=0 */ | ||
190 | saa_writeb(SAA7134_TS_DMA2, | ||
191 | ((((dev->ts.nr_packets-1)>>16)&0x3f) | 0x00)); | ||
192 | |||
193 | return 0; | ||
194 | } | ||
195 | |||
180 | int saa7134_ts_init1(struct saa7134_dev *dev) | 196 | int saa7134_ts_init1(struct saa7134_dev *dev) |
181 | { | 197 | { |
182 | /* sanitycheck insmod options */ | 198 | /* sanitycheck insmod options */ |
@@ -200,12 +216,7 @@ int saa7134_ts_init1(struct saa7134_dev *dev) | |||
200 | saa7134_pgtable_alloc(dev->pci,&dev->ts.pt_ts); | 216 | saa7134_pgtable_alloc(dev->pci,&dev->ts.pt_ts); |
201 | 217 | ||
202 | /* init TS hw */ | 218 | /* init TS hw */ |
203 | saa_writeb(SAA7134_TS_SERIAL1, 0x00); /* deactivate TS softreset */ | 219 | saa7134_ts_init_hw(dev); |
204 | saa_writeb(SAA7134_TS_PARALLEL, 0xec); /* TSSOP high active, TSVAL high active, TSLOCK ignored */ | ||
205 | saa_writeb(SAA7134_TS_PARALLEL_SERIAL, (TS_PACKET_SIZE-1)); | ||
206 | saa_writeb(SAA7134_TS_DMA0, ((dev->ts.nr_packets-1)&0xff)); | ||
207 | saa_writeb(SAA7134_TS_DMA1, (((dev->ts.nr_packets-1)>>8)&0xff)); | ||
208 | saa_writeb(SAA7134_TS_DMA2, ((((dev->ts.nr_packets-1)>>16)&0x3f) | 0x00)); /* TSNOPIT=0, TSCOLAP=0 */ | ||
209 | 220 | ||
210 | return 0; | 221 | return 0; |
211 | } | 222 | } |
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index 43501b5dc05b..df2dab06387d 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c | |||
@@ -231,7 +231,7 @@ static void mute_input_7134(struct saa7134_dev *dev) | |||
231 | } | 231 | } |
232 | 232 | ||
233 | if (dev->hw_mute == mute && | 233 | if (dev->hw_mute == mute && |
234 | dev->hw_input == in) { | 234 | dev->hw_input == in && !dev->force_mute_update) { |
235 | dprintk("mute/input: nothing to do [mute=%d,input=%s]\n", | 235 | dprintk("mute/input: nothing to do [mute=%d,input=%s]\n", |
236 | mute,in->name); | 236 | mute,in->name); |
237 | return; | 237 | return; |
@@ -876,7 +876,7 @@ static int tvaudio_thread_ddep(void *data) | |||
876 | /* ------------------------------------------------------------------ */ | 876 | /* ------------------------------------------------------------------ */ |
877 | /* common stuff + external entry points */ | 877 | /* common stuff + external entry points */ |
878 | 878 | ||
879 | static void saa7134_enable_i2s(struct saa7134_dev *dev) | 879 | void saa7134_enable_i2s(struct saa7134_dev *dev) |
880 | { | 880 | { |
881 | int i2s_format; | 881 | int i2s_format; |
882 | 882 | ||
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 525b5b77c13a..24d579723b55 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -540,22 +540,12 @@ void res_free(struct saa7134_dev *dev, struct saa7134_fh *fh, unsigned int bits) | |||
540 | 540 | ||
541 | /* ------------------------------------------------------------------ */ | 541 | /* ------------------------------------------------------------------ */ |
542 | 542 | ||
543 | static void set_tvnorm(struct saa7134_dev *dev, struct saa7134_tvnorm *norm) | 543 | void set_tvnorm(struct saa7134_dev *dev, struct saa7134_tvnorm *norm) |
544 | { | 544 | { |
545 | int luma_control,sync_control,mux; | ||
546 | 545 | ||
547 | dprintk("set tv norm = %s\n",norm->name); | 546 | dprintk("set tv norm = %s\n",norm->name); |
548 | dev->tvnorm = norm; | 547 | dev->tvnorm = norm; |
549 | 548 | ||
550 | mux = card_in(dev,dev->ctl_input).vmux; | ||
551 | luma_control = norm->luma_control; | ||
552 | sync_control = norm->sync_control; | ||
553 | |||
554 | if (mux > 5) | ||
555 | luma_control |= 0x80; /* svideo */ | ||
556 | if (noninterlaced || dev->nosignal) | ||
557 | sync_control |= 0x20; | ||
558 | |||
559 | /* setup cropping */ | 549 | /* setup cropping */ |
560 | dev->crop_bounds.left = norm->h_start; | 550 | dev->crop_bounds.left = norm->h_start; |
561 | dev->crop_defrect.left = norm->h_start; | 551 | dev->crop_defrect.left = norm->h_start; |
@@ -570,6 +560,40 @@ static void set_tvnorm(struct saa7134_dev *dev, struct saa7134_tvnorm *norm) | |||
570 | 560 | ||
571 | dev->crop_current = dev->crop_defrect; | 561 | dev->crop_current = dev->crop_defrect; |
572 | 562 | ||
563 | saa7134_set_decoder(dev); | ||
564 | |||
565 | if (card_in(dev, dev->ctl_input).tv) { | ||
566 | if ((card(dev).tuner_type == TUNER_PHILIPS_TDA8290) | ||
567 | && ((card(dev).tuner_config == 1) | ||
568 | || (card(dev).tuner_config == 2))) | ||
569 | saa7134_set_gpio(dev, 22, 5); | ||
570 | saa7134_i2c_call_clients(dev, VIDIOC_S_STD, &norm->id); | ||
571 | } | ||
572 | } | ||
573 | |||
574 | static void video_mux(struct saa7134_dev *dev, int input) | ||
575 | { | ||
576 | dprintk("video input = %d [%s]\n", input, card_in(dev, input).name); | ||
577 | dev->ctl_input = input; | ||
578 | set_tvnorm(dev, dev->tvnorm); | ||
579 | saa7134_tvaudio_setinput(dev, &card_in(dev, input)); | ||
580 | } | ||
581 | |||
582 | void saa7134_set_decoder(struct saa7134_dev *dev) | ||
583 | { | ||
584 | int luma_control, sync_control, mux; | ||
585 | |||
586 | struct saa7134_tvnorm *norm = dev->tvnorm; | ||
587 | mux = card_in(dev, dev->ctl_input).vmux; | ||
588 | |||
589 | luma_control = norm->luma_control; | ||
590 | sync_control = norm->sync_control; | ||
591 | |||
592 | if (mux > 5) | ||
593 | luma_control |= 0x80; /* svideo */ | ||
594 | if (noninterlaced || dev->nosignal) | ||
595 | sync_control |= 0x20; | ||
596 | |||
573 | /* setup video decoder */ | 597 | /* setup video decoder */ |
574 | saa_writeb(SAA7134_INCR_DELAY, 0x08); | 598 | saa_writeb(SAA7134_INCR_DELAY, 0x08); |
575 | saa_writeb(SAA7134_ANALOG_IN_CTRL1, 0xc0 | mux); | 599 | saa_writeb(SAA7134_ANALOG_IN_CTRL1, 0xc0 | mux); |
@@ -604,23 +628,6 @@ static void set_tvnorm(struct saa7134_dev *dev, struct saa7134_tvnorm *norm) | |||
604 | saa_writeb(SAA7134_MISC_VGATE_MSB, norm->vgate_misc); | 628 | saa_writeb(SAA7134_MISC_VGATE_MSB, norm->vgate_misc); |
605 | saa_writeb(SAA7134_RAW_DATA_GAIN, 0x40); | 629 | saa_writeb(SAA7134_RAW_DATA_GAIN, 0x40); |
606 | saa_writeb(SAA7134_RAW_DATA_OFFSET, 0x80); | 630 | saa_writeb(SAA7134_RAW_DATA_OFFSET, 0x80); |
607 | |||
608 | /* only tell the tuner if this is a tv input */ | ||
609 | if (card_in(dev,dev->ctl_input).tv) { | ||
610 | if ((card(dev).tuner_type == TUNER_PHILIPS_TDA8290) | ||
611 | && ((card(dev).tuner_config == 1) | ||
612 | || (card(dev).tuner_config == 2))) | ||
613 | saa7134_set_gpio(dev, 22, 5); | ||
614 | saa7134_i2c_call_clients(dev,VIDIOC_S_STD,&norm->id); | ||
615 | } | ||
616 | } | ||
617 | |||
618 | static void video_mux(struct saa7134_dev *dev, int input) | ||
619 | { | ||
620 | dprintk("video input = %d [%s]\n",input,card_in(dev,input).name); | ||
621 | dev->ctl_input = input; | ||
622 | set_tvnorm(dev,dev->tvnorm); | ||
623 | saa7134_tvaudio_setinput(dev,&card_in(dev,input)); | ||
624 | } | 631 | } |
625 | 632 | ||
626 | static void set_h_prescale(struct saa7134_dev *dev, int task, int prescale) | 633 | static void set_h_prescale(struct saa7134_dev *dev, int task, int prescale) |
@@ -2399,34 +2406,40 @@ int saa7134_video_init1(struct saa7134_dev *dev) | |||
2399 | dev->video_q.timeout.data = (unsigned long)(&dev->video_q); | 2406 | dev->video_q.timeout.data = (unsigned long)(&dev->video_q); |
2400 | dev->video_q.dev = dev; | 2407 | dev->video_q.dev = dev; |
2401 | 2408 | ||
2402 | if (saa7134_boards[dev->board].video_out) { | 2409 | if (saa7134_boards[dev->board].video_out) |
2403 | /* enable video output */ | 2410 | saa7134_videoport_init(dev); |
2404 | int vo = saa7134_boards[dev->board].video_out; | 2411 | |
2405 | int video_reg; | 2412 | return 0; |
2406 | unsigned int vid_port_opts = saa7134_boards[dev->board].vid_port_opts; | 2413 | } |
2407 | saa_writeb(SAA7134_VIDEO_PORT_CTRL0, video_out[vo][0]); | 2414 | |
2408 | video_reg = video_out[vo][1]; | 2415 | int saa7134_videoport_init(struct saa7134_dev *dev) |
2409 | if (vid_port_opts & SET_T_CODE_POLARITY_NON_INVERTED) | 2416 | { |
2410 | video_reg &= ~VP_T_CODE_P_INVERTED; | 2417 | /* enable video output */ |
2411 | saa_writeb(SAA7134_VIDEO_PORT_CTRL1, video_reg); | 2418 | int vo = saa7134_boards[dev->board].video_out; |
2412 | saa_writeb(SAA7134_VIDEO_PORT_CTRL2, video_out[vo][2]); | 2419 | int video_reg; |
2413 | saa_writeb(SAA7134_VIDEO_PORT_CTRL3, video_out[vo][3]); | 2420 | unsigned int vid_port_opts = saa7134_boards[dev->board].vid_port_opts; |
2414 | saa_writeb(SAA7134_VIDEO_PORT_CTRL4, video_out[vo][4]); | 2421 | saa_writeb(SAA7134_VIDEO_PORT_CTRL0, video_out[vo][0]); |
2415 | video_reg = video_out[vo][5]; | 2422 | video_reg = video_out[vo][1]; |
2416 | if (vid_port_opts & SET_CLOCK_NOT_DELAYED) | 2423 | if (vid_port_opts & SET_T_CODE_POLARITY_NON_INVERTED) |
2417 | video_reg &= ~VP_CLK_CTRL2_DELAYED; | 2424 | video_reg &= ~VP_T_CODE_P_INVERTED; |
2418 | if (vid_port_opts & SET_CLOCK_INVERTED) | 2425 | saa_writeb(SAA7134_VIDEO_PORT_CTRL1, video_reg); |
2419 | video_reg |= VP_CLK_CTRL1_INVERTED; | 2426 | saa_writeb(SAA7134_VIDEO_PORT_CTRL2, video_out[vo][2]); |
2420 | saa_writeb(SAA7134_VIDEO_PORT_CTRL5, video_reg); | 2427 | saa_writeb(SAA7134_VIDEO_PORT_CTRL3, video_out[vo][3]); |
2421 | video_reg = video_out[vo][6]; | 2428 | saa_writeb(SAA7134_VIDEO_PORT_CTRL4, video_out[vo][4]); |
2422 | if (vid_port_opts & SET_VSYNC_OFF) { | 2429 | video_reg = video_out[vo][5]; |
2423 | video_reg &= ~VP_VS_TYPE_MASK; | 2430 | if (vid_port_opts & SET_CLOCK_NOT_DELAYED) |
2424 | video_reg |= VP_VS_TYPE_OFF; | 2431 | video_reg &= ~VP_CLK_CTRL2_DELAYED; |
2425 | } | 2432 | if (vid_port_opts & SET_CLOCK_INVERTED) |
2426 | saa_writeb(SAA7134_VIDEO_PORT_CTRL6, video_reg); | 2433 | video_reg |= VP_CLK_CTRL1_INVERTED; |
2427 | saa_writeb(SAA7134_VIDEO_PORT_CTRL7, video_out[vo][7]); | 2434 | saa_writeb(SAA7134_VIDEO_PORT_CTRL5, video_reg); |
2428 | saa_writeb(SAA7134_VIDEO_PORT_CTRL8, video_out[vo][8]); | 2435 | video_reg = video_out[vo][6]; |
2429 | } | 2436 | if (vid_port_opts & SET_VSYNC_OFF) { |
2437 | video_reg &= ~VP_VS_TYPE_MASK; | ||
2438 | video_reg |= VP_VS_TYPE_OFF; | ||
2439 | } | ||
2440 | saa_writeb(SAA7134_VIDEO_PORT_CTRL6, video_reg); | ||
2441 | saa_writeb(SAA7134_VIDEO_PORT_CTRL7, video_out[vo][7]); | ||
2442 | saa_writeb(SAA7134_VIDEO_PORT_CTRL8, video_out[vo][8]); | ||
2430 | 2443 | ||
2431 | return 0; | 2444 | return 0; |
2432 | } | 2445 | } |
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index cb617c8dbb71..5b1f22606558 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -522,6 +522,7 @@ struct saa7134_dev { | |||
522 | struct saa7134_input *input; | 522 | struct saa7134_input *input; |
523 | struct saa7134_input *hw_input; | 523 | struct saa7134_input *hw_input; |
524 | unsigned int hw_mute; | 524 | unsigned int hw_mute; |
525 | unsigned int force_mute_update; | ||
525 | int last_carrier; | 526 | int last_carrier; |
526 | int nosignal; | 527 | int nosignal; |
527 | 528 | ||
@@ -594,6 +595,9 @@ void saa7134_buffer_next(struct saa7134_dev *dev, struct saa7134_dmaqueue *q); | |||
594 | void saa7134_buffer_timeout(unsigned long data); | 595 | void saa7134_buffer_timeout(unsigned long data); |
595 | void saa7134_dma_free(struct videobuf_queue *q,struct saa7134_buf *buf); | 596 | void saa7134_dma_free(struct videobuf_queue *q,struct saa7134_buf *buf); |
596 | 597 | ||
598 | int saa7134_buffer_requeue(struct saa7134_dev *dev, | ||
599 | struct saa7134_dmaqueue *q); | ||
600 | |||
597 | int saa7134_set_dmabits(struct saa7134_dev *dev); | 601 | int saa7134_set_dmabits(struct saa7134_dev *dev); |
598 | 602 | ||
599 | extern int (*saa7134_dmasound_init)(struct saa7134_dev *dev); | 603 | extern int (*saa7134_dmasound_init)(struct saa7134_dev *dev); |
@@ -626,6 +630,10 @@ void saa7134_i2c_call_clients(struct saa7134_dev *dev, | |||
626 | extern struct video_device saa7134_video_template; | 630 | extern struct video_device saa7134_video_template; |
627 | extern struct video_device saa7134_radio_template; | 631 | extern struct video_device saa7134_radio_template; |
628 | 632 | ||
633 | void set_tvnorm(struct saa7134_dev *dev, struct saa7134_tvnorm *norm); | ||
634 | int saa7134_videoport_init(struct saa7134_dev *dev); | ||
635 | void saa7134_set_decoder(struct saa7134_dev *dev); | ||
636 | |||
629 | int saa7134_common_ioctl(struct saa7134_dev *dev, | 637 | int saa7134_common_ioctl(struct saa7134_dev *dev, |
630 | unsigned int cmd, void *arg); | 638 | unsigned int cmd, void *arg); |
631 | 639 | ||
@@ -649,6 +657,8 @@ void saa7134_irq_ts_done(struct saa7134_dev *dev, unsigned long status); | |||
649 | int saa7134_ts_register(struct saa7134_mpeg_ops *ops); | 657 | int saa7134_ts_register(struct saa7134_mpeg_ops *ops); |
650 | void saa7134_ts_unregister(struct saa7134_mpeg_ops *ops); | 658 | void saa7134_ts_unregister(struct saa7134_mpeg_ops *ops); |
651 | 659 | ||
660 | int saa7134_ts_init_hw(struct saa7134_dev *dev); | ||
661 | |||
652 | /* ----------------------------------------------------------- */ | 662 | /* ----------------------------------------------------------- */ |
653 | /* saa7134-vbi.c */ | 663 | /* saa7134-vbi.c */ |
654 | 664 | ||
@@ -677,6 +687,8 @@ int saa7134_tvaudio_do_scan(struct saa7134_dev *dev); | |||
677 | 687 | ||
678 | int saa_dsp_writel(struct saa7134_dev *dev, int reg, u32 value); | 688 | int saa_dsp_writel(struct saa7134_dev *dev, int reg, u32 value); |
679 | 689 | ||
690 | void saa7134_enable_i2s(struct saa7134_dev *dev); | ||
691 | |||
680 | /* ----------------------------------------------------------- */ | 692 | /* ----------------------------------------------------------- */ |
681 | /* saa7134-oss.c */ | 693 | /* saa7134-oss.c */ |
682 | 694 | ||