Introducing NVMEM data structures and APIs
NVMEM is a small framework with a reduced set of APIs and data structures. In this section, we will introduce those APIs and data structures, as well as the concept of a cell, which is the base of this framework.
NVMEM is based on the producer/consumer pattern, just like the clock framework described in Chapter 4, Storming the Common Clock Framework. There is a single driver for the NVMEM device, exposing the device cells so that they can be accessed and manipulated by consumer drivers. While the NVMEM device driver must include <linux/nvmem-provider.h>
, consumers have to include <linux/nvmem-consumer.h>
. This framework has only a few data structures, among which is struct nvmem_device
, which looks as follows:
struct nvmem_device {     const char  *name;     struct module *owner;     struct device dev;     int stride;    ...