[linux-dvb] make dvb-pll probe for device presence

Andrew de Quincey adq_dvb at lidskialf.net
Wed Jun 21 03:41:02 CEST 2006


On Tuesday 20 June 2006 22:39, Johannes Stezenbach wrote:
> On Tue, Jun 20, 2006, Andrew de Quincey wrote:
> > Hi - heres that idea we talked about a week or so back - it makes dvb-pll
> > check for an i2c device's presence before going any further.
> >
> > wdyt? (this isn't a proper committable patch yet BTW; no signed off by
> > etc)
> >
> > diff -r 676364f7622d linux/drivers/media/dvb/frontends/dvb-pll.c
> > --- a/linux/drivers/media/dvb/frontends/dvb-pll.c	Tue Jun 20 00:30:57
> > 2006 -0300 +++ b/linux/drivers/media/dvb/frontends/dvb-pll.c	Tue Jun 20
> > 09:28:48 2006 +0100 @@ -615,6 +615,20 @@ int dvb_pll_attach(struct
> > dvb_frontend *
> >  {
> >  	struct dvb_pll_priv *priv = NULL;
> >
> > +	if (fe->ops.i2c_gate_ctrl)
> > +		fe->ops.i2c_gate_ctrl(fe, 1);
> > +	if (i2c_smbus_xfer(i2c, pll_addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) < 0)
> > +		return -1;
>
> Don't use smbus functions on i2c bus. (And if you do anyway,
> use I2C_SMBUS_WRITE/I2C_SMBUS_READ for readability).
>
> Some i2c controllers (like flexcop) don't support 0 byte messages.

Hmm good point... tricky one then... I suppose I could try and _read_ a status 
byte from the PLL; all of them support that as far as I know.



More information about the linux-dvb mailing list