From 14fd0cc48210f619a185198cdfb41fb3cf7d721c Mon Sep 17 00:00:00 2001 From: Manu Abraham Date: Wed, 21 Jun 2006 10:28:27 -0300 Subject: [PATCH] --- yaml --- r: 30047 b: refs/heads/master c: de1e6ec9f21ebd65d779524b614307291228a623 h: refs/heads/master i: 30045: 6bd59b7d17845d0dcf63b522a85c395c6d898ac1 30043: 3a23c3a4ddd32d2f42511f45b841b9749beb9efe 30039: be22b9aac05df0a5b6cdb2e4eb0b6297c59c4edf 30031: 7f2153361a48467325762a969d9aa7c4f6446c18 30015: 21b5adf9455e77fc0e356c4deb327e115b759732 v: v3 --- [refs] | 2 +- trunk/drivers/media/dvb/bt8xx/dst.c | 81 +++++++++++++++++++++++++---- 2 files changed, 73 insertions(+), 10 deletions(-) diff --git a/[refs] b/[refs] index ae6cfef4d88f..677c553ceff7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9500c7b05b1a618a32d49a249c28c98bcb039e35 +refs/heads/master: de1e6ec9f21ebd65d779524b614307291228a623 diff --git a/trunk/drivers/media/dvb/bt8xx/dst.c b/trunk/drivers/media/dvb/bt8xx/dst.c index 2e0c6e73d4ae..4a70d2a6f74f 100644 --- a/trunk/drivers/media/dvb/bt8xx/dst.c +++ b/trunk/drivers/media/dvb/bt8xx/dst.c @@ -962,6 +962,58 @@ static int dst_get_vendor(struct dst_state *state) return 0; } +static void debug_dst_buffer(struct dst_state *state) +{ + int i; + + if (verbose > 2) { + printk("%s: [", __func__); + for (i = 0; i < 8; i++) + printk(" %02x", state->rxbuffer[i]); + printk("]\n"); + } +} + +static int dst_check_stv0299(struct dst_state *state) +{ + u8 check_stv0299[] = { 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + + check_stv0299[7] = dst_check_sum(check_stv0299, 7); + if (dst_command(state, check_stv0299, 8) < 0) { + dprintk(verbose, DST_ERROR, 1, "Cmd=[0x04] failed"); + return -1; + } + debug_dst_buffer(state); + + if (memcmp(&check_stv0299, &state->rxbuffer, 8)) { + dprintk(verbose, DST_ERROR, 1, "Found a STV0299 NIM"); + state->tuner_type = TUNER_TYPE_STV0299; + return 0; + } + + return -1; +} + +static int dst_check_mb86a15(struct dst_state *state) +{ + u8 check_mb86a15[] = { 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + + check_mb86a15[7] = dst_check_sum(check_mb86a15, 7); + if (dst_command(state, check_mb86a15, 8) < 0) { + dprintk(verbose, DST_ERROR, 1, "Cmd=[0x10], failed"); + return -1; + } + debug_dst_buffer(state); + + if (memcmp(&check_mb86a15, &state->rxbuffer, 8) < 0) { + dprintk(verbose, DST_ERROR, 1, "Found a MB86A15 NIM"); + state->tuner_type = TUNER_TYPE_MB86A15; + return 0; + } + + return -1; +} + static int dst_get_tuner_info(struct dst_state *state) { 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) u8 reply; int i, j; - struct dst_types *p_dst_type; - struct tuner_types *p_tuner_list; + struct dst_types *p_dst_type = NULL; + struct tuner_types *p_tuner_list = NULL; u8 use_dst_type = 0; u32 use_type_flags = 0; static u8 device_type[8] = {0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff}; + state->tuner_type = 0; device_type[7] = dst_check_sum(device_type, 7); if (write_dst(state, device_type, FIXED_COMM)) @@ -1047,14 +1100,24 @@ static int dst_get_device_id(struct dst_state *state) state->dst_hw_cap = p_dst_type->dst_feature; dprintk(verbose, DST_ERROR, 1, "Recognise [%s]", p_dst_type->device_id); - if (p_dst_type->tuner_type != TUNER_TYPE_MULTI) { +// if (p_dst_type->tuner_type != TUNER_TYPE_MULTI) { + /* Multiple tuners */ + if (p_dst_type->tuner_type & TUNER_TYPE_MULTI) { + /* STV0299 check */ + if (dst_check_stv0299(state) < 0) + dprintk(verbose, DST_ERROR, 1, "Unsupported"); + /* MB86A15 check */ + if (dst_check_mb86a15(state) < 0) + dprintk(verbose, DST_ERROR, 1, "Unsupported"); + /* Single tuner */ + } else { state->tuner_type = p_dst_type->tuner_type; - - for (j = 0, p_tuner_list = tuner_list; j < ARRAY_SIZE(tuner_list); j++, p_tuner_list++) { - if (p_dst_type->tuner_type == p_tuner_list->tuner_type) { - state->tuner_type = p_tuner_list->tuner_type; - dprintk(verbose, DST_ERROR, 1, "DST has a [%s] based tuner", p_tuner_list->tuner_name); - } + } + for (j = 0, p_tuner_list = tuner_list; j < ARRAY_SIZE(tuner_list); j++, p_tuner_list++) { + if (!(strncmp(p_dst_type->device_id, p_tuner_list->fw_name, 7)) && + p_tuner_list->tuner_type == state->tuner_type) { + dprintk(verbose, DST_ERROR, 1, "[%s] has a [%s]", + p_dst_type->device_id, p_tuner_list->tuner_name); } } break;