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
->use_single_rw
= true;
347 if (!map
->format
.format_write
&&
348 !(map
->format
.format_reg
&& map
->format
.format_val
))
351 map
->work_buf
= kzalloc(map
->format
.buf_size
, GFP_KERNEL
);
352 if (map
->work_buf
== NULL
) {
357 regmap_debugfs_init(map
, config
->name
);
359 ret
= regcache_init(map
, config
);
361 goto err_free_workbuf
;
366 kfree(map
->work_buf
);
372 EXPORT_SYMBOL_GPL(regmap_init
);
374 static void devm_regmap_release(struct device
*dev
, void *res
)
376 regmap_exit(*(struct regmap
**)res
);
380 * devm_regmap_init(): Initialise managed register map
382 * @dev: Device that will be interacted with
383 * @bus: Bus-specific callbacks to use with device
384 * @bus_context: Data passed to bus-specific callbacks
385 * @config: Configuration for register map
387 * The return value will be an ERR_PTR() on error or a valid pointer
388 * to a struct regmap. This function should generally not be called
389 * directly, it should be called by bus-specific init functions. The
390 * map will be automatically freed by the device management code.
392 struct regmap
*devm_regmap_init(struct device
*dev
,
393 const struct regmap_bus
*bus
,
395 const struct regmap_config
*config
)
397 struct regmap
**ptr
, *regmap
;
399 ptr
= devres_alloc(devm_regmap_release
, sizeof(*ptr
), GFP_KERNEL
);
401 return ERR_PTR(-ENOMEM
);
403 regmap
= regmap_init(dev
, bus
, bus_context
, config
);
404 if (!IS_ERR(regmap
)) {
406 devres_add(dev
, ptr
);
413 EXPORT_SYMBOL_GPL(devm_regmap_init
);
416 * regmap_reinit_cache(): Reinitialise the current register cache
418 * @map: Register map to operate on.
419 * @config: New configuration. Only the cache data will be used.
421 * Discard any existing register cache for the map and initialize a
422 * new cache. This can be used to restore the cache to defaults or to
423 * update the cache configuration to reflect runtime discovery of the
426 int regmap_reinit_cache(struct regmap
*map
, const struct regmap_config
*config
)
433 regmap_debugfs_exit(map
);
435 map
->max_register
= config
->max_register
;
436 map
->writeable_reg
= config
->writeable_reg
;
437 map
->readable_reg
= config
->readable_reg
;
438 map
->volatile_reg
= config
->volatile_reg
;
439 map
->precious_reg
= config
->precious_reg
;
440 map
->cache_type
= config
->cache_type
;
442 regmap_debugfs_init(map
, config
->name
);
444 map
->cache_bypass
= false;
445 map
->cache_only
= false;
447 ret
= regcache_init(map
, config
);
455 * regmap_exit(): Free a previously allocated register map
457 void regmap_exit(struct regmap
*map
)
460 regmap_debugfs_exit(map
);
461 if (map
->bus
->free_context
)
462 map
->bus
->free_context(map
->bus_context
);
463 kfree(map
->work_buf
);
466 EXPORT_SYMBOL_GPL(regmap_exit
);
468 static int _regmap_raw_write(struct regmap
*map
, unsigned int reg
,
469 const void *val
, size_t val_len
)
471 u8
*u8
= map
->work_buf
;
477 /* Check for unwritable registers before we start */
478 if (map
->writeable_reg
)
479 for (i
= 0; i
< val_len
/ map
->format
.val_bytes
; i
++)
480 if (!map
->writeable_reg(map
->dev
,
481 reg
+ (i
* map
->reg_stride
)))
484 if (!map
->cache_bypass
&& map
->format
.parse_val
) {
486 int val_bytes
= map
->format
.val_bytes
;
487 for (i
= 0; i
< val_len
/ val_bytes
; i
++) {
488 memcpy(map
->work_buf
, val
+ (i
* val_bytes
), val_bytes
);
489 ival
= map
->format
.parse_val(map
->work_buf
);
490 ret
= regcache_write(map
, reg
+ (i
* map
->reg_stride
),
494 "Error in caching of register: %u ret: %d\n",
499 if (map
->cache_only
) {
500 map
->cache_dirty
= true;
505 map
->format
.format_reg(map
->work_buf
, reg
, map
->reg_shift
);
507 u8
[0] |= map
->write_flag_mask
;
509 trace_regmap_hw_write_start(map
->dev
, reg
,
510 val_len
/ map
->format
.val_bytes
);
512 /* If we're doing a single register write we can probably just
513 * send the work_buf directly, otherwise try to do a gather
516 if (val
== (map
->work_buf
+ map
->format
.pad_bytes
+
517 map
->format
.reg_bytes
))
518 ret
= map
->bus
->write(map
->bus_context
, map
->work_buf
,
519 map
->format
.reg_bytes
+
520 map
->format
.pad_bytes
+
522 else if (map
->bus
->gather_write
)
523 ret
= map
->bus
->gather_write(map
->bus_context
, map
->work_buf
,
524 map
->format
.reg_bytes
+
525 map
->format
.pad_bytes
,
528 /* If that didn't work fall back on linearising by hand. */
529 if (ret
== -ENOTSUPP
) {
530 len
= map
->format
.reg_bytes
+ map
->format
.pad_bytes
+ val_len
;
531 buf
= kzalloc(len
, GFP_KERNEL
);
535 memcpy(buf
, map
->work_buf
, map
->format
.reg_bytes
);
536 memcpy(buf
+ map
->format
.reg_bytes
+ map
->format
.pad_bytes
,
538 ret
= map
->bus
->write(map
->bus_context
, buf
, len
);
543 trace_regmap_hw_write_done(map
->dev
, reg
,
544 val_len
/ map
->format
.val_bytes
);
549 int _regmap_write(struct regmap
*map
, unsigned int reg
,
553 BUG_ON(!map
->format
.format_write
&& !map
->format
.format_val
);
555 if (!map
->cache_bypass
&& map
->format
.format_write
) {
556 ret
= regcache_write(map
, reg
, val
);
559 if (map
->cache_only
) {
560 map
->cache_dirty
= true;
565 trace_regmap_reg_write(map
->dev
, reg
, val
);
567 if (map
->format
.format_write
) {
568 map
->format
.format_write(map
, reg
, val
);
570 trace_regmap_hw_write_start(map
->dev
, reg
, 1);
572 ret
= map
->bus
->write(map
->bus_context
, map
->work_buf
,
573 map
->format
.buf_size
);
575 trace_regmap_hw_write_done(map
->dev
, reg
, 1);
579 map
->format
.format_val(map
->work_buf
+ map
->format
.reg_bytes
580 + map
->format
.pad_bytes
, val
, 0);
581 return _regmap_raw_write(map
, reg
,
583 map
->format
.reg_bytes
+
584 map
->format
.pad_bytes
,
585 map
->format
.val_bytes
);
590 * regmap_write(): Write a value to a single register
592 * @map: Register map to write to
593 * @reg: Register to write to
594 * @val: Value to be written
596 * A value of zero will be returned on success, a negative errno will
597 * be returned in error cases.
599 int regmap_write(struct regmap
*map
, unsigned int reg
, unsigned int val
)
603 if (reg
% map
->reg_stride
)
608 ret
= _regmap_write(map
, reg
, val
);
614 EXPORT_SYMBOL_GPL(regmap_write
);
617 * regmap_raw_write(): Write raw values to one or more registers
619 * @map: Register map to write to
620 * @reg: Initial register to write to
621 * @val: Block of data to be written, laid out for direct transmission to the
623 * @val_len: Length of data pointed to by val.
625 * This function is intended to be used for things like firmware
626 * download where a large block of data needs to be transferred to the
627 * device. No formatting will be done on the data provided.
629 * A value of zero will be returned on success, a negative errno will
630 * be returned in error cases.
632 int regmap_raw_write(struct regmap
*map
, unsigned int reg
,
633 const void *val
, size_t val_len
)
637 if (val_len
% map
->format
.val_bytes
)
639 if (reg
% map
->reg_stride
)
644 ret
= _regmap_raw_write(map
, reg
, val
, val_len
);
650 EXPORT_SYMBOL_GPL(regmap_raw_write
);
653 * regmap_bulk_write(): Write multiple registers to the device
655 * @map: Register map to write to
656 * @reg: First register to be write from
657 * @val: Block of data to be written, in native register size for device
658 * @val_count: Number of registers to write
660 * This function is intended to be used for writing a large block of
661 * data to be device either in single transfer or multiple transfer.
663 * A value of zero will be returned on success, a negative errno will
664 * be returned in error cases.
666 int regmap_bulk_write(struct regmap
*map
, unsigned int reg
, const void *val
,
670 size_t val_bytes
= map
->format
.val_bytes
;
673 if (!map
->format
.parse_val
)
675 if (reg
% map
->reg_stride
)
680 /* No formatting is require if val_byte is 1 */
681 if (val_bytes
== 1) {
684 wval
= kmemdup(val
, val_count
* val_bytes
, GFP_KERNEL
);
687 dev_err(map
->dev
, "Error in memory allocation\n");
690 for (i
= 0; i
< val_count
* val_bytes
; i
+= val_bytes
)
691 map
->format
.parse_val(wval
+ i
);
694 * Some devices does not support bulk write, for
695 * them we have a series of single write operations.
697 if (map
->use_single_rw
) {
698 for (i
= 0; i
< val_count
; i
++) {
699 ret
= regmap_raw_write(map
,
700 reg
+ (i
* map
->reg_stride
),
701 val
+ (i
* val_bytes
),
707 ret
= _regmap_raw_write(map
, reg
, wval
, val_bytes
* val_count
);
717 EXPORT_SYMBOL_GPL(regmap_bulk_write
);
719 static int _regmap_raw_read(struct regmap
*map
, unsigned int reg
, void *val
,
720 unsigned int val_len
)
722 u8
*u8
= map
->work_buf
;
725 map
->format
.format_reg(map
->work_buf
, reg
, map
->reg_shift
);
728 * Some buses or devices flag reads by setting the high bits in the
729 * register addresss; since it's always the high bits for all
730 * current formats we can do this here rather than in
731 * formatting. This may break if we get interesting formats.
733 u8
[0] |= map
->read_flag_mask
;
735 trace_regmap_hw_read_start(map
->dev
, reg
,
736 val_len
/ map
->format
.val_bytes
);
738 ret
= map
->bus
->read(map
->bus_context
, map
->work_buf
,
739 map
->format
.reg_bytes
+ map
->format
.pad_bytes
,
742 trace_regmap_hw_read_done(map
->dev
, reg
,
743 val_len
/ map
->format
.val_bytes
);
748 static int _regmap_read(struct regmap
*map
, unsigned int reg
,
753 if (!map
->cache_bypass
) {
754 ret
= regcache_read(map
, reg
, val
);
759 if (!map
->format
.parse_val
)
765 ret
= _regmap_raw_read(map
, reg
, map
->work_buf
, map
->format
.val_bytes
);
767 *val
= map
->format
.parse_val(map
->work_buf
);
768 trace_regmap_reg_read(map
->dev
, reg
, *val
);
775 * regmap_read(): Read a value from a single register
777 * @map: Register map to write to
778 * @reg: Register to be read from
779 * @val: Pointer to store read value
781 * A value of zero will be returned on success, a negative errno will
782 * be returned in error cases.
784 int regmap_read(struct regmap
*map
, unsigned int reg
, unsigned int *val
)
788 if (reg
% map
->reg_stride
)
793 ret
= _regmap_read(map
, reg
, val
);
799 EXPORT_SYMBOL_GPL(regmap_read
);
802 * regmap_raw_read(): Read raw data from the device
804 * @map: Register map to write to
805 * @reg: First register to be read from
806 * @val: Pointer to store read value
807 * @val_len: Size of data to read
809 * A value of zero will be returned on success, a negative errno will
810 * be returned in error cases.
812 int regmap_raw_read(struct regmap
*map
, unsigned int reg
, void *val
,
815 size_t val_bytes
= map
->format
.val_bytes
;
816 size_t val_count
= val_len
/ val_bytes
;
820 if (val_len
% map
->format
.val_bytes
)
822 if (reg
% map
->reg_stride
)
827 if (regmap_volatile_range(map
, reg
, val_count
) || map
->cache_bypass
||
828 map
->cache_type
== REGCACHE_NONE
) {
829 /* Physical block read if there's no cache involved */
830 ret
= _regmap_raw_read(map
, reg
, val
, val_len
);
833 /* Otherwise go word by word for the cache; should be low
834 * cost as we expect to hit the cache.
836 for (i
= 0; i
< val_count
; i
++) {
837 ret
= _regmap_read(map
, reg
+ (i
* map
->reg_stride
),
842 map
->format
.format_val(val
+ (i
* val_bytes
), v
, 0);
851 EXPORT_SYMBOL_GPL(regmap_raw_read
);
854 * regmap_bulk_read(): Read multiple registers from the device
856 * @map: Register map to write to
857 * @reg: First register to be read from
858 * @val: Pointer to store read value, in native register size for device
859 * @val_count: Number of registers to read
861 * A value of zero will be returned on success, a negative errno will
862 * be returned in error cases.
864 int regmap_bulk_read(struct regmap
*map
, unsigned int reg
, void *val
,
868 size_t val_bytes
= map
->format
.val_bytes
;
869 bool vol
= regmap_volatile_range(map
, reg
, val_count
);
871 if (!map
->format
.parse_val
)
873 if (reg
% map
->reg_stride
)
876 if (vol
|| map
->cache_type
== REGCACHE_NONE
) {
878 * Some devices does not support bulk read, for
879 * them we have a series of single read operations.
881 if (map
->use_single_rw
) {
882 for (i
= 0; i
< val_count
; i
++) {
883 ret
= regmap_raw_read(map
,
884 reg
+ (i
* map
->reg_stride
),
885 val
+ (i
* val_bytes
),
891 ret
= regmap_raw_read(map
, reg
, val
,
892 val_bytes
* val_count
);
897 for (i
= 0; i
< val_count
* val_bytes
; i
+= val_bytes
)
898 map
->format
.parse_val(val
+ i
);
900 for (i
= 0; i
< val_count
; i
++) {
902 ret
= regmap_read(map
, reg
+ (i
* map
->reg_stride
),
906 memcpy(val
+ (i
* val_bytes
), &ival
, val_bytes
);
912 EXPORT_SYMBOL_GPL(regmap_bulk_read
);
914 static int _regmap_update_bits(struct regmap
*map
, unsigned int reg
,
915 unsigned int mask
, unsigned int val
,
919 unsigned int tmp
, orig
;
923 ret
= _regmap_read(map
, reg
, &orig
);
931 ret
= _regmap_write(map
, reg
, tmp
);
944 * regmap_update_bits: Perform a read/modify/write cycle on the register map
946 * @map: Register map to update
947 * @reg: Register to update
948 * @mask: Bitmask to change
949 * @val: New value for bitmask
951 * Returns zero for success, a negative number on error.
953 int regmap_update_bits(struct regmap
*map
, unsigned int reg
,
954 unsigned int mask
, unsigned int val
)
957 return _regmap_update_bits(map
, reg
, mask
, val
, &change
);
959 EXPORT_SYMBOL_GPL(regmap_update_bits
);
962 * regmap_update_bits_check: Perform a read/modify/write cycle on the
963 * register map and report if updated
965 * @map: Register map to update
966 * @reg: Register to update
967 * @mask: Bitmask to change
968 * @val: New value for bitmask
969 * @change: Boolean indicating if a write was done
971 * Returns zero for success, a negative number on error.
973 int regmap_update_bits_check(struct regmap
*map
, unsigned int reg
,
974 unsigned int mask
, unsigned int val
,
977 return _regmap_update_bits(map
, reg
, mask
, val
, change
);
979 EXPORT_SYMBOL_GPL(regmap_update_bits_check
);
982 * regmap_register_patch: Register and apply register updates to be applied
983 * on device initialistion
985 * @map: Register map to apply updates to.
986 * @regs: Values to update.
987 * @num_regs: Number of entries in regs.
989 * Register a set of register updates to be applied to the device
990 * whenever the device registers are synchronised with the cache and
991 * apply them immediately. Typically this is used to apply
992 * corrections to be applied to the device defaults on startup, such
993 * as the updates some vendors provide to undocumented registers.
995 int regmap_register_patch(struct regmap
*map
, const struct reg_default
*regs
,
1001 /* If needed the implementation can be extended to support this */
1007 bypass
= map
->cache_bypass
;
1009 map
->cache_bypass
= true;
1011 /* Write out first; it's useful to apply even if we fail later. */
1012 for (i
= 0; i
< num_regs
; i
++) {
1013 ret
= _regmap_write(map
, regs
[i
].reg
, regs
[i
].def
);
1015 dev_err(map
->dev
, "Failed to write %x = %x: %d\n",
1016 regs
[i
].reg
, regs
[i
].def
, ret
);
1021 map
->patch
= kcalloc(num_regs
, sizeof(struct reg_default
), GFP_KERNEL
);
1022 if (map
->patch
!= NULL
) {
1023 memcpy(map
->patch
, regs
,
1024 num_regs
* sizeof(struct reg_default
));
1025 map
->patch_regs
= num_regs
;
1031 map
->cache_bypass
= bypass
;
1037 EXPORT_SYMBOL_GPL(regmap_register_patch
);
1040 * regmap_get_val_bytes(): Report the size of a register value
1042 * Report the size of a register value, mainly intended to for use by
1043 * generic infrastructure built on top of regmap.
1045 int regmap_get_val_bytes(struct regmap
*map
)
1047 if (map
->format
.format_write
)
1050 return map
->format
.val_bytes
;
1052 EXPORT_SYMBOL_GPL(regmap_get_val_bytes
);
1054 static int __init
regmap_initcall(void)
1056 regmap_debugfs_initcall();
1060 postcore_initcall(regmap_initcall
);