[i2c] i2c newbie questions

Anand Kumar S - TLS , Chennai sanandkumar at hcl.in
Wed Aug 2 13:55:23 CEST 2006


Hi Mark,

Thanks for the help. I think I will go with the user mode driver. I guess in
that case it will talk directly to the mcfi2c controller driver right? That
is all the requests will be routed to this controller driver via the i2c-dev
interface. Am I correct?

Also is it possible for you to point me to some example i2c user mode driver
implementations?

Rgds

Anand

-----Original Message-----
From: Mark M. Hoffman [mailto:mhoffman at lightlink.com] 
Sent: Wednesday, August 02, 2006 5:03 PM
To: Anand Kumar S - TLS , Chennai
Cc: i2c at lm-sensors.org
Subject: Re: [i2c] i2c newbie questions

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
DISCLAIMER 
The contents of this e-mail and any attachment(s) are confidential and intended for the 

named recipient(s) only. It shall not attach any liability on the originator or HCL or its 

affiliates. Any views or opinions presented in this email are solely those of the author and 

may not necessarily reflect the opinions of HCL or its affiliates. Any form of reproduction, 

dissemination, copying, disclosure, modification, distribution and / or publication of this 

message without the prior written consent of the author of this e-mail is strictly 

prohibited. If you have received this email in error please delete it and notify the sender 

immediately. Before opening any mail and attachments please check them for viruses and 

defect.



More information about the i2c mailing list