diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/regmap.h | 107 |
1 files changed, 58 insertions, 49 deletions
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 18394343f489..3dc08ce15426 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h | |||
| @@ -65,6 +65,36 @@ struct reg_sequence { | |||
| 65 | unsigned int delay_us; | 65 | unsigned int delay_us; |
| 66 | }; | 66 | }; |
| 67 | 67 | ||
| 68 | #define regmap_update_bits(map, reg, mask, val) \ | ||
| 69 | regmap_update_bits_base(map, reg, mask, val, NULL, false, false) | ||
| 70 | #define regmap_update_bits_async(map, reg, mask, val)\ | ||
| 71 | regmap_update_bits_base(map, reg, mask, val, NULL, true, false) | ||
| 72 | #define regmap_update_bits_check(map, reg, mask, val, change)\ | ||
| 73 | regmap_update_bits_base(map, reg, mask, val, change, false, false) | ||
| 74 | #define regmap_update_bits_check_async(map, reg, mask, val, change)\ | ||
| 75 | regmap_update_bits_base(map, reg, mask, val, change, true, false) | ||
| 76 | |||
| 77 | #define regmap_write_bits(map, reg, mask, val) \ | ||
| 78 | regmap_update_bits_base(map, reg, mask, val, NULL, false, true) | ||
| 79 | |||
| 80 | #define regmap_field_write(field, val) \ | ||
| 81 | regmap_field_update_bits_base(field, ~0, val, NULL, false, false) | ||
| 82 | #define regmap_field_force_write(field, val) \ | ||
| 83 | regmap_field_update_bits_base(field, ~0, val, NULL, false, true) | ||
| 84 | #define regmap_field_update_bits(field, mask, val)\ | ||
| 85 | regmap_field_update_bits_base(field, mask, val, NULL, false, false) | ||
| 86 | #define regmap_field_force_update_bits(field, mask, val) \ | ||
| 87 | regmap_field_update_bits_base(field, mask, val, NULL, false, true) | ||
| 88 | |||
| 89 | #define regmap_fields_write(field, id, val) \ | ||
| 90 | regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, false) | ||
| 91 | #define regmap_fields_force_write(field, id, val) \ | ||
| 92 | regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, true) | ||
| 93 | #define regmap_fields_update_bits(field, id, mask, val)\ | ||
| 94 | regmap_fields_update_bits_base(field, id, mask, val, NULL, false, false) | ||
| 95 | #define regmap_fields_force_update_bits(field, id, mask, val) \ | ||
| 96 | regmap_fields_update_bits_base(field, id, mask, val, NULL, false, true) | ||
| 97 | |||
| 68 | #ifdef CONFIG_REGMAP | 98 | #ifdef CONFIG_REGMAP |
| 69 | 99 | ||
| 70 | enum regmap_endian { | 100 | enum regmap_endian { |
| @@ -162,7 +192,7 @@ typedef void (*regmap_unlock)(void *); | |||
| 162 | * This field is a duplicate of a similar file in | 192 | * This field is a duplicate of a similar file in |
| 163 | * 'struct regmap_bus' and serves exact same purpose. | 193 | * 'struct regmap_bus' and serves exact same purpose. |
| 164 | * Use it only for "no-bus" cases. | 194 | * Use it only for "no-bus" cases. |
| 165 | * @max_register: Optional, specifies the maximum valid register index. | 195 | * @max_register: Optional, specifies the maximum valid register address. |
| 166 | * @wr_table: Optional, points to a struct regmap_access_table specifying | 196 | * @wr_table: Optional, points to a struct regmap_access_table specifying |
| 167 | * valid ranges for write access. | 197 | * valid ranges for write access. |
| 168 | * @rd_table: As above, for read access. | 198 | * @rd_table: As above, for read access. |
| @@ -691,18 +721,9 @@ int regmap_raw_read(struct regmap *map, unsigned int reg, | |||
| 691 | void *val, size_t val_len); | 721 | void *val, size_t val_len); |
| 692 | int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, | 722 | int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, |
| 693 | size_t val_count); | 723 | size_t val_count); |
| 694 | int regmap_update_bits(struct regmap *map, unsigned int reg, | 724 | int regmap_update_bits_base(struct regmap *map, unsigned int reg, |
| 695 | unsigned int mask, unsigned int val); | 725 | unsigned int mask, unsigned int val, |
| 696 | int regmap_write_bits(struct regmap *map, unsigned int reg, | 726 | bool *change, bool async, bool force); |
| 697 | unsigned int mask, unsigned int val); | ||
| 698 | int regmap_update_bits_async(struct regmap *map, unsigned int reg, | ||
| 699 | unsigned int mask, unsigned int val); | ||
| 700 | int regmap_update_bits_check(struct regmap *map, unsigned int reg, | ||
| 701 | unsigned int mask, unsigned int val, | ||
| 702 | bool *change); | ||
| 703 | int regmap_update_bits_check_async(struct regmap *map, unsigned int reg, | ||
| 704 | unsigned int mask, unsigned int val, | ||
| 705 | bool *change); | ||
| 706 | int regmap_get_val_bytes(struct regmap *map); | 727 | int regmap_get_val_bytes(struct regmap *map); |
| 707 | int regmap_get_max_register(struct regmap *map); | 728 | int regmap_get_max_register(struct regmap *map); |
| 708 | int regmap_get_reg_stride(struct regmap *map); | 729 | int regmap_get_reg_stride(struct regmap *map); |
| @@ -770,18 +791,14 @@ struct regmap_field *devm_regmap_field_alloc(struct device *dev, | |||
| 770 | void devm_regmap_field_free(struct device *dev, struct regmap_field *field); | 791 | void devm_regmap_field_free(struct device *dev, struct regmap_field *field); |
| 771 | 792 | ||
| 772 | int regmap_field_read(struct regmap_field *field, unsigned int *val); | 793 | int regmap_field_read(struct regmap_field *field, unsigned int *val); |
| 773 | int regmap_field_write(struct regmap_field *field, unsigned int val); | 794 | int regmap_field_update_bits_base(struct regmap_field *field, |
| 774 | int regmap_field_update_bits(struct regmap_field *field, | 795 | unsigned int mask, unsigned int val, |
| 775 | unsigned int mask, unsigned int val); | 796 | bool *change, bool async, bool force); |
| 776 | |||
| 777 | int regmap_fields_write(struct regmap_field *field, unsigned int id, | ||
| 778 | unsigned int val); | ||
| 779 | int regmap_fields_force_write(struct regmap_field *field, unsigned int id, | ||
| 780 | unsigned int val); | ||
| 781 | int regmap_fields_read(struct regmap_field *field, unsigned int id, | 797 | int regmap_fields_read(struct regmap_field *field, unsigned int id, |
| 782 | unsigned int *val); | 798 | unsigned int *val); |
| 783 | int regmap_fields_update_bits(struct regmap_field *field, unsigned int id, | 799 | int regmap_fields_update_bits_base(struct regmap_field *field, unsigned int id, |
| 784 | unsigned int mask, unsigned int val); | 800 | unsigned int mask, unsigned int val, |
| 801 | bool *change, bool async, bool force); | ||
| 785 | 802 | ||
| 786 | /** | 803 | /** |
| 787 | * Description of an IRQ for the generic regmap irq_chip. | 804 | * Description of an IRQ for the generic regmap irq_chip. |
| @@ -868,6 +885,14 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags, | |||
| 868 | int irq_base, const struct regmap_irq_chip *chip, | 885 | int irq_base, const struct regmap_irq_chip *chip, |
| 869 | struct regmap_irq_chip_data **data); | 886 | struct regmap_irq_chip_data **data); |
| 870 | void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data); | 887 | void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data); |
| 888 | |||
| 889 | int devm_regmap_add_irq_chip(struct device *dev, struct regmap *map, int irq, | ||
| 890 | int irq_flags, int irq_base, | ||
| 891 | const struct regmap_irq_chip *chip, | ||
| 892 | struct regmap_irq_chip_data **data); | ||
| 893 | void devm_regmap_del_irq_chip(struct device *dev, int irq, | ||
| 894 | struct regmap_irq_chip_data *data); | ||
| 895 | |||
| 871 | int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data); | 896 | int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data); |
| 872 | int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq); | 897 | int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq); |
| 873 | struct irq_domain *regmap_irq_get_domain(struct regmap_irq_chip_data *data); | 898 | struct irq_domain *regmap_irq_get_domain(struct regmap_irq_chip_data *data); |
| @@ -937,42 +962,26 @@ static inline int regmap_bulk_read(struct regmap *map, unsigned int reg, | |||
| 937 | return -EINVAL; | 962 | return -EINVAL; |
| 938 | } | 963 | } |
| 939 | 964 | ||
| 940 | static inline int regmap_update_bits(struct regmap *map, unsigned int reg, | 965 | static inline int regmap_update_bits_base(struct regmap *map, unsigned int reg, |
| 941 | unsigned int mask, unsigned int val) | 966 | unsigned int mask, unsigned int val, |
| 942 | { | 967 | bool *change, bool async, bool force) |
| 943 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 944 | return -EINVAL; | ||
| 945 | } | ||
| 946 | |||
| 947 | static inline int regmap_write_bits(struct regmap *map, unsigned int reg, | ||
| 948 | unsigned int mask, unsigned int val) | ||
| 949 | { | ||
| 950 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 951 | return -EINVAL; | ||
| 952 | } | ||
| 953 | |||
| 954 | static inline int regmap_update_bits_async(struct regmap *map, | ||
| 955 | unsigned int reg, | ||
| 956 | unsigned int mask, unsigned int val) | ||
| 957 | { | 968 | { |
| 958 | WARN_ONCE(1, "regmap API is disabled"); | 969 | WARN_ONCE(1, "regmap API is disabled"); |
| 959 | return -EINVAL; | 970 | return -EINVAL; |
| 960 | } | 971 | } |
| 961 | 972 | ||
| 962 | static inline int regmap_update_bits_check(struct regmap *map, | 973 | static inline int regmap_field_update_bits_base(struct regmap_field *field, |
| 963 | unsigned int reg, | 974 | unsigned int mask, unsigned int val, |
| 964 | unsigned int mask, unsigned int val, | 975 | bool *change, bool async, bool force) |
| 965 | bool *change) | ||
| 966 | { | 976 | { |
| 967 | WARN_ONCE(1, "regmap API is disabled"); | 977 | WARN_ONCE(1, "regmap API is disabled"); |
| 968 | return -EINVAL; | 978 | return -EINVAL; |
| 969 | } | 979 | } |
| 970 | 980 | ||
| 971 | static inline int regmap_update_bits_check_async(struct regmap *map, | 981 | static inline int regmap_fields_update_bits_base(struct regmap_field *field, |
| 972 | unsigned int reg, | 982 | unsigned int id, |
| 973 | unsigned int mask, | 983 | unsigned int mask, unsigned int val, |
| 974 | unsigned int val, | 984 | bool *change, bool async, bool force) |
| 975 | bool *change) | ||
| 976 | { | 985 | { |
| 977 | WARN_ONCE(1, "regmap API is disabled"); | 986 | WARN_ONCE(1, "regmap API is disabled"); |
| 978 | return -EINVAL; | 987 | return -EINVAL; |
