aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorManu Abraham <abraham.manu@gmail.com>2006-06-21 09:28:27 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-06-25 01:05:18 -0400
commitde1e6ec9f21ebd65d779524b614307291228a623 (patch)
tree3460e3af4e42253bd683d686fe39d69798140a1f /drivers/media
parent9500c7b05b1a618a32d49a249c28c98bcb039e35 (diff)
V4L/DVB (4174): Distinguish between STV0299 and MB86A15 based NIM's
Signed-off-by: Manu Abraham <manu@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/bt8xx/dst.c81
1 files changed, 72 insertions, 9 deletions
diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c
index 2e0c6e73d4ae..4a70d2a6f74f 100644
--- a/drivers/media/dvb/bt8xx/dst.c
+++ b/drivers/media/dvb/bt8xx/dst.c
@@ -962,6 +962,58 @@ static int dst_get_vendor(struct dst_state *state)
962 return 0; 962 return 0;
963} 963}
964 964
965static void debug_dst_buffer(struct dst_state *state)
966{
967 int i;
968
969 if (verbose > 2) {
970 printk("%s: [", __func__);
971 for (i = 0; i < 8; i++)
972 printk(" %02x", state->rxbuffer[i]);
973 printk("]\n");
974 }
975}
976
977static int dst_check_stv0299(struct dst_state *state)
978{
979 u8 check_stv0299[] = { 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
980
981 check_stv0299[7] = dst_check_sum(check_stv0299, 7);
982 if (dst_command(state, check_stv0299, 8) < 0) {
983 dprintk(verbose, DST_ERROR, 1, "Cmd=[0x04] failed");
984 return -1;
985 }
986 debug_dst_buffer(state);
987
988 if (memcmp(&check_stv0299, &state->rxbuffer, 8)) {
989 dprintk(verbose, DST_ERROR, 1, "Found a STV0299 NIM");
990 state->tuner_type = TUNER_TYPE_STV0299;
991 return 0;
992 }
993
994 return -1;
995}
996
997static int dst_check_mb86a15(struct dst_state *state)
998{
999 u8 check_mb86a15[] = { 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
1000
1001 check_mb86a15[7] = dst_check_sum(check_mb86a15, 7);
1002 if (dst_command(state, check_mb86a15, 8) < 0) {
1003 dprintk(verbose, DST_ERROR, 1, "Cmd=[0x10], failed");
1004 return -1;
1005 }
1006 debug_dst_buffer(state);
1007
1008 if (memcmp(&check_mb86a15, &state->rxbuffer, 8) < 0) {
1009 dprintk(verbose, DST_ERROR, 1, "Found a MB86A15 NIM");
1010 state->tuner_type = TUNER_TYPE_MB86A15;
1011 return 0;
1012 }
1013
1014 return -1;
1015}
1016
965static int dst_get_tuner_info(struct dst_state *state) 1017static int dst_get_tuner_info(struct dst_state *state)
966{ 1018{
967 u8 get_tuner_1[] = { 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 1019 u8 get_tuner_1[] = { 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
@@ -1006,14 +1058,15 @@ static int dst_get_device_id(struct dst_state *state)
1006 u8 reply; 1058 u8 reply;
1007 1059
1008 int i, j; 1060 int i, j;
1009 struct dst_types *p_dst_type; 1061 struct dst_types *p_dst_type = NULL;
1010 struct tuner_types *p_tuner_list; 1062 struct tuner_types *p_tuner_list = NULL;
1011 1063
1012 u8 use_dst_type = 0; 1064 u8 use_dst_type = 0;
1013 u32 use_type_flags = 0; 1065 u32 use_type_flags = 0;
1014 1066
1015 static u8 device_type[8] = {0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff}; 1067 static u8 device_type[8] = {0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff};
1016 1068
1069 state->tuner_type = 0;
1017 device_type[7] = dst_check_sum(device_type, 7); 1070 device_type[7] = dst_check_sum(device_type, 7);
1018 1071
1019 if (write_dst(state, device_type, FIXED_COMM)) 1072 if (write_dst(state, device_type, FIXED_COMM))
@@ -1047,14 +1100,24 @@ static int dst_get_device_id(struct dst_state *state)
1047 state->dst_hw_cap = p_dst_type->dst_feature; 1100 state->dst_hw_cap = p_dst_type->dst_feature;
1048 dprintk(verbose, DST_ERROR, 1, "Recognise [%s]", p_dst_type->device_id); 1101 dprintk(verbose, DST_ERROR, 1, "Recognise [%s]", p_dst_type->device_id);
1049 1102
1050 if (p_dst_type->tuner_type != TUNER_TYPE_MULTI) { 1103// if (p_dst_type->tuner_type != TUNER_TYPE_MULTI) {
1104 /* Multiple tuners */
1105 if (p_dst_type->tuner_type & TUNER_TYPE_MULTI) {
1106 /* STV0299 check */
1107 if (dst_check_stv0299(state) < 0)
1108 dprintk(verbose, DST_ERROR, 1, "Unsupported");
1109 /* MB86A15 check */
1110 if (dst_check_mb86a15(state) < 0)
1111 dprintk(verbose, DST_ERROR, 1, "Unsupported");
1112 /* Single tuner */
1113 } else {
1051 state->tuner_type = p_dst_type->tuner_type; 1114 state->tuner_type = p_dst_type->tuner_type;
1052 1115 }
1053 for (j = 0, p_tuner_list = tuner_list; j < ARRAY_SIZE(tuner_list); j++, p_tuner_list++) { 1116 for (j = 0, p_tuner_list = tuner_list; j < ARRAY_SIZE(tuner_list); j++, p_tuner_list++) {
1054 if (p_dst_type->tuner_type == p_tuner_list->tuner_type) { 1117 if (!(strncmp(p_dst_type->device_id, p_tuner_list->fw_name, 7)) &&
1055 state->tuner_type = p_tuner_list->tuner_type; 1118 p_tuner_list->tuner_type == state->tuner_type) {
1056 dprintk(verbose, DST_ERROR, 1, "DST has a [%s] based tuner", p_tuner_list->tuner_name); 1119 dprintk(verbose, DST_ERROR, 1, "[%s] has a [%s]",
1057 } 1120 p_dst_type->device_id, p_tuner_list->tuner_name);
1058 } 1121 }
1059 } 1122 }
1060 break; 1123 break;