summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorAapo Tahkola <aet@rasterburn.org>2007-01-21 15:57:20 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-02-21 13:34:53 -0200
commit84ad7574f69b971565061663be2b0a9ade5b8ca7 (patch)
treec874a372ec713e5a803019724a59d3c40b5e0545 /drivers/media
parent816172f8b944a98716f4b5fda801b7744cb91624 (diff)
downloadblackbird-op-linux-84ad7574f69b971565061663be2b0a9ade5b8ca7.tar.gz
blackbird-op-linux-84ad7574f69b971565061663be2b0a9ade5b8ca7.zip
V4L/DVB (5139): M920x: Fix tuner identification bug with qt1010 module
Fixes qt1010 identification bug with megasky caused by the Quantek QT1010 tuner module patch. Signed-off-by: Aapo Tahkola <aet@rasterburn.org> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/dvb-usb/m920x.c46
-rw-r--r--drivers/media/dvb/dvb-usb/m920x.h9
2 files changed, 41 insertions, 14 deletions
diff --git a/drivers/media/dvb/dvb-usb/m920x.c b/drivers/media/dvb/dvb-usb/m920x.c
index fd9d19b9cf2d..f06fee3af9e6 100644
--- a/drivers/media/dvb/dvb-usb/m920x.c
+++ b/drivers/media/dvb/dvb-usb/m920x.c
@@ -134,6 +134,7 @@ static int m9206_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
static int m9206_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num)
{
struct dvb_usb_device *d = i2c_get_adapdata(adap);
+ struct m9206_state *m = d->priv;
int i;
int ret = 0;
@@ -144,8 +145,6 @@ static int m9206_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int nu
return -EINVAL;
for (i = 0; i < num; i++) {
- u8 w_len;
-
if ((ret = m9206_write(d->udev, M9206_I2C, msg[i].addr, 0x80)) != 0)
goto unlock;
@@ -153,13 +152,19 @@ static int m9206_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int nu
goto unlock;
if (i + 1 < num && msg[i + 1].flags & I2C_M_RD) {
- /* Possibly device dependant */
- if (msg[i].addr == d->adapter[0].pll_addr)
- w_len = 0xc5;
- else
- w_len = 0x1f;
+ int i2c_i;
+
+ for (i2c_i = 0; i2c_i < M9206_I2C_MAX; i2c_i++)
+ if (msg[i].addr == m->i2c_r[i2c_i].addr)
+ break;
- if ((ret = m9206_write(d->udev, M9206_I2C, w_len, 0x80)) != 0)
+ if (i2c_i >= M9206_I2C_MAX) {
+ deb_rc("No magic for i2c addr!\n");
+ ret = -EINVAL;
+ goto unlock;
+ }
+
+ if ((ret = m9206_write(d->udev, M9206_I2C, m->i2c_r[i2c_i].magic, 0x80)) != 0)
goto unlock;
if ((ret = m9206_read(d->udev, M9206_I2C, 0x0, 0x60, msg[i + 1].buf, msg[i + 1].len)) != 0)
@@ -238,11 +243,17 @@ static struct mt352_config megasky_mt352_config = {
static int megasky_frontend_attach(struct dvb_usb_adapter *adap)
{
+ struct m9206_state *m = adap->dev->priv;
+
deb_rc("megasky_frontend_attach!\n");
- if ((adap->fe = dvb_attach(mt352_attach, &megasky_mt352_config, &adap->dev->i2c_adap)) != NULL)
- return 0;
- return -EIO;
+ m->i2c_r[M9206_I2C_DEMOD].addr = megasky_mt352_config.demod_address;
+ m->i2c_r[M9206_I2C_DEMOD].magic = 0x1f;
+
+ if ((adap->fe = dvb_attach(mt352_attach, &megasky_mt352_config, &adap->dev->i2c_adap)) == NULL)
+ return -EIO;
+
+ return 0;
}
static int m9206_set_filter(struct dvb_usb_adapter *adap, int type, int idx, int pid)
@@ -389,9 +400,16 @@ static struct qt1010_config megasky_qt1010_config = {
static int megasky_tuner_attach(struct dvb_usb_adapter *adap)
{
- return dvb_attach(qt1010_attach,
- adap->fe, &adap->dev->i2c_adap,
- &megasky_qt1010_config) == NULL ? -ENODEV : 0;
+ struct m9206_state *m = adap->dev->priv;
+
+ m->i2c_r[M9206_I2C_TUNER].addr = megasky_qt1010_config.i2c_address;
+ m->i2c_r[M9206_I2C_TUNER].magic = 0xc5;
+
+ if (dvb_attach(qt1010_attach, adap->fe, &adap->dev->i2c_adap,
+ &megasky_qt1010_config) == NULL)
+ return -ENODEV;
+
+ return 0;
}
/* DVB USB Driver stuff */
diff --git a/drivers/media/dvb/dvb-usb/m920x.h b/drivers/media/dvb/dvb-usb/m920x.h
index 597df11e6ea0..c354196ffe5d 100644
--- a/drivers/media/dvb/dvb-usb/m920x.h
+++ b/drivers/media/dvb/dvb-usb/m920x.h
@@ -18,9 +18,18 @@
#define M9206_FW 0x30
#define M9206_MAX_FILTERS 8
+
+#define M9206_I2C_TUNER 0
+#define M9206_I2C_DEMOD 1
+#define M9206_I2C_MAX 2
+
struct m9206_state {
u16 filters[M9206_MAX_FILTERS];
int filtering_enabled;
int rep_count;
+ struct {
+ unsigned char addr;
+ unsigned char magic;
+ }i2c_r[M9206_I2C_MAX];
};
#endif
OpenPOWER on IntegriCloud