Re: make dvb-pll probe for device presence

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



OK, updated patch attached; this one will try and read a byte from the PLL 
chip using normal i2c to check it is there.
diff -r fff6e39edcb0 linux/drivers/media/dvb/frontends/dvb-pll.c
--- a/linux/drivers/media/dvb/frontends/dvb-pll.c	Wed Jun 28 15:27:45 2006 -0300
+++ b/linux/drivers/media/dvb/frontends/dvb-pll.c	Wed Jun 28 21:04:41 2006 +0100
@@ -613,7 +613,20 @@ static struct dvb_tuner_ops dvb_pll_tune
 
 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)
_______________________________________________

linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux