Skip to Content
Linux Device Drivers Development
book

Linux Device Drivers Development

by John Madieu
October 2017
Intermediate to advanced
586 pages
14h 8m
English
Packt Publishing
Content preview from Linux Device Drivers Development

I2C initialization

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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Device Drivers, Second Edition

Linux Device Drivers, Second Edition

Jonathan Corbet, Alessandro Rubini
Linux Device Drivers, 3rd Edition

Linux Device Drivers, 3rd Edition

Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman

Publisher Resources

ISBN: 9781785280009Supplemental Content