Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I2C Driver in Linux [closed]

I am aware of I2C in a very basic level which relies inside linux kernel, but no clue to implement a basic I2C driver.

Trying to moving for a start in I2C device driver. could you please suggest any beginner tutorial with source code mapping !!

like image 677
San Avatar asked May 24 '13 06:05

San


People also ask

How I2C driver works in Linux?

I2C device drivers using this binding model work just like any other kind of driver in Linux: they provide a probe() method to bind to those devices, and a remove() method to unbind. static int foo_probe(struct i2c_client *client); static int foo_remove(struct i2c_client *client);

What is I2C driver?

An I2C “Adapter Driver” abstracts the controller hardware; it binds to a physical device (perhaps a PCI device or platform_device) and exposes a struct i2c_adapter representing each I2C bus segment it manages. On each I2C bus segment will be I2C devices represented by a struct i2c_client .

Why I2C driver is used?

This month, we discuss what the I2C subsystem does and how to write a driver for it. I2C is the name for a two-wire serial bus protocol originally developed by Phillips. It commonly is used in embedded systems so different components can communicate; PC motherboards use I2C to talk to different sensor chips.


1 Answers

linux-source/Documentation/i2c/ has lot of the information you'd need. .../writing-clients.txt is a good place to start.

Have a look at the online version:

https://www.kernel.org/doc/Documentation/i2c/writing-clients

There is an okay sort of a tutorial at:

http://renjucnair.blogspot.ca/2012/01/writing-i2c-client-driver.html

Here is a good commentary on someone writing an i2c driver and has a tutorial feel to it:

http://www.embedded-bits.co.uk/2009/i2c-in-the-2632-linux-kernel/

Here is some sample code:

http://code.google.com/p/ldd-templates/source/browse/drivers/i2c/sample-i2c-client.c

like image 138
Ahmed Masud Avatar answered Nov 21 '22 21:11

Ahmed Masud