[i2c] Doubts related to I2c Subsystem
kishore kadiyala
kishorek.kadiyala at gmail.com
Fri May 11 14:22:43 CEST 2007
Hi jean,
Many thanks for your Valuable Reply.
really found the Group helping in clearing doubts.
please clarify me the Following Doubts
a) Jean as You explained me for the Query-1 through i2c-dev we can have any
number of clients on opening the device node /dev/i2c.lets see the following
implementation in *User Space*
step-1 : open device /dev/i2c-0 to get fd1
step-2 : Use FUNC as ioctl command to check adapter Functionality
step-3 : Use I2C_SLAVE_FORCE as ioctl cmd and pass the SLAVE_ADDRESS
step-4 : i2c_smbus_write_byte_data(fd1,SLAVE_ADDRESS,value)
How the call i2c_smbus_write_byte_data in step-4 conversion takes place
from *user space* to *kernel space?*
If repeatead step-1 to step-4 to get fd2 ! whether it should be always
assumed that fd1 is associated with SLAVE1 and fd2 for slave Device for
further Communication with the slaves also if I use i2c_SLAVE_FORCE and pass
Slave address for each & every communcation with adapter?
b) Regarding i2c-driver is the Subsystem?
Is i2c-driver an interface to client device to communicate with the
Adapter.?
C) please verify the attached Diagram about i2c subsystem (as per my
understanding) and please modify if any corrections for my clarity ?
Thank you In advance
Regards,
Kishore.
On 5/6/07, Jean Delvare <khali at linux-fr.org> wrote:
>
> Hi Kishore,
>
> On Thu, 3 May 2007 21:10:31 +0200, kishore kadiyala wrote:
> > Can any one please clarify the Following doubts regarding I2c Subsystem
> >
> > 1) Regarding I2c-dev interface
> > a)I have a setup with a codec Chip interfaced with the processor
> > through I2c bus.
> > My doubt is when i open a /dev/i2c-0 twice i will be getting a
> > file-descriptor say fd1 & fd2.
> > Does fd1 and fd2 mean different clients?
>
> Yes. Each time you open an i2c device node, you get a new client on
> that specific i2c bus.
>
> > If so how can a Single Slave can have different Clients.?
>
> It doesn't. /dev/i2c-0 corresponds to the whole i2c bus #0, not to a
> specific slave. You can have one client per slave device.
>
> > b) USing Dev interface can I Communicate with two slaves on i2c bus
> > interfaced with processor?
>
> Yes, you can. As you described above yourself, just open /dev/i2c-0
> twice, so you have one client for each slave device.
>
> > 2)Regarding Chip driver
> >
> > i have a setup with two different slave devices say S1 & S2 on
> I2c
> > bus interface towards processor .
> > Using Chip driver with Slave address mentioned in normal_i2c[] =
> > {s1_address,s2_address ,I2C_CLIENT_END };
> > Is it possible to communicate with the 2 slave devices .?
>
> Yes. The i2c core will call your driver's attach_adapter callback when
> your driver is loaded, from there you should call i2c_probe with your
> address data and your detect function as parameters. This will call
> your detect function once for every possible address (if a chip is
> found at said address.)
>
> Alternatively, you can use the new i2c probing method, by using static
> i2c device declarations in the platform code, or by calling
> i2c_new_device(). This is relatively new so there aren't many example
> in the kernel tree yet.
>
> > If not Do I have to write Two different chip drivers for two
> slaves?
>
> No, you don't. But then it depends if the slaves are the same chip
> type. If they are not, then it really doesn't make sense to support
> them both in the same driver!
>
> > 3) Regarding Sub system Layering
> >
> > What is the Role of I2c_driver in the Subsytem?
>
> Sorry, I don't understand this question. Please be more precise.
>
> --
> Jean Delvare
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.lm-sensors.org/pipermail/i2c/attachments/20070511/f84e2a78/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: i2csubsystem.odt
Type: application/vnd.oasis.opendocument.text
Size: 12113 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/i2c/attachments/20070511/f84e2a78/attachment-0001.odt
More information about the i2c
mailing list