aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2011-06-13 08:47:56 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-07-07 14:04:41 -0400
commit487833018eb2b969f20457fcf1956b3c6dbfad51 (patch)
tree2da679bc20e3a8fee464cb1ee980b87debcd9ba0
parent338e9e1ad541cbb2a3fa5839376ff6c138d40301 (diff)
[media] tuner-core: simplify the standard fixup
Get rid of a number of unnecessary tuner_dbg messages by simplifying the std fixup function. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/tuner-core.c93
1 files changed, 28 insertions, 65 deletions
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 6c007aa00236..1e7505eb32e9 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -823,7 +823,8 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq)
823/** 823/**
824 * tuner_fixup_std - force a given video standard variant 824 * tuner_fixup_std - force a given video standard variant
825 * 825 *
826 * @t: tuner internal struct 826 * @t: tuner internal struct
827 * @std: TV standard
827 * 828 *
828 * A few devices or drivers have problem to detect some standard variations. 829 * A few devices or drivers have problem to detect some standard variations.
829 * On other operational systems, the drivers generally have a per-country 830 * On other operational systems, the drivers generally have a per-country
@@ -833,57 +834,39 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq)
833 * to distinguish all video standard variations, a modprobe parameter can 834 * to distinguish all video standard variations, a modprobe parameter can
834 * be used to force a video standard match. 835 * be used to force a video standard match.
835 */ 836 */
836static int tuner_fixup_std(struct tuner *t) 837static v4l2_std_id tuner_fixup_std(struct tuner *t, v4l2_std_id std)
837{ 838{
838 if ((t->std & V4L2_STD_PAL) == V4L2_STD_PAL) { 839 if (pal[0] != '-' && (std & V4L2_STD_PAL) == V4L2_STD_PAL) {
839 switch (pal[0]) { 840 switch (pal[0]) {
840 case '6': 841 case '6':
841 tuner_dbg("insmod fixup: PAL => PAL-60\n"); 842 return V4L2_STD_PAL_60;
842 t->std = V4L2_STD_PAL_60;
843 break;
844 case 'b': 843 case 'b':
845 case 'B': 844 case 'B':
846 case 'g': 845 case 'g':
847 case 'G': 846 case 'G':
848 tuner_dbg("insmod fixup: PAL => PAL-BG\n"); 847 return V4L2_STD_PAL_BG;
849 t->std = V4L2_STD_PAL_BG;
850 break;
851 case 'i': 848 case 'i':
852 case 'I': 849 case 'I':
853 tuner_dbg("insmod fixup: PAL => PAL-I\n"); 850 return V4L2_STD_PAL_I;
854 t->std = V4L2_STD_PAL_I;
855 break;
856 case 'd': 851 case 'd':
857 case 'D': 852 case 'D':
858 case 'k': 853 case 'k':
859 case 'K': 854 case 'K':
860 tuner_dbg("insmod fixup: PAL => PAL-DK\n"); 855 return V4L2_STD_PAL_DK;
861 t->std = V4L2_STD_PAL_DK;
862 break;
863 case 'M': 856 case 'M':
864 case 'm': 857 case 'm':
865 tuner_dbg("insmod fixup: PAL => PAL-M\n"); 858 return V4L2_STD_PAL_M;
866 t->std = V4L2_STD_PAL_M;
867 break;
868 case 'N': 859 case 'N':
869 case 'n': 860 case 'n':
870 if (pal[1] == 'c' || pal[1] == 'C') { 861 if (pal[1] == 'c' || pal[1] == 'C')
871 tuner_dbg("insmod fixup: PAL => PAL-Nc\n"); 862 return V4L2_STD_PAL_Nc;
872 t->std = V4L2_STD_PAL_Nc; 863 return V4L2_STD_PAL_N;
873 } else {
874 tuner_dbg("insmod fixup: PAL => PAL-N\n");
875 t->std = V4L2_STD_PAL_N;
876 }
877 break;
878 case '-':
879 /* default parameter, do nothing */
880 break;
881 default: 864 default:
882 tuner_warn("pal= argument not recognised\n"); 865 tuner_warn("pal= argument not recognised\n");
883 break; 866 break;
884 } 867 }
885 } 868 }
886 if ((t->std & V4L2_STD_SECAM) == V4L2_STD_SECAM) { 869 if (secam[0] != '-' && (std & V4L2_STD_SECAM) == V4L2_STD_SECAM) {
887 switch (secam[0]) { 870 switch (secam[0]) {
888 case 'b': 871 case 'b':
889 case 'B': 872 case 'B':
@@ -891,63 +874,42 @@ static int tuner_fixup_std(struct tuner *t)
891 case 'G': 874 case 'G':
892 case 'h': 875 case 'h':
893 case 'H': 876 case 'H':
894 tuner_dbg("insmod fixup: SECAM => SECAM-BGH\n"); 877 return V4L2_STD_SECAM_B |
895 t->std = V4L2_STD_SECAM_B | 878 V4L2_STD_SECAM_G |
896 V4L2_STD_SECAM_G | 879 V4L2_STD_SECAM_H;
897 V4L2_STD_SECAM_H;
898 break;
899 case 'd': 880 case 'd':
900 case 'D': 881 case 'D':
901 case 'k': 882 case 'k':
902 case 'K': 883 case 'K':
903 tuner_dbg("insmod fixup: SECAM => SECAM-DK\n"); 884 return V4L2_STD_SECAM_DK;
904 t->std = V4L2_STD_SECAM_DK;
905 break;
906 case 'l': 885 case 'l':
907 case 'L': 886 case 'L':
908 if ((secam[1] == 'C') || (secam[1] == 'c')) { 887 if ((secam[1] == 'C') || (secam[1] == 'c'))
909 tuner_dbg("insmod fixup: SECAM => SECAM-L'\n"); 888 return V4L2_STD_SECAM_LC;
910 t->std = V4L2_STD_SECAM_LC; 889 return V4L2_STD_SECAM_L;
911 } else {
912 tuner_dbg("insmod fixup: SECAM => SECAM-L\n");
913 t->std = V4L2_STD_SECAM_L;
914 }
915 break;
916 case '-':
917 /* default parameter, do nothing */
918 break;
919 default: 890 default:
920 tuner_warn("secam= argument not recognised\n"); 891 tuner_warn("secam= argument not recognised\n");
921 break; 892 break;
922 } 893 }
923 } 894 }
924 895
925 if ((t->std & V4L2_STD_NTSC) == V4L2_STD_NTSC) { 896 if (ntsc[0] != '-' && (std & V4L2_STD_NTSC) == V4L2_STD_NTSC) {
926 switch (ntsc[0]) { 897 switch (ntsc[0]) {
927 case 'm': 898 case 'm':
928 case 'M': 899 case 'M':
929 tuner_dbg("insmod fixup: NTSC => NTSC-M\n"); 900 return V4L2_STD_NTSC_M;
930 t->std = V4L2_STD_NTSC_M;
931 break;
932 case 'j': 901 case 'j':
933 case 'J': 902 case 'J':
934 tuner_dbg("insmod fixup: NTSC => NTSC_M_JP\n"); 903 return V4L2_STD_NTSC_M_JP;
935 t->std = V4L2_STD_NTSC_M_JP;
936 break;
937 case 'k': 904 case 'k':
938 case 'K': 905 case 'K':
939 tuner_dbg("insmod fixup: NTSC => NTSC_M_KR\n"); 906 return V4L2_STD_NTSC_M_KR;
940 t->std = V4L2_STD_NTSC_M_KR;
941 break;
942 case '-':
943 /* default parameter, do nothing */
944 break;
945 default: 907 default:
946 tuner_info("ntsc= argument not recognised\n"); 908 tuner_info("ntsc= argument not recognised\n");
947 break; 909 break;
948 } 910 }
949 } 911 }
950 return 0; 912 return std;
951} 913}
952 914
953/* 915/*
@@ -1102,8 +1064,9 @@ static int tuner_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
1102 if (set_mode(t, V4L2_TUNER_ANALOG_TV)) 1064 if (set_mode(t, V4L2_TUNER_ANALOG_TV))
1103 return 0; 1065 return 0;
1104 1066
1105 t->std = std; 1067 t->std = tuner_fixup_std(t, std);
1106 tuner_fixup_std(t); 1068 if (t->std != std)
1069 tuner_dbg("Fixup standard %llx to %llx\n", std, t->std);
1107 set_freq(t, 0); 1070 set_freq(t, 0);
1108 return 0; 1071 return 0;
1109} 1072}