diff options
author | Andrew de Quincey <adq_dvb@lidskialf.net> | 2006-07-10 03:34:14 -0300 |
---|---|---|
committer | Andrew de Quincey <adq_dvb@lidskialf.net> | 2006-07-10 03:34:14 -0300 |
commit | 789a5a51b4420ee76e4341cf32154c0ddb225d19 (patch) | |
tree | 49d4dc9a350965e1254485a8776467aa0f9d9490 /linux/drivers/media/dvb | |
parent | 54b507ede0a1c5349b47f84af7d3d0b417467e3a (diff) | |
download | mediapointer-dvb-s2-789a5a51b4420ee76e4341cf32154c0ddb225d19.tar.gz mediapointer-dvb-s2-789a5a51b4420ee76e4341cf32154c0ddb225d19.tar.bz2 |
Add dvbpll i2c device check.
From: Andrew de Quincey <adq_dvb@lidskialf.net>
Some cards have multiple possible addresses for their PLLs, with no other
way to tell if a PLL is present or not apart from probing to see if an i2c
device is present. This adds a quick check to see if an i2c device is
present at the given i2c address.
Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Acked-by: Michael Krufky <mkrufky@linuxtv.org>
Diffstat (limited to 'linux/drivers/media/dvb')
-rw-r--r-- | linux/drivers/media/dvb/frontends/dvb-pll.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/linux/drivers/media/dvb/frontends/dvb-pll.c b/linux/drivers/media/dvb/frontends/dvb-pll.c index a18968345..b9a338875 100644 --- a/linux/drivers/media/dvb/frontends/dvb-pll.c +++ b/linux/drivers/media/dvb/frontends/dvb-pll.c @@ -613,7 +613,20 @@ static struct dvb_tuner_ops dvb_pll_tuner_ops = { int dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, struct i2c_adapter *i2c, struct dvb_pll_desc *desc) { + u8 b1 [] = { 0 }; + struct i2c_msg msg [] = { { .addr = pll_addr, .flags = 0, .buf = NULL, .len = 0 }, + { .addr = pll_addr, .flags = I2C_M_RD, .buf = b1, .len = 1 } }; struct dvb_pll_priv *priv = NULL; + int ret; + + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + + ret = i2c_transfer (i2c, msg, 2); + if (ret != 2) + return -1; + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 0); priv = kzalloc(sizeof(struct dvb_pll_priv), GFP_KERNEL); if (priv == NULL) |