Introduction to regmap and its data structures – I2C, SPI, and MMIO
Regmap is an abstraction register access mechanism provided by the Linux kernel that mainly targets SPI, I2C, and memory-mapped registers.
APIs in this framework are bus agnostic and handle the underlying configuration under the hood. That being said, the main data structure in this framework is struct regmap_config
, defined in include/linux/regmap.h
in the kernel source tree as follows:
struct regmap_config { Â Â Â const char *name; Â Â Â int reg_bits; Â Â Â int reg_stride; Â Â Â int pad_bits; Â Â Â int val_bits; Â Â Â bool (*writeable_reg)(struct device *dev, unsigned int reg); Â Â Â bool (*readable_reg)(struct device *dev, unsigned int reg); Â Â Â bool (*volatile_reg)(struct device *dev, unsigned int reg); Â Â Â bool (*precious_reg)(struct device *dev, unsigned int reg); Â Â Â int...