2. 请看devm_regmap_init_i2c (include/linux/regmap.h) /** * devm_regmap_init_i2c() - Initialise managed register map * * @i2c: Device that will be interacted with * @config: Configuration for register map * * The return value will be an ERR_PTR() on error or a valid pointer * ...
2. 请看devm_regmap_init_i2c (include/linux/regmap.h) /** * devm_regmap_init_i2c() - Initialise managed register map * * @i2c: Device that will be interacted with * @config: Configuration for register map * * The return value will be an ERR_PTR() on error or a valid pointer * ...
* devm_regmap_init_i2c() - Initialise managed register map * * @i2c: Device that will be interacted with * @config: Configuration for register map * * The return value will be an ERR_PTR() on error or a valid pointer * to a struct regmap. The regmap will be automatically freed by...
struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c, const struct regmap_config *config) 读写I2C: int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);//读取reg中的值,保存在val中 int regmap_raw_read(struct regmap *map, unsigned int reg, void *val, size_t...
i2c = devm_kzalloc(&pdev->dev, sizeof(struct rk3x_i2c), GFP_KERNEL); if (!i2c) return -ENOMEM; match = of_match_node(rk3x_i2c_match, np); i2c->soc_data = (struct rk3x_i2c_soc_data *)match->data; /* use common interface to get I2C timing properties */ ...
compatible = “rockchip,rk809”匹配到i2c驱动module_i2c_driver(rk808_i2c_driver),会调用rk808_probe,该函数会继续i2c设备初始化等操作,其中会调用devm_mfd_add_devices函数,添加mfd(multi-function device,多功能设备)设备,会添加rk808-regulator平台设备,该设备会和平台驱动rk808_regulator_driver匹配,最后在...
1、Regmap 申请与初始化 regmap 支持多种物理总线,比如 I2C 和 SPI,我们需要根据所使用的接口来选择合适的 regmap 初始化函数。Linux 内核提供了针对不同接口的 regmap 初始化函数。 SPI 接口初始化函数为 regmap_init_spi I2C 接口的初始化函数为 regmap_init_i2c ...
my_dev->regmap = devm_regmap_init_mmio(&pdev->dev,base, &my_device_regmap_config);if(IS_ERR(my_dev->regmap))returnPTR_ERR(my_dev->regmap);// 其他设备初始化操作return0; } 使用regmapAPI 访问寄存器: 在设备驱动中,你可以使用regmap提供的 API 来访问设备寄存器。例如,你可以使用regmap_read(...
simple_mfd_data->regmap_config) regmap_config = ®map_config_8r_8v; else regmap_config = simple_mfd_data->regmap_config; regmap = devm_regmap_init_i2c(i2c, config); regmap = devm_regmap_init_i2c(i2c, regmap_config); if (IS_ERR(regmap)) return PTR_ERR(regmap); return devm_of_...
#include <linux/i2c.h> #include <linux/module.h> #include <linux/regmap.h> #include <linux/slab.h> #include <linux/cdev.h> #include <sound/pcm.h> #include <sound/pcm_params.h> #include <sound/soc.h> #include <linux/gpio.h> ...