diff options
author | Stefan Ringel <stefan.ringel@arcor.de> | 2011-05-09 15:53:50 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-05-20 19:01:02 -0400 |
commit | 886a3c0b58f4c3d11a8cf723b8f5ee167708ebf5 (patch) | |
tree | 0b8766ee6d9e651d390621106b3fb84a85a9719c /drivers/staging | |
parent | 1416910743e63e751a95de14c0477e41d54076b7 (diff) |
[media] tm6000: add tm6010 audio mode setup
add tm6010 audio mode setup
Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/tm6000/tm6000-stds.c | 149 | ||||
-rw-r--r-- | drivers/staging/tm6000/tm6000-video.c | 35 | ||||
-rw-r--r-- | drivers/staging/tm6000/tm6000.h | 1 |
3 files changed, 107 insertions, 78 deletions
diff --git a/drivers/staging/tm6000/tm6000-stds.c b/drivers/staging/tm6000/tm6000-stds.c index da3e51bde109..588b1fc7f887 100644 --- a/drivers/staging/tm6000/tm6000-stds.c +++ b/drivers/staging/tm6000/tm6000-stds.c | |||
@@ -22,6 +22,9 @@ | |||
22 | #include "tm6000.h" | 22 | #include "tm6000.h" |
23 | #include "tm6000-regs.h" | 23 | #include "tm6000-regs.h" |
24 | 24 | ||
25 | static unsigned int tm6010_a_mode = 0; | ||
26 | module_param(tm6010_a_mode, int, 0644); | ||
27 | MODULE_PARM_DESC(tm6010_a_mode, "set tm6010 sif audio mode"); | ||
25 | struct tm6000_reg_settings { | 28 | struct tm6000_reg_settings { |
26 | unsigned char req; | 29 | unsigned char req; |
27 | unsigned char reg; | 30 | unsigned char reg; |
@@ -947,9 +950,8 @@ static int tm6000_set_audio_std(struct tm6000_core *dev, | |||
947 | enum tm6000_audio_std std) | 950 | enum tm6000_audio_std std) |
948 | { | 951 | { |
949 | uint8_t areg_02 = 0x04; /* GC1 Fixed gain 0dB */ | 952 | uint8_t areg_02 = 0x04; /* GC1 Fixed gain 0dB */ |
950 | uint8_t areg_05 = 0x09; /* Auto 4.5 = M Japan, Auto 6.5 = DK */ | 953 | uint8_t areg_05 = 0x01; /* Auto 4.5 = M Japan, Auto 6.5 = DK */ |
951 | uint8_t areg_06 = 0x02; /* Auto de-emphasis, mannual channel mode */ | 954 | uint8_t areg_06 = 0x02; /* Auto de-emphasis, mannual channel mode */ |
952 | uint8_t mono_flag = 0; /* No mono */ | ||
953 | uint8_t nicam_flag = 0; /* No NICAM */ | 955 | uint8_t nicam_flag = 0; /* No NICAM */ |
954 | 956 | ||
955 | if (dev->radio) { | 957 | if (dev->radio) { |
@@ -958,81 +960,99 @@ static int tm6000_set_audio_std(struct tm6000_core *dev, | |||
958 | tm6000_set_reg(dev, TM6010_REQ08_R03_A_AUTO_GAIN_CTRL, 0x00); | 960 | tm6000_set_reg(dev, TM6010_REQ08_R03_A_AUTO_GAIN_CTRL, 0x00); |
959 | tm6000_set_reg(dev, TM6010_REQ08_R04_A_SIF_AMP_CTRL, 0x80); | 961 | tm6000_set_reg(dev, TM6010_REQ08_R04_A_SIF_AMP_CTRL, 0x80); |
960 | tm6000_set_reg(dev, TM6010_REQ08_R05_A_STANDARD_MOD, 0x0c); | 962 | tm6000_set_reg(dev, TM6010_REQ08_R05_A_STANDARD_MOD, 0x0c); |
961 | tm6000_set_reg(dev, TM6010_REQ08_R06_A_SOUND_MOD, 0x00); | 963 | /* set mono or stereo */ |
964 | if (dev->amode == V4L2_TUNER_MODE_MONO) | ||
965 | tm6000_set_reg(dev, TM6010_REQ08_R06_A_SOUND_MOD, 0x00); | ||
966 | else if (dev->amode == V4L2_TUNER_MODE_STEREO) | ||
967 | tm6000_set_reg(dev, TM6010_REQ08_R06_A_SOUND_MOD, 0x02); | ||
962 | tm6000_set_reg(dev, TM6010_REQ08_R09_A_MAIN_VOL, 0x18); | 968 | tm6000_set_reg(dev, TM6010_REQ08_R09_A_MAIN_VOL, 0x18); |
963 | tm6000_set_reg(dev, TM6010_REQ08_R0C_A_ASD_THRES2, 0x0a); | 969 | tm6000_set_reg(dev, TM6010_REQ08_R0C_A_ASD_THRES2, 0x0a); |
964 | tm6000_set_reg(dev, TM6010_REQ08_R0D_A_AMD_THRES, 0x40); | 970 | tm6000_set_reg(dev, TM6010_REQ08_R0D_A_AMD_THRES, 0x40); |
965 | tm6000_set_reg(dev, TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc); | 971 | tm6000_set_reg(dev, TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfe); |
966 | tm6000_set_reg(dev, TM6010_REQ08_R1E_A_GAIN_DEEMPH_OUT, 0x13); | 972 | tm6000_set_reg(dev, TM6010_REQ08_R1E_A_GAIN_DEEMPH_OUT, 0x13); |
967 | tm6000_set_reg(dev, TM6010_REQ08_R01_A_INIT, 0x80); | 973 | tm6000_set_reg(dev, TM6010_REQ08_R01_A_INIT, 0x80); |
968 | return 0; | 974 | return 0; |
969 | } | 975 | } |
970 | 976 | ||
971 | switch (std) { | 977 | switch (tm6010_a_mode) { |
972 | #if 0 | 978 | /* auto */ |
973 | case DK_MONO: | 979 | case 0: |
974 | mono_flag = 1; | 980 | switch (dev->norm) { |
975 | break; | 981 | case V4L2_STD_NTSC_M_KR: |
976 | case DK_A2_1: | 982 | areg_05 |= 0x00; |
977 | break; | 983 | break; |
978 | case DK_A2_3: | 984 | case V4L2_STD_NTSC_M_JP: |
979 | areg_05 = 0x0b; | 985 | areg_05 |= 0x40; |
980 | break; | 986 | break; |
981 | case BG_MONO: | 987 | case V4L2_STD_NTSC_M: |
982 | mono_flag = 1; | 988 | case V4L2_STD_PAL_M: |
983 | areg_05 = 0x05; | 989 | case V4L2_STD_PAL_N: |
984 | break; | 990 | areg_05 |= 0x20; |
985 | #endif | 991 | break; |
986 | case BG_NICAM: | 992 | case V4L2_STD_PAL_Nc: |
987 | areg_05 = 0x07; | 993 | areg_05 |= 0x60; |
988 | nicam_flag = 1; | 994 | break; |
989 | break; | 995 | case V4L2_STD_SECAM_L: |
990 | case BTSC: | 996 | areg_05 |= 0x00; |
991 | areg_05 = 0x02; | 997 | break; |
992 | break; | 998 | case V4L2_STD_DK: |
993 | case BG_A2: | 999 | areg_05 |= 0x10; |
994 | areg_05 = 0x05; | 1000 | break; |
995 | break; | 1001 | } |
996 | case DK_NICAM: | ||
997 | areg_05 = 0x06; | ||
998 | nicam_flag = 1; | ||
999 | break; | ||
1000 | case EIAJ: | ||
1001 | areg_05 = 0x02; | ||
1002 | break; | ||
1003 | case I_NICAM: | ||
1004 | areg_05 = 0x08; | ||
1005 | nicam_flag = 1; | ||
1006 | break; | 1002 | break; |
1007 | case KOREA_A2: | 1003 | /* A2 */ |
1008 | areg_05 = 0x04; | 1004 | case 1: |
1005 | switch (dev->norm) { | ||
1006 | case V4L2_STD_B: | ||
1007 | case V4L2_STD_GH: | ||
1008 | areg_05 = 0x05; | ||
1009 | break; | ||
1010 | case V4L2_STD_DK: | ||
1011 | areg_05 = 0x09; | ||
1012 | break; | ||
1013 | } | ||
1009 | break; | 1014 | break; |
1010 | case L_NICAM: | 1015 | /* NICAM */ |
1011 | areg_02 = 0x02; /* GC1 Fixed gain +12dB */ | 1016 | case 2: |
1012 | areg_05 = 0x0a; | 1017 | switch (dev->norm) { |
1018 | case V4L2_STD_B: | ||
1019 | case V4L2_STD_GH: | ||
1020 | areg_05 = 0x07; | ||
1021 | break; | ||
1022 | case V4L2_STD_DK: | ||
1023 | areg_05 = 0x06; | ||
1024 | break; | ||
1025 | case V4L2_STD_PAL_I: | ||
1026 | areg_05 = 0x08; | ||
1027 | break; | ||
1028 | case V4L2_STD_SECAM_L: | ||
1029 | areg_05 = 0x0a; | ||
1030 | areg_02 = 0x02; | ||
1031 | break; | ||
1032 | } | ||
1013 | nicam_flag = 1; | 1033 | nicam_flag = 1; |
1014 | break; | 1034 | break; |
1015 | default: | 1035 | /* other */ |
1016 | /* do nothink */ | 1036 | case 3: |
1017 | break; | 1037 | switch (dev->norm) { |
1018 | } | 1038 | /* DK3_A2 */ |
1019 | 1039 | case V4L2_STD_DK: | |
1020 | #if 0 | 1040 | areg_05 = 0x0b; |
1021 | switch (tv_audio_mode) { | 1041 | break; |
1022 | case TV_MONO: | 1042 | /* Korea */ |
1023 | areg_06 = (nicam_flag) ? 0x03 : 0x00; | 1043 | case V4L2_STD_NTSC_M_KR: |
1024 | break; | 1044 | areg_05 = 0x04; |
1025 | case TV_LANG_A: | 1045 | break; |
1026 | areg_06 = 0x00; | 1046 | /* EIAJ */ |
1027 | break; | 1047 | case V4L2_STD_NTSC_M_JP: |
1028 | case TV_LANG_B: | 1048 | areg_05 = 0x03; |
1029 | areg_06 = 0x01; | 1049 | break; |
1050 | default: | ||
1051 | areg_05 = 0x02; | ||
1052 | break; | ||
1053 | } | ||
1030 | break; | 1054 | break; |
1031 | } | 1055 | } |
1032 | #endif | ||
1033 | |||
1034 | if (mono_flag) | ||
1035 | areg_06 = 0x00; | ||
1036 | 1056 | ||
1037 | tm6000_set_reg(dev, TM6010_REQ08_R01_A_INIT, 0x00); | 1057 | tm6000_set_reg(dev, TM6010_REQ08_R01_A_INIT, 0x00); |
1038 | tm6000_set_reg(dev, TM6010_REQ08_R02_A_FIX_GAIN_CTRL, areg_02); | 1058 | tm6000_set_reg(dev, TM6010_REQ08_R02_A_FIX_GAIN_CTRL, areg_02); |
@@ -1066,9 +1086,6 @@ static int tm6000_set_audio_std(struct tm6000_core *dev, | |||
1066 | tm6000_set_reg(dev, TM6010_REQ08_R1E_A_GAIN_DEEMPH_OUT, 0x13); | 1086 | tm6000_set_reg(dev, TM6010_REQ08_R1E_A_GAIN_DEEMPH_OUT, 0x13); |
1067 | tm6000_set_reg(dev, TM6010_REQ08_R1F_A_TEST_INTF_SEL, 0x00); | 1087 | tm6000_set_reg(dev, TM6010_REQ08_R1F_A_TEST_INTF_SEL, 0x00); |
1068 | tm6000_set_reg(dev, TM6010_REQ08_R20_A_TEST_PIN_SEL, 0x00); | 1088 | tm6000_set_reg(dev, TM6010_REQ08_R20_A_TEST_PIN_SEL, 0x00); |
1069 | tm6000_set_reg(dev, TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3); | ||
1070 | tm6000_set_reg(dev, TM6010_REQ08_R06_A_SOUND_MOD, 0x00); | ||
1071 | tm6000_set_reg(dev, TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc); | ||
1072 | tm6000_set_reg(dev, TM6010_REQ08_R01_A_INIT, 0x80); | 1089 | tm6000_set_reg(dev, TM6010_REQ08_R01_A_INIT, 0x80); |
1073 | 1090 | ||
1074 | return 0; | 1091 | return 0; |
diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index a434a32454db..e1a7eb238727 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/usb.h> | 34 | #include <linux/usb.h> |
35 | #include <linux/videodev2.h> | 35 | #include <linux/videodev2.h> |
36 | #include <media/v4l2-ioctl.h> | 36 | #include <media/v4l2-ioctl.h> |
37 | #include <media/tuner.h> | ||
37 | #include <linux/interrupt.h> | 38 | #include <linux/interrupt.h> |
38 | #include <linux/kthread.h> | 39 | #include <linux/kthread.h> |
39 | #include <linux/highmem.h> | 40 | #include <linux/highmem.h> |
@@ -883,14 +884,19 @@ static void res_free(struct tm6000_core *dev, struct tm6000_fh *fh) | |||
883 | static int vidioc_querycap(struct file *file, void *priv, | 884 | static int vidioc_querycap(struct file *file, void *priv, |
884 | struct v4l2_capability *cap) | 885 | struct v4l2_capability *cap) |
885 | { | 886 | { |
887 | struct tm6000_core *dev = ((struct tm6000_fh *)priv)->dev; | ||
886 | 888 | ||
887 | strlcpy(cap->driver, "tm6000", sizeof(cap->driver)); | 889 | strlcpy(cap->driver, "tm6000", sizeof(cap->driver)); |
888 | strlcpy(cap->card, "Trident TVMaster TM5600/6000/6010", sizeof(cap->card)); | 890 | strlcpy(cap->card, "Trident TVMaster TM5600/6000/6010", sizeof(cap->card)); |
889 | cap->version = TM6000_VERSION; | 891 | cap->version = TM6000_VERSION; |
890 | cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | | 892 | cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | |
891 | V4L2_CAP_STREAMING | | 893 | V4L2_CAP_STREAMING | |
892 | V4L2_CAP_TUNER | | 894 | V4L2_CAP_AUDIO | |
893 | V4L2_CAP_READWRITE; | 895 | V4L2_CAP_READWRITE; |
896 | |||
897 | if (dev->tuner_type != TUNER_ABSENT) | ||
898 | cap->capabilities |= V4L2_CAP_TUNER; | ||
899 | |||
894 | return 0; | 900 | return 0; |
895 | } | 901 | } |
896 | 902 | ||
@@ -1150,7 +1156,7 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i) | |||
1150 | return rc; | 1156 | return rc; |
1151 | } | 1157 | } |
1152 | 1158 | ||
1153 | /* --- controls ---------------------------------------------- */ | 1159 | /* --- controls ---------------------------------------------- */ |
1154 | static int vidioc_queryctrl(struct file *file, void *priv, | 1160 | static int vidioc_queryctrl(struct file *file, void *priv, |
1155 | struct v4l2_queryctrl *qc) | 1161 | struct v4l2_queryctrl *qc) |
1156 | { | 1162 | { |
@@ -1251,7 +1257,11 @@ static int vidioc_g_tuner(struct file *file, void *priv, | |||
1251 | t->type = V4L2_TUNER_ANALOG_TV; | 1257 | t->type = V4L2_TUNER_ANALOG_TV; |
1252 | t->capability = V4L2_TUNER_CAP_NORM; | 1258 | t->capability = V4L2_TUNER_CAP_NORM; |
1253 | t->rangehigh = 0xffffffffUL; | 1259 | t->rangehigh = 0xffffffffUL; |
1254 | t->rxsubchans = V4L2_TUNER_SUB_MONO; | 1260 | t->rxsubchans = V4L2_TUNER_SUB_STEREO; |
1261 | |||
1262 | v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t); | ||
1263 | |||
1264 | t->audmode = dev->amode; | ||
1255 | 1265 | ||
1256 | return 0; | 1266 | return 0; |
1257 | } | 1267 | } |
@@ -1267,6 +1277,10 @@ static int vidioc_s_tuner(struct file *file, void *priv, | |||
1267 | if (0 != t->index) | 1277 | if (0 != t->index) |
1268 | return -EINVAL; | 1278 | return -EINVAL; |
1269 | 1279 | ||
1280 | dev->amode = t->audmode; | ||
1281 | dprintk(dev, 3, "audio mode: %x\n", t->audmode); | ||
1282 | |||
1283 | v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_tuner, t); | ||
1270 | return 0; | 1284 | return 0; |
1271 | } | 1285 | } |
1272 | 1286 | ||
@@ -1320,7 +1334,11 @@ static int radio_querycap(struct file *file, void *priv, | |||
1320 | le16_to_cpu(dev->udev->descriptor.idVendor), | 1334 | le16_to_cpu(dev->udev->descriptor.idVendor), |
1321 | le16_to_cpu(dev->udev->descriptor.idProduct)); | 1335 | le16_to_cpu(dev->udev->descriptor.idProduct)); |
1322 | cap->version = dev->dev_type; | 1336 | cap->version = dev->dev_type; |
1323 | cap->capabilities = V4L2_CAP_TUNER; | 1337 | cap->capabilities = V4L2_CAP_TUNER | |
1338 | V4L2_CAP_AUDIO | | ||
1339 | V4L2_CAP_RADIO | | ||
1340 | V4L2_CAP_READWRITE | | ||
1341 | V4L2_CAP_STREAMING; | ||
1324 | 1342 | ||
1325 | return 0; | 1343 | return 0; |
1326 | } | 1344 | } |
@@ -1337,17 +1355,10 @@ static int radio_g_tuner(struct file *file, void *priv, | |||
1337 | memset(t, 0, sizeof(*t)); | 1355 | memset(t, 0, sizeof(*t)); |
1338 | strcpy(t->name, "Radio"); | 1356 | strcpy(t->name, "Radio"); |
1339 | t->type = V4L2_TUNER_RADIO; | 1357 | t->type = V4L2_TUNER_RADIO; |
1358 | t->rxsubchans = V4L2_TUNER_SUB_STEREO; | ||
1340 | 1359 | ||
1341 | v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t); | 1360 | v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t); |
1342 | 1361 | ||
1343 | if ((dev->aradio == TM6000_AIP_LINE1) || | ||
1344 | (dev->aradio == TM6000_AIP_LINE2)) { | ||
1345 | t->rxsubchans = V4L2_TUNER_SUB_MONO; | ||
1346 | } | ||
1347 | else { | ||
1348 | t->rxsubchans = V4L2_TUNER_SUB_STEREO; | ||
1349 | } | ||
1350 | |||
1351 | return 0; | 1362 | return 0; |
1352 | } | 1363 | } |
1353 | 1364 | ||
diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index 8cdc992da5a5..43b0d6265bcb 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h | |||
@@ -221,6 +221,7 @@ struct tm6000_core { | |||
221 | 221 | ||
222 | int ctl_mute; /* audio */ | 222 | int ctl_mute; /* audio */ |
223 | int ctl_volume; | 223 | int ctl_volume; |
224 | int amode; | ||
224 | 225 | ||
225 | /* DVB-T support */ | 226 | /* DVB-T support */ |
226 | struct tm6000_dvb *dvb; | 227 | struct tm6000_dvb *dvb; |