diff options
Diffstat (limited to 'include/linux/regmap.h')
| -rw-r--r-- | include/linux/regmap.h | 28 | 
1 files changed, 25 insertions, 3 deletions
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index a90abb6bfa6..0258bcd6258 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -46,7 +46,13 @@ struct reg_default {  /**   * Configuration for the register map of a device.   * + * @name: Optional name of the regmap. Useful when a device has multiple + *        register regions. + *   * @reg_bits: Number of bits in a register address, mandatory. + * @reg_stride: The register address stride. Valid register addresses are a + *              multiple of this value. If set to 0, a value of 1 will be + *              used.   * @pad_bits: Number of bits of padding between register and value.   * @val_bits: Number of bits in a register value, mandatory.   * @@ -77,7 +83,10 @@ struct reg_default {   * @num_reg_defaults_raw: Number of elements in reg_defaults_raw.   */  struct regmap_config { +	const char *name; +  	int reg_bits; +	int reg_stride;  	int pad_bits;  	int val_bits; @@ -97,18 +106,21 @@ struct regmap_config {  	u8 write_flag_mask;  }; -typedef int (*regmap_hw_write)(struct device *dev, const void *data, +typedef int (*regmap_hw_write)(void *context, const void *data,  			       size_t count); -typedef int (*regmap_hw_gather_write)(struct device *dev, +typedef int (*regmap_hw_gather_write)(void *context,  				      const void *reg, size_t reg_len,  				      const void *val, size_t val_len); -typedef int (*regmap_hw_read)(struct device *dev, +typedef int (*regmap_hw_read)(void *context,  			      const void *reg_buf, size_t reg_size,  			      void *val_buf, size_t val_size); +typedef void (*regmap_hw_free_context)(void *context);  /**   * Description of a hardware bus for the register map infrastructure.   * + * @fast_io: Register IO is fast. Use a spinlock instead of a mutex + *           to perform locking.   * @write: Write operation.   * @gather_write: Write operation with split register/value, return -ENOTSUPP   *                if not implemented  on a given device. @@ -118,27 +130,37 @@ typedef int (*regmap_hw_read)(struct device *dev,   *                  a read.   */  struct regmap_bus { +	bool fast_io;  	regmap_hw_write write;  	regmap_hw_gather_write gather_write;  	regmap_hw_read read; +	regmap_hw_free_context free_context;  	u8 read_flag_mask;  };  struct regmap *regmap_init(struct device *dev,  			   const struct regmap_bus *bus, +			   void *bus_context,  			   const struct regmap_config *config);  struct regmap *regmap_init_i2c(struct i2c_client *i2c,  			       const struct regmap_config *config);  struct regmap *regmap_init_spi(struct spi_device *dev,  			       const struct regmap_config *config); +struct regmap *regmap_init_mmio(struct device *dev, +				void __iomem *regs, +				const struct regmap_config *config);  struct regmap *devm_regmap_init(struct device *dev,  				const struct regmap_bus *bus, +				void *bus_context,  				const struct regmap_config *config);  struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,  				    const struct regmap_config *config);  struct regmap *devm_regmap_init_spi(struct spi_device *dev,  				    const struct regmap_config *config); +struct regmap *devm_regmap_init_mmio(struct device *dev, +				     void __iomem *regs, +				     const struct regmap_config *config);  void regmap_exit(struct regmap *map);  int regmap_reinit_cache(struct regmap *map,  |