2 * Register map access API
4 * Copyright 2011 Wolfson Microelectronics plc
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/device.h>
14 #include <linux/slab.h>
15 #include <linux/export.h>
16 #include <linux/mutex.h>
17 #include <linux/err.h>
19 #define CREATE_TRACE_POINTS
20 #include <trace/events/regmap.h>
24 bool regmap_writeable(struct regmap
*map
, unsigned int reg
)
26 if (map
->max_register
&& reg
> map
->max_register
)
29 if (map
->writeable_reg
)
30 return map
->writeable_reg(map
->dev
, reg
);
35 bool regmap_readable(struct regmap
*map
, unsigned int reg
)
37 if (map
->max_register
&& reg
> map
->max_register
)
40 if (map
->format
.format_write
)
43 if (map
->readable_reg
)
44 return map
->readable_reg(map
->dev
, reg
);
49 bool regmap_volatile(struct regmap
*map
, unsigned int reg
)
51 if (!regmap_readable(map
, reg
))
54 if (map
->volatile_reg
)
55 return map
->volatile_reg(map
->dev
, reg
);
60 bool regmap_precious(struct regmap
*map
, unsigned int reg
)
62 if (!regmap_readable(map
, reg
))
65 if (map
->precious_reg
)
66 return map
->precious_reg(map
->dev
, reg
);
71 static bool regmap_volatile_range(struct regmap
*map
, unsigned int reg
,
76 for (i
= 0; i
< num
; i
++)
77 if (!regmap_volatile(map
, reg
+ i
))
83 static void regmap_format_2_6_write(struct regmap
*map
,
84 unsigned int reg
, unsigned int val
)
86 u8
*out
= map
->work_buf
;
88 *out
= (reg
<< 6) | val
;
91 static void regmap_format_4_12_write(struct regmap
*map
,
92 unsigned int reg
, unsigned int val
)
94 __be16
*out
= map
->work_buf
;
95 *out
= cpu_to_be16((reg
<< 12) | val
);
98 static void regmap_format_7_9_write(struct regmap
*map
,
99 unsigned int reg
, unsigned int val
)
101 __be16
*out
= map
->work_buf
;
102 *out
= cpu_to_be16((reg
<< 9) | val
);
105 static void regmap_format_10_14_write(struct regmap
*map
,
106 unsigned int reg
, unsigned int val
)
108 u8
*out
= map
->work_buf
;
111 out
[1] = (val
>> 8) | (reg
<< 6);
115 static void regmap_format_8(void *buf
, unsigned int val
, unsigned int shift
)
122 static void regmap_format_16(void *buf
, unsigned int val
, unsigned int shift
)
126 b
[0] = cpu_to_be16(val
<< shift
);
129 static void regmap_format_24(void *buf
, unsigned int val
, unsigned int shift
)
140 static void regmap_format_32(void *buf
, unsigned int val
, unsigned int shift
)
144 b
[0] = cpu_to_be32(val
<< shift
);
147 static unsigned int regmap_parse_8(void *buf
)
154 static unsigned int regmap_parse_16(void *buf
)
158 b
[0] = be16_to_cpu(b
[0]);
163 static unsigned int regmap_parse_24(void *buf
)
166 unsigned int ret
= b
[2];
167 ret
|= ((unsigned int)b
[1]) << 8;
168 ret
|= ((unsigned int)b
[0]) << 16;
173 static unsigned int regmap_parse_32(void *buf
)
177 b
[0] = be32_to_cpu(b
[0]);
182 static void regmap_lock_mutex(struct regmap
*map
)
184 mutex_lock(&map
->mutex
);
187 static void regmap_unlock_mutex(struct regmap
*map
)
189 mutex_unlock(&map
->mutex
);
192 static void regmap_lock_spinlock(struct regmap
*map
)
194 spin_lock(&map
->spinlock
);
197 static void regmap_unlock_spinlock(struct regmap
*map
)
199 spin_unlock(&map
->spinlock
);
203 * regmap_init(): Initialise register map
205 * @dev: Device that will be interacted with
206 * @bus: Bus-specific callbacks to use with device
207 * @bus_context: Data passed to bus-specific callbacks
208 * @config: Configuration for register map
210 * The return value will be an ERR_PTR() on error or a valid pointer to
211 * a struct regmap. This function should generally not be called
212 * directly, it should be called by bus-specific init functions.
214 struct regmap
*regmap_init(struct device
*dev
,
215 const struct regmap_bus
*bus
,
217 const struct regmap_config
*config
)
225 map
= kzalloc(sizeof(*map
), GFP_KERNEL
);
232 spin_lock_init(&map
->spinlock
);
233 map
->lock
= regmap_lock_spinlock
;
234 map
->unlock
= regmap_unlock_spinlock
;
236 mutex_init(&map
->mutex
);
237 map
->lock
= regmap_lock_mutex
;
238 map
->unlock
= regmap_unlock_mutex
;
240 map
->format
.buf_size
= (config
->reg_bits
+ config
->val_bits
) / 8;
241 map
->format
.reg_bytes
= DIV_ROUND_UP(config
->reg_bits
, 8);
242 map
->format
.pad_bytes
= config
->pad_bits
/ 8;
243 map
->format
.val_bytes
= DIV_ROUND_UP(config
->val_bits
, 8);
244 map
->format
.buf_size
+= map
->format
.pad_bytes
;
245 map
->reg_shift
= config
->pad_bits
% 8;
246 if (config
->reg_stride
)
247 map
->reg_stride
= config
->reg_stride
;
250 map
->use_single_rw
= config
->use_single_rw
;
253 map
->bus_context
= bus_context
;
254 map
->max_register
= config
->max_register
;
255 map
->writeable_reg
= config
->writeable_reg
;
256 map
->readable_reg
= config
->readable_reg
;
257 map
->volatile_reg
= config
->volatile_reg
;
258 map
->precious_reg
= config
->precious_reg
;
259 map
->cache_type
= config
->cache_type
;
261 if (config
->read_flag_mask
|| config
->write_flag_mask
) {
262 map
->read_flag_mask
= config
->read_flag_mask
;
263 map
->write_flag_mask
= config
->write_flag_mask
;
265 map
->read_flag_mask
= bus
->read_flag_mask
;
268 switch (config
->reg_bits
+ map
->reg_shift
) {
270 switch (config
->val_bits
) {
272 map
->format
.format_write
= regmap_format_2_6_write
;
280 switch (config
->val_bits
) {
282 map
->format
.format_write
= regmap_format_4_12_write
;
290 switch (config
->val_bits
) {
292 map
->format
.format_write
= regmap_format_7_9_write
;
300 switch (config
->val_bits
) {
302 map
->format
.format_write
= regmap_format_10_14_write
;
310 map
->format
.format_reg
= regmap_format_8
;
314 map
->format
.format_reg
= regmap_format_16
;
318 map
->format
.format_reg
= regmap_format_32
;
325 switch (config
->val_bits
) {
327 map
->format
.format_val
= regmap_format_8
;
328 map
->format
.parse_val
= regmap_parse_8
;
331 map
->format
.format_val
= regmap_format_16
;
332 map
->format
.parse_val
= regmap_parse_16
;
335 map
->format
.format_val
= regmap_format_24
;
336 map
->format
.parse_val
= regmap_parse_24
;
339 map
->format
.format_val
= regmap_format_32
;
340 map
->format
.parse_val
= regmap_parse_32
;
344 if (!map
->format
.format_write
&&
345 !(map
->format
.format_reg
&& map
->format
.format_val
))
348 map
->work_buf
= kzalloc(map
->format
.buf_size
, GFP_KERNEL
);
349 if (map
->work_buf
== NULL
) {
354 regmap_debugfs_init(map
, config
->name
);
356 ret
= regcache_init(map
, config
);
358 goto err_free_workbuf
;
363 kfree(map
->work_buf
);
369 EXPORT_SYMBOL_GPL(regmap_init
);
371 static void devm_regmap_release(struct device
*dev
, void *res
)
373 regmap_exit(*(struct regmap
**)res
);
377 * devm_regmap_init(): Initialise managed register map
379 * @dev: Device that will be interacted with
380 * @bus: Bus-specific callbacks to use with device
381 * @bus_context: Data passed to bus-specific callbacks
382 * @config: Configuration for register map
384 * The return value will be an ERR_PTR() on error or a valid pointer
385 * to a struct regmap. This function should generally not be called
386 * directly, it should be called by bus-specific init functions. The
387 * map will be automatically freed by the device management code.
389 struct regmap
*devm_regmap_init(struct device
*dev
,
390 const struct regmap_bus
*bus
,
392 const struct regmap_config
*config
)
394 struct regmap
**ptr
, *regmap
;
396 ptr
= devres_alloc(devm_regmap_release
, sizeof(*ptr
), GFP_KERNEL
);
398 return ERR_PTR(-ENOMEM
);
400 regmap
= regmap_init(dev
, bus
, bus_context
, config
);
401 if (!IS_ERR(regmap
)) {
403 devres_add(dev
, ptr
);
410 EXPORT_SYMBOL_GPL(devm_regmap_init
);
413 * regmap_reinit_cache(): Reinitialise the current register cache
415 * @map: Register map to operate on.
416 * @config: New configuration. Only the cache data will be used.
418 * Discard any existing register cache for the map and initialize a
419 * new cache. This can be used to restore the cache to defaults or to
420 * update the cache configuration to reflect runtime discovery of the
423 int regmap_reinit_cache(struct regmap
*map
, const struct regmap_config
*config
)
430 regmap_debugfs_exit(map
);
432 map
->max_register
= config
->max_register
;
433 map
->writeable_reg
= config
->writeable_reg
;
434 map
->readable_reg
= config
->readable_reg
;
435 map
->volatile_reg
= config
->volatile_reg
;
436 map
->precious_reg
= config
->precious_reg
;
437 map
->cache_type
= config
->cache_type
;
439 regmap_debugfs_init(map
, config
->name
);
441 map
->cache_bypass
= false;
442 map
->cache_only
= false;
444 ret
= regcache_init(map
, config
);
452 * regmap_exit(): Free a previously allocated register map
454 void regmap_exit(struct regmap
*map
)
457 regmap_debugfs_exit(map
);
458 if (map
->bus
->free_context
)
459 map
->bus
->free_context(map
->bus_context
);
460 kfree(map
->work_buf
);
463 EXPORT_SYMBOL_GPL(regmap_exit
);
465 static int _regmap_raw_write(struct regmap
*map
, unsigned int reg
,
466 const void *val
, size_t val_len
)
468 u8
*u8
= map
->work_buf
;
474 /* Check for unwritable registers before we start */
475 if (map
->writeable_reg
)
476 for (i
= 0; i
< val_len
/ map
->format
.val_bytes
; i
++)
477 if (!map
->writeable_reg(map
->dev
,
478 reg
+ (i
* map
->reg_stride
)))
481 if (!map
->cache_bypass
&& map
->format
.parse_val
) {
483 int val_bytes
= map
->format
.val_bytes
;
484 for (i
= 0; i
< val_len
/ val_bytes
; i
++) {
485 memcpy(map
->work_buf
, val
+ (i
* val_bytes
), val_bytes
);
486 ival
= map
->format
.parse_val(map
->work_buf
);
487 ret
= regcache_write(map
, reg
+ (i
* map
->reg_stride
),
491 "Error in caching of register: %u ret: %d\n",
496 if (map
->cache_only
) {
497 map
->cache_dirty
= true;
502 map
->format
.format_reg(map
->work_buf
, reg
, map
->reg_shift
);
504 u8
[0] |= map
->write_flag_mask
;
506 trace_regmap_hw_write_start(map
->dev
, reg
,
507 val_len
/ map
->format
.val_bytes
);
509 /* If we're doing a single register write we can probably just
510 * send the work_buf directly, otherwise try to do a gather
513 if (val
== (map
->work_buf
+ map
->format
.pad_bytes
+
514 map
->format
.reg_bytes
))
515 ret
= map
->bus
->write(map
->bus_context
, map
->work_buf
,
516 map
->format
.reg_bytes
+
517 map
->format
.pad_bytes
+
519 else if (map
->bus
->gather_write
)
520 ret
= map
->bus
->gather_write(map
->bus_context
, map
->work_buf
,
521 map
->format
.reg_bytes
+
522 map
->format
.pad_bytes
,
525 /* If that didn't work fall back on linearising by hand. */
526 if (ret
== -ENOTSUPP
) {
527 len
= map
->format
.reg_bytes
+ map
->format
.pad_bytes
+ val_len
;
528 buf
= kzalloc(len
, GFP_KERNEL
);
532 memcpy(buf
, map
->work_buf
, map
->format
.reg_bytes
);
533 memcpy(buf
+ map
->format
.reg_bytes
+ map
->format
.pad_bytes
,
535 ret
= map
->bus
->write(map
->bus_context
, buf
, len
);
540 trace_regmap_hw_write_done(map
->dev
, reg
,
541 val_len
/ map
->format
.val_bytes
);
546 int _regmap_write(struct regmap
*map
, unsigned int reg
,
550 BUG_ON(!map
->format
.format_write
&& !map
->format
.format_val
);
552 if (!map
->cache_bypass
&& map
->format
.format_write
) {
553 ret
= regcache_write(map
, reg
, val
);
556 if (map
->cache_only
) {
557 map
->cache_dirty
= true;
562 trace_regmap_reg_write(map
->dev
, reg
, val
);
564 if (map
->format
.format_write
) {
565 map
->format
.format_write(map
, reg
, val
);
567 trace_regmap_hw_write_start(map
->dev
, reg
, 1);
569 ret
= map
->bus
->write(map
->bus_context
, map
->work_buf
,
570 map
->format
.buf_size
);
572 trace_regmap_hw_write_done(map
->dev
, reg
, 1);
576 map
->format
.format_val(map
->work_buf
+ map
->format
.reg_bytes
577 + map
->format
.pad_bytes
, val
, 0);
578 return _regmap_raw_write(map
, reg
,
580 map
->format
.reg_bytes
+
581 map
->format
.pad_bytes
,
582 map
->format
.val_bytes
);
587 * regmap_write(): Write a value to a single register
589 * @map: Register map to write to
590 * @reg: Register to write to
591 * @val: Value to be written
593 * A value of zero will be returned on success, a negative errno will
594 * be returned in error cases.
596 int regmap_write(struct regmap
*map
, unsigned int reg
, unsigned int val
)
600 if (reg
% map
->reg_stride
)
605 ret
= _regmap_write(map
, reg
, val
);
611 EXPORT_SYMBOL_GPL(regmap_write
);
614 * regmap_raw_write(): Write raw values to one or more registers
616 * @map: Register map to write to
617 * @reg: Initial register to write to
618 * @val: Block of data to be written, laid out for direct transmission to the
620 * @val_len: Length of data pointed to by val.
622 * This function is intended to be used for things like firmware
623 * download where a large block of data needs to be transferred to the
624 * device. No formatting will be done on the data provided.
626 * A value of zero will be returned on success, a negative errno will
627 * be returned in error cases.
629 int regmap_raw_write(struct regmap
*map
, unsigned int reg
,
630 const void *val
, size_t val_len
)
634 if (val_len
% map
->format
.val_bytes
)
636 if (reg
% map
->reg_stride
)
641 ret
= _regmap_raw_write(map
, reg
, val
, val_len
);
647 EXPORT_SYMBOL_GPL(regmap_raw_write
);
650 * regmap_bulk_write(): Write multiple registers to the device
652 * @map: Register map to write to
653 * @reg: First register to be write from
654 * @val: Block of data to be written, in native register size for device
655 * @val_count: Number of registers to write
657 * This function is intended to be used for writing a large block of
658 * data to be device either in single transfer or multiple transfer.
660 * A value of zero will be returned on success, a negative errno will
661 * be returned in error cases.
663 int regmap_bulk_write(struct regmap
*map
, unsigned int reg
, const void *val
,
667 size_t val_bytes
= map
->format
.val_bytes
;
670 if (!map
->format
.parse_val
)
672 if (reg
% map
->reg_stride
)
677 /* No formatting is require if val_byte is 1 */
678 if (val_bytes
== 1) {
681 wval
= kmemdup(val
, val_count
* val_bytes
, GFP_KERNEL
);
684 dev_err(map
->dev
, "Error in memory allocation\n");
687 for (i
= 0; i
< val_count
* val_bytes
; i
+= val_bytes
)
688 map
->format
.parse_val(wval
+ i
);
691 * Some devices does not support bulk write, for
692 * them we have a series of single write operations.
694 if (map
->use_single_rw
) {
695 for (i
= 0; i
< val_count
; i
++) {
696 ret
= regmap_raw_write(map
,
697 reg
+ (i
* map
->reg_stride
),
698 val
+ (i
* val_bytes
),
704 ret
= _regmap_raw_write(map
, reg
, wval
, val_bytes
* val_count
);
714 EXPORT_SYMBOL_GPL(regmap_bulk_write
);
716 static int _regmap_raw_read(struct regmap
*map
, unsigned int reg
, void *val
,
717 unsigned int val_len
)
719 u8
*u8
= map
->work_buf
;
722 map
->format
.format_reg(map
->work_buf
, reg
, map
->reg_shift
);
725 * Some buses or devices flag reads by setting the high bits in the
726 * register addresss; since it's always the high bits for all
727 * current formats we can do this here rather than in
728 * formatting. This may break if we get interesting formats.
730 u8
[0] |= map
->read_flag_mask
;
732 trace_regmap_hw_read_start(map
->dev
, reg
,
733 val_len
/ map
->format
.val_bytes
);
735 ret
= map
->bus
->read(map
->bus_context
, map
->work_buf
,
736 map
->format
.reg_bytes
+ map
->format
.pad_bytes
,
739 trace_regmap_hw_read_done(map
->dev
, reg
,
740 val_len
/ map
->format
.val_bytes
);
745 static int _regmap_read(struct regmap
*map
, unsigned int reg
,
750 if (!map
->cache_bypass
) {
751 ret
= regcache_read(map
, reg
, val
);
756 if (!map
->format
.parse_val
)
762 ret
= _regmap_raw_read(map
, reg
, map
->work_buf
, map
->format
.val_bytes
);
764 *val
= map
->format
.parse_val(map
->work_buf
);
765 trace_regmap_reg_read(map
->dev
, reg
, *val
);
772 * regmap_read(): Read a value from a single register
774 * @map: Register map to write to
775 * @reg: Register to be read from
776 * @val: Pointer to store read value
778 * A value of zero will be returned on success, a negative errno will
779 * be returned in error cases.
781 int regmap_read(struct regmap
*map
, unsigned int reg
, unsigned int *val
)
785 if (reg
% map
->reg_stride
)
790 ret
= _regmap_read(map
, reg
, val
);
796 EXPORT_SYMBOL_GPL(regmap_read
);
799 * regmap_raw_read(): Read raw data from the device
801 * @map: Register map to write to
802 * @reg: First register to be read from
803 * @val: Pointer to store read value
804 * @val_len: Size of data to read
806 * A value of zero will be returned on success, a negative errno will
807 * be returned in error cases.
809 int regmap_raw_read(struct regmap
*map
, unsigned int reg
, void *val
,
812 size_t val_bytes
= map
->format
.val_bytes
;
813 size_t val_count
= val_len
/ val_bytes
;
817 if (val_len
% map
->format
.val_bytes
)
819 if (reg
% map
->reg_stride
)
824 if (regmap_volatile_range(map
, reg
, val_count
) || map
->cache_bypass
||
825 map
->cache_type
== REGCACHE_NONE
) {
826 /* Physical block read if there's no cache involved */
827 ret
= _regmap_raw_read(map
, reg
, val
, val_len
);
830 /* Otherwise go word by word for the cache; should be low
831 * cost as we expect to hit the cache.
833 for (i
= 0; i
< val_count
; i
++) {
834 ret
= _regmap_read(map
, reg
+ (i
* map
->reg_stride
),
839 map
->format
.format_val(val
+ (i
* val_bytes
), v
, 0);
848 EXPORT_SYMBOL_GPL(regmap_raw_read
);
851 * regmap_bulk_read(): Read multiple registers from the device
853 * @map: Register map to write to
854 * @reg: First register to be read from
855 * @val: Pointer to store read value, in native register size for device
856 * @val_count: Number of registers to read
858 * A value of zero will be returned on success, a negative errno will
859 * be returned in error cases.
861 int regmap_bulk_read(struct regmap
*map
, unsigned int reg
, void *val
,
865 size_t val_bytes
= map
->format
.val_bytes
;
866 bool vol
= regmap_volatile_range(map
, reg
, val_count
);
868 if (!map
->format
.parse_val
)
870 if (reg
% map
->reg_stride
)
873 if (vol
|| map
->cache_type
== REGCACHE_NONE
) {
875 * Some devices does not support bulk read, for
876 * them we have a series of single read operations.
878 if (map
->use_single_rw
) {
879 for (i
= 0; i
< val_count
; i
++) {
880 ret
= regmap_raw_read(map
,
881 reg
+ (i
* map
->reg_stride
),
882 val
+ (i
* val_bytes
),
888 ret
= regmap_raw_read(map
, reg
, val
,
889 val_bytes
* val_count
);
894 for (i
= 0; i
< val_count
* val_bytes
; i
+= val_bytes
)
895 map
->format
.parse_val(val
+ i
);
897 for (i
= 0; i
< val_count
; i
++) {
898 ret
= regmap_read(map
, reg
+ (i
* map
->reg_stride
),
899 val
+ (i
* val_bytes
));
907 EXPORT_SYMBOL_GPL(regmap_bulk_read
);
909 static int _regmap_update_bits(struct regmap
*map
, unsigned int reg
,
910 unsigned int mask
, unsigned int val
,
914 unsigned int tmp
, orig
;
918 ret
= _regmap_read(map
, reg
, &orig
);
926 ret
= _regmap_write(map
, reg
, tmp
);
939 * regmap_update_bits: Perform a read/modify/write cycle on the register map
941 * @map: Register map to update
942 * @reg: Register to update
943 * @mask: Bitmask to change
944 * @val: New value for bitmask
946 * Returns zero for success, a negative number on error.
948 int regmap_update_bits(struct regmap
*map
, unsigned int reg
,
949 unsigned int mask
, unsigned int val
)
952 return _regmap_update_bits(map
, reg
, mask
, val
, &change
);
954 EXPORT_SYMBOL_GPL(regmap_update_bits
);
957 * regmap_update_bits_check: Perform a read/modify/write cycle on the
958 * register map and report if updated
960 * @map: Register map to update
961 * @reg: Register to update
962 * @mask: Bitmask to change
963 * @val: New value for bitmask
964 * @change: Boolean indicating if a write was done
966 * Returns zero for success, a negative number on error.
968 int regmap_update_bits_check(struct regmap
*map
, unsigned int reg
,
969 unsigned int mask
, unsigned int val
,
972 return _regmap_update_bits(map
, reg
, mask
, val
, change
);
974 EXPORT_SYMBOL_GPL(regmap_update_bits_check
);
977 * regmap_register_patch: Register and apply register updates to be applied
978 * on device initialistion
980 * @map: Register map to apply updates to.
981 * @regs: Values to update.
982 * @num_regs: Number of entries in regs.
984 * Register a set of register updates to be applied to the device
985 * whenever the device registers are synchronised with the cache and
986 * apply them immediately. Typically this is used to apply
987 * corrections to be applied to the device defaults on startup, such
988 * as the updates some vendors provide to undocumented registers.
990 int regmap_register_patch(struct regmap
*map
, const struct reg_default
*regs
,
996 /* If needed the implementation can be extended to support this */
1002 bypass
= map
->cache_bypass
;
1004 map
->cache_bypass
= true;
1006 /* Write out first; it's useful to apply even if we fail later. */
1007 for (i
= 0; i
< num_regs
; i
++) {
1008 ret
= _regmap_write(map
, regs
[i
].reg
, regs
[i
].def
);
1010 dev_err(map
->dev
, "Failed to write %x = %x: %d\n",
1011 regs
[i
].reg
, regs
[i
].def
, ret
);
1016 map
->patch
= kcalloc(num_regs
, sizeof(struct reg_default
), GFP_KERNEL
);
1017 if (map
->patch
!= NULL
) {
1018 memcpy(map
->patch
, regs
,
1019 num_regs
* sizeof(struct reg_default
));
1020 map
->patch_regs
= num_regs
;
1026 map
->cache_bypass
= bypass
;
1032 EXPORT_SYMBOL_GPL(regmap_register_patch
);
1035 * regmap_get_val_bytes(): Report the size of a register value
1037 * Report the size of a register value, mainly intended to for use by
1038 * generic infrastructure built on top of regmap.
1040 int regmap_get_val_bytes(struct regmap
*map
)
1042 if (map
->format
.format_write
)
1045 return map
->format
.val_bytes
;
1047 EXPORT_SYMBOL_GPL(regmap_get_val_bytes
);
1049 static int __init
regmap_initcall(void)
1051 regmap_debugfs_initcall();
1055 postcore_initcall(regmap_initcall
);