Peter Schildmann wrote:
You must not register before/after ioctls for this card if you want to let the frontend handle the DiSEqC stuff.Hi, On Mon, Jan 13, 2003 at 06:27:52PM +0100, Holger Waechtler wrote:Peter, could you please verify that the a driver built fresh from the CVS source works flawlessly for your card?
Here is a patch for the stv0299 driver that works for the low band only. The 22KHz generation doesn't work, the FE_SET_TONE ioctl of the driver is never called.
please don't patch the frontend driver, fix the i2c stuff in the saa7146 code. Otherwise we would have to patch other frontend drivers too.There is also a small i2c problem: When I load the modules for the first time I get an address error and the frontend is not detected, after reloading the dvb-ttpci-budget module works.
Peter
------------------------------------------------------------------------
--- stv0299.c.original Tue Jan 14 17:48:51 2003
+++ stv0299.c Tue Jan 14 17:48:51 2003
@@ -235,20 +235,24 @@
int tsa5059_write (struct dvb_i2c_bus *i2c, u8 data [4], int ftype)
{
int ret;
+ char* error_msg = "%s: i/o error (ret == %i)\n";
u8 rpt1 [] = { 0x05, 0xb5 }; /* enable i2c repeater on stv0299 */
/* TSA5059 i2c-bus address */
u8 addr = (ftype == PHILIPS_SU1278SH) ? 0x60 : 0x61;
- struct i2c_msg msg [] = {{ addr: 0x68, flags: 0, buf: rpt1, len: 2 },
- { addr: addr, flags: 0, buf: data, len: 4 }};
+ struct i2c_msg msg1 [] = {{ addr: 0x68, flags: 0, buf: rpt1, len: 2 }};
+ struct i2c_msg msg2 [] = {{ addr: addr, flags: 0, buf: data, len: 4 }};
dprintk ("%s\n", __FUNCTION__);
- ret = i2c->xfer (i2c, msg, 2);
+ ret = i2c->xfer (i2c, msg1, 1);
+ if (ret != 1)
+ dprintk(error_msg, __FUNCTION__, ret);
- if (ret != 2)
- dprintk("%s: i/o error (ret == %i)\n", __FUNCTION__, ret);
+ ret = i2c->xfer (i2c, msg2, 1);
+ if (ret != 1)
+ dprintk(error_msg, __FUNCTION__, ret);
- return (ret != 2) ? -1 : 0;
+ return (ret != 1) ? -1 : 0;
}
@@ -270,7 +274,7 @@
else
buf[3] = freq > 1530000 ? 0xc0 : 0xc4;
- dprintk ("%s\n", __FUNCTION__);
+ dprintk ("%s: freq = %d\n", __FUNCTION__, freq);
return tsa5059_write (i2c, buf, ftype);
}
@@ -490,8 +494,10 @@
switch (tone) {
case SEC_TONE_ON:
+ dprintk ("%s: tone on\n", __FILE__);
return stv0299_writereg (i2c, 0x08, val | 0x3);
case SEC_TONE_OFF:
+ dprintk ("%s: tone off\n", __FILE__);
return stv0299_writereg (i2c, 0x08, (val & ~0x3) | 0x02);
default:
return -EINVAL;
@@ -740,29 +746,32 @@
static
int probe_tuner (struct dvb_i2c_bus *i2c)
{
- int type;
-
/* read the status register of TSA5059 */
+ int addr;
u8 rpt[] = { 0x05, 0xb5 };
u8 stat [] = { 0 };
- struct i2c_msg msg1 [] = {{ addr: 0x68, flags: 0, buf: rpt, len: 2 },
- { addr: 0x60, flags: I2C_M_RD, buf: stat, len: 1 }};
- struct i2c_msg msg2 [] = {{ addr: 0x68, flags: 0, buf: rpt, len: 2 },
- { addr: 0x61, flags: I2C_M_RD, buf: stat, len: 1 }};
+ struct i2c_msg msg1 [] = {{ addr: 0x68, flags: 0, buf: rpt, len: 2 }};
+ struct i2c_msg msg2 [] = {{ addr: 0x00, flags: I2C_M_RD, buf: stat, len: 1 }};
- if (i2c->xfer(i2c, msg1, 2) == 2) {
- type = PHILIPS_SU1278SH;
+ for(addr = 0x60; addr < 0x64; addr++) {
+ dprintk("probing for TSA5059 at I2C address 0x%x\n", addr);
+ msg2[0].addr = addr;
+
+ if (i2c->xfer(i2c, msg1, 1) == 1)
+ if (i2c->xfer(i2c, msg2, 1) == 1)
+ switch(addr) {
+ case 0x60:
printk ("%s: setup for tuner SU1278/SH\n", __FILE__);
- } else if (i2c->xfer(i2c, msg2, 2) == 2) {
- type = ALPS_BSRU6;
+ return PHILIPS_SU1278SH;
+ case 0x61:
printk ("%s: setup for tuner BSRU6, TDQB-S00x\n", __FILE__);
- } else {
- type = UNKNOWN_FRONTEND;
- printk ("%s: unknown PLL synthesizer, "
- "please report to <linuxdvb@linuxtv.org>!!\n",
- __FILE__);
+ return ALPS_BSRU6;
+ }
}
- return type;
+ printk ("%s: unknown PLL synthesizer, "
+ "please report to <linuxdvb@linuxtv.org>!!\n",
+ __FILE__);
+ return UNKNOWN_FRONTEND;
}
static
@@ -775,7 +784,9 @@
/* register 0x00 contains 0xa1 for STV0299 and STV0299B */
/* register 0x00 might contain 0x80 when returning from standby */
- if (id != 0xa1)
+ if (id == 0xa1)
+ printk ("%s: STV0299 QPSK link IC detected\n", __FILE__);
+ else
return -ENODEV;
if ((tuner_type = probe_tuner(i2c)) < 0)
-- Info: To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe linux-dvb" as subject.