[linux-dvb] Patches to fix support for VisionPlus DTV (VP1020) / tuning problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This revised patch for dst.c also fixes the tuning problems. It seems 
that sometimes the asic acknowledged a command but failed to execute it. 
This might have also be the reason why sometimes szap reported that the 
tuner supposedly had lost the lock on the signal even though it did not.

The values for signal-quality (dB) and signal-level are returned at 
different offsets and need to be converted for this particular 
VisionPlus card.
-------------- next part --------------
*** dst_common.h.orig	2005-04-23 17:30:45.000000000 +0200
--- dst_common.h	2005-04-23 17:31:02.000000000 +0200
***************
*** 46,51 ****
--- 46,52 ----
  #define DST_TYPE_HAS_FW_1	8
  #define DST_TYPE_HAS_FW_2	16
  #define DST_TYPE_HAS_FW_3	32
+ #define DST_TYPE_CONV_LEVEL_SNR 64
  
  
  
-------------- next part --------------
*** dst.c.orig	2005-04-23 17:30:19.000000000 +0200
--- dst.c	2005-04-23 17:30:56.000000000 +0200
*************** MODULE_PARM_DESC(new_fw, "Support for th
*** 58,63 ****
--- 58,65 ----
  #define ATTEMPT_TUNE	2
  #define HAS_POWER	4
  
+ #define ASIC_DELAY     50
+ 
  static void dst_packsize(struct dst_state* state, int psize)
  {
  	union dst_gpio_packet bits;
*************** int rdc_reset_state(struct dst_state *st
*** 129,139 ****
  		return -1;
  	}
  
! 	msleep(10);
  
  	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);
  		return -1;
  	}
  
--- 131,141 ----
  		return -1;
  	}
  
! 	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(ASIC_DELAY);
  		return -1;
  	}
  
*************** int dst_error_recovery(struct dst_state 
*** 213,221 ****
  {
  	dprintk("%s: Trying to return from previous errors...\n", __FUNCTION__);
  	dst_pio_disable(state);
! 	msleep(10);
  	dst_pio_enable(state);
! 	msleep(10);
  
  	return 0;
  }
--- 215,223 ----
  {
  	dprintk("%s: Trying to return from previous errors...\n", __FUNCTION__);
  	dst_pio_disable(state);
! 	msleep(ASIC_DELAY);
  	dst_pio_enable(state);
! 	msleep(ASIC_DELAY);
  
  	return 0;
  }
*************** int dst_error_bailout(struct dst_state *
*** 226,232 ****
  	dprintk("%s: Trying to bailout from previous error...\n", __FUNCTION__);
  	rdc_8820_reset(state);
  	dst_pio_disable(state);
! 	msleep(10);
  
  	return 0;
  }
--- 228,234 ----
  	dprintk("%s: Trying to bailout from previous error...\n", __FUNCTION__);
  	rdc_8820_reset(state);
  	dst_pio_disable(state);
! 	msleep(ASIC_DELAY);
  
  	return 0;
  }
*************** int dst_comm_init(struct dst_state* stat
*** 245,250 ****
--- 247,257 ----
  		dprintk("%s: RDC 8820 State RESET Failed.\n", __FUNCTION__);
  		return -1;
  	}
+ 	msleep(ASIC_DELAY);
+ 	dst_wait_dst_ready(state,NO_DELAY);
+ 	dst_pio_enable(state);
+ 	msleep(ASIC_DELAY);
+ 
  	return 0;
  }
  EXPORT_SYMBOL(dst_comm_init);
*************** struct dst_types dst_tlist[] = {
*** 684,689 ****
--- 691,704 ----
  		.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
+         },
+ 
  	{ }
  
  };
*************** static int dst_get_device_id(struct dst_
*** 702,707 ****
--- 717,727 ----
  
  	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		*/
  
*************** static int dst_get_device_id(struct dst_
*** 732,738 ****
  	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))) {
  			use_type_flags = p_dst_type->type_flags;
  			use_dst_type = p_dst_type->dst_type;
  
--- 752,758 ----
  	state->rxbuffer[7] = '\0';
  
  	for (i = 0, p_dst_type = dst_tlist; i < ARRAY_SIZE (dst_tlist); i++, p_dst_type++) {
! 		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;
  
*************** static int dst_probe(struct dst_state *s
*** 770,779 ****
  		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__);
--- 790,795 ----
*************** static int dst_get_signal(struct dst_sta
*** 861,869 ****
  		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];
  		} 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;
--- 877,893 ----
  		if (retval < 0)
  			return retval;
  		if (state->dst_type == DST_TYPE_IS_SAT) {
! 		        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;
*************** static int dst_get_tuna(struct dst_state
*** 911,917 ****
  	if (!dst_wait_dst_ready(state, NO_DELAY))
  		return 0;
  
! 	msleep(10);
  
  	if (state->type_flags & DST_TYPE_HAS_NEWTUNE) {
  		/* how to get variable length reply ???? */
--- 935,941 ----
  	if (!dst_wait_dst_ready(state, NO_DELAY))
  		return 0;
  
! 	msleep(ASIC_DELAY);
  
  	if (state->type_flags & DST_TYPE_HAS_NEWTUNE) {
  		/* how to get variable length reply ???? */

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux