diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2021-06-16 10:54:36 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-06-16 10:54:36 +0200 |
commit | 1087e67b74b5ad8e1d5ec2eace7d40beac55dc17 (patch) | |
tree | 29436017d51f52e87ba56da013307b3d5e0cd5f6 /include | |
parent | 1c5746ef8c8669a0de02c5e5d238298aa851d7c5 (diff) | |
parent | 881553032a6953cdd48bf254e501181b65993bdf (diff) | |
download | barebox-1087e67b74b5ad8e1d5ec2eace7d40beac55dc17.tar.gz barebox-1087e67b74b5ad8e1d5ec2eace7d40beac55dc17.tar.xz |
Merge branch 'for-next/i2c'
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/nvmem-provider.h | 15 | ||||
-rw-r--r-- | include/regmap.h | 14 |
2 files changed, 25 insertions, 4 deletions
diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index 6ef5ea6854..2d73898373 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -18,10 +18,8 @@ struct nvmem_device; struct nvmem_bus { - int (*write)(struct device_d *dev, const int reg, const void *val, - int val_size); - int (*read)(struct device_d *dev, const int reg, void *val, - int val_size); + int (*write)(void *ctx, unsigned int reg, const void *val, size_t val_size); + int (*read)(void *ctx, unsigned int reg, void *val, size_t val_size); }; struct nvmem_config { @@ -32,11 +30,15 @@ struct nvmem_config { int word_size; int size; const struct nvmem_bus *bus; + void *priv; }; +struct regmap; + #if IS_ENABLED(CONFIG_NVMEM) struct nvmem_device *nvmem_register(const struct nvmem_config *cfg); +struct nvmem_device *nvmem_regmap_register(struct regmap *regmap, const char *name); #else @@ -45,5 +47,10 @@ static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c) return ERR_PTR(-ENOSYS); } +static inline struct nvmem_device *nvmem_regmap_register(struct regmap *regmap, const char *name) +{ + return ERR_PTR(-ENOSYS); +} + #endif /* CONFIG_NVMEM */ #endif /* ifndef _LINUX_NVMEM_PROVIDER_H */ diff --git a/include/regmap.h b/include/regmap.h index 057370afc7..db84c7a534 100644 --- a/include/regmap.h +++ b/include/regmap.h @@ -77,6 +77,19 @@ struct regmap *regmap_init_mmio_clk(struct device_d *dev, const char *clk_id, const struct regmap_config *config); /** + * regmap_init_i2c() - Initialise i2c 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. + */ +struct i2c_client; +struct regmap *regmap_init_i2c(struct i2c_client *i2c, + const struct regmap_config *config); + +/** * regmap_init_mmio() - Initialise register map * * @dev: Device that will be interacted with @@ -96,6 +109,7 @@ void regmap_mmio_detach_clk(struct regmap *map); void regmap_exit(struct regmap *map); struct regmap *dev_get_regmap(struct device_d *dev, const char *name); +struct device_d *regmap_get_device(struct regmap *map); int regmap_register_cdev(struct regmap *map, const char *name); |