Merge branches 'regmap-core', 'regmap-stride', 'regmap-mmio' and 'regmap-irq' into regmap-next
This commit is contained in:
@@ -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.
|
||||
*
|
||||
@@ -70,6 +76,9 @@ struct reg_default {
|
||||
* @write_flag_mask: Mask to be set in the top byte of the register when doing
|
||||
* a write. If both read_flag_mask and write_flag_mask are
|
||||
* empty the regmap_bus default masks are used.
|
||||
* @use_single_rw: If set, converts the bulk read and write operations into
|
||||
* a series of single read and write operations. This is useful
|
||||
* for device that does not support bulk read and write.
|
||||
*
|
||||
* @cache_type: The actual cache type.
|
||||
* @reg_defaults_raw: Power on reset values for registers (for use with
|
||||
@@ -77,7 +86,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;
|
||||
|
||||
@@ -95,20 +107,25 @@ struct regmap_config {
|
||||
|
||||
u8 read_flag_mask;
|
||||
u8 write_flag_mask;
|
||||
|
||||
bool use_single_rw;
|
||||
};
|
||||
|
||||
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,31 +135,42 @@ 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,
|
||||
const struct regmap_config *config);
|
||||
struct regmap *dev_get_regmap(struct device *dev, const char *name);
|
||||
int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
|
||||
int regmap_raw_write(struct regmap *map, unsigned int reg,
|
||||
const void *val, size_t val_len);
|
||||
@@ -327,6 +355,13 @@ static inline int regmap_register_patch(struct regmap *map,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline struct regmap *dev_get_regmap(struct device *dev,
|
||||
const char *name)
|
||||
{
|
||||
WARN_ONCE(1, "regmap API is disabled");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user