summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/frontends
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/dvb/frontends')
-rw-r--r--linux/drivers/media/dvb/frontends/stv0299.c72
1 files changed, 37 insertions, 35 deletions
diff --git a/linux/drivers/media/dvb/frontends/stv0299.c b/linux/drivers/media/dvb/frontends/stv0299.c
index a88a8b792..2e51faef8 100644
--- a/linux/drivers/media/dvb/frontends/stv0299.c
+++ b/linux/drivers/media/dvb/frontends/stv0299.c
@@ -41,12 +41,13 @@
#include <linux/module.h>
#include <linux/string.h>
-#include "dvb_compat.h"
#include "dvb_frontend.h"
+#include "dvb_compat.h"
static int debug = 0;
#define dprintk if (debug) printk
+
/* frontend types */
#define UNKNOWN_FRONTEND -1
#define PHILIPS_SU1278SH 0
@@ -196,8 +197,8 @@ int stv0299_writereg (struct dvb_i2c_bus *i2c, u8 reg, u8 data)
ret = i2c->xfer (i2c, &msg, 1);
if (ret != 1)
- dprintk("%s: writereg error (reg == 0x%02x, val == 0x%02x, ret == %i)\n",
- __FUNCTION__, reg, data, ret);
+ dprintk("%s: writereg error (reg == 0x%02x, val == 0x%02x, "
+ "ret == %i)\n", __FUNCTION__, reg, data, ret);
return (ret != 1) ? -1 : 0;
}
@@ -253,13 +254,7 @@ int pll_write (struct dvb_i2c_bus *i2c, u8 data [4], int ftype)
dprintk ("%s\n", __FUNCTION__);
- if (ftype == LG_TDQF_S001F || ftype == ALPS_BSRU6) {
- ret = i2c->xfer (i2c, &msg[0], 1);
- ret += i2c->xfer (i2c, &msg[1], 1);
- }
- else {
- ret = i2c->xfer (i2c, msg, 2);
- }
+ ret = i2c->xfer (i2c, msg, 2);
if (ret != 2)
dprintk("%s: i/o error (ret == %i)\n", __FUNCTION__, ret);
@@ -439,8 +434,7 @@ int stv0299_wait_diseqc_fifo (struct dvb_i2c_bus *i2c, int timeout)
dprintk ("%s: timeout!!\n", __FUNCTION__);
return -ETIMEDOUT;
}
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout (1);
+ ddelay(10);
};
return 0;
@@ -459,8 +453,7 @@ int stv0299_wait_diseqc_idle (struct dvb_i2c_bus *i2c, int timeout)
dprintk ("%s: timeout!!\n", __FUNCTION__);
return -ETIMEDOUT;
}
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout (1);
+ ddelay(10);
};
return 0;
@@ -791,35 +784,40 @@ int uni0299_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg)
static
int probe_tuner (struct dvb_i2c_bus *i2c)
{
- int type;
-
/* read the status register of TSA5059 */
u8 rpt[] = { 0x05, 0xb5 };
- u8 stat [] = { 0 };
+ u8 stat [1];
+ int ret;
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 }};
- if (i2c->xfer(i2c, msg1, 2) == 2) {
- type = PHILIPS_SU1278SH;
+
+ if ((ret = i2c->xfer(i2c, msg1, 2)) == 2) {
printk ("%s: setup for tuner SU1278/SH\n", __FILE__);
- } else if (i2c->xfer(i2c, msg2, 2) == 2) {
-if (0) { // if ((stat[0] & 0x3f) == 0) {
- type = LG_TDQF_S001F;
+ return PHILIPS_SU1278SH;
+ }
+
+ ret = i2c->xfer(i2c, msg2, 2);
+
+ if (ret == 2) {
+ if ((stat[0] & 0x3f) == 0) {
printk ("%s: setup for tuner TDQF-S001F\n", __FILE__);
+ return LG_TDQF_S001F;
}
else {
- type = ALPS_BSRU6;
- printk ("%s: setup for tuner BSRU6, TDQB-S00x\n", __FILE__);
+ printk ("%s: setup for tuner BSRU6, TDQB-S00x\n",
+ __FILE__);
+ return ALPS_BSRU6;
}
- } else {
- type = UNKNOWN_FRONTEND;
- printk ("%s: unknown PLL synthesizer, "
- "please report to <linuxdvb@linuxtv.org>!!\n",
- __FILE__);
}
- return type;
+
+ printk ("%s: unknown PLL synthesizer (ret == %i), "
+ "please report to <linuxdvb@linuxtv.org>!!\n",
+ __FILE__, ret);
+
+ return UNKNOWN_FRONTEND;
}
@@ -829,13 +827,20 @@ int uni0299_attach (struct dvb_i2c_bus *i2c)
int tuner_type;
u8 id = stv0299_readreg (i2c, 0x00);
- dprintk ("%s\n", __FUNCTION__);
+ dprintk ("%s: id == 0x%02x\n", __FUNCTION__, id);
/* register 0x00 contains 0xa1 for STV0299 and STV0299B */
/* register 0x00 might contain 0x80 when returning from standby */
if (id != 0xa1 && id != 0x80)
return -ENODEV;
+ /**
+ * wake up...
+ */
+ stv0299_writereg (i2c, 0x01, 0x15);
+ stv0299_writereg (i2c, 0x02, 0x30);
+ stv0299_writereg (i2c, 0x03, 0x00);
+
if ((tuner_type = probe_tuner(i2c)) < 0)
return -ENODEV;
@@ -850,7 +855,6 @@ static
void uni0299_detach (struct dvb_i2c_bus *i2c)
{
dprintk ("%s\n", __FUNCTION__);
-
dvb_unregister_frontend (uni0299_ioctl, i2c);
}
@@ -859,8 +863,7 @@ static
int __init init_uni0299 (void)
{
dprintk ("%s\n", __FUNCTION__);
-
- return dvb_register_i2c_device (THIS_MODULE, uni0299_attach, uni0299_detach);
+ return dvb_register_i2c_device (NULL, uni0299_attach, uni0299_detach);
}
@@ -868,7 +871,6 @@ static
void __exit exit_uni0299 (void)
{
dprintk ("%s\n", __FUNCTION__);
-
dvb_unregister_i2c_device (uni0299_attach);
}