pres: Add way to bind fan eeprom driver after plug
Some fans have EEPROMs on them that are read by other BMC code so the
contents can be added to the BMC inventory. Since fans can usually be
hotplugged, this means those EEPROMs need to be read after a fan is
plugged, and there was previously no method to trigger that.
This commit adds functionality to phosphor-fan-presence-tach to bind the
EEPROM driver to the new device after a fan with an EEPROM is plugged.
This triggers a udev event which triggers EEPROM reads if the platform
is configured to do so.
This is done with a new optional JSON section in the config.json, which
looks like:
"eeprom": {
"bus_address": "31-0050",
"driver_name": "at24",
"bind_delay_ms": 1000
}
The 'bus_address' field is the device's I2C bus and address string as it
is represented in the I2C subsystem in sysfs. The 'driver_name' field
is the name of the device driver that manages that device. The
'bind_delay_ms' field allows there to be a defined amount of time
between when the device is plugged and when the driver is bound, in case
a certain amount of time is required for the device to come online after
it receives power.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I10d36efab954393239e6face96244ecd34035596
11 files changed