2013年8月28日星期三

LINUX on the i2c bus eeprom driver issue.

Saw many days the i2c bus device drivers, see now or in a group was, please help me reasonable grounds.
I use mini2440, kernel version 2.6.32.2.
I analyzed the kernel's "i2c-s3c2410.c" file, know that this is a platform device driver that i2c bus adapter driver layer files, mainly to i2c bus registered to the platform-bus, so development board we can see these two things:
one is :/ sys/bus/platform/devices/s3c2440-i2c Another is :/ sys/bus/platform/drivers/s3c-i2c

Another "s3c-i2c" passed through the looking "id_table" in the "s3c2440-i2c" enabling and device "match", and can be seen in this file has the following structure:
static const struct i2c_algorithm s3c24xx_i2c_algorithm = {
. master_xfer = s3c24xx_i2c_xfer,
. functionality = s3c24xx_i2c_func,
}; This is the next device on the bus information transfer data transmission, the device driver layer will call
So far I have not there is any doubt (right place, please help correct)

I saw eeprom application is invoked drive :/ dev/i2c/0 but just could not find how to generate this driver corresponding document?
Then, I read that ". master_xfer = s3c24xx_i2c_xfer," This is the junction device driver layer file calls, I found the next whole project did not find somewhere else useful? Is not it?
In addition, the corresponding board eeprom (AT24C08) drive in the end is which one? "I2c-dev.c" The document is mainly used to do?
Please help busy Analysis Analysis

------ Solution ------------------------------------ --------
I was / dev/i2c/0 this device node, I do not know what this program is to engage in a generation?
-------------------
should i2c-dev.c generated, you can think of ways to test


and I can say that the next at24.c and i2c-dev.c relationship do?
------------------------------------------
at24.c eeprom is kernel mode driver. This is a common drive, which is what you said, "not with a controller driver (i2c-s3c2410.c) we write a specific device driver, then the application can call, you can do ? "

i2c-dev.c more unique. linux in the IO port, usb i2c to provide user-mode driver. Applications with i2c-dev.c able to directly read and write i2c device. This particular case, the application will become eeprom driver.


i2c driver used by the read, write, file_operations is not that i2c-dev.c file of those who do?
-------------------------
i2c-dev.c Again, not a device driver. It is the i2c bus controller driver provides an interface to the user space.
You can i2c-dev.c the read, write, at the application layer can also write eeprom rtc i2c device driver of these


You already know a bus driver needs to have bus controller and device drivers, a total of two kinds of driver
at24.c belong to device drivers
i2c-dev.c is a special bus controller driver


------ For reference only ---------------------------------- -----
eeprom application I see the call on a drive is :/ dev/i2c/0 but just could not find how to generate this driver corresponding document?
Then, I read that ". master_xfer = s3c24xx_i2c_xfer," This is the junction device driver layer file calls, I found the next whole project did not find somewhere else useful? Is not it?
In addition, the corresponding board eeprom (AT24C08) drive in the end is which one? "I2c-dev.c" The document is mainly used to do?
Please help busy Analysis Analysis


your problem statement is unclear, I look out three issues

say ". master_xfer = s3c24xx_i2c_xfer," This is the junction device driver layer file calls, I found the next whole project did not find somewhere else useful?
-----------------------------
c language simulation kernel uses an object-oriented programming, the use of function pointers analog polymorphism. So you can not find s3c24xx_i2c_xfer call, only to find
ret = adap-> algo-> master_xfer (adap, msgs, num); such a call

corresponding board eeprom (AT24C08) drive in the end is which one of the
------------
drivers/i2c/chips/at24.c

"i2c-dev.c" The document is mainly used to do?
-------------------------
This is the user-mode driver i2c driver. Application can pass / dev/i2c-0 such a device nodes communicate directly with i2c device. The i2c device driver functionality into the user layer.

------ For reference only ---------------------------------- -----
I just have read, there is no "drivers/i2c/chips/at24.c" of this document, but in the "drivers / misc / eeprom" has found at24.c documents, In this document the following structure:
static struct i2c_driver at24_driver = {
. driver = {
. name = "at24",
. owner = THIS_MODULE,
},
. probe = at24_probe,
. remove = __ devexit_p (at24_remove),
. id_table = at24_ids,
};
static const struct i2c_device_id at24_ids [] = {
/ * needs 8 addresses as A0-A2 are ignored * /
{"24c00", AT24_DEVICE_MAGIC (128/8, AT24_FLAG_TAKE8ADDR)},
/ * old variants can't be handled with this generic entry! * /
{"24c01", AT24_DEVICE_MAGIC (1024/8, 0)},
{"24c02", AT24_DEVICE_MAGIC (2048/8, 0)},
/ * spd is a 24c02 in memory DIMMs * /
...
I can on the board / sys / file is also not found in the corresponding file name of the country?

This is the user-mode driver i2c driver. Application can pass / dev/i2c-0 such a device node
------------------
I was / dev/i2c/0 this device node, I do not know what this program is to engage in a generation?

Also, and I can say that the next at24.c and i2c-dev.c relationship do? Not with a controller driver (i2c-s3c2410.c) we write a specific device driver, then the application can call, it can do?
i2c driver used by the read, write, file_operations is not that i2c-dev.c file of those who do?
------ For reference only -------------------------------------- -
ah now basically be figured out
I open the i2c plate board :/ dev/i2c/0 node is still looking for this thing now than just a. .
Thank pointing! ! !
------ For reference only -------------------------------------- -
  This reply was moderator deleted at 2012-06-19 10:31:16

------ For reference only ---------------------------------- -----
mdev-s can be generated automatically
And I see are / dev/i2c-0, may be old kernel / dev/i2c/0
------ For reference only ------- --------------------------------
that nothing is the same as the two
Some time ago I found a file system thing
in / etc / folder there is a file mdev.conf, in this file has the following few words:
# serial port devices
s3c2410_serial0 0:5 0666 = ttySAC0
s3c2410_serial1 0:5 0666 = ttySAC1
s3c2410_serial2 0:5 0666 = ttySAC2
s3c2410_serial3 0:5 0666 = ttySAC3

# loop devices
loop [0-9] * 0:0 0660 = loop /

# i2c devices
i2c-0 0:0 0666 = i2c / 0
i2c-1 0:0 0666 = i2c / 1

should be is where the name of the i2c-0 is equivalent to i2c / 0 of the name!
------ For reference only -------------------------------------- -
ret = adap-> algo-> master_xfer (adap, msgs, num); I2C problem like you explorations ah
654813453QQ

没有评论:

发表评论