Perform the following steps to set up a regmap subsystem:
- Set up a struct regmap_config, according to your device's characteristic. Set a register range if needed, default values if any, the cache_type if needed, and so on. If custom read/write functions are needed, pass them to the reg_read/reg_write fields.
- In the probe function, allocate a regmap using regmap_init_i2c or regmap_init_spi depending on the bus: I2C or SPI.
- Whenever you need to read/write from/into registers, call the regmap_[read|write] functions.
- When you are done with the regmap, call regmap_exit to free the register map allocated in probe.