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

Johannes Stezenbach js at linuxtv.org
Tue Jun 20 23:39:36 CEST 2006


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.

> +	/* prevent 24RF08 corruption */

That's what you get for doing random i2c bus writes...
(But I guess no dvb/i2c card has such an EEPROM, AFAIK they are
only used in IBM Thinkpads on the system monitoring smbus.)


Johannes



More information about the linux-dvb mailing list