xref: /OK3568_Linux_fs/kernel/Documentation/i2c/slave-eeprom-backend.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun==============================
2*4882a593SmuzhiyunLinux I2C slave EEPROM backend
3*4882a593Smuzhiyun==============================
4*4882a593Smuzhiyun
5*4882a593Smuzhiyunby Wolfram Sang <wsa@sang-engineering.com> in 2014-20
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunThis backend simulates an EEPROM on the connected I2C bus. Its memory contents
8*4882a593Smuzhiyuncan be accessed from userspace via this file located in sysfs::
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun	/sys/bus/i2c/devices/<device-directory>/slave-eeprom
11*4882a593Smuzhiyun
12*4882a593SmuzhiyunThe following types are available: 24c02, 24c32, 24c64, and 24c512. Read-only
13*4882a593Smuzhiyunvariants are also supported. The name needed for instantiating has the form
14*4882a593Smuzhiyun'slave-<type>[ro]'. Examples follow:
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun24c02, read/write, address 0x64:
17*4882a593Smuzhiyun  # echo slave-24c02 0x1064 > /sys/bus/i2c/devices/i2c-1/new_device
18*4882a593Smuzhiyun
19*4882a593Smuzhiyun24c512, read-only, address 0x42:
20*4882a593Smuzhiyun  # echo slave-24c512ro 0x1042 > /sys/bus/i2c/devices/i2c-1/new_device
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunYou can also preload data during boot if a device-property named
23*4882a593Smuzhiyun'firmware-name' contains a valid filename (DT or ACPI only).
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunAs of 2015, Linux doesn't support poll on binary sysfs files, so there is no
26*4882a593Smuzhiyunnotification when another master changed the content.
27