diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-01-20 11:58:33 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-02-21 10:34:44 -0500 |
commit | 63ab1bdc3b98b804f69bd345b1e3a491804c12de (patch) | |
tree | fc8aed8e06698de61bd16da9f3b71b71c461923d /drivers/media/video/cx88 | |
parent | e90311a198e21902cda4fd4cac8e09bc6ce52603 (diff) |
V4L/DVB (5102): make videodev to auto-generate standards
v4l2_tvnorm were meant to describe video standards and its names to V4L2 API.
However, this were doing by some static structures at the driver.
This patch changes the internals in a way that, at the driver, only a
v4l2_tvnorm (a 64 bit integer) should be filled, with all supported
tvnorms. videodev will dynamically generate the proper API array
based on supported standards.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/cx88')
-rw-r--r-- | drivers/media/video/cx88/cx88-core.c | 75 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-vbi.c | 4 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-video.c | 71 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88.h | 21 |
4 files changed, 63 insertions, 108 deletions
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index a51a3b76b1c8..d86813be56de 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c | |||
@@ -636,30 +636,30 @@ int cx88_reset(struct cx88_core *core) | |||
636 | 636 | ||
637 | /* ------------------------------------------------------------------ */ | 637 | /* ------------------------------------------------------------------ */ |
638 | 638 | ||
639 | static unsigned int inline norm_swidth(struct v4l2_tvnorm *norm) | 639 | static unsigned int inline norm_swidth(v4l2_std_id norm) |
640 | { | 640 | { |
641 | return (norm->id & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 754 : 922; | 641 | return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 754 : 922; |
642 | } | 642 | } |
643 | 643 | ||
644 | static unsigned int inline norm_hdelay(struct v4l2_tvnorm *norm) | 644 | static unsigned int inline norm_hdelay(v4l2_std_id norm) |
645 | { | 645 | { |
646 | return (norm->id & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 135 : 186; | 646 | return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 135 : 186; |
647 | } | 647 | } |
648 | 648 | ||
649 | static unsigned int inline norm_vdelay(struct v4l2_tvnorm *norm) | 649 | static unsigned int inline norm_vdelay(v4l2_std_id norm) |
650 | { | 650 | { |
651 | return (norm->id & V4L2_STD_625_50) ? 0x24 : 0x18; | 651 | return (norm & V4L2_STD_625_50) ? 0x24 : 0x18; |
652 | } | 652 | } |
653 | 653 | ||
654 | static unsigned int inline norm_fsc8(struct v4l2_tvnorm *norm) | 654 | static unsigned int inline norm_fsc8(v4l2_std_id norm) |
655 | { | 655 | { |
656 | if (norm->id & V4L2_STD_PAL_M) | 656 | if (norm & V4L2_STD_PAL_M) |
657 | return 28604892; // 3.575611 MHz | 657 | return 28604892; // 3.575611 MHz |
658 | 658 | ||
659 | if (norm->id & (V4L2_STD_PAL_Nc)) | 659 | if (norm & (V4L2_STD_PAL_Nc)) |
660 | return 28656448; // 3.582056 MHz | 660 | return 28656448; // 3.582056 MHz |
661 | 661 | ||
662 | if (norm->id & V4L2_STD_NTSC) // All NTSC/M and variants | 662 | if (norm & V4L2_STD_NTSC) // All NTSC/M and variants |
663 | return 28636360; // 3.57954545 MHz +/- 10 Hz | 663 | return 28636360; // 3.57954545 MHz +/- 10 Hz |
664 | 664 | ||
665 | /* SECAM have also different sub carrier for chroma, | 665 | /* SECAM have also different sub carrier for chroma, |
@@ -671,20 +671,20 @@ static unsigned int inline norm_fsc8(struct v4l2_tvnorm *norm) | |||
671 | return 35468950; // 4.43361875 MHz +/- 5 Hz | 671 | return 35468950; // 4.43361875 MHz +/- 5 Hz |
672 | } | 672 | } |
673 | 673 | ||
674 | static unsigned int inline norm_htotal(struct v4l2_tvnorm *norm) | 674 | static unsigned int inline norm_htotal(v4l2_std_id norm) |
675 | { | 675 | { |
676 | 676 | ||
677 | unsigned int fsc4=norm_fsc8(norm)/2; | 677 | unsigned int fsc4=norm_fsc8(norm)/2; |
678 | 678 | ||
679 | /* returns 4*FSC / vtotal / frames per seconds */ | 679 | /* returns 4*FSC / vtotal / frames per seconds */ |
680 | return (norm->id & V4L2_STD_625_50) ? | 680 | return (norm & V4L2_STD_625_50) ? |
681 | ((fsc4+312)/625+12)/25 : | 681 | ((fsc4+312)/625+12)/25 : |
682 | ((fsc4+262)/525*1001+15000)/30000; | 682 | ((fsc4+262)/525*1001+15000)/30000; |
683 | } | 683 | } |
684 | 684 | ||
685 | static unsigned int inline norm_vbipack(struct v4l2_tvnorm *norm) | 685 | static unsigned int inline norm_vbipack(v4l2_std_id norm) |
686 | { | 686 | { |
687 | return (norm->id & V4L2_STD_625_50) ? 511 : 400; | 687 | return (norm & V4L2_STD_625_50) ? 511 : 400; |
688 | } | 688 | } |
689 | 689 | ||
690 | int cx88_set_scale(struct cx88_core *core, unsigned int width, unsigned int height, | 690 | int cx88_set_scale(struct cx88_core *core, unsigned int width, unsigned int height, |
@@ -697,7 +697,7 @@ int cx88_set_scale(struct cx88_core *core, unsigned int width, unsigned int heig | |||
697 | dprintk(1,"set_scale: %dx%d [%s%s,%s]\n", width, height, | 697 | dprintk(1,"set_scale: %dx%d [%s%s,%s]\n", width, height, |
698 | V4L2_FIELD_HAS_TOP(field) ? "T" : "", | 698 | V4L2_FIELD_HAS_TOP(field) ? "T" : "", |
699 | V4L2_FIELD_HAS_BOTTOM(field) ? "B" : "", | 699 | V4L2_FIELD_HAS_BOTTOM(field) ? "B" : "", |
700 | core->tvnorm->name); | 700 | v4l2_norm_to_name(core->tvnorm)); |
701 | if (!V4L2_FIELD_HAS_BOTH(field)) | 701 | if (!V4L2_FIELD_HAS_BOTH(field)) |
702 | height *= 2; | 702 | height *= 2; |
703 | 703 | ||
@@ -734,7 +734,7 @@ int cx88_set_scale(struct cx88_core *core, unsigned int width, unsigned int heig | |||
734 | // setup filters | 734 | // setup filters |
735 | value = 0; | 735 | value = 0; |
736 | value |= (1 << 19); // CFILT (default) | 736 | value |= (1 << 19); // CFILT (default) |
737 | if (core->tvnorm->id & V4L2_STD_SECAM) { | 737 | if (core->tvnorm & V4L2_STD_SECAM) { |
738 | value |= (1 << 15); | 738 | value |= (1 << 15); |
739 | value |= (1 << 16); | 739 | value |= (1 << 16); |
740 | } | 740 | } |
@@ -831,36 +831,36 @@ int cx88_stop_audio_dma(struct cx88_core *core) | |||
831 | 831 | ||
832 | static int set_tvaudio(struct cx88_core *core) | 832 | static int set_tvaudio(struct cx88_core *core) |
833 | { | 833 | { |
834 | struct v4l2_tvnorm *norm = core->tvnorm; | 834 | v4l2_std_id norm = core->tvnorm; |
835 | 835 | ||
836 | if (CX88_VMUX_TELEVISION != INPUT(core->input)->type) | 836 | if (CX88_VMUX_TELEVISION != INPUT(core->input)->type) |
837 | return 0; | 837 | return 0; |
838 | 838 | ||
839 | if (V4L2_STD_PAL_BG & norm->id) { | 839 | if (V4L2_STD_PAL_BG & norm) { |
840 | core->tvaudio = WW_BG; | 840 | core->tvaudio = WW_BG; |
841 | 841 | ||
842 | } else if (V4L2_STD_PAL_DK & norm->id) { | 842 | } else if (V4L2_STD_PAL_DK & norm) { |
843 | core->tvaudio = WW_DK; | 843 | core->tvaudio = WW_DK; |
844 | 844 | ||
845 | } else if (V4L2_STD_PAL_I & norm->id) { | 845 | } else if (V4L2_STD_PAL_I & norm) { |
846 | core->tvaudio = WW_I; | 846 | core->tvaudio = WW_I; |
847 | 847 | ||
848 | } else if (V4L2_STD_SECAM_L & norm->id) { | 848 | } else if (V4L2_STD_SECAM_L & norm) { |
849 | core->tvaudio = WW_L; | 849 | core->tvaudio = WW_L; |
850 | 850 | ||
851 | } else if (V4L2_STD_SECAM_DK & norm->id) { | 851 | } else if (V4L2_STD_SECAM_DK & norm) { |
852 | core->tvaudio = WW_DK; | 852 | core->tvaudio = WW_DK; |
853 | 853 | ||
854 | } else if ((V4L2_STD_NTSC_M & norm->id) || | 854 | } else if ((V4L2_STD_NTSC_M & norm) || |
855 | (V4L2_STD_PAL_M & norm->id)) { | 855 | (V4L2_STD_PAL_M & norm)) { |
856 | core->tvaudio = WW_BTSC; | 856 | core->tvaudio = WW_BTSC; |
857 | 857 | ||
858 | } else if (V4L2_STD_NTSC_M_JP & norm->id) { | 858 | } else if (V4L2_STD_NTSC_M_JP & norm) { |
859 | core->tvaudio = WW_EIAJ; | 859 | core->tvaudio = WW_EIAJ; |
860 | 860 | ||
861 | } else { | 861 | } else { |
862 | printk("%s/0: tvaudio support needs work for this tv norm [%s], sorry\n", | 862 | printk("%s/0: tvaudio support needs work for this tv norm [%s], sorry\n", |
863 | core->name, norm->name); | 863 | core->name, v4l2_norm_to_name(core->tvnorm)); |
864 | core->tvaudio = 0; | 864 | core->tvaudio = 0; |
865 | return 0; | 865 | return 0; |
866 | } | 866 | } |
@@ -879,7 +879,7 @@ static int set_tvaudio(struct cx88_core *core) | |||
879 | 879 | ||
880 | 880 | ||
881 | 881 | ||
882 | int cx88_set_tvnorm(struct cx88_core *core, struct v4l2_tvnorm *norm) | 882 | int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm) |
883 | { | 883 | { |
884 | u32 fsc8; | 884 | u32 fsc8; |
885 | u32 adc_clock; | 885 | u32 adc_clock; |
@@ -896,28 +896,28 @@ int cx88_set_tvnorm(struct cx88_core *core, struct v4l2_tvnorm *norm) | |||
896 | step_db = fsc8; | 896 | step_db = fsc8; |
897 | step_dr = fsc8; | 897 | step_dr = fsc8; |
898 | 898 | ||
899 | if (norm->id & V4L2_STD_NTSC_M_JP) { | 899 | if (norm & V4L2_STD_NTSC_M_JP) { |
900 | cxiformat = VideoFormatNTSCJapan; | 900 | cxiformat = VideoFormatNTSCJapan; |
901 | cxoformat = 0x181f0008; | 901 | cxoformat = 0x181f0008; |
902 | } else if (norm->id & V4L2_STD_NTSC_443) { | 902 | } else if (norm & V4L2_STD_NTSC_443) { |
903 | cxiformat = VideoFormatNTSC443; | 903 | cxiformat = VideoFormatNTSC443; |
904 | cxoformat = 0x181f0008; | 904 | cxoformat = 0x181f0008; |
905 | } else if (norm->id & V4L2_STD_PAL_M) { | 905 | } else if (norm & V4L2_STD_PAL_M) { |
906 | cxiformat = VideoFormatPALM; | 906 | cxiformat = VideoFormatPALM; |
907 | cxoformat = 0x1c1f0008; | 907 | cxoformat = 0x1c1f0008; |
908 | } else if (norm->id & V4L2_STD_PAL_N) { | 908 | } else if (norm & V4L2_STD_PAL_N) { |
909 | cxiformat = VideoFormatPALN; | 909 | cxiformat = VideoFormatPALN; |
910 | cxoformat = 0x1c1f0008; | 910 | cxoformat = 0x1c1f0008; |
911 | } else if (norm->id & V4L2_STD_PAL_Nc) { | 911 | } else if (norm & V4L2_STD_PAL_Nc) { |
912 | cxiformat = VideoFormatPALNC; | 912 | cxiformat = VideoFormatPALNC; |
913 | cxoformat = 0x1c1f0008; | 913 | cxoformat = 0x1c1f0008; |
914 | } else if (norm->id & V4L2_STD_PAL_60) { | 914 | } else if (norm & V4L2_STD_PAL_60) { |
915 | cxiformat = VideoFormatPAL60; | 915 | cxiformat = VideoFormatPAL60; |
916 | cxoformat = 0x181f0008; | 916 | cxoformat = 0x181f0008; |
917 | } else if (norm->id & V4L2_STD_NTSC) { | 917 | } else if (norm & V4L2_STD_NTSC) { |
918 | cxiformat = VideoFormatNTSC; | 918 | cxiformat = VideoFormatNTSC; |
919 | cxoformat = 0x181f0008; | 919 | cxoformat = 0x181f0008; |
920 | } else if (norm->id & V4L2_STD_SECAM) { | 920 | } else if (norm & V4L2_STD_SECAM) { |
921 | step_db = 4250000 * 8; | 921 | step_db = 4250000 * 8; |
922 | step_dr = 4406250 * 8; | 922 | step_dr = 4406250 * 8; |
923 | 923 | ||
@@ -929,7 +929,8 @@ int cx88_set_tvnorm(struct cx88_core *core, struct v4l2_tvnorm *norm) | |||
929 | } | 929 | } |
930 | 930 | ||
931 | dprintk(1,"set_tvnorm: \"%s\" fsc8=%d adc=%d vdec=%d db/dr=%d/%d\n", | 931 | dprintk(1,"set_tvnorm: \"%s\" fsc8=%d adc=%d vdec=%d db/dr=%d/%d\n", |
932 | norm->name, fsc8, adc_clock, vdec_clock, step_db, step_dr); | 932 | v4l2_norm_to_name(core->tvnorm), fsc8, adc_clock, vdec_clock, |
933 | step_db, step_dr); | ||
933 | set_pll(core,2,vdec_clock); | 934 | set_pll(core,2,vdec_clock); |
934 | 935 | ||
935 | dprintk(1,"set_tvnorm: MO_INPUT_FORMAT 0x%08x [old=0x%08x]\n", | 936 | dprintk(1,"set_tvnorm: MO_INPUT_FORMAT 0x%08x [old=0x%08x]\n", |
@@ -988,7 +989,7 @@ int cx88_set_tvnorm(struct cx88_core *core, struct v4l2_tvnorm *norm) | |||
988 | set_tvaudio(core); | 989 | set_tvaudio(core); |
989 | 990 | ||
990 | // tell i2c chips | 991 | // tell i2c chips |
991 | cx88_call_i2c_clients(core,VIDIOC_S_STD,&norm->id); | 992 | cx88_call_i2c_clients(core,VIDIOC_S_STD,&norm); |
992 | 993 | ||
993 | // done | 994 | // done |
994 | return 0; | 995 | return 0; |
diff --git a/drivers/media/video/cx88/cx88-vbi.c b/drivers/media/video/cx88/cx88-vbi.c index b6b968851d71..86c1cf8334bc 100644 --- a/drivers/media/video/cx88/cx88-vbi.c +++ b/drivers/media/video/cx88/cx88-vbi.c | |||
@@ -33,13 +33,13 @@ int cx8800_vbi_fmt (struct file *file, void *priv, | |||
33 | f->fmt.vbi.count[0] = VBI_LINE_COUNT; | 33 | f->fmt.vbi.count[0] = VBI_LINE_COUNT; |
34 | f->fmt.vbi.count[1] = VBI_LINE_COUNT; | 34 | f->fmt.vbi.count[1] = VBI_LINE_COUNT; |
35 | 35 | ||
36 | if (dev->core->tvnorm->id & V4L2_STD_525_60) { | 36 | if (dev->core->tvnorm & V4L2_STD_525_60) { |
37 | /* ntsc */ | 37 | /* ntsc */ |
38 | f->fmt.vbi.sampling_rate = 28636363; | 38 | f->fmt.vbi.sampling_rate = 28636363; |
39 | f->fmt.vbi.start[0] = 10; | 39 | f->fmt.vbi.start[0] = 10; |
40 | f->fmt.vbi.start[1] = 273; | 40 | f->fmt.vbi.start[1] = 273; |
41 | 41 | ||
42 | } else if (dev->core->tvnorm->id & V4L2_STD_625_50) { | 42 | } else if (dev->core->tvnorm & V4L2_STD_625_50) { |
43 | /* pal */ | 43 | /* pal */ |
44 | f->fmt.vbi.sampling_rate = 35468950; | 44 | f->fmt.vbi.sampling_rate = 35468950; |
45 | f->fmt.vbi.start[0] = 7 -1; | 45 | f->fmt.vbi.start[0] = 7 -1; |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 85e51831e774..8ba994273292 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -86,56 +86,7 @@ static LIST_HEAD(cx8800_devlist); | |||
86 | /* ------------------------------------------------------------------- */ | 86 | /* ------------------------------------------------------------------- */ |
87 | /* static data */ | 87 | /* static data */ |
88 | 88 | ||
89 | struct v4l2_tvnorm cx88_tvnorms[] = { | 89 | v4l2_std_id radionorms[] = { 0 }; |
90 | { | ||
91 | .name = "NTSC-M", | ||
92 | .id = V4L2_STD_NTSC_M, | ||
93 | },{ | ||
94 | .name = "NTSC-JP", | ||
95 | .id = V4L2_STD_NTSC_M_JP, | ||
96 | },{ | ||
97 | .name = "NTSC-4.43", | ||
98 | .id = V4L2_STD_NTSC_443, | ||
99 | },{ | ||
100 | .name = "PAL-BG", | ||
101 | .id = V4L2_STD_PAL_BG, | ||
102 | },{ | ||
103 | .name = "PAL-DK", | ||
104 | .id = V4L2_STD_PAL_DK, | ||
105 | },{ | ||
106 | .name = "PAL-I", | ||
107 | .id = V4L2_STD_PAL_I, | ||
108 | },{ | ||
109 | .name = "PAL-M", | ||
110 | .id = V4L2_STD_PAL_M, | ||
111 | },{ | ||
112 | .name = "PAL-N", | ||
113 | .id = V4L2_STD_PAL_N, | ||
114 | },{ | ||
115 | .name = "PAL-Nc", | ||
116 | .id = V4L2_STD_PAL_Nc, | ||
117 | },{ | ||
118 | .name = "PAL-60", | ||
119 | .id = V4L2_STD_PAL_60, | ||
120 | },{ | ||
121 | .name = "SECAM-L", | ||
122 | .id = V4L2_STD_SECAM_L, | ||
123 | },{ | ||
124 | .name = "SECAM-DK", | ||
125 | .id = V4L2_STD_SECAM_DK, | ||
126 | } | ||
127 | }; | ||
128 | EXPORT_SYMBOL(cx88_tvnorms); | ||
129 | |||
130 | unsigned int cx88_tvnormsize=ARRAY_SIZE(cx88_tvnorms); | ||
131 | EXPORT_SYMBOL(cx88_tvnormsize); | ||
132 | |||
133 | static struct v4l2_tvnorm radionorms[] = { | ||
134 | { | ||
135 | .name = "RADIO", | ||
136 | .id = 0, | ||
137 | } | ||
138 | }; | ||
139 | 90 | ||
140 | static struct cx8800_fmt formats[] = { | 91 | static struct cx8800_fmt formats[] = { |
141 | { | 92 | { |
@@ -999,7 +950,7 @@ int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl) | |||
999 | 950 | ||
1000 | value = ((ctl->value - c->off) << c->shift) & c->mask; | 951 | value = ((ctl->value - c->off) << c->shift) & c->mask; |
1001 | 952 | ||
1002 | if (core->tvnorm->id & V4L2_STD_SECAM) { | 953 | if (core->tvnorm & V4L2_STD_SECAM) { |
1003 | /* For SECAM, both U and V sat should be equal */ | 954 | /* For SECAM, both U and V sat should be equal */ |
1004 | value=value<<8|value; | 955 | value=value<<8|value; |
1005 | } else { | 956 | } else { |
@@ -1242,13 +1193,14 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) | |||
1242 | return 0; | 1193 | return 0; |
1243 | } | 1194 | } |
1244 | 1195 | ||
1245 | static int vidioc_s_std (struct file *file, void *priv, unsigned int i) | 1196 | static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *tvnorms) |
1246 | { | 1197 | { |
1247 | struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core; | 1198 | struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core; |
1248 | 1199 | ||
1249 | mutex_lock(&core->lock); | 1200 | mutex_lock(&core->lock); |
1250 | cx88_set_tvnorm(core,&cx88_tvnorms[i]); | 1201 | cx88_set_tvnorm(core,*tvnorms); |
1251 | mutex_unlock(&core->lock); | 1202 | mutex_unlock(&core->lock); |
1203 | |||
1252 | return 0; | 1204 | return 0; |
1253 | } | 1205 | } |
1254 | 1206 | ||
@@ -1280,8 +1232,7 @@ int cx88_enum_input (struct cx88_core *core,struct v4l2_input *i) | |||
1280 | if ((CX88_VMUX_TELEVISION == INPUT(n)->type) || | 1232 | if ((CX88_VMUX_TELEVISION == INPUT(n)->type) || |
1281 | (CX88_VMUX_CABLE == INPUT(n)->type)) | 1233 | (CX88_VMUX_CABLE == INPUT(n)->type)) |
1282 | i->type = V4L2_INPUT_TYPE_TUNER; | 1234 | i->type = V4L2_INPUT_TYPE_TUNER; |
1283 | for (n = 0; n < ARRAY_SIZE(cx88_tvnorms); n++) | 1235 | i->std = CX88_NORMS; |
1284 | i->std |= cx88_tvnorms[n].id; | ||
1285 | return 0; | 1236 | return 0; |
1286 | } | 1237 | } |
1287 | EXPORT_SYMBOL(cx88_enum_input); | 1238 | EXPORT_SYMBOL(cx88_enum_input); |
@@ -1703,8 +1654,8 @@ static struct video_device cx8800_video_template = | |||
1703 | .vidioc_s_tuner = vidioc_s_tuner, | 1654 | .vidioc_s_tuner = vidioc_s_tuner, |
1704 | .vidioc_g_frequency = vidioc_g_frequency, | 1655 | .vidioc_g_frequency = vidioc_g_frequency, |
1705 | .vidioc_s_frequency = vidioc_s_frequency, | 1656 | .vidioc_s_frequency = vidioc_s_frequency, |
1706 | .tvnorms = cx88_tvnorms, | 1657 | .tvnorms = CX88_NORMS, |
1707 | .tvnormsize = ARRAY_SIZE(cx88_tvnorms), | 1658 | .current_norm = V4L2_STD_PAL_BG, |
1708 | }; | 1659 | }; |
1709 | 1660 | ||
1710 | static const struct file_operations radio_fops = | 1661 | static const struct file_operations radio_fops = |
@@ -1736,8 +1687,6 @@ static struct video_device cx8800_radio_template = | |||
1736 | .vidioc_s_ctrl = vidioc_s_ctrl, | 1687 | .vidioc_s_ctrl = vidioc_s_ctrl, |
1737 | .vidioc_g_frequency = vidioc_g_frequency, | 1688 | .vidioc_g_frequency = vidioc_g_frequency, |
1738 | .vidioc_s_frequency = vidioc_s_frequency, | 1689 | .vidioc_s_frequency = vidioc_s_frequency, |
1739 | .tvnorms = radionorms, | ||
1740 | .tvnormsize = ARRAY_SIZE(radionorms), | ||
1741 | }; | 1690 | }; |
1742 | 1691 | ||
1743 | /* ----------------------------------------------------------- */ | 1692 | /* ----------------------------------------------------------- */ |
@@ -1815,7 +1764,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, | |||
1815 | 1764 | ||
1816 | /* initialize driver struct */ | 1765 | /* initialize driver struct */ |
1817 | spin_lock_init(&dev->slock); | 1766 | spin_lock_init(&dev->slock); |
1818 | core->tvnorm = cx88_tvnorms; | 1767 | core->tvnorm = cx8800_video_template.current_norm; |
1819 | 1768 | ||
1820 | /* init video dma queues */ | 1769 | /* init video dma queues */ |
1821 | INIT_LIST_HEAD(&dev->vidq.active); | 1770 | INIT_LIST_HEAD(&dev->vidq.active); |
@@ -1896,7 +1845,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, | |||
1896 | 1845 | ||
1897 | /* initial device configuration */ | 1846 | /* initial device configuration */ |
1898 | mutex_lock(&core->lock); | 1847 | mutex_lock(&core->lock); |
1899 | cx88_set_tvnorm(core,cx88_tvnorms); | 1848 | cx88_set_tvnorm(core,core->tvnorm); |
1900 | init_controls(core); | 1849 | init_controls(core); |
1901 | cx88_video_mux(core,0); | 1850 | cx88_video_mux(core,0); |
1902 | mutex_unlock(&core->lock); | 1851 | mutex_unlock(&core->lock); |
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 5d2f40fe5b7d..a4f4958699b1 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h | |||
@@ -50,6 +50,13 @@ | |||
50 | /* ----------------------------------------------------------- */ | 50 | /* ----------------------------------------------------------- */ |
51 | /* defines and enums */ | 51 | /* defines and enums */ |
52 | 52 | ||
53 | /* Currently unsupported by the driver: PAL/H, NTSC/Kr, SECAM B/G/H/LC */ | ||
54 | #define CX88_NORMS (\ | ||
55 | V4L2_STD_NTSC_M| V4L2_STD_NTSC_M_JP| V4L2_STD_NTSC_443 | \ | ||
56 | V4L2_STD_PAL_BG| V4L2_STD_PAL_DK | V4L2_STD_PAL_I | \ | ||
57 | V4L2_STD_PAL_M | V4L2_STD_PAL_N | V4L2_STD_PAL_Nc | \ | ||
58 | V4L2_STD_PAL_60| V4L2_STD_SECAM_L | V4L2_STD_SECAM_DK ) | ||
59 | |||
53 | #define FORMAT_FLAGS_PACKED 0x01 | 60 | #define FORMAT_FLAGS_PACKED 0x01 |
54 | #define FORMAT_FLAGS_PLANAR 0x02 | 61 | #define FORMAT_FLAGS_PLANAR 0x02 |
55 | 62 | ||
@@ -82,15 +89,15 @@ enum cx8802_board_access { | |||
82 | /* ----------------------------------------------------------- */ | 89 | /* ----------------------------------------------------------- */ |
83 | /* tv norms */ | 90 | /* tv norms */ |
84 | 91 | ||
85 | static unsigned int inline norm_maxw(struct v4l2_tvnorm *norm) | 92 | static unsigned int inline norm_maxw(v4l2_std_id norm) |
86 | { | 93 | { |
87 | return (norm->id & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 720 : 768; | 94 | return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 720 : 768; |
88 | } | 95 | } |
89 | 96 | ||
90 | 97 | ||
91 | static unsigned int inline norm_maxh(struct v4l2_tvnorm *norm) | 98 | static unsigned int inline norm_maxh(v4l2_std_id norm) |
92 | { | 99 | { |
93 | return (norm->id & V4L2_STD_625_50) ? 576 : 480; | 100 | return (norm & V4L2_STD_625_50) ? 576 : 480; |
94 | } | 101 | } |
95 | 102 | ||
96 | /* ----------------------------------------------------------- */ | 103 | /* ----------------------------------------------------------- */ |
@@ -312,7 +319,7 @@ struct cx88_core { | |||
312 | 319 | ||
313 | /* state info */ | 320 | /* state info */ |
314 | struct task_struct *kthread; | 321 | struct task_struct *kthread; |
315 | struct v4l2_tvnorm *tvnorm; | 322 | v4l2_std_id tvnorm; |
316 | u32 tvaudio; | 323 | u32 tvaudio; |
317 | u32 audiomode_manual; | 324 | u32 audiomode_manual; |
318 | u32 audiomode_current; | 325 | u32 audiomode_current; |
@@ -529,7 +536,7 @@ extern void cx88_sram_channel_dump(struct cx88_core *core, | |||
529 | 536 | ||
530 | extern int cx88_set_scale(struct cx88_core *core, unsigned int width, | 537 | extern int cx88_set_scale(struct cx88_core *core, unsigned int width, |
531 | unsigned int height, enum v4l2_field field); | 538 | unsigned int height, enum v4l2_field field); |
532 | extern int cx88_set_tvnorm(struct cx88_core *core, struct v4l2_tvnorm *norm); | 539 | extern int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm); |
533 | 540 | ||
534 | extern struct video_device *cx88_vdev_init(struct cx88_core *core, | 541 | extern struct video_device *cx88_vdev_init(struct cx88_core *core, |
535 | struct pci_dev *pci, | 542 | struct pci_dev *pci, |
@@ -630,8 +637,6 @@ int cx8802_resume_common(struct pci_dev *pci_dev); | |||
630 | 637 | ||
631 | /* ----------------------------------------------------------- */ | 638 | /* ----------------------------------------------------------- */ |
632 | /* cx88-video.c*/ | 639 | /* cx88-video.c*/ |
633 | extern unsigned int cx88_tvnormsize; | ||
634 | extern struct v4l2_tvnorm cx88_tvnorms[]; | ||
635 | extern const u32 cx88_user_ctrls[]; | 640 | extern const u32 cx88_user_ctrls[]; |
636 | extern int cx8800_ctrl_query(struct v4l2_queryctrl *qctrl); | 641 | extern int cx8800_ctrl_query(struct v4l2_queryctrl *qctrl); |
637 | int cx88_enum_input (struct cx88_core *core,struct v4l2_input *i); | 642 | int cx88_enum_input (struct cx88_core *core,struct v4l2_input *i); |