October 2017
Intermediate to advanced
586 pages
14h 8m
English
On the other hand, I2C regmap initialization consists of calling regmap_init_i2c() on the regmap config, which will configure the regmap so that any device access will internally be translated into I2C commands:
struct regmap * regmap_init_i2c(struct i2c_client *i2c, const struct regmap_config);
The function takes a struct i2c_client structure as parameter, which is the I2C device that will be used for interaction, along with a pointer to struct regmap_config, which represents the configuration for the regmap. This function returns either a pointer to the allocated struct regmap on success, or a value that will be an ERR_PTR() on error.
A full example is:
static int bar_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id ...