[i2c] i2c newbie questions

Mark M. Hoffman mhoffman at lightlink.com
Wed Aug 2 13:33:00 CEST 2006


Hi Anand:

(dropped sensors mailing list)

* Anand Kumar S - TLS , Chennai <sanandkumar at hcl.in> [2006-08-02 15:48:43 +0530]:
> I am trying to develop i2c drivers in uclinux for some devices to be used in
> coldfire based system. I am new to i2c drivers in linux and I have some
> questions rgding the implementation. 

Start with Documentation/i2c/* from the Linux source, if you haven't already.

> 1. The number of different slave devices in the system is roughly 7. This
> includes eeprom, sensors, DAC, ADC etc. Does that mean
>     I need to develop 7 different chip drivers?

Maybe, maybe not.

> 2. How will the application interface with the i2c subsystem? Is it like the
> following way?
>  
>     Open ("/dev/i2c-0") // open
>  
>     ioctl(fd, ..SLAVE);  // slave selection
>  
>     // do some operation on the slave device...
>  
>     // select different slave using the above mentioned ioctl
>  
>     // do some more operation on the new slave device etc
>  
>    ...
>  
>   3. Is it possible for us to directly develop use space drivers in i2c
> without developing the chip driver? In this case do we directly
>       talk to the coldfire i2c bus controller? Can we use the same code as
> mentioned in point 2 to interact with the slave devices?

Yes, you could do this instead of writing a driver for each slave device.
I have a Python interface you could use too... wait, you said uclinux.
Nevermind about Python then. ;)

> I am generally confused about the interaction between the different chip
> drivers and how the application will interact with the chip
> drivers to control various devices.

If you choose to write kernel drivers for your slave devices, you can
expose whatever interface to users that is appropriate for the device.
E.g. sysfs files, char device, etc... that's up to you.

> I understand that the i2c core subsystem provides the device interface for
> i2c but I need to know more specifically the part played
> by the chip driver in the whole setup and do we need that at all if we are
> planning to write applications to control the device.

If you use the i2c-dev mechanism, you don't need a kernel driver for the
slave device.

> DISCLAIMER 
> [...]

Kill the disclaimer, or if you can't, post your questions from a gmail
(or whatever) account instead please.

Regards,

-- 
Mark M. Hoffman
mhoffman at lightlink.com




More information about the i2c mailing list