Manu Abraham wrote: > With your patch my cards (VP-1030A, VP-1032A, DST-03T, DST-MOT) which > were working quite okay, gave similar results as attached The current > result is from the VP-1030, but in fact all the said cards had the same > problem.. I have asked a couple of others to check whether it works for > them at least .. Let's see what can be done .. I changed my patch and I hope that this patch works better with the other cards. The default value for asic_delay is 10 ms again and can be changed on loading the module. My card needs approximately 30 ms with this new patch. If the delay is way too small (i.e. 10ms) the asic "accepts" a command but it doesn't seem to execute it correctly. If the delay is almost long enough (28ms) the asic often doesn't accept the command and returns an error. -------------- next part -------------- --- dst.c.orig 2005-04-25 11:21:06.000000000 +0200 +++ dst.c 2005-04-25 12:36:56.000000000 +0200 @@ -50,6 +50,9 @@ module_param(new_fw, int, 0644); MODULE_PARM_DESC(new_fw, "Support for the new interface firmware, default 0"); +static unsigned int asic_delay = 10; +module_param(asic_delay, int, 0644); +MODULE_PARM_DESC(asic_delay, "Delay needed for the asic used by the twinhan card, default is 10 (ms)"); #define dprintk if (debug) printk @@ -89,7 +92,7 @@ return 0; if (delay) - msleep(10); + msleep(asic_delay); bits.outp.mask = enbb; bits.outp.highvals = outhigh; @@ -129,11 +132,11 @@ return -1; } - msleep(10); + msleep(asic_delay); if (dst_gpio_outb(state, RDC_8820_INT, RDC_8820_INT, RDC_8820_INT, NO_DELAY) < 0) { dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__); - msleep(10); + msleep(asic_delay); return -1; } @@ -213,9 +216,9 @@ { dprintk("%s: Trying to return from previous errors...\n", __FUNCTION__); dst_pio_disable(state); - msleep(10); + msleep(asic_delay); dst_pio_enable(state); - msleep(10); + msleep(asic_delay); return 0; } @@ -226,7 +229,7 @@ dprintk("%s: Trying to bailout from previous error...\n", __FUNCTION__); rdc_8820_reset(state); dst_pio_disable(state); - msleep(10); + msleep(asic_delay); return 0; } @@ -245,6 +248,8 @@ dprintk("%s: RDC 8820 State RESET Failed.\n", __FUNCTION__); return -1; } + msleep(asic_delay); + return 0; } EXPORT_SYMBOL(dst_comm_init); @@ -684,6 +689,14 @@ .dst_feature = 0 }, + { + .device_id = "200103A", + .offset = 0, + .dst_type = DST_TYPE_IS_SAT, + .type_flags = DST_TYPE_HAS_SYMDIV | DST_TYPE_HAS_FW_1 | DST_TYPE_CONV_LEVEL_SNR, + .dst_feature = 0 + }, + { } }; @@ -702,6 +715,11 @@ device_type[7] = dst_check_sum(device_type, 7); + if ((dst_comm_init(state)) < 0) { + dprintk("%s: DST Communication initialization failed.\n", __FUNCTION__); + return -1; + } + if (write_dst(state, device_type, FIXED_COMM)) return -1; /* Write failed */ @@ -732,7 +750,7 @@ state->rxbuffer[7] = '\0'; for (i = 0, p_dst_type = dst_tlist; i < ARRAY_SIZE (dst_tlist); i++, p_dst_type++) { - if (!strncmp (&state->rxbuffer[p_dst_type->offset], p_dst_type->device_id, strlen (p_dst_type->device_id))) { + if (p_dst_type->device_id!=NULL && !strncmp (&state->rxbuffer[p_dst_type->offset], p_dst_type->device_id, strlen (p_dst_type->device_id))) { use_type_flags = p_dst_type->type_flags; use_dst_type = p_dst_type->dst_type; @@ -770,10 +788,6 @@ return -1; } msleep(4000); - if ((dst_comm_init(state)) < 0) { - dprintk("%s: DST Initialization Failed.\n", __FUNCTION__); - return -1; - } if (dst_get_device_id(state) < 0) { dprintk("%s: unknown device.\n", __FUNCTION__); @@ -861,9 +875,17 @@ if (retval < 0) return retval; if (state->dst_type == DST_TYPE_IS_SAT) { - state->decode_lock = ((state->rxbuffer[6] & 0x10) == 0) ? 1 : 0; - state->decode_strength = state->rxbuffer[5] << 8; - state->decode_snr = state->rxbuffer[2] << 8 | state->rxbuffer[3]; + if (state->type_flags & DST_TYPE_CONV_LEVEL_SNR) { + state->decode_lock = ((state->rxbuffer[6] & 0x10) == 0) ?1 : 0; + state->decode_strength = 65535- (state->rxbuffer[5] << 8); + state->decode_snr = state->rxbuffer[2] << 8 | state->rxbuffer[3]; + if (state->decode_snr==0) state->decode_snr=65535; + else state->decode_snr=(u16)((u32)265850e3/(u32)state->decode_snr); + } else { + state->decode_lock = ((state->rxbuffer[6] & 0x10) == 0) ? 1 : 0; + state->decode_strength = state->rxbuffer[5] << 8; + state->decode_snr = state->rxbuffer[2] << 8 | state->rxbuffer[3]; + } } else if ((state->dst_type == DST_TYPE_IS_TERR) || (state->dst_type == DST_TYPE_IS_CABLE)) { state->decode_lock = (state->rxbuffer[1]) ? 1 : 0; state->decode_strength = state->rxbuffer[4] << 8; @@ -911,7 +933,7 @@ if (!dst_wait_dst_ready(state, NO_DELAY)) return 0; - msleep(10); + msleep(asic_delay); if (state->type_flags & DST_TYPE_HAS_NEWTUNE) { /* how to get variable length reply ???? */