diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-20 20:20:34 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-20 20:20:34 -0500 |
commit | b3de5ad688f0f52457e73767f95a640ab4158d0d (patch) | |
tree | 9a29d171cc2468005bd9d5b068dc6f027aaffb22 | |
parent | 27a67e0f983567574ef659520d930f82cf65125a (diff) | |
parent | 90e51e6dd27d6418358ec6c9964d54ca9c25c1b9 (diff) |
Merge tag 'regmap-v4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap
Pull regmap updates from Mark Brown:
"For v4.11 activity on the regmap API has literally doubled, there are
two patches this release:
- fixes from Charles Keepax to make the kerneldoc generate correctly
- a cleanup from Geliang Tang using rb_entry() rather than open
coding it with container_of()"
* tag 'regmap-v4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
regmap: Fixup the kernel-doc comments on functions/structures
regmap: use rb_entry()
-rw-r--r-- | drivers/base/regmap/regcache-rbtree.c | 7 | ||||
-rw-r--r-- | drivers/base/regmap/regcache.c | 20 | ||||
-rw-r--r-- | drivers/base/regmap/regmap-irq.c | 62 | ||||
-rw-r--r-- | drivers/base/regmap/regmap.c | 129 | ||||
-rw-r--r-- | include/linux/regmap.h | 115 |
5 files changed, 184 insertions, 149 deletions
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c index b11af3f2c1db..b1e9aae9a5d0 100644 --- a/drivers/base/regmap/regcache-rbtree.c +++ b/drivers/base/regmap/regcache-rbtree.c | |||
@@ -81,7 +81,7 @@ static struct regcache_rbtree_node *regcache_rbtree_lookup(struct regmap *map, | |||
81 | 81 | ||
82 | node = rbtree_ctx->root.rb_node; | 82 | node = rbtree_ctx->root.rb_node; |
83 | while (node) { | 83 | while (node) { |
84 | rbnode = container_of(node, struct regcache_rbtree_node, node); | 84 | rbnode = rb_entry(node, struct regcache_rbtree_node, node); |
85 | regcache_rbtree_get_base_top_reg(map, rbnode, &base_reg, | 85 | regcache_rbtree_get_base_top_reg(map, rbnode, &base_reg, |
86 | &top_reg); | 86 | &top_reg); |
87 | if (reg >= base_reg && reg <= top_reg) { | 87 | if (reg >= base_reg && reg <= top_reg) { |
@@ -108,8 +108,7 @@ static int regcache_rbtree_insert(struct regmap *map, struct rb_root *root, | |||
108 | parent = NULL; | 108 | parent = NULL; |
109 | new = &root->rb_node; | 109 | new = &root->rb_node; |
110 | while (*new) { | 110 | while (*new) { |
111 | rbnode_tmp = container_of(*new, struct regcache_rbtree_node, | 111 | rbnode_tmp = rb_entry(*new, struct regcache_rbtree_node, node); |
112 | node); | ||
113 | /* base and top registers of the current rbnode */ | 112 | /* base and top registers of the current rbnode */ |
114 | regcache_rbtree_get_base_top_reg(map, rbnode_tmp, &base_reg_tmp, | 113 | regcache_rbtree_get_base_top_reg(map, rbnode_tmp, &base_reg_tmp, |
115 | &top_reg_tmp); | 114 | &top_reg_tmp); |
@@ -152,7 +151,7 @@ static int rbtree_show(struct seq_file *s, void *ignored) | |||
152 | 151 | ||
153 | for (node = rb_first(&rbtree_ctx->root); node != NULL; | 152 | for (node = rb_first(&rbtree_ctx->root); node != NULL; |
154 | node = rb_next(node)) { | 153 | node = rb_next(node)) { |
155 | n = container_of(node, struct regcache_rbtree_node, node); | 154 | n = rb_entry(node, struct regcache_rbtree_node, node); |
156 | mem_size += sizeof(*n); | 155 | mem_size += sizeof(*n); |
157 | mem_size += (n->blklen * map->cache_word_size); | 156 | mem_size += (n->blklen * map->cache_word_size); |
158 | mem_size += BITS_TO_LONGS(n->blklen) * sizeof(long); | 157 | mem_size += BITS_TO_LONGS(n->blklen) * sizeof(long); |
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 4e582561e1e7..b0a0dcf32fb7 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c | |||
@@ -224,7 +224,7 @@ void regcache_exit(struct regmap *map) | |||
224 | } | 224 | } |
225 | 225 | ||
226 | /** | 226 | /** |
227 | * regcache_read: Fetch the value of a given register from the cache. | 227 | * regcache_read - Fetch the value of a given register from the cache. |
228 | * | 228 | * |
229 | * @map: map to configure. | 229 | * @map: map to configure. |
230 | * @reg: The register index. | 230 | * @reg: The register index. |
@@ -255,7 +255,7 @@ int regcache_read(struct regmap *map, | |||
255 | } | 255 | } |
256 | 256 | ||
257 | /** | 257 | /** |
258 | * regcache_write: Set the value of a given register in the cache. | 258 | * regcache_write - Set the value of a given register in the cache. |
259 | * | 259 | * |
260 | * @map: map to configure. | 260 | * @map: map to configure. |
261 | * @reg: The register index. | 261 | * @reg: The register index. |
@@ -328,7 +328,7 @@ static int regcache_default_sync(struct regmap *map, unsigned int min, | |||
328 | } | 328 | } |
329 | 329 | ||
330 | /** | 330 | /** |
331 | * regcache_sync: Sync the register cache with the hardware. | 331 | * regcache_sync - Sync the register cache with the hardware. |
332 | * | 332 | * |
333 | * @map: map to configure. | 333 | * @map: map to configure. |
334 | * | 334 | * |
@@ -396,7 +396,7 @@ out: | |||
396 | EXPORT_SYMBOL_GPL(regcache_sync); | 396 | EXPORT_SYMBOL_GPL(regcache_sync); |
397 | 397 | ||
398 | /** | 398 | /** |
399 | * regcache_sync_region: Sync part of the register cache with the hardware. | 399 | * regcache_sync_region - Sync part of the register cache with the hardware. |
400 | * | 400 | * |
401 | * @map: map to sync. | 401 | * @map: map to sync. |
402 | * @min: first register to sync | 402 | * @min: first register to sync |
@@ -452,7 +452,7 @@ out: | |||
452 | EXPORT_SYMBOL_GPL(regcache_sync_region); | 452 | EXPORT_SYMBOL_GPL(regcache_sync_region); |
453 | 453 | ||
454 | /** | 454 | /** |
455 | * regcache_drop_region: Discard part of the register cache | 455 | * regcache_drop_region - Discard part of the register cache |
456 | * | 456 | * |
457 | * @map: map to operate on | 457 | * @map: map to operate on |
458 | * @min: first register to discard | 458 | * @min: first register to discard |
@@ -483,10 +483,10 @@ int regcache_drop_region(struct regmap *map, unsigned int min, | |||
483 | EXPORT_SYMBOL_GPL(regcache_drop_region); | 483 | EXPORT_SYMBOL_GPL(regcache_drop_region); |
484 | 484 | ||
485 | /** | 485 | /** |
486 | * regcache_cache_only: Put a register map into cache only mode | 486 | * regcache_cache_only - Put a register map into cache only mode |
487 | * | 487 | * |
488 | * @map: map to configure | 488 | * @map: map to configure |
489 | * @cache_only: flag if changes should be written to the hardware | 489 | * @enable: flag if changes should be written to the hardware |
490 | * | 490 | * |
491 | * When a register map is marked as cache only writes to the register | 491 | * When a register map is marked as cache only writes to the register |
492 | * map API will only update the register cache, they will not cause | 492 | * map API will only update the register cache, they will not cause |
@@ -505,7 +505,7 @@ void regcache_cache_only(struct regmap *map, bool enable) | |||
505 | EXPORT_SYMBOL_GPL(regcache_cache_only); | 505 | EXPORT_SYMBOL_GPL(regcache_cache_only); |
506 | 506 | ||
507 | /** | 507 | /** |
508 | * regcache_mark_dirty: Indicate that HW registers were reset to default values | 508 | * regcache_mark_dirty - Indicate that HW registers were reset to default values |
509 | * | 509 | * |
510 | * @map: map to mark | 510 | * @map: map to mark |
511 | * | 511 | * |
@@ -527,10 +527,10 @@ void regcache_mark_dirty(struct regmap *map) | |||
527 | EXPORT_SYMBOL_GPL(regcache_mark_dirty); | 527 | EXPORT_SYMBOL_GPL(regcache_mark_dirty); |
528 | 528 | ||
529 | /** | 529 | /** |
530 | * regcache_cache_bypass: Put a register map into cache bypass mode | 530 | * regcache_cache_bypass - Put a register map into cache bypass mode |
531 | * | 531 | * |
532 | * @map: map to configure | 532 | * @map: map to configure |
533 | * @cache_bypass: flag if changes should not be written to the cache | 533 | * @enable: flag if changes should not be written to the cache |
534 | * | 534 | * |
535 | * When a register map is marked with the cache bypass option, writes | 535 | * When a register map is marked with the cache bypass option, writes |
536 | * to the register map API will only update the hardware and not the | 536 | * to the register map API will only update the hardware and not the |
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index ec262476d043..cd54189f2b1d 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c | |||
@@ -398,13 +398,14 @@ static const struct irq_domain_ops regmap_domain_ops = { | |||
398 | }; | 398 | }; |
399 | 399 | ||
400 | /** | 400 | /** |
401 | * regmap_add_irq_chip(): Use standard regmap IRQ controller handling | 401 | * regmap_add_irq_chip() - Use standard regmap IRQ controller handling |
402 | * | 402 | * |
403 | * map: The regmap for the device. | 403 | * @map: The regmap for the device. |
404 | * irq: The IRQ the device uses to signal interrupts | 404 | * @irq: The IRQ the device uses to signal interrupts. |
405 | * irq_flags: The IRQF_ flags to use for the primary interrupt. | 405 | * @irq_flags: The IRQF_ flags to use for the primary interrupt. |
406 | * chip: Configuration for the interrupt controller. | 406 | * @irq_base: Allocate at specific IRQ number if irq_base > 0. |
407 | * data: Runtime data structure for the controller, allocated on success | 407 | * @chip: Configuration for the interrupt controller. |
408 | * @data: Runtime data structure for the controller, allocated on success. | ||
408 | * | 409 | * |
409 | * Returns 0 on success or an errno on failure. | 410 | * Returns 0 on success or an errno on failure. |
410 | * | 411 | * |
@@ -659,12 +660,12 @@ err_alloc: | |||
659 | EXPORT_SYMBOL_GPL(regmap_add_irq_chip); | 660 | EXPORT_SYMBOL_GPL(regmap_add_irq_chip); |
660 | 661 | ||
661 | /** | 662 | /** |
662 | * regmap_del_irq_chip(): Stop interrupt handling for a regmap IRQ chip | 663 | * regmap_del_irq_chip() - Stop interrupt handling for a regmap IRQ chip |
663 | * | 664 | * |
664 | * @irq: Primary IRQ for the device | 665 | * @irq: Primary IRQ for the device |
665 | * @d: regmap_irq_chip_data allocated by regmap_add_irq_chip() | 666 | * @d: ®map_irq_chip_data allocated by regmap_add_irq_chip() |
666 | * | 667 | * |
667 | * This function also dispose all mapped irq on chip. | 668 | * This function also disposes of all mapped IRQs on the chip. |
668 | */ | 669 | */ |
669 | void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *d) | 670 | void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *d) |
670 | { | 671 | { |
@@ -723,18 +724,19 @@ static int devm_regmap_irq_chip_match(struct device *dev, void *res, void *data) | |||
723 | } | 724 | } |
724 | 725 | ||
725 | /** | 726 | /** |
726 | * devm_regmap_add_irq_chip(): Resource manager regmap_add_irq_chip() | 727 | * devm_regmap_add_irq_chip() - Resource manager regmap_add_irq_chip() |
727 | * | 728 | * |
728 | * @dev: The device pointer on which irq_chip belongs to. | 729 | * @dev: The device pointer on which irq_chip belongs to. |
729 | * @map: The regmap for the device. | 730 | * @map: The regmap for the device. |
730 | * @irq: The IRQ the device uses to signal interrupts | 731 | * @irq: The IRQ the device uses to signal interrupts |
731 | * @irq_flags: The IRQF_ flags to use for the primary interrupt. | 732 | * @irq_flags: The IRQF_ flags to use for the primary interrupt. |
732 | * @chip: Configuration for the interrupt controller. | 733 | * @irq_base: Allocate at specific IRQ number if irq_base > 0. |
733 | * @data: Runtime data structure for the controller, allocated on success | 734 | * @chip: Configuration for the interrupt controller. |
735 | * @data: Runtime data structure for the controller, allocated on success | ||
734 | * | 736 | * |
735 | * Returns 0 on success or an errno on failure. | 737 | * Returns 0 on success or an errno on failure. |
736 | * | 738 | * |
737 | * The regmap_irq_chip data automatically be released when the device is | 739 | * The ®map_irq_chip_data will be automatically released when the device is |
738 | * unbound. | 740 | * unbound. |
739 | */ | 741 | */ |
740 | int devm_regmap_add_irq_chip(struct device *dev, struct regmap *map, int irq, | 742 | int devm_regmap_add_irq_chip(struct device *dev, struct regmap *map, int irq, |
@@ -765,11 +767,13 @@ int devm_regmap_add_irq_chip(struct device *dev, struct regmap *map, int irq, | |||
765 | EXPORT_SYMBOL_GPL(devm_regmap_add_irq_chip); | 767 | EXPORT_SYMBOL_GPL(devm_regmap_add_irq_chip); |
766 | 768 | ||
767 | /** | 769 | /** |
768 | * devm_regmap_del_irq_chip(): Resource managed regmap_del_irq_chip() | 770 | * devm_regmap_del_irq_chip() - Resource managed regmap_del_irq_chip() |
769 | * | 771 | * |
770 | * @dev: Device for which which resource was allocated. | 772 | * @dev: Device for which which resource was allocated. |
771 | * @irq: Primary IRQ for the device | 773 | * @irq: Primary IRQ for the device. |
772 | * @d: regmap_irq_chip_data allocated by regmap_add_irq_chip() | 774 | * @data: ®map_irq_chip_data allocated by regmap_add_irq_chip(). |
775 | * | ||
776 | * A resource managed version of regmap_del_irq_chip(). | ||
773 | */ | 777 | */ |
774 | void devm_regmap_del_irq_chip(struct device *dev, int irq, | 778 | void devm_regmap_del_irq_chip(struct device *dev, int irq, |
775 | struct regmap_irq_chip_data *data) | 779 | struct regmap_irq_chip_data *data) |
@@ -786,11 +790,11 @@ void devm_regmap_del_irq_chip(struct device *dev, int irq, | |||
786 | EXPORT_SYMBOL_GPL(devm_regmap_del_irq_chip); | 790 | EXPORT_SYMBOL_GPL(devm_regmap_del_irq_chip); |
787 | 791 | ||
788 | /** | 792 | /** |
789 | * regmap_irq_chip_get_base(): Retrieve interrupt base for a regmap IRQ chip | 793 | * regmap_irq_chip_get_base() - Retrieve interrupt base for a regmap IRQ chip |
790 | * | 794 | * |
791 | * Useful for drivers to request their own IRQs. | 795 | * @data: regmap irq controller to operate on. |
792 | * | 796 | * |
793 | * @data: regmap_irq controller to operate on. | 797 | * Useful for drivers to request their own IRQs. |
794 | */ | 798 | */ |
795 | int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data) | 799 | int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data) |
796 | { | 800 | { |
@@ -800,12 +804,12 @@ int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data) | |||
800 | EXPORT_SYMBOL_GPL(regmap_irq_chip_get_base); | 804 | EXPORT_SYMBOL_GPL(regmap_irq_chip_get_base); |
801 | 805 | ||
802 | /** | 806 | /** |
803 | * regmap_irq_get_virq(): Map an interrupt on a chip to a virtual IRQ | 807 | * regmap_irq_get_virq() - Map an interrupt on a chip to a virtual IRQ |
804 | * | 808 | * |
805 | * Useful for drivers to request their own IRQs. | 809 | * @data: regmap irq controller to operate on. |
810 | * @irq: index of the interrupt requested in the chip IRQs. | ||
806 | * | 811 | * |
807 | * @data: regmap_irq controller to operate on. | 812 | * Useful for drivers to request their own IRQs. |
808 | * @irq: index of the interrupt requested in the chip IRQs | ||
809 | */ | 813 | */ |
810 | int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq) | 814 | int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq) |
811 | { | 815 | { |
@@ -818,14 +822,14 @@ int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq) | |||
818 | EXPORT_SYMBOL_GPL(regmap_irq_get_virq); | 822 | EXPORT_SYMBOL_GPL(regmap_irq_get_virq); |
819 | 823 | ||
820 | /** | 824 | /** |
821 | * regmap_irq_get_domain(): Retrieve the irq_domain for the chip | 825 | * regmap_irq_get_domain() - Retrieve the irq_domain for the chip |
826 | * | ||
827 | * @data: regmap_irq controller to operate on. | ||
822 | * | 828 | * |
823 | * Useful for drivers to request their own IRQs and for integration | 829 | * Useful for drivers to request their own IRQs and for integration |
824 | * with subsystems. For ease of integration NULL is accepted as a | 830 | * with subsystems. For ease of integration NULL is accepted as a |
825 | * domain, allowing devices to just call this even if no domain is | 831 | * domain, allowing devices to just call this even if no domain is |
826 | * allocated. | 832 | * allocated. |
827 | * | ||
828 | * @data: regmap_irq controller to operate on. | ||
829 | */ | 833 | */ |
830 | struct irq_domain *regmap_irq_get_domain(struct regmap_irq_chip_data *data) | 834 | struct irq_domain *regmap_irq_get_domain(struct regmap_irq_chip_data *data) |
831 | { | 835 | { |
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index ae63bb0875ea..b9a779a4a739 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c | |||
@@ -459,7 +459,7 @@ static bool _regmap_range_add(struct regmap *map, | |||
459 | 459 | ||
460 | while (*new) { | 460 | while (*new) { |
461 | struct regmap_range_node *this = | 461 | struct regmap_range_node *this = |
462 | container_of(*new, struct regmap_range_node, node); | 462 | rb_entry(*new, struct regmap_range_node, node); |
463 | 463 | ||
464 | parent = *new; | 464 | parent = *new; |
465 | if (data->range_max < this->range_min) | 465 | if (data->range_max < this->range_min) |
@@ -483,7 +483,7 @@ static struct regmap_range_node *_regmap_range_lookup(struct regmap *map, | |||
483 | 483 | ||
484 | while (node) { | 484 | while (node) { |
485 | struct regmap_range_node *this = | 485 | struct regmap_range_node *this = |
486 | container_of(node, struct regmap_range_node, node); | 486 | rb_entry(node, struct regmap_range_node, node); |
487 | 487 | ||
488 | if (reg < this->range_min) | 488 | if (reg < this->range_min) |
489 | node = node->rb_left; | 489 | node = node->rb_left; |
@@ -1091,8 +1091,7 @@ static void regmap_field_init(struct regmap_field *rm_field, | |||
1091 | } | 1091 | } |
1092 | 1092 | ||
1093 | /** | 1093 | /** |
1094 | * devm_regmap_field_alloc(): Allocate and initialise a register field | 1094 | * devm_regmap_field_alloc() - Allocate and initialise a register field. |
1095 | * in a register map. | ||
1096 | * | 1095 | * |
1097 | * @dev: Device that will be interacted with | 1096 | * @dev: Device that will be interacted with |
1098 | * @regmap: regmap bank in which this register field is located. | 1097 | * @regmap: regmap bank in which this register field is located. |
@@ -1118,13 +1117,15 @@ struct regmap_field *devm_regmap_field_alloc(struct device *dev, | |||
1118 | EXPORT_SYMBOL_GPL(devm_regmap_field_alloc); | 1117 | EXPORT_SYMBOL_GPL(devm_regmap_field_alloc); |
1119 | 1118 | ||
1120 | /** | 1119 | /** |
1121 | * devm_regmap_field_free(): Free register field allocated using | 1120 | * devm_regmap_field_free() - Free a register field allocated using |
1122 | * devm_regmap_field_alloc. Usally drivers need not call this function, | 1121 | * devm_regmap_field_alloc. |
1123 | * as the memory allocated via devm will be freed as per device-driver | ||
1124 | * life-cyle. | ||
1125 | * | 1122 | * |
1126 | * @dev: Device that will be interacted with | 1123 | * @dev: Device that will be interacted with |
1127 | * @field: regmap field which should be freed. | 1124 | * @field: regmap field which should be freed. |
1125 | * | ||
1126 | * Free register field allocated using devm_regmap_field_alloc(). Usually | ||
1127 | * drivers need not call this function, as the memory allocated via devm | ||
1128 | * will be freed as per device-driver life-cyle. | ||
1128 | */ | 1129 | */ |
1129 | void devm_regmap_field_free(struct device *dev, | 1130 | void devm_regmap_field_free(struct device *dev, |
1130 | struct regmap_field *field) | 1131 | struct regmap_field *field) |
@@ -1134,8 +1135,7 @@ void devm_regmap_field_free(struct device *dev, | |||
1134 | EXPORT_SYMBOL_GPL(devm_regmap_field_free); | 1135 | EXPORT_SYMBOL_GPL(devm_regmap_field_free); |
1135 | 1136 | ||
1136 | /** | 1137 | /** |
1137 | * regmap_field_alloc(): Allocate and initialise a register field | 1138 | * regmap_field_alloc() - Allocate and initialise a register field. |
1138 | * in a register map. | ||
1139 | * | 1139 | * |
1140 | * @regmap: regmap bank in which this register field is located. | 1140 | * @regmap: regmap bank in which this register field is located. |
1141 | * @reg_field: Register field with in the bank. | 1141 | * @reg_field: Register field with in the bank. |
@@ -1159,7 +1159,8 @@ struct regmap_field *regmap_field_alloc(struct regmap *regmap, | |||
1159 | EXPORT_SYMBOL_GPL(regmap_field_alloc); | 1159 | EXPORT_SYMBOL_GPL(regmap_field_alloc); |
1160 | 1160 | ||
1161 | /** | 1161 | /** |
1162 | * regmap_field_free(): Free register field allocated using regmap_field_alloc | 1162 | * regmap_field_free() - Free register field allocated using |
1163 | * regmap_field_alloc. | ||
1163 | * | 1164 | * |
1164 | * @field: regmap field which should be freed. | 1165 | * @field: regmap field which should be freed. |
1165 | */ | 1166 | */ |
@@ -1170,7 +1171,7 @@ void regmap_field_free(struct regmap_field *field) | |||
1170 | EXPORT_SYMBOL_GPL(regmap_field_free); | 1171 | EXPORT_SYMBOL_GPL(regmap_field_free); |
1171 | 1172 | ||
1172 | /** | 1173 | /** |
1173 | * regmap_reinit_cache(): Reinitialise the current register cache | 1174 | * regmap_reinit_cache() - Reinitialise the current register cache |
1174 | * | 1175 | * |
1175 | * @map: Register map to operate on. | 1176 | * @map: Register map to operate on. |
1176 | * @config: New configuration. Only the cache data will be used. | 1177 | * @config: New configuration. Only the cache data will be used. |
@@ -1205,7 +1206,9 @@ int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config) | |||
1205 | EXPORT_SYMBOL_GPL(regmap_reinit_cache); | 1206 | EXPORT_SYMBOL_GPL(regmap_reinit_cache); |
1206 | 1207 | ||
1207 | /** | 1208 | /** |
1208 | * regmap_exit(): Free a previously allocated register map | 1209 | * regmap_exit() - Free a previously allocated register map |
1210 | * | ||
1211 | * @map: Register map to operate on. | ||
1209 | */ | 1212 | */ |
1210 | void regmap_exit(struct regmap *map) | 1213 | void regmap_exit(struct regmap *map) |
1211 | { | 1214 | { |
@@ -1245,7 +1248,7 @@ static int dev_get_regmap_match(struct device *dev, void *res, void *data) | |||
1245 | } | 1248 | } |
1246 | 1249 | ||
1247 | /** | 1250 | /** |
1248 | * dev_get_regmap(): Obtain the regmap (if any) for a device | 1251 | * dev_get_regmap() - Obtain the regmap (if any) for a device |
1249 | * | 1252 | * |
1250 | * @dev: Device to retrieve the map for | 1253 | * @dev: Device to retrieve the map for |
1251 | * @name: Optional name for the register map, usually NULL. | 1254 | * @name: Optional name for the register map, usually NULL. |
@@ -1268,7 +1271,7 @@ struct regmap *dev_get_regmap(struct device *dev, const char *name) | |||
1268 | EXPORT_SYMBOL_GPL(dev_get_regmap); | 1271 | EXPORT_SYMBOL_GPL(dev_get_regmap); |
1269 | 1272 | ||
1270 | /** | 1273 | /** |
1271 | * regmap_get_device(): Obtain the device from a regmap | 1274 | * regmap_get_device() - Obtain the device from a regmap |
1272 | * | 1275 | * |
1273 | * @map: Register map to operate on. | 1276 | * @map: Register map to operate on. |
1274 | * | 1277 | * |
@@ -1654,7 +1657,7 @@ int _regmap_write(struct regmap *map, unsigned int reg, | |||
1654 | } | 1657 | } |
1655 | 1658 | ||
1656 | /** | 1659 | /** |
1657 | * regmap_write(): Write a value to a single register | 1660 | * regmap_write() - Write a value to a single register |
1658 | * | 1661 | * |
1659 | * @map: Register map to write to | 1662 | * @map: Register map to write to |
1660 | * @reg: Register to write to | 1663 | * @reg: Register to write to |
@@ -1681,7 +1684,7 @@ int regmap_write(struct regmap *map, unsigned int reg, unsigned int val) | |||
1681 | EXPORT_SYMBOL_GPL(regmap_write); | 1684 | EXPORT_SYMBOL_GPL(regmap_write); |
1682 | 1685 | ||
1683 | /** | 1686 | /** |
1684 | * regmap_write_async(): Write a value to a single register asynchronously | 1687 | * regmap_write_async() - Write a value to a single register asynchronously |
1685 | * | 1688 | * |
1686 | * @map: Register map to write to | 1689 | * @map: Register map to write to |
1687 | * @reg: Register to write to | 1690 | * @reg: Register to write to |
@@ -1712,7 +1715,7 @@ int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val) | |||
1712 | EXPORT_SYMBOL_GPL(regmap_write_async); | 1715 | EXPORT_SYMBOL_GPL(regmap_write_async); |
1713 | 1716 | ||
1714 | /** | 1717 | /** |
1715 | * regmap_raw_write(): Write raw values to one or more registers | 1718 | * regmap_raw_write() - Write raw values to one or more registers |
1716 | * | 1719 | * |
1717 | * @map: Register map to write to | 1720 | * @map: Register map to write to |
1718 | * @reg: Initial register to write to | 1721 | * @reg: Initial register to write to |
@@ -1750,9 +1753,8 @@ int regmap_raw_write(struct regmap *map, unsigned int reg, | |||
1750 | EXPORT_SYMBOL_GPL(regmap_raw_write); | 1753 | EXPORT_SYMBOL_GPL(regmap_raw_write); |
1751 | 1754 | ||
1752 | /** | 1755 | /** |
1753 | * regmap_field_update_bits_base(): | 1756 | * regmap_field_update_bits_base() - Perform a read/modify/write cycle a |
1754 | * Perform a read/modify/write cycle on the register field | 1757 | * register field. |
1755 | * with change, async, force option | ||
1756 | * | 1758 | * |
1757 | * @field: Register field to write to | 1759 | * @field: Register field to write to |
1758 | * @mask: Bitmask to change | 1760 | * @mask: Bitmask to change |
@@ -1761,6 +1763,9 @@ EXPORT_SYMBOL_GPL(regmap_raw_write); | |||
1761 | * @async: Boolean indicating asynchronously | 1763 | * @async: Boolean indicating asynchronously |
1762 | * @force: Boolean indicating use force update | 1764 | * @force: Boolean indicating use force update |
1763 | * | 1765 | * |
1766 | * Perform a read/modify/write cycle on the register field with change, | ||
1767 | * async, force option. | ||
1768 | * | ||
1764 | * A value of zero will be returned on success, a negative errno will | 1769 | * A value of zero will be returned on success, a negative errno will |
1765 | * be returned in error cases. | 1770 | * be returned in error cases. |
1766 | */ | 1771 | */ |
@@ -1777,9 +1782,8 @@ int regmap_field_update_bits_base(struct regmap_field *field, | |||
1777 | EXPORT_SYMBOL_GPL(regmap_field_update_bits_base); | 1782 | EXPORT_SYMBOL_GPL(regmap_field_update_bits_base); |
1778 | 1783 | ||
1779 | /** | 1784 | /** |
1780 | * regmap_fields_update_bits_base(): | 1785 | * regmap_fields_update_bits_base() - Perform a read/modify/write cycle a |
1781 | * Perform a read/modify/write cycle on the register field | 1786 | * register field with port ID |
1782 | * with change, async, force option | ||
1783 | * | 1787 | * |
1784 | * @field: Register field to write to | 1788 | * @field: Register field to write to |
1785 | * @id: port ID | 1789 | * @id: port ID |
@@ -1808,8 +1812,8 @@ int regmap_fields_update_bits_base(struct regmap_field *field, unsigned int id, | |||
1808 | } | 1812 | } |
1809 | EXPORT_SYMBOL_GPL(regmap_fields_update_bits_base); | 1813 | EXPORT_SYMBOL_GPL(regmap_fields_update_bits_base); |
1810 | 1814 | ||
1811 | /* | 1815 | /** |
1812 | * regmap_bulk_write(): Write multiple registers to the device | 1816 | * regmap_bulk_write() - Write multiple registers to the device |
1813 | * | 1817 | * |
1814 | * @map: Register map to write to | 1818 | * @map: Register map to write to |
1815 | * @reg: First register to be write from | 1819 | * @reg: First register to be write from |
@@ -2174,18 +2178,18 @@ static int _regmap_multi_reg_write(struct regmap *map, | |||
2174 | return _regmap_raw_multi_reg_write(map, regs, num_regs); | 2178 | return _regmap_raw_multi_reg_write(map, regs, num_regs); |
2175 | } | 2179 | } |
2176 | 2180 | ||
2177 | /* | 2181 | /** |
2178 | * regmap_multi_reg_write(): Write multiple registers to the device | 2182 | * regmap_multi_reg_write() - Write multiple registers to the device |
2179 | * | ||
2180 | * where the set of register,value pairs are supplied in any order, | ||
2181 | * possibly not all in a single range. | ||
2182 | * | 2183 | * |
2183 | * @map: Register map to write to | 2184 | * @map: Register map to write to |
2184 | * @regs: Array of structures containing register,value to be written | 2185 | * @regs: Array of structures containing register,value to be written |
2185 | * @num_regs: Number of registers to write | 2186 | * @num_regs: Number of registers to write |
2186 | * | 2187 | * |
2188 | * Write multiple registers to the device where the set of register, value | ||
2189 | * pairs are supplied in any order, possibly not all in a single range. | ||
2190 | * | ||
2187 | * The 'normal' block write mode will send ultimately send data on the | 2191 | * The 'normal' block write mode will send ultimately send data on the |
2188 | * target bus as R,V1,V2,V3,..,Vn where successively higer registers are | 2192 | * target bus as R,V1,V2,V3,..,Vn where successively higher registers are |
2189 | * addressed. However, this alternative block multi write mode will send | 2193 | * addressed. However, this alternative block multi write mode will send |
2190 | * the data as R1,V1,R2,V2,..,Rn,Vn on the target bus. The target device | 2194 | * the data as R1,V1,R2,V2,..,Rn,Vn on the target bus. The target device |
2191 | * must of course support the mode. | 2195 | * must of course support the mode. |
@@ -2208,16 +2212,17 @@ int regmap_multi_reg_write(struct regmap *map, const struct reg_sequence *regs, | |||
2208 | } | 2212 | } |
2209 | EXPORT_SYMBOL_GPL(regmap_multi_reg_write); | 2213 | EXPORT_SYMBOL_GPL(regmap_multi_reg_write); |
2210 | 2214 | ||
2211 | /* | 2215 | /** |
2212 | * regmap_multi_reg_write_bypassed(): Write multiple registers to the | 2216 | * regmap_multi_reg_write_bypassed() - Write multiple registers to the |
2213 | * device but not the cache | 2217 | * device but not the cache |
2214 | * | ||
2215 | * where the set of register are supplied in any order | ||
2216 | * | 2218 | * |
2217 | * @map: Register map to write to | 2219 | * @map: Register map to write to |
2218 | * @regs: Array of structures containing register,value to be written | 2220 | * @regs: Array of structures containing register,value to be written |
2219 | * @num_regs: Number of registers to write | 2221 | * @num_regs: Number of registers to write |
2220 | * | 2222 | * |
2223 | * Write multiple registers to the device but not the cache where the set | ||
2224 | * of register are supplied in any order. | ||
2225 | * | ||
2221 | * This function is intended to be used for writing a large block of data | 2226 | * This function is intended to be used for writing a large block of data |
2222 | * atomically to the device in single transfer for those I2C client devices | 2227 | * atomically to the device in single transfer for those I2C client devices |
2223 | * that implement this alternative block write mode. | 2228 | * that implement this alternative block write mode. |
@@ -2248,8 +2253,8 @@ int regmap_multi_reg_write_bypassed(struct regmap *map, | |||
2248 | EXPORT_SYMBOL_GPL(regmap_multi_reg_write_bypassed); | 2253 | EXPORT_SYMBOL_GPL(regmap_multi_reg_write_bypassed); |
2249 | 2254 | ||
2250 | /** | 2255 | /** |
2251 | * regmap_raw_write_async(): Write raw values to one or more registers | 2256 | * regmap_raw_write_async() - Write raw values to one or more registers |
2252 | * asynchronously | 2257 | * asynchronously |
2253 | * | 2258 | * |
2254 | * @map: Register map to write to | 2259 | * @map: Register map to write to |
2255 | * @reg: Initial register to write to | 2260 | * @reg: Initial register to write to |
@@ -2385,7 +2390,7 @@ static int _regmap_read(struct regmap *map, unsigned int reg, | |||
2385 | } | 2390 | } |
2386 | 2391 | ||
2387 | /** | 2392 | /** |
2388 | * regmap_read(): Read a value from a single register | 2393 | * regmap_read() - Read a value from a single register |
2389 | * | 2394 | * |
2390 | * @map: Register map to read from | 2395 | * @map: Register map to read from |
2391 | * @reg: Register to be read from | 2396 | * @reg: Register to be read from |
@@ -2412,7 +2417,7 @@ int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val) | |||
2412 | EXPORT_SYMBOL_GPL(regmap_read); | 2417 | EXPORT_SYMBOL_GPL(regmap_read); |
2413 | 2418 | ||
2414 | /** | 2419 | /** |
2415 | * regmap_raw_read(): Read raw data from the device | 2420 | * regmap_raw_read() - Read raw data from the device |
2416 | * | 2421 | * |
2417 | * @map: Register map to read from | 2422 | * @map: Register map to read from |
2418 | * @reg: First register to be read from | 2423 | * @reg: First register to be read from |
@@ -2477,7 +2482,7 @@ int regmap_raw_read(struct regmap *map, unsigned int reg, void *val, | |||
2477 | EXPORT_SYMBOL_GPL(regmap_raw_read); | 2482 | EXPORT_SYMBOL_GPL(regmap_raw_read); |
2478 | 2483 | ||
2479 | /** | 2484 | /** |
2480 | * regmap_field_read(): Read a value to a single register field | 2485 | * regmap_field_read() - Read a value to a single register field |
2481 | * | 2486 | * |
2482 | * @field: Register field to read from | 2487 | * @field: Register field to read from |
2483 | * @val: Pointer to store read value | 2488 | * @val: Pointer to store read value |
@@ -2502,7 +2507,7 @@ int regmap_field_read(struct regmap_field *field, unsigned int *val) | |||
2502 | EXPORT_SYMBOL_GPL(regmap_field_read); | 2507 | EXPORT_SYMBOL_GPL(regmap_field_read); |
2503 | 2508 | ||
2504 | /** | 2509 | /** |
2505 | * regmap_fields_read(): Read a value to a single register field with port ID | 2510 | * regmap_fields_read() - Read a value to a single register field with port ID |
2506 | * | 2511 | * |
2507 | * @field: Register field to read from | 2512 | * @field: Register field to read from |
2508 | * @id: port ID | 2513 | * @id: port ID |
@@ -2535,7 +2540,7 @@ int regmap_fields_read(struct regmap_field *field, unsigned int id, | |||
2535 | EXPORT_SYMBOL_GPL(regmap_fields_read); | 2540 | EXPORT_SYMBOL_GPL(regmap_fields_read); |
2536 | 2541 | ||
2537 | /** | 2542 | /** |
2538 | * regmap_bulk_read(): Read multiple registers from the device | 2543 | * regmap_bulk_read() - Read multiple registers from the device |
2539 | * | 2544 | * |
2540 | * @map: Register map to read from | 2545 | * @map: Register map to read from |
2541 | * @reg: First register to be read from | 2546 | * @reg: First register to be read from |
@@ -2692,9 +2697,7 @@ static int _regmap_update_bits(struct regmap *map, unsigned int reg, | |||
2692 | } | 2697 | } |
2693 | 2698 | ||
2694 | /** | 2699 | /** |
2695 | * regmap_update_bits_base: | 2700 | * regmap_update_bits_base() - Perform a read/modify/write cycle on a register |
2696 | * Perform a read/modify/write cycle on the | ||
2697 | * register map with change, async, force option | ||
2698 | * | 2701 | * |
2699 | * @map: Register map to update | 2702 | * @map: Register map to update |
2700 | * @reg: Register to update | 2703 | * @reg: Register to update |
@@ -2704,10 +2707,14 @@ static int _regmap_update_bits(struct regmap *map, unsigned int reg, | |||
2704 | * @async: Boolean indicating asynchronously | 2707 | * @async: Boolean indicating asynchronously |
2705 | * @force: Boolean indicating use force update | 2708 | * @force: Boolean indicating use force update |
2706 | * | 2709 | * |
2707 | * if async was true, | 2710 | * Perform a read/modify/write cycle on a register map with change, async, force |
2708 | * With most buses the read must be done synchronously so this is most | 2711 | * options. |
2709 | * useful for devices with a cache which do not need to interact with | 2712 | * |
2710 | * the hardware to determine the current register value. | 2713 | * If async is true: |
2714 | * | ||
2715 | * With most buses the read must be done synchronously so this is most useful | ||
2716 | * for devices with a cache which do not need to interact with the hardware to | ||
2717 | * determine the current register value. | ||
2711 | * | 2718 | * |
2712 | * Returns zero for success, a negative number on error. | 2719 | * Returns zero for success, a negative number on error. |
2713 | */ | 2720 | */ |
@@ -2765,7 +2772,7 @@ static int regmap_async_is_done(struct regmap *map) | |||
2765 | } | 2772 | } |
2766 | 2773 | ||
2767 | /** | 2774 | /** |
2768 | * regmap_async_complete: Ensure all asynchronous I/O has completed. | 2775 | * regmap_async_complete - Ensure all asynchronous I/O has completed. |
2769 | * | 2776 | * |
2770 | * @map: Map to operate on. | 2777 | * @map: Map to operate on. |
2771 | * | 2778 | * |
@@ -2797,8 +2804,8 @@ int regmap_async_complete(struct regmap *map) | |||
2797 | EXPORT_SYMBOL_GPL(regmap_async_complete); | 2804 | EXPORT_SYMBOL_GPL(regmap_async_complete); |
2798 | 2805 | ||
2799 | /** | 2806 | /** |
2800 | * regmap_register_patch: Register and apply register updates to be applied | 2807 | * regmap_register_patch - Register and apply register updates to be applied |
2801 | * on device initialistion | 2808 | * on device initialistion |
2802 | * | 2809 | * |
2803 | * @map: Register map to apply updates to. | 2810 | * @map: Register map to apply updates to. |
2804 | * @regs: Values to update. | 2811 | * @regs: Values to update. |
@@ -2855,8 +2862,10 @@ int regmap_register_patch(struct regmap *map, const struct reg_sequence *regs, | |||
2855 | } | 2862 | } |
2856 | EXPORT_SYMBOL_GPL(regmap_register_patch); | 2863 | EXPORT_SYMBOL_GPL(regmap_register_patch); |
2857 | 2864 | ||
2858 | /* | 2865 | /** |
2859 | * regmap_get_val_bytes(): Report the size of a register value | 2866 | * regmap_get_val_bytes() - Report the size of a register value |
2867 | * | ||
2868 | * @map: Register map to operate on. | ||
2860 | * | 2869 | * |
2861 | * Report the size of a register value, mainly intended to for use by | 2870 | * Report the size of a register value, mainly intended to for use by |
2862 | * generic infrastructure built on top of regmap. | 2871 | * generic infrastructure built on top of regmap. |
@@ -2871,7 +2880,9 @@ int regmap_get_val_bytes(struct regmap *map) | |||
2871 | EXPORT_SYMBOL_GPL(regmap_get_val_bytes); | 2880 | EXPORT_SYMBOL_GPL(regmap_get_val_bytes); |
2872 | 2881 | ||
2873 | /** | 2882 | /** |
2874 | * regmap_get_max_register(): Report the max register value | 2883 | * regmap_get_max_register() - Report the max register value |
2884 | * | ||
2885 | * @map: Register map to operate on. | ||
2875 | * | 2886 | * |
2876 | * Report the max register value, mainly intended to for use by | 2887 | * Report the max register value, mainly intended to for use by |
2877 | * generic infrastructure built on top of regmap. | 2888 | * generic infrastructure built on top of regmap. |
@@ -2883,7 +2894,9 @@ int regmap_get_max_register(struct regmap *map) | |||
2883 | EXPORT_SYMBOL_GPL(regmap_get_max_register); | 2894 | EXPORT_SYMBOL_GPL(regmap_get_max_register); |
2884 | 2895 | ||
2885 | /** | 2896 | /** |
2886 | * regmap_get_reg_stride(): Report the register address stride | 2897 | * regmap_get_reg_stride() - Report the register address stride |
2898 | * | ||
2899 | * @map: Register map to operate on. | ||
2887 | * | 2900 | * |
2888 | * Report the register address stride, mainly intended to for use by | 2901 | * Report the register address stride, mainly intended to for use by |
2889 | * generic infrastructure built on top of regmap. | 2902 | * generic infrastructure built on top of regmap. |
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index f6673132431d..e88649225a60 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h | |||
@@ -40,12 +40,13 @@ enum regcache_type { | |||
40 | }; | 40 | }; |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * Default value for a register. We use an array of structs rather | 43 | * struct reg_default - Default value for a register. |
44 | * than a simple array as many modern devices have very sparse | ||
45 | * register maps. | ||
46 | * | 44 | * |
47 | * @reg: Register address. | 45 | * @reg: Register address. |
48 | * @def: Register default value. | 46 | * @def: Register default value. |
47 | * | ||
48 | * We use an array of structs rather than a simple array as many modern devices | ||
49 | * have very sparse register maps. | ||
49 | */ | 50 | */ |
50 | struct reg_default { | 51 | struct reg_default { |
51 | unsigned int reg; | 52 | unsigned int reg; |
@@ -53,12 +54,14 @@ struct reg_default { | |||
53 | }; | 54 | }; |
54 | 55 | ||
55 | /** | 56 | /** |
56 | * Register/value pairs for sequences of writes with an optional delay in | 57 | * struct reg_sequence - An individual write from a sequence of writes. |
57 | * microseconds to be applied after each write. | ||
58 | * | 58 | * |
59 | * @reg: Register address. | 59 | * @reg: Register address. |
60 | * @def: Register value. | 60 | * @def: Register value. |
61 | * @delay_us: Delay to be applied after the register write in microseconds | 61 | * @delay_us: Delay to be applied after the register write in microseconds |
62 | * | ||
63 | * Register/value pairs for sequences of writes with an optional delay in | ||
64 | * microseconds to be applied after each write. | ||
62 | */ | 65 | */ |
63 | struct reg_sequence { | 66 | struct reg_sequence { |
64 | unsigned int reg; | 67 | unsigned int reg; |
@@ -98,6 +101,7 @@ struct reg_sequence { | |||
98 | 101 | ||
99 | /** | 102 | /** |
100 | * regmap_read_poll_timeout - Poll until a condition is met or a timeout occurs | 103 | * regmap_read_poll_timeout - Poll until a condition is met or a timeout occurs |
104 | * | ||
101 | * @map: Regmap to read from | 105 | * @map: Regmap to read from |
102 | * @addr: Address to poll | 106 | * @addr: Address to poll |
103 | * @val: Unsigned integer variable to read the value into | 107 | * @val: Unsigned integer variable to read the value into |
@@ -146,8 +150,8 @@ enum regmap_endian { | |||
146 | }; | 150 | }; |
147 | 151 | ||
148 | /** | 152 | /** |
149 | * A register range, used for access related checks | 153 | * struct regmap_range - A register range, used for access related checks |
150 | * (readable/writeable/volatile/precious checks) | 154 | * (readable/writeable/volatile/precious checks) |
151 | * | 155 | * |
152 | * @range_min: address of first register | 156 | * @range_min: address of first register |
153 | * @range_max: address of last register | 157 | * @range_max: address of last register |
@@ -159,16 +163,18 @@ struct regmap_range { | |||
159 | 163 | ||
160 | #define regmap_reg_range(low, high) { .range_min = low, .range_max = high, } | 164 | #define regmap_reg_range(low, high) { .range_min = low, .range_max = high, } |
161 | 165 | ||
162 | /* | 166 | /** |
163 | * A table of ranges including some yes ranges and some no ranges. | 167 | * struct regmap_access_table - A table of register ranges for access checks |
164 | * If a register belongs to a no_range, the corresponding check function | ||
165 | * will return false. If a register belongs to a yes range, the corresponding | ||
166 | * check function will return true. "no_ranges" are searched first. | ||
167 | * | 168 | * |
168 | * @yes_ranges : pointer to an array of regmap ranges used as "yes ranges" | 169 | * @yes_ranges : pointer to an array of regmap ranges used as "yes ranges" |
169 | * @n_yes_ranges: size of the above array | 170 | * @n_yes_ranges: size of the above array |
170 | * @no_ranges: pointer to an array of regmap ranges used as "no ranges" | 171 | * @no_ranges: pointer to an array of regmap ranges used as "no ranges" |
171 | * @n_no_ranges: size of the above array | 172 | * @n_no_ranges: size of the above array |
173 | * | ||
174 | * A table of ranges including some yes ranges and some no ranges. | ||
175 | * If a register belongs to a no_range, the corresponding check function | ||
176 | * will return false. If a register belongs to a yes range, the corresponding | ||
177 | * check function will return true. "no_ranges" are searched first. | ||
172 | */ | 178 | */ |
173 | struct regmap_access_table { | 179 | struct regmap_access_table { |
174 | const struct regmap_range *yes_ranges; | 180 | const struct regmap_range *yes_ranges; |
@@ -181,7 +187,7 @@ typedef void (*regmap_lock)(void *); | |||
181 | typedef void (*regmap_unlock)(void *); | 187 | typedef void (*regmap_unlock)(void *); |
182 | 188 | ||
183 | /** | 189 | /** |
184 | * Configuration for the register map of a device. | 190 | * struct regmap_config - Configuration for the register map of a device. |
185 | * | 191 | * |
186 | * @name: Optional name of the regmap. Useful when a device has multiple | 192 | * @name: Optional name of the regmap. Useful when a device has multiple |
187 | * register regions. | 193 | * register regions. |
@@ -314,22 +320,24 @@ struct regmap_config { | |||
314 | }; | 320 | }; |
315 | 321 | ||
316 | /** | 322 | /** |
317 | * Configuration for indirectly accessed or paged registers. | 323 | * struct regmap_range_cfg - Configuration for indirectly accessed or paged |
318 | * Registers, mapped to this virtual range, are accessed in two steps: | 324 | * registers. |
319 | * 1. page selector register update; | ||
320 | * 2. access through data window registers. | ||
321 | * | 325 | * |
322 | * @name: Descriptive name for diagnostics | 326 | * @name: Descriptive name for diagnostics |
323 | * | 327 | * |
324 | * @range_min: Address of the lowest register address in virtual range. | 328 | * @range_min: Address of the lowest register address in virtual range. |
325 | * @range_max: Address of the highest register in virtual range. | 329 | * @range_max: Address of the highest register in virtual range. |
326 | * | 330 | * |
327 | * @page_sel_reg: Register with selector field. | 331 | * @selector_reg: Register with selector field. |
328 | * @page_sel_mask: Bit shift for selector value. | 332 | * @selector_mask: Bit shift for selector value. |
329 | * @page_sel_shift: Bit mask for selector value. | 333 | * @selector_shift: Bit mask for selector value. |
330 | * | 334 | * |
331 | * @window_start: Address of first (lowest) register in data window. | 335 | * @window_start: Address of first (lowest) register in data window. |
332 | * @window_len: Number of registers in data window. | 336 | * @window_len: Number of registers in data window. |
337 | * | ||
338 | * Registers, mapped to this virtual range, are accessed in two steps: | ||
339 | * 1. page selector register update; | ||
340 | * 2. access through data window registers. | ||
333 | */ | 341 | */ |
334 | struct regmap_range_cfg { | 342 | struct regmap_range_cfg { |
335 | const char *name; | 343 | const char *name; |
@@ -372,7 +380,8 @@ typedef struct regmap_async *(*regmap_hw_async_alloc)(void); | |||
372 | typedef void (*regmap_hw_free_context)(void *context); | 380 | typedef void (*regmap_hw_free_context)(void *context); |
373 | 381 | ||
374 | /** | 382 | /** |
375 | * Description of a hardware bus for the register map infrastructure. | 383 | * struct regmap_bus - Description of a hardware bus for the register map |
384 | * infrastructure. | ||
376 | * | 385 | * |
377 | * @fast_io: Register IO is fast. Use a spinlock instead of a mutex | 386 | * @fast_io: Register IO is fast. Use a spinlock instead of a mutex |
378 | * to perform locking. This field is ignored if custom lock/unlock | 387 | * to perform locking. This field is ignored if custom lock/unlock |
@@ -385,6 +394,10 @@ typedef void (*regmap_hw_free_context)(void *context); | |||
385 | * must serialise with respect to non-async I/O. | 394 | * must serialise with respect to non-async I/O. |
386 | * @reg_write: Write a single register value to the given register address. This | 395 | * @reg_write: Write a single register value to the given register address. This |
387 | * write operation has to complete when returning from the function. | 396 | * write operation has to complete when returning from the function. |
397 | * @reg_update_bits: Update bits operation to be used against volatile | ||
398 | * registers, intended for devices supporting some mechanism | ||
399 | * for setting clearing bits without having to | ||
400 | * read/modify/write. | ||
388 | * @read: Read operation. Data is returned in the buffer used to transmit | 401 | * @read: Read operation. Data is returned in the buffer used to transmit |
389 | * data. | 402 | * data. |
390 | * @reg_read: Read a single register value from a given register address. | 403 | * @reg_read: Read a single register value from a given register address. |
@@ -514,7 +527,7 @@ struct regmap *__devm_regmap_init_ac97(struct snd_ac97 *ac97, | |||
514 | #endif | 527 | #endif |
515 | 528 | ||
516 | /** | 529 | /** |
517 | * regmap_init(): Initialise register map | 530 | * regmap_init() - Initialise register map |
518 | * | 531 | * |
519 | * @dev: Device that will be interacted with | 532 | * @dev: Device that will be interacted with |
520 | * @bus: Bus-specific callbacks to use with device | 533 | * @bus: Bus-specific callbacks to use with device |
@@ -532,7 +545,7 @@ int regmap_attach_dev(struct device *dev, struct regmap *map, | |||
532 | const struct regmap_config *config); | 545 | const struct regmap_config *config); |
533 | 546 | ||
534 | /** | 547 | /** |
535 | * regmap_init_i2c(): Initialise register map | 548 | * regmap_init_i2c() - Initialise register map |
536 | * | 549 | * |
537 | * @i2c: Device that will be interacted with | 550 | * @i2c: Device that will be interacted with |
538 | * @config: Configuration for register map | 551 | * @config: Configuration for register map |
@@ -545,9 +558,9 @@ int regmap_attach_dev(struct device *dev, struct regmap *map, | |||
545 | i2c, config) | 558 | i2c, config) |
546 | 559 | ||
547 | /** | 560 | /** |
548 | * regmap_init_spi(): Initialise register map | 561 | * regmap_init_spi() - Initialise register map |
549 | * | 562 | * |
550 | * @spi: Device that will be interacted with | 563 | * @dev: Device that will be interacted with |
551 | * @config: Configuration for register map | 564 | * @config: Configuration for register map |
552 | * | 565 | * |
553 | * The return value will be an ERR_PTR() on error or a valid pointer to | 566 | * The return value will be an ERR_PTR() on error or a valid pointer to |
@@ -558,8 +571,9 @@ int regmap_attach_dev(struct device *dev, struct regmap *map, | |||
558 | dev, config) | 571 | dev, config) |
559 | 572 | ||
560 | /** | 573 | /** |
561 | * regmap_init_spmi_base(): Create regmap for the Base register space | 574 | * regmap_init_spmi_base() - Create regmap for the Base register space |
562 | * @sdev: SPMI device that will be interacted with | 575 | * |
576 | * @dev: SPMI device that will be interacted with | ||
563 | * @config: Configuration for register map | 577 | * @config: Configuration for register map |
564 | * | 578 | * |
565 | * The return value will be an ERR_PTR() on error or a valid pointer to | 579 | * The return value will be an ERR_PTR() on error or a valid pointer to |
@@ -570,8 +584,9 @@ int regmap_attach_dev(struct device *dev, struct regmap *map, | |||
570 | dev, config) | 584 | dev, config) |
571 | 585 | ||
572 | /** | 586 | /** |
573 | * regmap_init_spmi_ext(): Create regmap for Ext register space | 587 | * regmap_init_spmi_ext() - Create regmap for Ext register space |
574 | * @sdev: Device that will be interacted with | 588 | * |
589 | * @dev: Device that will be interacted with | ||
575 | * @config: Configuration for register map | 590 | * @config: Configuration for register map |
576 | * | 591 | * |
577 | * The return value will be an ERR_PTR() on error or a valid pointer to | 592 | * The return value will be an ERR_PTR() on error or a valid pointer to |
@@ -582,7 +597,7 @@ int regmap_attach_dev(struct device *dev, struct regmap *map, | |||
582 | dev, config) | 597 | dev, config) |
583 | 598 | ||
584 | /** | 599 | /** |
585 | * regmap_init_mmio_clk(): Initialise register map with register clock | 600 | * regmap_init_mmio_clk() - Initialise register map with register clock |
586 | * | 601 | * |
587 | * @dev: Device that will be interacted with | 602 | * @dev: Device that will be interacted with |
588 | * @clk_id: register clock consumer ID | 603 | * @clk_id: register clock consumer ID |
@@ -597,7 +612,7 @@ int regmap_attach_dev(struct device *dev, struct regmap *map, | |||
597 | dev, clk_id, regs, config) | 612 | dev, clk_id, regs, config) |
598 | 613 | ||
599 | /** | 614 | /** |
600 | * regmap_init_mmio(): Initialise register map | 615 | * regmap_init_mmio() - Initialise register map |
601 | * | 616 | * |
602 | * @dev: Device that will be interacted with | 617 | * @dev: Device that will be interacted with |
603 | * @regs: Pointer to memory-mapped IO region | 618 | * @regs: Pointer to memory-mapped IO region |
@@ -610,7 +625,7 @@ int regmap_attach_dev(struct device *dev, struct regmap *map, | |||
610 | regmap_init_mmio_clk(dev, NULL, regs, config) | 625 | regmap_init_mmio_clk(dev, NULL, regs, config) |
611 | 626 | ||
612 | /** | 627 | /** |
613 | * regmap_init_ac97(): Initialise AC'97 register map | 628 | * regmap_init_ac97() - Initialise AC'97 register map |
614 | * | 629 | * |
615 | * @ac97: Device that will be interacted with | 630 | * @ac97: Device that will be interacted with |
616 | * @config: Configuration for register map | 631 | * @config: Configuration for register map |
@@ -624,7 +639,7 @@ int regmap_attach_dev(struct device *dev, struct regmap *map, | |||
624 | bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); | 639 | bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); |
625 | 640 | ||
626 | /** | 641 | /** |
627 | * devm_regmap_init(): Initialise managed register map | 642 | * devm_regmap_init() - Initialise managed register map |
628 | * | 643 | * |
629 | * @dev: Device that will be interacted with | 644 | * @dev: Device that will be interacted with |
630 | * @bus: Bus-specific callbacks to use with device | 645 | * @bus: Bus-specific callbacks to use with device |
@@ -641,7 +656,7 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); | |||
641 | dev, bus, bus_context, config) | 656 | dev, bus, bus_context, config) |
642 | 657 | ||
643 | /** | 658 | /** |
644 | * devm_regmap_init_i2c(): Initialise managed register map | 659 | * devm_regmap_init_i2c() - Initialise managed register map |
645 | * | 660 | * |
646 | * @i2c: Device that will be interacted with | 661 | * @i2c: Device that will be interacted with |
647 | * @config: Configuration for register map | 662 | * @config: Configuration for register map |
@@ -655,9 +670,9 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); | |||
655 | i2c, config) | 670 | i2c, config) |
656 | 671 | ||
657 | /** | 672 | /** |
658 | * devm_regmap_init_spi(): Initialise register map | 673 | * devm_regmap_init_spi() - Initialise register map |
659 | * | 674 | * |
660 | * @spi: Device that will be interacted with | 675 | * @dev: Device that will be interacted with |
661 | * @config: Configuration for register map | 676 | * @config: Configuration for register map |
662 | * | 677 | * |
663 | * The return value will be an ERR_PTR() on error or a valid pointer | 678 | * The return value will be an ERR_PTR() on error or a valid pointer |
@@ -669,8 +684,9 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); | |||
669 | dev, config) | 684 | dev, config) |
670 | 685 | ||
671 | /** | 686 | /** |
672 | * devm_regmap_init_spmi_base(): Create managed regmap for Base register space | 687 | * devm_regmap_init_spmi_base() - Create managed regmap for Base register space |
673 | * @sdev: SPMI device that will be interacted with | 688 | * |
689 | * @dev: SPMI device that will be interacted with | ||
674 | * @config: Configuration for register map | 690 | * @config: Configuration for register map |
675 | * | 691 | * |
676 | * The return value will be an ERR_PTR() on error or a valid pointer | 692 | * The return value will be an ERR_PTR() on error or a valid pointer |
@@ -682,8 +698,9 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); | |||
682 | dev, config) | 698 | dev, config) |
683 | 699 | ||
684 | /** | 700 | /** |
685 | * devm_regmap_init_spmi_ext(): Create managed regmap for Ext register space | 701 | * devm_regmap_init_spmi_ext() - Create managed regmap for Ext register space |
686 | * @sdev: SPMI device that will be interacted with | 702 | * |
703 | * @dev: SPMI device that will be interacted with | ||
687 | * @config: Configuration for register map | 704 | * @config: Configuration for register map |
688 | * | 705 | * |
689 | * The return value will be an ERR_PTR() on error or a valid pointer | 706 | * The return value will be an ERR_PTR() on error or a valid pointer |
@@ -695,7 +712,7 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); | |||
695 | dev, config) | 712 | dev, config) |
696 | 713 | ||
697 | /** | 714 | /** |
698 | * devm_regmap_init_mmio_clk(): Initialise managed register map with clock | 715 | * devm_regmap_init_mmio_clk() - Initialise managed register map with clock |
699 | * | 716 | * |
700 | * @dev: Device that will be interacted with | 717 | * @dev: Device that will be interacted with |
701 | * @clk_id: register clock consumer ID | 718 | * @clk_id: register clock consumer ID |
@@ -711,7 +728,7 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); | |||
711 | dev, clk_id, regs, config) | 728 | dev, clk_id, regs, config) |
712 | 729 | ||
713 | /** | 730 | /** |
714 | * devm_regmap_init_mmio(): Initialise managed register map | 731 | * devm_regmap_init_mmio() - Initialise managed register map |
715 | * | 732 | * |
716 | * @dev: Device that will be interacted with | 733 | * @dev: Device that will be interacted with |
717 | * @regs: Pointer to memory-mapped IO region | 734 | * @regs: Pointer to memory-mapped IO region |
@@ -725,7 +742,7 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); | |||
725 | devm_regmap_init_mmio_clk(dev, NULL, regs, config) | 742 | devm_regmap_init_mmio_clk(dev, NULL, regs, config) |
726 | 743 | ||
727 | /** | 744 | /** |
728 | * devm_regmap_init_ac97(): Initialise AC'97 register map | 745 | * devm_regmap_init_ac97() - Initialise AC'97 register map |
729 | * | 746 | * |
730 | * @ac97: Device that will be interacted with | 747 | * @ac97: Device that will be interacted with |
731 | * @config: Configuration for register map | 748 | * @config: Configuration for register map |
@@ -800,7 +817,7 @@ bool regmap_reg_in_ranges(unsigned int reg, | |||
800 | unsigned int nranges); | 817 | unsigned int nranges); |
801 | 818 | ||
802 | /** | 819 | /** |
803 | * Description of an register field | 820 | * struct reg_field - Description of an register field |
804 | * | 821 | * |
805 | * @reg: Offset of the register within the regmap bank | 822 | * @reg: Offset of the register within the regmap bank |
806 | * @lsb: lsb of the register field. | 823 | * @lsb: lsb of the register field. |
@@ -841,7 +858,7 @@ int regmap_fields_update_bits_base(struct regmap_field *field, unsigned int id, | |||
841 | bool *change, bool async, bool force); | 858 | bool *change, bool async, bool force); |
842 | 859 | ||
843 | /** | 860 | /** |
844 | * Description of an IRQ for the generic regmap irq_chip. | 861 | * struct regmap_irq - Description of an IRQ for the generic regmap irq_chip. |
845 | * | 862 | * |
846 | * @reg_offset: Offset of the status/mask register within the bank | 863 | * @reg_offset: Offset of the status/mask register within the bank |
847 | * @mask: Mask used to flag/control the register. | 864 | * @mask: Mask used to flag/control the register. |
@@ -861,9 +878,7 @@ struct regmap_irq { | |||
861 | [_irq] = { .reg_offset = (_off), .mask = (_mask) } | 878 | [_irq] = { .reg_offset = (_off), .mask = (_mask) } |
862 | 879 | ||
863 | /** | 880 | /** |
864 | * Description of a generic regmap irq_chip. This is not intended to | 881 | * struct regmap_irq_chip - Description of a generic regmap irq_chip. |
865 | * handle every possible interrupt controller, but it should handle a | ||
866 | * substantial proportion of those that are found in the wild. | ||
867 | * | 882 | * |
868 | * @name: Descriptive name for IRQ controller. | 883 | * @name: Descriptive name for IRQ controller. |
869 | * | 884 | * |
@@ -897,6 +912,10 @@ struct regmap_irq { | |||
897 | * after handling the interrupts in regmap_irq_handler(). | 912 | * after handling the interrupts in regmap_irq_handler(). |
898 | * @irq_drv_data: Driver specific IRQ data which is passed as parameter when | 913 | * @irq_drv_data: Driver specific IRQ data which is passed as parameter when |
899 | * driver specific pre/post interrupt handler is called. | 914 | * driver specific pre/post interrupt handler is called. |
915 | * | ||
916 | * This is not intended to handle every possible interrupt controller, but | ||
917 | * it should handle a substantial proportion of those that are found in the | ||
918 | * wild. | ||
900 | */ | 919 | */ |
901 | struct regmap_irq_chip { | 920 | struct regmap_irq_chip { |
902 | const char *name; | 921 | const char *name; |