diff options
Diffstat (limited to 'drivers/media/video/bttv-driver.c')
-rw-r--r-- | drivers/media/video/bttv-driver.c | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index 3c58a2a68906..1ddf9ba613ef 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c | |||
@@ -727,71 +727,71 @@ void free_btres(struct bttv *btv, struct bttv_fh *fh, int bits) | |||
727 | 727 | ||
728 | static void set_pll_freq(struct bttv *btv, unsigned int fin, unsigned int fout) | 728 | static void set_pll_freq(struct bttv *btv, unsigned int fin, unsigned int fout) |
729 | { | 729 | { |
730 | unsigned char fl, fh, fi; | 730 | unsigned char fl, fh, fi; |
731 | 731 | ||
732 | /* prevent overflows */ | 732 | /* prevent overflows */ |
733 | fin/=4; | 733 | fin/=4; |
734 | fout/=4; | 734 | fout/=4; |
735 | 735 | ||
736 | fout*=12; | 736 | fout*=12; |
737 | fi=fout/fin; | 737 | fi=fout/fin; |
738 | 738 | ||
739 | fout=(fout%fin)*256; | 739 | fout=(fout%fin)*256; |
740 | fh=fout/fin; | 740 | fh=fout/fin; |
741 | 741 | ||
742 | fout=(fout%fin)*256; | 742 | fout=(fout%fin)*256; |
743 | fl=fout/fin; | 743 | fl=fout/fin; |
744 | 744 | ||
745 | btwrite(fl, BT848_PLL_F_LO); | 745 | btwrite(fl, BT848_PLL_F_LO); |
746 | btwrite(fh, BT848_PLL_F_HI); | 746 | btwrite(fh, BT848_PLL_F_HI); |
747 | btwrite(fi|BT848_PLL_X, BT848_PLL_XCI); | 747 | btwrite(fi|BT848_PLL_X, BT848_PLL_XCI); |
748 | } | 748 | } |
749 | 749 | ||
750 | static void set_pll(struct bttv *btv) | 750 | static void set_pll(struct bttv *btv) |
751 | { | 751 | { |
752 | int i; | 752 | int i; |
753 | 753 | ||
754 | if (!btv->pll.pll_crystal) | 754 | if (!btv->pll.pll_crystal) |
755 | return; | 755 | return; |
756 | 756 | ||
757 | if (btv->pll.pll_ofreq == btv->pll.pll_current) { | 757 | if (btv->pll.pll_ofreq == btv->pll.pll_current) { |
758 | dprintk("bttv%d: PLL: no change required\n",btv->c.nr); | 758 | dprintk("bttv%d: PLL: no change required\n",btv->c.nr); |
759 | return; | 759 | return; |
760 | } | 760 | } |
761 | 761 | ||
762 | if (btv->pll.pll_ifreq == btv->pll.pll_ofreq) { | 762 | if (btv->pll.pll_ifreq == btv->pll.pll_ofreq) { |
763 | /* no PLL needed */ | 763 | /* no PLL needed */ |
764 | if (btv->pll.pll_current == 0) | 764 | if (btv->pll.pll_current == 0) |
765 | return; | 765 | return; |
766 | bttv_printk(KERN_INFO "bttv%d: PLL can sleep, using XTAL (%d).\n", | 766 | bttv_printk(KERN_INFO "bttv%d: PLL can sleep, using XTAL (%d).\n", |
767 | btv->c.nr,btv->pll.pll_ifreq); | 767 | btv->c.nr,btv->pll.pll_ifreq); |
768 | btwrite(0x00,BT848_TGCTRL); | 768 | btwrite(0x00,BT848_TGCTRL); |
769 | btwrite(0x00,BT848_PLL_XCI); | 769 | btwrite(0x00,BT848_PLL_XCI); |
770 | btv->pll.pll_current = 0; | 770 | btv->pll.pll_current = 0; |
771 | return; | 771 | return; |
772 | } | 772 | } |
773 | 773 | ||
774 | bttv_printk(KERN_INFO "bttv%d: PLL: %d => %d ",btv->c.nr, | 774 | bttv_printk(KERN_INFO "bttv%d: PLL: %d => %d ",btv->c.nr, |
775 | btv->pll.pll_ifreq, btv->pll.pll_ofreq); | 775 | btv->pll.pll_ifreq, btv->pll.pll_ofreq); |
776 | set_pll_freq(btv, btv->pll.pll_ifreq, btv->pll.pll_ofreq); | 776 | set_pll_freq(btv, btv->pll.pll_ifreq, btv->pll.pll_ofreq); |
777 | 777 | ||
778 | for (i=0; i<10; i++) { | 778 | for (i=0; i<10; i++) { |
779 | /* Let other people run while the PLL stabilizes */ | 779 | /* Let other people run while the PLL stabilizes */ |
780 | bttv_printk("."); | 780 | bttv_printk("."); |
781 | msleep(10); | 781 | msleep(10); |
782 | 782 | ||
783 | if (btread(BT848_DSTATUS) & BT848_DSTATUS_PLOCK) { | 783 | if (btread(BT848_DSTATUS) & BT848_DSTATUS_PLOCK) { |
784 | btwrite(0,BT848_DSTATUS); | 784 | btwrite(0,BT848_DSTATUS); |
785 | } else { | 785 | } else { |
786 | btwrite(0x08,BT848_TGCTRL); | 786 | btwrite(0x08,BT848_TGCTRL); |
787 | btv->pll.pll_current = btv->pll.pll_ofreq; | 787 | btv->pll.pll_current = btv->pll.pll_ofreq; |
788 | bttv_printk(" ok\n"); | 788 | bttv_printk(" ok\n"); |
789 | return; | 789 | return; |
790 | } | 790 | } |
791 | } | 791 | } |
792 | btv->pll.pll_current = -1; | 792 | btv->pll.pll_current = -1; |
793 | bttv_printk("failed\n"); | 793 | bttv_printk("failed\n"); |
794 | return; | 794 | return; |
795 | } | 795 | } |
796 | 796 | ||
797 | /* used to switch between the bt848's analog/digital video capture modes */ | 797 | /* used to switch between the bt848's analog/digital video capture modes */ |
@@ -1964,7 +1964,7 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv, | |||
1964 | } | 1964 | } |
1965 | 1965 | ||
1966 | down(&fh->cap.lock); | 1966 | down(&fh->cap.lock); |
1967 | kfree(fh->ov.clips); | 1967 | kfree(fh->ov.clips); |
1968 | fh->ov.clips = clips; | 1968 | fh->ov.clips = clips; |
1969 | fh->ov.nclips = n; | 1969 | fh->ov.nclips = n; |
1970 | 1970 | ||
@@ -2758,7 +2758,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2758 | fh->ov.w.height = fb->fmt.height; | 2758 | fh->ov.w.height = fb->fmt.height; |
2759 | btv->init.ov.w.width = fb->fmt.width; | 2759 | btv->init.ov.w.width = fb->fmt.width; |
2760 | btv->init.ov.w.height = fb->fmt.height; | 2760 | btv->init.ov.w.height = fb->fmt.height; |
2761 | kfree(fh->ov.clips); | 2761 | kfree(fh->ov.clips); |
2762 | fh->ov.clips = NULL; | 2762 | fh->ov.clips = NULL; |
2763 | fh->ov.nclips = 0; | 2763 | fh->ov.nclips = 0; |
2764 | 2764 | ||