Chapter 12: Abstracting Memory Access – Introduction to the Regmap API: a Register Map Abstraction
Before the Regmap API was developed, there was redundant code for the device drivers dealing with SPI, I2C, or memory-mapped devices. Many of these drivers contained some very similar code for accessing hardware device registers.
The following figure shows how SPI, I2C, and memory-mapped related APIs were used standalone before Regmap was introduced:
The Regmap API was introduced in version v3.1 of the Linux kernel and proposes a solution that factors out and unifies these similar register access codes, saving code and making it much easier to share infrastructure. It is then just a matter of how to initialize and to configure a regmap
structure, and process any read/write/modify operations fluently, whether it is SPI, I2C, or memory-mapped.
The following diagram depicts this API...