linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Hunold (LinuxTV.org CVS maintainer)  <hunold@convergence.de>
To: torvalds@osdl.org, linux-kernel@vger.kernel.org
Subject: [PATCH 15/17] Update various other frontend drivers
Date: Tue, 15 Jul 2003 14:21:00 +0200	[thread overview]
Message-ID: <10582716601905@convergence.de> (raw)
In-Reply-To: <10582716591780@convergence.de>

[DVB] - In alps_tdlb7.c read SP8870 status reg to clear pending irqs in FE_SET_FRONTEND, as suggested by Ragnar Sundblad to avoid frontend hang-ups.
[DVB] - the vp310 support in mt312.c support should be configured to 90Mhz, too. skystar2 driver with bugfixed master_xfer() should probably work now.
diff -uNrwB --new-file linux-2.6.0-test1.work/drivers/media/dvb/frontends/alps_tdlb7.c linux-2.6.0-test1.patch/drivers/media/dvb/frontends/alps_tdlb7.c
--- linux-2.6.0-test1.work/drivers/media/dvb/frontends/alps_tdlb7.c	2003-07-15 09:42:37.000000000 +0200
+++ linux-2.6.0-test1.patch/drivers/media/dvb/frontends/alps_tdlb7.c	2003-07-14 11:56:37.000000000 +0200
@@ -349,6 +349,9 @@
 
 		sp5659_set_tv_freq (i2c, p->frequency);
 
+		// read status reg in order to clear pending irqs
+		sp8870_readreg(i2c, 0x200);
+
 		// sample rate correction bit [23..17]
 		sp8870_writereg(i2c,0x0319,0x000A);
 		
diff -uNrwB --new-file linux-2.6.0-test1.work/drivers/media/dvb/frontends/mt312.c linux-2.6.0-test1.patch/drivers/media/dvb/frontends/mt312.c
--- linux-2.6.0-test1.work/drivers/media/dvb/frontends/mt312.c	2003-07-15 10:59:46.000000000 +0200
+++ linux-2.6.0-test1.patch/drivers/media/dvb/frontends/mt312.c	2003-06-27 00:04:06.000000000 +0200
@@ -34,6 +34,7 @@
 
 #define I2C_ADDR_MT312		0x0e
 #define I2C_ADDR_SL1935		0x61
+#define I2C_ADDR_TSA5059	0x61
 
 #define MT312_DEBUG		0
 
@@ -207,12 +208,32 @@
 	return mt312_pll_write(i2c, I2C_ADDR_SL1935, buf, sizeof(buf));
 }
 
+static int tsa5059_set_tv_freq(struct dvb_i2c_bus *i2c, u32 freq, u32 sr)
+{
+	u8 buf[4];
+
+	u32 ref = mt312_div(freq, 125);
+
+	buf[0] = (ref >> 8) & 0x7f;
+	buf[1] = (ref >> 0) & 0xff;
+	buf[2] = 0x84 | ((ref >> 10) & 0x60);
+	buf[3] = 0x80;
+	
+	if (freq < 1550000)
+		buf[3] |= 0x02;
+
+	printk(KERN_INFO "synth dword = %02x%02x%02x%02x\n", buf[0],
+	       buf[1], buf[2], buf[3]);
+
+	return mt312_pll_write(i2c, I2C_ADDR_TSA5059, buf, sizeof(buf));
+}
+
 static int mt312_reset(struct dvb_i2c_bus *i2c, const u8 full)
 {
 	return mt312_writereg(i2c, RESET, full ? 0x80 : 0x40);
 }
 
-static int mt312_init(struct dvb_i2c_bus *i2c)
+static int mt312_init(struct dvb_i2c_bus *i2c, const long id)
 {
 	int ret;
 	u8 buf[2];
@@ -240,6 +261,9 @@
 	if ((ret = mt312_writereg(i2c, SNR_THS_HIGH, 0x32)) < 0)
 		return ret;
 
+	if ((ret = mt312_writereg(i2c, OP_CTRL, 0x53)) < 0)
+		return ret;
+
 	/* TS_SW_LIM */
 	buf[0] = 0x8c;
 	buf[1] = 0x98;
@@ -427,7 +451,8 @@
 }
 
 static int mt312_set_frontend(struct dvb_i2c_bus *i2c,
-			      const struct dvb_frontend_parameters *p)
+			      const struct dvb_frontend_parameters *p,
+			      const long id)
 {
 	int ret;
 	u8 buf[5];
@@ -437,6 +462,8 @@
 	    { 0x00, 0x01, 0x02, 0x04, 0x3f, 0x08, 0x10, 0x20, 0x3f, 0x3f };
 	const u8 inv_tab[3] = { 0x00, 0x40, 0x80 };
 
+	int (*set_tv_freq)(struct dvb_i2c_bus *i2c, u32 freq, u32 sr);
+
 	if ((p->frequency < mt312_info.frequency_min)
 	    || (p->frequency > mt312_info.frequency_max))
 		return -EINVAL;
@@ -457,8 +484,18 @@
 	    || (p->u.qpsk.fec_inner == FEC_8_9))
 		return -EINVAL;
 
-	if ((ret =
-	     sl1935_set_tv_freq(i2c, p->frequency, p->u.qpsk.symbol_rate)) < 0)
+	switch (id) {
+	case ID_VP310:
+		set_tv_freq = tsa5059_set_tv_freq;
+		break;
+	case ID_MT312:
+		set_tv_freq = sl1935_set_tv_freq;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	if ((ret = set_tv_freq(i2c, p->frequency, p->u.qpsk.symbol_rate)) < 0)
 		return ret;
 
 	/* sr = (u16)(sr * 256.0 / 1000000.0) */
@@ -552,9 +589,7 @@
 {
 	const fe_code_rate_t fec_tab[8] =
 	    { FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_6_7, FEC_7_8,
-		FEC_AUTO,
-		FEC_AUTO
-	};
+		FEC_AUTO, FEC_AUTO };
 
 	int ret;
 	u8 fec_status;
@@ -652,7 +687,7 @@
 		return mt312_read_ubc(i2c, arg);
 
 	case FE_SET_FRONTEND:
-		return mt312_set_frontend(i2c, arg);
+		return mt312_set_frontend(i2c, arg, (long) fe->data);
 
 	case FE_GET_FRONTEND:
 		return mt312_get_frontend(i2c, arg);
@@ -664,7 +699,7 @@
 		return mt312_sleep(i2c);
 
 	case FE_INIT:
-		return mt312_init(i2c);
+		return mt312_init(i2c, (long) fe->data);
 
 	case FE_RESET:
 		return mt312_reset(i2c, 0);


  reply	other threads:[~2003-07-15 12:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-15 12:20 [PATCH 1/17] Update the saa7146 driver core Michael Hunold
2003-07-15 12:20 ` [PATCH 2/17] Various small fixes in dvb-core Michael Hunold
2003-07-15 12:20   ` [PATCH 3/17] Major dvb net code cleanup, many fixes Michael Hunold
2003-07-15 12:20     ` [PATCH 4/17] Update dvb frontend drivers Michael Hunold
2003-07-15 12:20       ` [PATCH 5/17] Add Zarlink MT312 DVB-T frontend driver Michael Hunold
2003-07-15 12:20         ` [PATCH 6/17] Update the DVB budget drivers Michael Hunold
2003-07-15 12:20           ` [PATCH 7/17] Update the DVB av7110 driver Michael Hunold
2003-07-15 12:20             ` [PATCH 8/17] Update firmware of " Michael Hunold
2003-07-15 12:20               ` [PATCH 9/17] More saa7146 driver core updates Michael Hunold
2003-07-15 12:20                 ` [PATCH 10/17] Various kconfig and Makefile updates Michael Hunold
2003-07-15 12:20                   ` [PATCH 11/17] Add a driver for the Technisat Skystar2 DVB card Michael Hunold
2003-07-15 12:20                     ` [PATCH 12/17] Add two drivers for Hexium frame grabber cards Michael Hunold
2003-07-15 12:20                       ` [PATCH 13/17] More updates for the dvb core Michael Hunold
2003-07-15 12:20                         ` [PATCH 14/17] Add TDA14500x DVB-T frontend driver Michael Hunold
2003-07-15 12:21                           ` Michael Hunold [this message]
2003-07-15 12:21                             ` [PATCH 16/17] Update the av7110 DVB driver Michael Hunold
2003-07-16  1:28                     ` [PATCH 11/17] Add a driver for the Technisat Skystar2 DVB card Greg KH
2003-07-16  7:41                       ` Michael Hunold
2003-07-16 16:37                         ` Greg KH

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=10582716601905@convergence.de \
    --to=hunold@convergence.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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;
as well as URLs for NNTP newsgroup(s).