Writing the NVMEM provider driver
The provider is the one exposing the device memory so that other drivers (the consumers) can access it. The main tasks of these drivers are as follows:
- Providing suitable NVMEM configuration with respect to the device’s datasheet, along with the routines allowing you to access the memory
- Registering the device with the system
- Providing device tree binding documentation
That is all the provider has to do. Most (the rest) of the mechanism/logic is handled by the NVMEM framework’s code.
NVMEM device (un)registration
Registering/unregistering the NVMEM device is actually part of the provider-side driver, which can use the nvmem_register()
/nvmem_unregister()
functions, or their managed versions, devm_nvmem_register()
/devm_nvmem_unregister()
:
struct nvmem_device *nvmem_register(const ...