diff options
Diffstat (limited to 'include/linux/regmap.h')
| -rw-r--r-- | include/linux/regmap.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index a10380bfbeac..e55907804d39 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h | |||
| @@ -23,6 +23,7 @@ struct device; | |||
| 23 | struct i2c_client; | 23 | struct i2c_client; |
| 24 | struct irq_domain; | 24 | struct irq_domain; |
| 25 | struct spi_device; | 25 | struct spi_device; |
| 26 | struct spmi_device; | ||
| 26 | struct regmap; | 27 | struct regmap; |
| 27 | struct regmap_range_cfg; | 28 | struct regmap_range_cfg; |
| 28 | struct regmap_field; | 29 | struct regmap_field; |
| @@ -70,6 +71,8 @@ struct regmap_range { | |||
| 70 | unsigned int range_max; | 71 | unsigned int range_max; |
| 71 | }; | 72 | }; |
| 72 | 73 | ||
| 74 | #define regmap_reg_range(low, high) { .range_min = low, .range_max = high, } | ||
| 75 | |||
| 73 | /* | 76 | /* |
| 74 | * A table of ranges including some yes ranges and some no ranges. | 77 | * A table of ranges including some yes ranges and some no ranges. |
| 75 | * If a register belongs to a no_range, the corresponding check function | 78 | * If a register belongs to a no_range, the corresponding check function |
| @@ -318,6 +321,8 @@ struct regmap *regmap_init_i2c(struct i2c_client *i2c, | |||
| 318 | const struct regmap_config *config); | 321 | const struct regmap_config *config); |
| 319 | struct regmap *regmap_init_spi(struct spi_device *dev, | 322 | struct regmap *regmap_init_spi(struct spi_device *dev, |
| 320 | const struct regmap_config *config); | 323 | const struct regmap_config *config); |
| 324 | struct regmap *regmap_init_spmi(struct spmi_device *dev, | ||
| 325 | const struct regmap_config *config); | ||
| 321 | struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id, | 326 | struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id, |
| 322 | void __iomem *regs, | 327 | void __iomem *regs, |
| 323 | const struct regmap_config *config); | 328 | const struct regmap_config *config); |
| @@ -330,6 +335,8 @@ struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c, | |||
| 330 | const struct regmap_config *config); | 335 | const struct regmap_config *config); |
| 331 | struct regmap *devm_regmap_init_spi(struct spi_device *dev, | 336 | struct regmap *devm_regmap_init_spi(struct spi_device *dev, |
| 332 | const struct regmap_config *config); | 337 | const struct regmap_config *config); |
| 338 | struct regmap *devm_regmap_init_spmi(struct spmi_device *dev, | ||
| 339 | const struct regmap_config *config); | ||
| 333 | struct regmap *devm_regmap_init_mmio_clk(struct device *dev, const char *clk_id, | 340 | struct regmap *devm_regmap_init_mmio_clk(struct device *dev, const char *clk_id, |
| 334 | void __iomem *regs, | 341 | void __iomem *regs, |
| 335 | const struct regmap_config *config); | 342 | const struct regmap_config *config); |
| @@ -374,10 +381,13 @@ int regmap_reinit_cache(struct regmap *map, | |||
| 374 | const struct regmap_config *config); | 381 | const struct regmap_config *config); |
| 375 | struct regmap *dev_get_regmap(struct device *dev, const char *name); | 382 | struct regmap *dev_get_regmap(struct device *dev, const char *name); |
| 376 | int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); | 383 | int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); |
| 384 | int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val); | ||
| 377 | int regmap_raw_write(struct regmap *map, unsigned int reg, | 385 | int regmap_raw_write(struct regmap *map, unsigned int reg, |
| 378 | const void *val, size_t val_len); | 386 | const void *val, size_t val_len); |
| 379 | int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, | 387 | int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, |
| 380 | size_t val_count); | 388 | size_t val_count); |
| 389 | int regmap_multi_reg_write(struct regmap *map, struct reg_default *regs, | ||
| 390 | int num_regs); | ||
| 381 | int regmap_raw_write_async(struct regmap *map, unsigned int reg, | 391 | int regmap_raw_write_async(struct regmap *map, unsigned int reg, |
| 382 | const void *val, size_t val_len); | 392 | const void *val, size_t val_len); |
| 383 | int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val); | 393 | int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val); |
| @@ -387,9 +397,14 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, | |||
| 387 | size_t val_count); | 397 | size_t val_count); |
| 388 | int regmap_update_bits(struct regmap *map, unsigned int reg, | 398 | int regmap_update_bits(struct regmap *map, unsigned int reg, |
| 389 | unsigned int mask, unsigned int val); | 399 | unsigned int mask, unsigned int val); |
| 400 | int regmap_update_bits_async(struct regmap *map, unsigned int reg, | ||
| 401 | unsigned int mask, unsigned int val); | ||
| 390 | int regmap_update_bits_check(struct regmap *map, unsigned int reg, | 402 | int regmap_update_bits_check(struct regmap *map, unsigned int reg, |
| 391 | unsigned int mask, unsigned int val, | 403 | unsigned int mask, unsigned int val, |
| 392 | bool *change); | 404 | bool *change); |
| 405 | int regmap_update_bits_check_async(struct regmap *map, unsigned int reg, | ||
| 406 | unsigned int mask, unsigned int val, | ||
| 407 | bool *change); | ||
| 393 | int regmap_get_val_bytes(struct regmap *map); | 408 | int regmap_get_val_bytes(struct regmap *map); |
| 394 | int regmap_async_complete(struct regmap *map); | 409 | int regmap_async_complete(struct regmap *map); |
| 395 | bool regmap_can_raw_write(struct regmap *map); | 410 | bool regmap_can_raw_write(struct regmap *map); |
| @@ -425,11 +440,15 @@ bool regmap_reg_in_ranges(unsigned int reg, | |||
| 425 | * @reg: Offset of the register within the regmap bank | 440 | * @reg: Offset of the register within the regmap bank |
| 426 | * @lsb: lsb of the register field. | 441 | * @lsb: lsb of the register field. |
| 427 | * @reg: msb of the register field. | 442 | * @reg: msb of the register field. |
| 443 | * @id_size: port size if it has some ports | ||
| 444 | * @id_offset: address offset for each ports | ||
| 428 | */ | 445 | */ |
| 429 | struct reg_field { | 446 | struct reg_field { |
| 430 | unsigned int reg; | 447 | unsigned int reg; |
| 431 | unsigned int lsb; | 448 | unsigned int lsb; |
| 432 | unsigned int msb; | 449 | unsigned int msb; |
| 450 | unsigned int id_size; | ||
| 451 | unsigned int id_offset; | ||
| 433 | }; | 452 | }; |
| 434 | 453 | ||
| 435 | #define REG_FIELD(_reg, _lsb, _msb) { \ | 454 | #define REG_FIELD(_reg, _lsb, _msb) { \ |
| @@ -448,6 +467,15 @@ void devm_regmap_field_free(struct device *dev, struct regmap_field *field); | |||
| 448 | 467 | ||
| 449 | int regmap_field_read(struct regmap_field *field, unsigned int *val); | 468 | int regmap_field_read(struct regmap_field *field, unsigned int *val); |
| 450 | int regmap_field_write(struct regmap_field *field, unsigned int val); | 469 | int regmap_field_write(struct regmap_field *field, unsigned int val); |
| 470 | int regmap_field_update_bits(struct regmap_field *field, | ||
| 471 | unsigned int mask, unsigned int val); | ||
| 472 | |||
| 473 | int regmap_fields_write(struct regmap_field *field, unsigned int id, | ||
| 474 | unsigned int val); | ||
| 475 | int regmap_fields_read(struct regmap_field *field, unsigned int id, | ||
| 476 | unsigned int *val); | ||
| 477 | int regmap_fields_update_bits(struct regmap_field *field, unsigned int id, | ||
| 478 | unsigned int mask, unsigned int val); | ||
| 451 | 479 | ||
| 452 | /** | 480 | /** |
| 453 | * Description of an IRQ for the generic regmap irq_chip. | 481 | * Description of an IRQ for the generic regmap irq_chip. |
| @@ -527,6 +555,13 @@ static inline int regmap_write(struct regmap *map, unsigned int reg, | |||
| 527 | return -EINVAL; | 555 | return -EINVAL; |
| 528 | } | 556 | } |
| 529 | 557 | ||
| 558 | static inline int regmap_write_async(struct regmap *map, unsigned int reg, | ||
| 559 | unsigned int val) | ||
| 560 | { | ||
| 561 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 562 | return -EINVAL; | ||
| 563 | } | ||
| 564 | |||
| 530 | static inline int regmap_raw_write(struct regmap *map, unsigned int reg, | 565 | static inline int regmap_raw_write(struct regmap *map, unsigned int reg, |
| 531 | const void *val, size_t val_len) | 566 | const void *val, size_t val_len) |
| 532 | { | 567 | { |
| @@ -576,6 +611,14 @@ static inline int regmap_update_bits(struct regmap *map, unsigned int reg, | |||
| 576 | return -EINVAL; | 611 | return -EINVAL; |
| 577 | } | 612 | } |
| 578 | 613 | ||
| 614 | static inline int regmap_update_bits_async(struct regmap *map, | ||
| 615 | unsigned int reg, | ||
| 616 | unsigned int mask, unsigned int val) | ||
| 617 | { | ||
| 618 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 619 | return -EINVAL; | ||
| 620 | } | ||
| 621 | |||
| 579 | static inline int regmap_update_bits_check(struct regmap *map, | 622 | static inline int regmap_update_bits_check(struct regmap *map, |
| 580 | unsigned int reg, | 623 | unsigned int reg, |
| 581 | unsigned int mask, unsigned int val, | 624 | unsigned int mask, unsigned int val, |
| @@ -585,6 +628,16 @@ static inline int regmap_update_bits_check(struct regmap *map, | |||
| 585 | return -EINVAL; | 628 | return -EINVAL; |
| 586 | } | 629 | } |
| 587 | 630 | ||
| 631 | static inline int regmap_update_bits_check_async(struct regmap *map, | ||
| 632 | unsigned int reg, | ||
| 633 | unsigned int mask, | ||
| 634 | unsigned int val, | ||
| 635 | bool *change) | ||
| 636 | { | ||
| 637 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 638 | return -EINVAL; | ||
| 639 | } | ||
| 640 | |||
| 588 | static inline int regmap_get_val_bytes(struct regmap *map) | 641 | static inline int regmap_get_val_bytes(struct regmap *map) |
| 589 | { | 642 | { |
| 590 | WARN_ONCE(1, "regmap API is disabled"); | 643 | WARN_ONCE(1, "regmap API is disabled"); |
