Mailing List archive

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

[linux-dvb] Re: kernel I2C question



On Saturday 07 August 2004 23:23, Patrick Boettcher wrote:
> Hi list,
>
> which functions do I have to call when I want to use the kernel I2C bus,
> instead of dvb I2C in my adapter module. Currently I use
> "dvb_(un)register_i2c_bus" but this is, of course, not working with the
> frontend driver, which is using kernel I2C.
>
> Can someone give me a hint, please.

Sure, please have a look at the include/linux/i2c.h in you kernel tree also, 
but this is the meat:

	static struct i2c_adapter i2c_adap = {
		.name = "my i2c adapter"
                .client_register = client_register,
                .client_unregister = client_unregister,
#ifdef I2C_ADAP_CLASS_TV_DIGITAL
                .class = I2C_ADAP_CLASS_TV_DIGITAL,
#else
                .class = I2C_CLASS_TV_DIGITAL,
#endif
        };

        if (i2c_add_adapter(&i2c_adap) < 0) {
		...error handling...
	}

You will then be notified by way of the client_(un)register functions when 
clients connects/disconnects to/from your bus. Look at the forementioned 
header for the details of these functions and structs.

Unregistering the bus is a meere (which will also detach all clients):
	i2c_del_adapter(&i2c_adap);

Btw, what driver is not working with kernel i2c?

Kenneth




Home | Main Index | Thread Index