diff options
Diffstat (limited to 'drivers/base/regmap/internal.h')
-rw-r--r-- | drivers/base/regmap/internal.h | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h index 5b19459828..ac3f0d3c0f 100644 --- a/drivers/base/regmap/internal.h +++ b/drivers/base/regmap/internal.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ #ifndef REGMAP_INTERNAL_H_ #define REGMAP_INTERNAL_H_ @@ -6,20 +7,51 @@ struct regmap_bus; +struct regmap_format { + size_t buf_size; + size_t reg_bytes; + size_t pad_bytes; + size_t val_bytes; + void (*format_write)(struct regmap *map, + unsigned int reg, unsigned int val); + void (*format_reg)(void *buf, unsigned int reg, unsigned int shift); + void (*format_val)(void *buf, unsigned int val, unsigned int shift); + unsigned int (*parse_val)(const void *buf); +}; + struct regmap { - struct device_d *dev; + struct device *dev; const struct regmap_bus *bus; const char *name; void *bus_context; struct list_head list; - int reg_bits; int reg_stride; - int pad_bits; - int val_bits; - int val_bytes; + void *work_buf; /* Scratch buffer used to format I/O */ + struct regmap_format format; + unsigned int read_flag_mask; + unsigned int write_flag_mask; + int reg_shift; unsigned int max_register; struct cdev cdev; + + int (*reg_read)(void *context, unsigned int reg, + unsigned int *val); + int (*reg_write)(void *context, unsigned int reg, + unsigned int val); }; +enum regmap_endian regmap_get_val_endian(struct device *dev, + const struct regmap_bus *bus, + const struct regmap_config *config); + +#ifdef CONFIG_REGMAP_FORMATTED +int regmap_formatted_init(struct regmap *map, const struct regmap_config *); +#else +static inline int regmap_formatted_init(struct regmap *map, const struct regmap_config *cfg) +{ + return -ENOSYS; +} +#endif + #endif |