mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johannes Stezenbach <js@linuxtv.org>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [DVB patch 30/37] DST: fixed tuning problem
Date: Sun, 08 May 2005 20:42:59 +0200	[thread overview]
Message-ID: <20050508184349.197853000@abc> (raw)
In-Reply-To: <20050508184229.957247000@abc>

[-- Attachment #1: dvb-bt8xx-dst-tuning.patch --]
[-- Type: text/plain, Size: 7056 bytes --]

fixed a tuning problem for cards based on the old firmware
(Steffen Motzer, Manu Abraham)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
---

 drivers/media/dvb/bt8xx/dst.c        |   57 +++++++++++++++++++++++------------
 drivers/media/dvb/bt8xx/dst_common.h |    6 +--
 2 files changed, 41 insertions(+), 22 deletions(-)

Index: linux-2.6.12-rc4/drivers/media/dvb/bt8xx/dst.c
===================================================================
--- linux-2.6.12-rc4.orig/drivers/media/dvb/bt8xx/dst.c	2005-05-08 18:13:39.000000000 +0200
+++ linux-2.6.12-rc4/drivers/media/dvb/bt8xx/dst.c	2005-05-08 18:13:44.000000000 +0200
@@ -81,9 +81,7 @@ int dst_gpio_outb(struct dst_state* stat
 		dprintk("%s: dst_gpio_enb error (err == %i, mask == %02x, enb == %02x)\n", __FUNCTION__, err, mask, enbb);
 		return -EREMOTEIO;
 	}
-
-	msleep(1);
-
+	udelay(1000);
 	/* because complete disabling means no output, no need to do output packet */
 	if (enbb == 0)
 		return 0;
@@ -150,8 +148,7 @@ int rdc_8820_reset(struct dst_state *sta
 		dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__);
 		return -1;
 	}
-	msleep(1);
-
+	udelay(1000);
 	if (dst_gpio_outb(state, RDC_8820_RESET, RDC_8820_RESET, RDC_8820_RESET, DELAY) < 0) {
 		dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__);
 		return -1;
@@ -167,8 +164,7 @@ int dst_pio_enable(struct dst_state *sta
 		dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__);
 		return -1;
 	}
-	msleep(1);
-
+	udelay(1000);
 	return 0;
 }
 EXPORT_SYMBOL(dst_pio_enable);
@@ -179,6 +175,8 @@ int dst_pio_disable(struct dst_state *st
 		dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__);
 		return -1;
 	}
+	if (state->type_flags & DST_TYPE_HAS_FW_1)
+		udelay(1000);
 
 	return 0;
 }
@@ -200,7 +198,7 @@ int dst_wait_dst_ready(struct dst_state 
 				dprintk("%s: dst wait ready after %d\n", __FUNCTION__, i);
 			return 1;
 		}
-		msleep(1);
+		msleep(35);
 	}
 	if (verbose > 1)
 		dprintk("%s: dst wait NOT ready after %d\n", __FUNCTION__, i);
@@ -245,6 +243,11 @@ int dst_comm_init(struct dst_state* stat
 		dprintk("%s: RDC 8820 State RESET Failed.\n", __FUNCTION__);
 		return -1;
 	}
+	if (state->type_flags & DST_TYPE_HAS_FW_1)
+		msleep(100);
+	else
+		msleep(5);
+
 	return 0;
 }
 EXPORT_SYMBOL(dst_comm_init);
@@ -328,8 +331,9 @@ static int dst_set_freq(struct dst_state
 	u8 *val;
 
 	state->frequency = freq;
+	if (debug > 4)
+		dprintk("%s: set Frequency %u\n", __FUNCTION__, freq);
 
-	// dprintk("%s: set frequency %u\n", __FUNCTION__, freq);
 	if (state->dst_type == DST_TYPE_IS_SAT) {
 		freq = freq / 1000;
 		if (freq < 950 || freq > 2150)
@@ -452,7 +456,8 @@ static int dst_set_symbolrate(struct dst
 	if (state->dst_type == DST_TYPE_IS_TERR) {
 		return 0;
 	}
-	// dprintk("%s: set srate %u\n", __FUNCTION__, srate);
+	if (debug > 4)
+		dprintk("%s: set symrate %u\n", __FUNCTION__, srate);
 	srate /= 1000;
 	val = &state->tx_tuna[0];
 
@@ -461,7 +466,10 @@ static int dst_set_symbolrate(struct dst
 		sval <<= 20;
 		do_div(sval, 88000);
 		symcalc = (u32) sval;
-		// dprintk("%s: set symcalc %u\n", __FUNCTION__, symcalc);
+
+		if (debug > 4)
+			dprintk("%s: set symcalc %u\n", __FUNCTION__, symcalc);
+
 		val[5] = (u8) (symcalc >> 12);
 		val[6] = (u8) (symcalc >> 4);
 		val[7] = (u8) (symcalc << 4);
@@ -504,6 +512,7 @@ static void dst_type_flags_print(u32 typ
 		printk(" 0x%x firmware version = 2", DST_TYPE_HAS_FW_2);
 	if (type_flags & DST_TYPE_HAS_FW_3)
 		printk(" 0x%x firmware version = 3", DST_TYPE_HAS_FW_3);
+//	if ((type_flags & DST_TYPE_HAS_FW_BUILD) && new_fw)
 
 	printk("\n");
 }
@@ -617,13 +626,13 @@ struct dst_types dst_tlist[] = {
 		.dst_type = DST_TYPE_IS_SAT,
 		.type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_1,
 		.dst_feature = DST_TYPE_HAS_CA
-	},	/* unknown to vendor	*/
+	},	/*	An OEM board	*/
 
 	{
 		.device_id = "DSTMCI",
 		.offset = 1,
 		.dst_type = DST_TYPE_IS_SAT,
-		.type_flags = DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_2,
+		.type_flags = DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_2 | DST_TYPE_HAS_FW_BUILD,
 		.dst_feature = DST_TYPE_HAS_CA | DST_TYPE_HAS_DISEQC3 | DST_TYPE_HAS_DISEQC4
 							| DST_TYPE_HAS_MOTO | DST_TYPE_HAS_MAC
 	},
@@ -640,7 +649,8 @@ struct dst_types dst_tlist[] = {
 		.device_id = "DCT-CI",
 		.offset = 1,
 		.dst_type = DST_TYPE_IS_CABLE,
-		.type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_1									| DST_TYPE_HAS_FW_2,
+		.type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_1
+							| DST_TYPE_HAS_FW_2 | DST_TYPE_HAS_FW_BUILD,
 		.dst_feature = DST_TYPE_HAS_CA
 	},
 
@@ -656,7 +666,7 @@ struct dst_types dst_tlist[] = {
 		.device_id = "DTT-CI",
 		.offset = 1,
 		.dst_type = DST_TYPE_IS_TERR,
-		.type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_FW_2,
+		.type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_FW_2 | DST_TYPE_HAS_FW_BUILD,
 		.dst_feature = 0
 	},
 
@@ -782,7 +792,7 @@ static int dst_probe(struct dst_state *s
 		dprintk("%s: DST Initialization Failed.\n", __FUNCTION__);
 		return -1;
 	}
-
+	msleep(100);
 	if (dst_get_device_id(state) < 0) {
 		dprintk("%s: unknown device.\n", __FUNCTION__);
 		return -1;
@@ -812,6 +822,8 @@ int dst_command(struct dst_state* state,
 		dprintk("%s: PIO Disable Failed.\n", __FUNCTION__);
 		return -1;
 	}
+	if (state->type_flags & DST_TYPE_HAS_FW_1)
+		udelay(3000);
 
 	if (read_dst(state, &reply, GET_ACK)) {
 		if (verbose > 1)
@@ -829,6 +841,13 @@ int dst_command(struct dst_state* state,
 	}
 	if (len >= 2 && data[0] == 0 && (data[1] == 1 || data[1] == 3))
 		return 0;
+
+//	udelay(3000);
+	if (state->type_flags & DST_TYPE_HAS_FW_1)
+		udelay(3000);
+	else
+		udelay(2000);
+
 	if (!dst_wait_dst_ready(state, NO_DELAY))
 		return -1;
 
@@ -919,8 +938,6 @@ static int dst_get_tuna(struct dst_state
 	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 ???? */
 		retval = read_dst(state, state->rx_tuna, 10);
@@ -969,7 +986,9 @@ static int dst_write_tuna(struct dvb_fro
 	int retval;
 	u8 reply;
 
-	dprintk("%s: type_flags 0x%x \n", __FUNCTION__, state->type_flags);
+	if (debug > 4)
+		dprintk("%s: type_flags 0x%x \n", __FUNCTION__, state->type_flags);
+
 	state->decode_freq = 0;
 	state->decode_lock = state->decode_strength = state->decode_snr = 0;
 	if (state->dst_type == DST_TYPE_IS_SAT) {
Index: linux-2.6.12-rc4/drivers/media/dvb/bt8xx/dst_common.h
===================================================================
--- linux-2.6.12-rc4.orig/drivers/media/dvb/bt8xx/dst_common.h	2005-05-08 18:13:30.000000000 +0200
+++ linux-2.6.12-rc4/drivers/media/dvb/bt8xx/dst_common.h	2005-05-08 18:13:44.000000000 +0200
@@ -46,7 +46,7 @@
 #define DST_TYPE_HAS_FW_1	8
 #define DST_TYPE_HAS_FW_2	16
 #define DST_TYPE_HAS_FW_3	32
-
+#define DST_TYPE_HAS_FW_BUILD	64
 
 
 /*	Card capability list	*/
@@ -117,8 +117,8 @@ struct dst_types {
 	char *device_id;
 	int offset;
 	u8 dst_type;
-	u32 type_flags;
-	u8 dst_feature;
+	u64 type_flags;
+	u64 dst_feature;
 };
 
 

--


  parent reply	other threads:[~2005-05-08 20:09 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-08 18:42 [DVB patch 00/37] DVB updates for 2.6.12-rc4 Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 01/37] support for TT/Hauppauge Nexus-S Rev 2.3 Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 02/37] saa7146: no need to initialize static/global variables to 0 Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 03/37] dvb_frontend: fix module param Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 04/37] av7110: audio out fix Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 05/37] add support for KNC-1 cards Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 06/37] remove unnecessary casts in dvb-core Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 07/37] make dvb_class static Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 08/37] dvb_net: handle IPv6 and LLC/SNAP Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 09/37] av7110: fix VIDEO_SET_DISPLAY_FORMAT Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 10/37] av7110: fix NTSC/PAL switching Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 11/37] av7110: fix comment Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 12/37] av7110: fix indentation Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 13/37] nxt6000: support frontend status reads Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 14/37] tda1004x: formatting cleanups Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 15/37] stv0299: fix FE_DISHNETWORK_SEND_LEGACY_CMD Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 16/37] remove unnecessary casts in frontends Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 17/37] dib3000: add NULL pointer check Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 18/37] ves1820: remove unnecessary msleep Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 19/37] mt352: embed struct mt352_config in mt352_state Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 20/37] tda1004x: dont use bitfields Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 21/37] tda1004x: allow N_I2C to be overridden by the card driver Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 22/37] tda10046: support for different firmware versions Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 23/37] dvb-pll.h: prevent multiple inclusion Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 24/37] make needlessly global code static or drop it Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 25/37] frontends: misc. minor cleanups Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 26/37] modified dvb_register_adapter() to avoid kmalloc/kfree Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 27/37] bt8xx: update documentation Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 28/37] DST: reorganize Twinhan DST driver to support CI Johannes Stezenbach
2005-05-08 18:42 ` [DVB patch 29/37] DST: add support for Twinhan 200103A Johannes Stezenbach
2005-05-08 18:42 ` Johannes Stezenbach [this message]
2005-05-08 18:43 ` [DVB patch 31/37] DST: fix for descrambling failure Johannes Stezenbach
2005-05-08 18:43 ` [DVB patch 32/37] DST: misc. fixes Johannes Stezenbach
2005-05-08 18:43 ` [DVB patch 33/37] bt8xx: updated documentation Johannes Stezenbach
2005-05-08 18:43 ` [DVB patch 34/37] DST: fix a bug in the module parameter Johannes Stezenbach
2005-05-08 18:43 ` [DVB patch 35/37] DST: fixed CI debug output Johannes Stezenbach
2005-05-08 18:43 ` [DVB patch 36/37] bt8xx: whitespace cleanup Johannes Stezenbach
2005-05-08 18:43 ` [DVB patch 37/37] budget-av: CI fixes Johannes Stezenbach
2005-05-10  1:04 ` [DVB patch 00/37] DVB updates for 2.6.12-rc4 Andrew Morton
2005-05-10  8:52   ` Johannes Stezenbach
2005-05-10  9:16     ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050508184349.197853000@abc \
    --to=js@linuxtv.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome