0

I'm trying to understand how the read/write on "eeprom" device node in linux works ? I'm using at24 (drivers/misc/eeprom/at24.c) i2c driver to access my eeprom. From userspace, I'm able to do open/read/write/close on the created device node and I can access the eeprom without any issues. But I can't seem to find the corresponding callbacks defined in the at24 driver. Does anyone know how this works ?

Thanks in advance!

ch2301
  • 3
  • 1
  • 1
    It depends on the kernel version, but there will be a call to `sysfs_create_bin_file` somewhere that creates the sysfs file and registers the callbacks. From kernel version 4.6 onwards it uses a combination of `devm_regmap_init` and `nvmem_register` instead. `nvmem_register` calls `dev_get_regmap` to get at the regmap initialized by the at24 driver. – Ian Abbott May 15 '18 at 14:41
  • Thanks. The "eeprom" sysfs entry is created as part of `nvmem_setup_compat`. – ch2301 Aug 07 '18 at 10:21

0 Answers0