Before the Regmap API was developed, there was redundant code for the device drivers dealing with SPI core, I2C core, or both. The principle was the same: accessing the register for read/write operations. The following diagram shows how either the SPI or I2C API were standalone before Regmap was introduced to the kernel:
SPI and I2C subsystems before regmap
The regmap API was introduced in version 3.1 of the kernel, to factorize and unify the way kernel developers access SPI/I2C devices. It is then just a matter of how to initialize, configure a regmap, and process any read/write/modify operation fluently, whether it is SPI or I2C:
SPI and I2C subsystems after regmap
This chapter will walk through the regmap framework by means of:
- Introducing the main data structures used in by the regmap framework
- Walking through regmap configuration...