diff options
Diffstat (limited to 'include/linux/regmap.h')
| -rw-r--r-- | include/linux/regmap.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 4f38068ffb71..379505a53722 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h | |||
| @@ -268,6 +268,13 @@ typedef void (*regmap_unlock)(void *); | |||
| 268 | * field is NULL but precious_table (see below) is not, the | 268 | * field is NULL but precious_table (see below) is not, the |
| 269 | * check is performed on such table (a register is precious if | 269 | * check is performed on such table (a register is precious if |
| 270 | * it belongs to one of the ranges specified by precious_table). | 270 | * it belongs to one of the ranges specified by precious_table). |
| 271 | * @readable_noinc_reg: Optional callback returning true if the register | ||
| 272 | * supports multiple read operations without incrementing | ||
| 273 | * the register number. If this field is NULL but | ||
| 274 | * rd_noinc_table (see below) is not, the check is | ||
| 275 | * performed on such table (a register is no increment | ||
| 276 | * readable if it belongs to one of the ranges specified | ||
| 277 | * by rd_noinc_table). | ||
| 271 | * @disable_locking: This regmap is either protected by external means or | 278 | * @disable_locking: This regmap is either protected by external means or |
| 272 | * is guaranteed not be be accessed from multiple threads. | 279 | * is guaranteed not be be accessed from multiple threads. |
| 273 | * Don't use any locking mechanisms. | 280 | * Don't use any locking mechanisms. |
| @@ -295,6 +302,7 @@ typedef void (*regmap_unlock)(void *); | |||
| 295 | * @rd_table: As above, for read access. | 302 | * @rd_table: As above, for read access. |
| 296 | * @volatile_table: As above, for volatile registers. | 303 | * @volatile_table: As above, for volatile registers. |
| 297 | * @precious_table: As above, for precious registers. | 304 | * @precious_table: As above, for precious registers. |
| 305 | * @rd_noinc_table: As above, for no increment readable registers. | ||
| 298 | * @reg_defaults: Power on reset values for registers (for use with | 306 | * @reg_defaults: Power on reset values for registers (for use with |
| 299 | * register cache support). | 307 | * register cache support). |
| 300 | * @num_reg_defaults: Number of elements in reg_defaults. | 308 | * @num_reg_defaults: Number of elements in reg_defaults. |
| @@ -344,6 +352,7 @@ struct regmap_config { | |||
| 344 | bool (*readable_reg)(struct device *dev, unsigned int reg); | 352 | bool (*readable_reg)(struct device *dev, unsigned int reg); |
| 345 | bool (*volatile_reg)(struct device *dev, unsigned int reg); | 353 | bool (*volatile_reg)(struct device *dev, unsigned int reg); |
| 346 | bool (*precious_reg)(struct device *dev, unsigned int reg); | 354 | bool (*precious_reg)(struct device *dev, unsigned int reg); |
| 355 | bool (*readable_noinc_reg)(struct device *dev, unsigned int reg); | ||
| 347 | 356 | ||
| 348 | bool disable_locking; | 357 | bool disable_locking; |
| 349 | regmap_lock lock; | 358 | regmap_lock lock; |
| @@ -360,6 +369,7 @@ struct regmap_config { | |||
| 360 | const struct regmap_access_table *rd_table; | 369 | const struct regmap_access_table *rd_table; |
| 361 | const struct regmap_access_table *volatile_table; | 370 | const struct regmap_access_table *volatile_table; |
| 362 | const struct regmap_access_table *precious_table; | 371 | const struct regmap_access_table *precious_table; |
| 372 | const struct regmap_access_table *rd_noinc_table; | ||
| 363 | const struct reg_default *reg_defaults; | 373 | const struct reg_default *reg_defaults; |
| 364 | unsigned int num_reg_defaults; | 374 | unsigned int num_reg_defaults; |
| 365 | enum regcache_type cache_type; | 375 | enum regcache_type cache_type; |
| @@ -514,6 +524,10 @@ struct regmap *__regmap_init_i2c(struct i2c_client *i2c, | |||
| 514 | const struct regmap_config *config, | 524 | const struct regmap_config *config, |
| 515 | struct lock_class_key *lock_key, | 525 | struct lock_class_key *lock_key, |
| 516 | const char *lock_name); | 526 | const char *lock_name); |
| 527 | struct regmap *__regmap_init_sccb(struct i2c_client *i2c, | ||
| 528 | const struct regmap_config *config, | ||
| 529 | struct lock_class_key *lock_key, | ||
| 530 | const char *lock_name); | ||
| 517 | struct regmap *__regmap_init_slimbus(struct slim_device *slimbus, | 531 | struct regmap *__regmap_init_slimbus(struct slim_device *slimbus, |
| 518 | const struct regmap_config *config, | 532 | const struct regmap_config *config, |
| 519 | struct lock_class_key *lock_key, | 533 | struct lock_class_key *lock_key, |
| @@ -558,6 +572,10 @@ struct regmap *__devm_regmap_init_i2c(struct i2c_client *i2c, | |||
| 558 | const struct regmap_config *config, | 572 | const struct regmap_config *config, |
| 559 | struct lock_class_key *lock_key, | 573 | struct lock_class_key *lock_key, |
| 560 | const char *lock_name); | 574 | const char *lock_name); |
| 575 | struct regmap *__devm_regmap_init_sccb(struct i2c_client *i2c, | ||
| 576 | const struct regmap_config *config, | ||
| 577 | struct lock_class_key *lock_key, | ||
| 578 | const char *lock_name); | ||
| 561 | struct regmap *__devm_regmap_init_spi(struct spi_device *dev, | 579 | struct regmap *__devm_regmap_init_spi(struct spi_device *dev, |
| 562 | const struct regmap_config *config, | 580 | const struct regmap_config *config, |
| 563 | struct lock_class_key *lock_key, | 581 | struct lock_class_key *lock_key, |
| @@ -646,6 +664,19 @@ int regmap_attach_dev(struct device *dev, struct regmap *map, | |||
| 646 | i2c, config) | 664 | i2c, config) |
| 647 | 665 | ||
| 648 | /** | 666 | /** |
| 667 | * regmap_init_sccb() - Initialise register map | ||
| 668 | * | ||
| 669 | * @i2c: Device that will be interacted with | ||
| 670 | * @config: Configuration for register map | ||
| 671 | * | ||
| 672 | * The return value will be an ERR_PTR() on error or a valid pointer to | ||
| 673 | * a struct regmap. | ||
| 674 | */ | ||
| 675 | #define regmap_init_sccb(i2c, config) \ | ||
| 676 | __regmap_lockdep_wrapper(__regmap_init_sccb, #config, \ | ||
| 677 | i2c, config) | ||
| 678 | |||
| 679 | /** | ||
| 649 | * regmap_init_slimbus() - Initialise register map | 680 | * regmap_init_slimbus() - Initialise register map |
| 650 | * | 681 | * |
| 651 | * @slimbus: Device that will be interacted with | 682 | * @slimbus: Device that will be interacted with |
| @@ -798,6 +829,20 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); | |||
| 798 | i2c, config) | 829 | i2c, config) |
| 799 | 830 | ||
| 800 | /** | 831 | /** |
| 832 | * devm_regmap_init_sccb() - Initialise managed register map | ||
| 833 | * | ||
| 834 | * @i2c: Device that will be interacted with | ||
| 835 | * @config: Configuration for register map | ||
| 836 | * | ||
| 837 | * The return value will be an ERR_PTR() on error or a valid pointer | ||
| 838 | * to a struct regmap. The regmap will be automatically freed by the | ||
| 839 | * device management code. | ||
| 840 | */ | ||
| 841 | #define devm_regmap_init_sccb(i2c, config) \ | ||
| 842 | __regmap_lockdep_wrapper(__devm_regmap_init_sccb, #config, \ | ||
| 843 | i2c, config) | ||
| 844 | |||
| 845 | /** | ||
| 801 | * devm_regmap_init_spi() - Initialise register map | 846 | * devm_regmap_init_spi() - Initialise register map |
| 802 | * | 847 | * |
| 803 | * @dev: Device that will be interacted with | 848 | * @dev: Device that will be interacted with |
| @@ -946,6 +991,8 @@ int regmap_raw_write_async(struct regmap *map, unsigned int reg, | |||
| 946 | int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val); | 991 | int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val); |
| 947 | int regmap_raw_read(struct regmap *map, unsigned int reg, | 992 | int regmap_raw_read(struct regmap *map, unsigned int reg, |
| 948 | void *val, size_t val_len); | 993 | void *val, size_t val_len); |
| 994 | int regmap_noinc_read(struct regmap *map, unsigned int reg, | ||
| 995 | void *val, size_t val_len); | ||
| 949 | int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, | 996 | int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, |
| 950 | size_t val_count); | 997 | size_t val_count); |
| 951 | int regmap_update_bits_base(struct regmap *map, unsigned int reg, | 998 | int regmap_update_bits_base(struct regmap *map, unsigned int reg, |
| @@ -1196,6 +1243,13 @@ static inline int regmap_raw_read(struct regmap *map, unsigned int reg, | |||
| 1196 | return -EINVAL; | 1243 | return -EINVAL; |
| 1197 | } | 1244 | } |
| 1198 | 1245 | ||
| 1246 | static inline int regmap_noinc_read(struct regmap *map, unsigned int reg, | ||
| 1247 | void *val, size_t val_len) | ||
| 1248 | { | ||
| 1249 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 1250 | return -EINVAL; | ||
| 1251 | } | ||
| 1252 | |||
| 1199 | static inline int regmap_bulk_read(struct regmap *map, unsigned int reg, | 1253 | static inline int regmap_bulk_read(struct regmap *map, unsigned int reg, |
| 1200 | void *val, size_t val_count) | 1254 | void *val, size_t val_count) |
| 1201 | { | 1255 | { |
