summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/frontends
diff options
context:
space:
mode:
authorAndrew de Quincy <devnull@localhost>2004-11-09 17:44:20 +0000
committerAndrew de Quincy <devnull@localhost>2004-11-09 17:44:20 +0000
commit82f343f250fd1d7451496e5cf7e54710f95c6ca2 (patch)
tree501db1572484b6065fcc4778a982b79af9ad298b /linux/drivers/media/dvb/frontends
parentd52312378d00bdea3e1057c6ba997ddeda2a179e (diff)
downloadmediapointer-dvb-s2-82f343f250fd1d7451496e5cf7e54710f95c6ca2.tar.gz
mediapointer-dvb-s2-82f343f250fd1d7451496e5cf7e54710f95c6ca2.tar.bz2
This device cannot handle a read operation without a stop condition
between register and byte
Diffstat (limited to 'linux/drivers/media/dvb/frontends')
-rw-r--r--linux/drivers/media/dvb/frontends/stv0297.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/linux/drivers/media/dvb/frontends/stv0297.c b/linux/drivers/media/dvb/frontends/stv0297.c
index 8bea1c275..d6cda95b4 100644
--- a/linux/drivers/media/dvb/frontends/stv0297.c
+++ b/linux/drivers/media/dvb/frontends/stv0297.c
@@ -45,7 +45,7 @@ struct stv0297_state {
u8 pwm;
};
-#if 0
+#if 1
#define dprintk(x...) printk(x)
#else
#define dprintk(x...)
@@ -157,7 +157,7 @@ static int stv0297_writereg (struct stv0297_state* state, u8 reg, u8 data)
return (ret != 1) ? -1 : 0;
}
-static u8 stv0297_readreg (struct stv0297_state* state, u8 reg)
+static int stv0297_readreg (struct stv0297_state* state, u8 reg)
{
int ret;
u8 b0[] = { reg };
@@ -165,11 +165,17 @@ static u8 stv0297_readreg (struct stv0297_state* state, u8 reg)
struct i2c_msg msg [] = { { .addr = state->config->demod_address, .flags = 0, .buf = b0, .len = 1 },
{ .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } };
- ret = i2c_transfer (state->i2c, msg, 2);
-
- if (ret != 2)
- dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n",
- __FUNCTION__, reg, ret);
+ // this device cannot seem to handle having two transfers back to back */
+ if ((ret = i2c_transfer (state->i2c, &msg[0], 1)) != 1) {
+ dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n",
+ __FUNCTION__, reg, ret);
+ return -1;
+ }
+ if ((ret = i2c_transfer (state->i2c, &msg[1], 1)) != 1) {
+ dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n",
+ __FUNCTION__, reg, ret);
+ return -1;
+ }
return b1[0];
}
@@ -692,10 +698,6 @@ struct dvb_frontend* stv0297_attach(const struct stv0297_config* config,
struct i2c_adapter* i2c,
int pwm)
{
- u8 b0[] = { 0x80 };
- u8 b1[] = { 0 };
- struct i2c_msg msg [] = { { .addr = config->demod_address, .flags = 0, .buf = b0, .len = 1 },
- { .addr = config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } };
struct stv0297_state* state = NULL;
/* allocate memory for the internal state */
@@ -711,11 +713,11 @@ struct dvb_frontend* stv0297_attach(const struct stv0297_config* config,
state->pwm = pwm;
/* check if the demod is there */
- if (i2c_transfer (state->i2c, msg, 2) != 2) goto error;
+ if ((stv0297_readreg(state, 0x80) & 0x70) != 0x20) goto error;
/* create dvb_frontend */
state->frontend.ops = &state->ops;
- state->frontend.demodulator_priv = state;
+ state->frontend.demodulator_priv = state;
return &state->frontend;
error:
@@ -758,3 +760,4 @@ MODULE_AUTHOR("Dennis Noermann and Andrew de Quincey");
MODULE_LICENSE("GPL");
EXPORT_SYMBOL(stv0297_attach);
+EXPORT_SYMBOL(stv0297_enable_plli2c);