[linux-dvb] [PATCH] Twinhan-fixes was --fix support for VisionPlus DTV (VP1020)

Steffen Motzer motzersn at tlink.de
Thu Apr 28 16:51:02 CEST 2005


Manu Abraham wrote:

> Can you check whether the attached patches works for you, for the
> (VP-1020, 200103A) ?

With my card tuning works fine. I have attached a patch that converts 
the strength and snr values returned by the asic. It seems that the asic 
simply returns some registers of the tuner (STV0299B) without any 
further processing.

I noticed something strange while making this patch: In dst_get_signal 
the flag 0x10 in rxbuffer[6] used to be set, when the tuner had lost the 
lock on the signal. This worked with older drivers but with the latest 
driver the bit never gets set when the tuner no longer receives a signal.
-------------- next part --------------
--- dst_common.h.orig	2005-04-28 13:59:48.000000000 +0200
+++ dst_common.h	2005-04-28 14:00:36.000000000 +0200
@@ -47,7 +47,7 @@
 #define DST_TYPE_HAS_FW_2	16
 #define DST_TYPE_HAS_FW_3	32
 #define DST_TYPE_HAS_FW_BUILD	64
-
+#define DST_TYPE_CONV_STV0299   128
 
 /*	Card capability list	*/
 
-------------- next part --------------
--- dst.c.orig	2005-04-28 10:16:41.000000000 +0200
+++ dst.c	2005-04-28 16:27:37.000000000 +0200
@@ -583,7 +583,7 @@
 		.device_id = "200103A",
 		.offset = 0,
 		.dst_type =  DST_TYPE_IS_SAT,
-		.type_flags = DST_TYPE_HAS_SYMDIV | DST_TYPE_HAS_FW_1,
+		.type_flags = DST_TYPE_HAS_SYMDIV | DST_TYPE_HAS_FW_1 |  DST_TYPE_CONV_STV0299,
 		.dst_feature = 0
 	},	/*	obsolete	*/
 
@@ -891,6 +891,12 @@
 			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_STV0299) {
+			        s32 snr=((0xffff-state->decode_snr)-0xa100)*3;
+				s32 signal=(0xffff-state->decode_strength)*5/4;
+				state->decode_snr=(snr > 0xffff) ? 0xffff : (snr < 0) ? 0 : snr;
+				state->decode_strength =(signal > 0xffff) ? 0xffff : (signal < 0) ? 0 : signal;
+			}
 		} 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;


More information about the linux-dvb mailing list