1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef __LINUX_REGMAP_H
3 #define __LINUX_REGMAP_H
6 * Register map access API
8 * Copyright 2011 Wolfson Microelectronics plc
10 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
13 #include <linux/list.h>
14 #include <linux/rbtree.h>
15 #include <linux/ktime.h>
16 #include <linux/delay.h>
17 #include <linux/err.h>
18 #include <linux/bug.h>
19 #include <linux/lockdep.h>
32 struct regmap_range_cfg;
37 /* An enum of all the supported cache types */
46 * struct reg_default - Default value for a register.
48 * @reg: Register address.
49 * @def: Register default value.
51 * We use an array of structs rather than a simple array as many modern devices
52 * have very sparse register maps.
60 * struct reg_sequence - An individual write from a sequence of writes.
62 * @reg: Register address.
63 * @def: Register value.
64 * @delay_us: Delay to be applied after the register write in microseconds
66 * Register/value pairs for sequences of writes with an optional delay in
67 * microseconds to be applied after each write.
72 unsigned int delay_us;
75 #define regmap_update_bits(map, reg, mask, val) \
76 regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
77 #define regmap_update_bits_async(map, reg, mask, val)\
78 regmap_update_bits_base(map, reg, mask, val, NULL, true, false)
79 #define regmap_update_bits_check(map, reg, mask, val, change)\
80 regmap_update_bits_base(map, reg, mask, val, change, false, false)
81 #define regmap_update_bits_check_async(map, reg, mask, val, change)\
82 regmap_update_bits_base(map, reg, mask, val, change, true, false)
84 #define regmap_write_bits(map, reg, mask, val) \
85 regmap_update_bits_base(map, reg, mask, val, NULL, false, true)
87 #define regmap_field_write(field, val) \
88 regmap_field_update_bits_base(field, ~0, val, NULL, false, false)
89 #define regmap_field_force_write(field, val) \
90 regmap_field_update_bits_base(field, ~0, val, NULL, false, true)
91 #define regmap_field_update_bits(field, mask, val)\
92 regmap_field_update_bits_base(field, mask, val, NULL, false, false)
93 #define regmap_field_force_update_bits(field, mask, val) \
94 regmap_field_update_bits_base(field, mask, val, NULL, false, true)
96 #define regmap_fields_write(field, id, val) \
97 regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, false)
98 #define regmap_fields_force_write(field, id, val) \
99 regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, true)
100 #define regmap_fields_update_bits(field, id, mask, val)\
101 regmap_fields_update_bits_base(field, id, mask, val, NULL, false, false)
102 #define regmap_fields_force_update_bits(field, id, mask, val) \
103 regmap_fields_update_bits_base(field, id, mask, val, NULL, false, true)
106 * regmap_read_poll_timeout - Poll until a condition is met or a timeout occurs
108 * @map: Regmap to read from
109 * @addr: Address to poll
110 * @val: Unsigned integer variable to read the value into
111 * @cond: Break condition (usually involving @val)
112 * @sleep_us: Maximum time to sleep between reads in us (0
113 * tight-loops). Should be less than ~20ms since usleep_range
114 * is used (see Documentation/timers/timers-howto.rst).
115 * @timeout_us: Timeout in us, 0 means never timeout
117 * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_read
118 * error return value in case of a error read. In the two former cases,
119 * the last read value at @addr is stored in @val. Must not be called
120 * from atomic context if sleep_us or timeout_us are used.
122 * This is modelled after the readx_poll_timeout macros in linux/iopoll.h.
124 #define regmap_read_poll_timeout(map, addr, val, cond, sleep_us, timeout_us) \
126 u64 __timeout_us = (timeout_us); \
127 unsigned long __sleep_us = (sleep_us); \
128 ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \
130 might_sleep_if(__sleep_us); \
132 __ret = regmap_read((map), (addr), &(val)); \
137 if ((__timeout_us) && \
138 ktime_compare(ktime_get(), __timeout) > 0) { \
139 __ret = regmap_read((map), (addr), &(val)); \
143 usleep_range((__sleep_us >> 2) + 1, __sleep_us); \
145 __ret ?: ((cond) ? 0 : -ETIMEDOUT); \
149 * regmap_read_poll_timeout_atomic - Poll until a condition is met or a timeout occurs
151 * @map: Regmap to read from
152 * @addr: Address to poll
153 * @val: Unsigned integer variable to read the value into
154 * @cond: Break condition (usually involving @val)
155 * @delay_us: Time to udelay between reads in us (0 tight-loops).
156 * Should be less than ~10us since udelay is used
157 * (see Documentation/timers/timers-howto.rst).
158 * @timeout_us: Timeout in us, 0 means never timeout
160 * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_read
161 * error return value in case of a error read. In the two former cases,
162 * the last read value at @addr is stored in @val.
164 * This is modelled after the readx_poll_timeout_atomic macros in linux/iopoll.h.
166 * Note: In general regmap cannot be used in atomic context. If you want to use
167 * this macro then first setup your regmap for atomic use (flat or no cache
170 #define regmap_read_poll_timeout_atomic(map, addr, val, cond, delay_us, timeout_us) \
172 u64 __timeout_us = (timeout_us); \
173 unsigned long __delay_us = (delay_us); \
174 ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \
177 __ret = regmap_read((map), (addr), &(val)); \
182 if ((__timeout_us) && \
183 ktime_compare(ktime_get(), __timeout) > 0) { \
184 __ret = regmap_read((map), (addr), &(val)); \
188 udelay(__delay_us); \
190 __ret ?: ((cond) ? 0 : -ETIMEDOUT); \
194 * regmap_field_read_poll_timeout - Poll until a condition is met or timeout
196 * @field: Regmap field to read from
197 * @val: Unsigned integer variable to read the value into
198 * @cond: Break condition (usually involving @val)
199 * @sleep_us: Maximum time to sleep between reads in us (0
200 * tight-loops). Should be less than ~20ms since usleep_range
201 * is used (see Documentation/timers/timers-howto.rst).
202 * @timeout_us: Timeout in us, 0 means never timeout
204 * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_field_read
205 * error return value in case of a error read. In the two former cases,
206 * the last read value at @addr is stored in @val. Must not be called
207 * from atomic context if sleep_us or timeout_us are used.
209 * This is modelled after the readx_poll_timeout macros in linux/iopoll.h.
211 #define regmap_field_read_poll_timeout(field, val, cond, sleep_us, timeout_us) \
213 u64 __timeout_us = (timeout_us); \
214 unsigned long __sleep_us = (sleep_us); \
215 ktime_t timeout = ktime_add_us(ktime_get(), __timeout_us); \
217 might_sleep_if(__sleep_us); \
219 pollret = regmap_field_read((field), &(val)); \
224 if (__timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \
225 pollret = regmap_field_read((field), &(val)); \
229 usleep_range((__sleep_us >> 2) + 1, __sleep_us); \
231 pollret ?: ((cond) ? 0 : -ETIMEDOUT); \
237 /* Unspecified -> 0 -> Backwards compatible default */
238 REGMAP_ENDIAN_DEFAULT = 0,
240 REGMAP_ENDIAN_LITTLE,
241 REGMAP_ENDIAN_NATIVE,
245 * struct regmap_range - A register range, used for access related checks
246 * (readable/writeable/volatile/precious checks)
248 * @range_min: address of first register
249 * @range_max: address of last register
251 struct regmap_range {
252 unsigned int range_min;
253 unsigned int range_max;
256 #define regmap_reg_range(low, high) { .range_min = low, .range_max = high, }
259 * struct regmap_access_table - A table of register ranges for access checks
261 * @yes_ranges : pointer to an array of regmap ranges used as "yes ranges"
262 * @n_yes_ranges: size of the above array
263 * @no_ranges: pointer to an array of regmap ranges used as "no ranges"
264 * @n_no_ranges: size of the above array
266 * A table of ranges including some yes ranges and some no ranges.
267 * If a register belongs to a no_range, the corresponding check function
268 * will return false. If a register belongs to a yes range, the corresponding
269 * check function will return true. "no_ranges" are searched first.
271 struct regmap_access_table {
272 const struct regmap_range *yes_ranges;
273 unsigned int n_yes_ranges;
274 const struct regmap_range *no_ranges;
275 unsigned int n_no_ranges;
278 typedef void (*regmap_lock)(void *);
279 typedef void (*regmap_unlock)(void *);
282 * struct regmap_config - Configuration for the register map of a device.
284 * @name: Optional name of the regmap. Useful when a device has multiple
287 * @reg_bits: Number of bits in a register address, mandatory.
288 * @reg_stride: The register address stride. Valid register addresses are a
289 * multiple of this value. If set to 0, a value of 1 will be
291 * @pad_bits: Number of bits of padding between register and value.
292 * @val_bits: Number of bits in a register value, mandatory.
294 * @writeable_reg: Optional callback returning true if the register
295 * can be written to. If this field is NULL but wr_table
296 * (see below) is not, the check is performed on such table
297 * (a register is writeable if it belongs to one of the ranges
298 * specified by wr_table).
299 * @readable_reg: Optional callback returning true if the register
300 * can be read from. If this field is NULL but rd_table
301 * (see below) is not, the check is performed on such table
302 * (a register is readable if it belongs to one of the ranges
303 * specified by rd_table).
304 * @volatile_reg: Optional callback returning true if the register
305 * value can't be cached. If this field is NULL but
306 * volatile_table (see below) is not, the check is performed on
307 * such table (a register is volatile if it belongs to one of
308 * the ranges specified by volatile_table).
309 * @precious_reg: Optional callback returning true if the register
310 * should not be read outside of a call from the driver
311 * (e.g., a clear on read interrupt status register). If this
312 * field is NULL but precious_table (see below) is not, the
313 * check is performed on such table (a register is precious if
314 * it belongs to one of the ranges specified by precious_table).
315 * @writeable_noinc_reg: Optional callback returning true if the register
316 * supports multiple write operations without incrementing
317 * the register number. If this field is NULL but
318 * wr_noinc_table (see below) is not, the check is
319 * performed on such table (a register is no increment
320 * writeable if it belongs to one of the ranges specified
321 * by wr_noinc_table).
322 * @readable_noinc_reg: Optional callback returning true if the register
323 * supports multiple read operations without incrementing
324 * the register number. If this field is NULL but
325 * rd_noinc_table (see below) is not, the check is
326 * performed on such table (a register is no increment
327 * readable if it belongs to one of the ranges specified
328 * by rd_noinc_table).
329 * @disable_locking: This regmap is either protected by external means or
330 * is guaranteed not be be accessed from multiple threads.
331 * Don't use any locking mechanisms.
332 * @lock: Optional lock callback (overrides regmap's default lock
333 * function, based on spinlock or mutex).
334 * @unlock: As above for unlocking.
335 * @lock_arg: this field is passed as the only argument of lock/unlock
336 * functions (ignored in case regular lock/unlock functions
337 * are not overridden).
338 * @reg_read: Optional callback that if filled will be used to perform
339 * all the reads from the registers. Should only be provided for
340 * devices whose read operation cannot be represented as a simple
341 * read operation on a bus such as SPI, I2C, etc. Most of the
342 * devices do not need this.
343 * @reg_write: Same as above for writing.
344 * @fast_io: Register IO is fast. Use a spinlock instead of a mutex
345 * to perform locking. This field is ignored if custom lock/unlock
346 * functions are used (see fields lock/unlock of struct regmap_config).
347 * This field is a duplicate of a similar file in
348 * 'struct regmap_bus' and serves exact same purpose.
349 * Use it only for "no-bus" cases.
350 * @max_register: Optional, specifies the maximum valid register address.
351 * @wr_table: Optional, points to a struct regmap_access_table specifying
352 * valid ranges for write access.
353 * @rd_table: As above, for read access.
354 * @volatile_table: As above, for volatile registers.
355 * @precious_table: As above, for precious registers.
356 * @wr_noinc_table: As above, for no increment writeable registers.
357 * @rd_noinc_table: As above, for no increment readable registers.
358 * @reg_defaults: Power on reset values for registers (for use with
359 * register cache support).
360 * @num_reg_defaults: Number of elements in reg_defaults.
362 * @read_flag_mask: Mask to be set in the top bytes of the register when doing
364 * @write_flag_mask: Mask to be set in the top bytes of the register when doing
365 * a write. If both read_flag_mask and write_flag_mask are
366 * empty and zero_flag_mask is not set the regmap_bus default
368 * @zero_flag_mask: If set, read_flag_mask and write_flag_mask are used even
369 * if they are both empty.
370 * @use_single_read: If set, converts the bulk read operation into a series of
371 * single read operations. This is useful for a device that
372 * does not support bulk read.
373 * @use_single_write: If set, converts the bulk write operation into a series of
374 * single write operations. This is useful for a device that
375 * does not support bulk write.
376 * @can_multi_write: If set, the device supports the multi write mode of bulk
377 * write operations, if clear multi write requests will be
378 * split into individual write operations
380 * @cache_type: The actual cache type.
381 * @reg_defaults_raw: Power on reset values for registers (for use with
382 * register cache support).
383 * @num_reg_defaults_raw: Number of elements in reg_defaults_raw.
384 * @reg_format_endian: Endianness for formatted register addresses. If this is
385 * DEFAULT, the @reg_format_endian_default value from the
386 * regmap bus is used.
387 * @val_format_endian: Endianness for formatted register values. If this is
388 * DEFAULT, the @reg_format_endian_default value from the
389 * regmap bus is used.
391 * @ranges: Array of configuration entries for virtual address ranges.
392 * @num_ranges: Number of range configuration entries.
393 * @use_hwlock: Indicate if a hardware spinlock should be used.
394 * @hwlock_id: Specify the hardware spinlock id.
395 * @hwlock_mode: The hardware spinlock mode, should be HWLOCK_IRQSTATE,
398 struct regmap_config {
406 bool (*writeable_reg)(struct device *dev, unsigned int reg);
407 bool (*readable_reg)(struct device *dev, unsigned int reg);
408 bool (*volatile_reg)(struct device *dev, unsigned int reg);
409 bool (*precious_reg)(struct device *dev, unsigned int reg);
410 bool (*writeable_noinc_reg)(struct device *dev, unsigned int reg);
411 bool (*readable_noinc_reg)(struct device *dev, unsigned int reg);
413 bool disable_locking;
415 regmap_unlock unlock;
418 int (*reg_read)(void *context, unsigned int reg, unsigned int *val);
419 int (*reg_write)(void *context, unsigned int reg, unsigned int val);
423 unsigned int max_register;
424 const struct regmap_access_table *wr_table;
425 const struct regmap_access_table *rd_table;
426 const struct regmap_access_table *volatile_table;
427 const struct regmap_access_table *precious_table;
428 const struct regmap_access_table *wr_noinc_table;
429 const struct regmap_access_table *rd_noinc_table;
430 const struct reg_default *reg_defaults;
431 unsigned int num_reg_defaults;
432 enum regcache_type cache_type;
433 const void *reg_defaults_raw;
434 unsigned int num_reg_defaults_raw;
436 unsigned long read_flag_mask;
437 unsigned long write_flag_mask;
440 bool use_single_read;
441 bool use_single_write;
442 bool can_multi_write;
444 enum regmap_endian reg_format_endian;
445 enum regmap_endian val_format_endian;
447 const struct regmap_range_cfg *ranges;
448 unsigned int num_ranges;
451 unsigned int hwlock_id;
452 unsigned int hwlock_mode;
456 * struct regmap_range_cfg - Configuration for indirectly accessed or paged
459 * @name: Descriptive name for diagnostics
461 * @range_min: Address of the lowest register address in virtual range.
462 * @range_max: Address of the highest register in virtual range.
464 * @selector_reg: Register with selector field.
465 * @selector_mask: Bit mask for selector value.
466 * @selector_shift: Bit shift for selector value.
468 * @window_start: Address of first (lowest) register in data window.
469 * @window_len: Number of registers in data window.
471 * Registers, mapped to this virtual range, are accessed in two steps:
472 * 1. page selector register update;
473 * 2. access through data window registers.
475 struct regmap_range_cfg {
478 /* Registers of virtual address range */
479 unsigned int range_min;
480 unsigned int range_max;
482 /* Page selector for indirect addressing */
483 unsigned int selector_reg;
484 unsigned int selector_mask;
487 /* Data window (per each page) */
488 unsigned int window_start;
489 unsigned int window_len;
494 typedef int (*regmap_hw_write)(void *context, const void *data,
496 typedef int (*regmap_hw_gather_write)(void *context,
497 const void *reg, size_t reg_len,
498 const void *val, size_t val_len);
499 typedef int (*regmap_hw_async_write)(void *context,
500 const void *reg, size_t reg_len,
501 const void *val, size_t val_len,
502 struct regmap_async *async);
503 typedef int (*regmap_hw_read)(void *context,
504 const void *reg_buf, size_t reg_size,
505 void *val_buf, size_t val_size);
506 typedef int (*regmap_hw_reg_read)(void *context, unsigned int reg,
508 typedef int (*regmap_hw_reg_write)(void *context, unsigned int reg,
510 typedef int (*regmap_hw_reg_update_bits)(void *context, unsigned int reg,
511 unsigned int mask, unsigned int val);
512 typedef struct regmap_async *(*regmap_hw_async_alloc)(void);
513 typedef void (*regmap_hw_free_context)(void *context);
516 * struct regmap_bus - Description of a hardware bus for the register map
519 * @fast_io: Register IO is fast. Use a spinlock instead of a mutex
520 * to perform locking. This field is ignored if custom lock/unlock
521 * functions are used (see fields lock/unlock of
522 * struct regmap_config).
523 * @write: Write operation.
524 * @gather_write: Write operation with split register/value, return -ENOTSUPP
525 * if not implemented on a given device.
526 * @async_write: Write operation which completes asynchronously, optional and
527 * must serialise with respect to non-async I/O.
528 * @reg_write: Write a single register value to the given register address. This
529 * write operation has to complete when returning from the function.
530 * @reg_update_bits: Update bits operation to be used against volatile
531 * registers, intended for devices supporting some mechanism
532 * for setting clearing bits without having to
534 * @read: Read operation. Data is returned in the buffer used to transmit
536 * @reg_read: Read a single register value from a given register address.
537 * @free_context: Free context.
538 * @async_alloc: Allocate a regmap_async() structure.
539 * @read_flag_mask: Mask to be set in the top byte of the register when doing
541 * @reg_format_endian_default: Default endianness for formatted register
542 * addresses. Used when the regmap_config specifies DEFAULT. If this is
543 * DEFAULT, BIG is assumed.
544 * @val_format_endian_default: Default endianness for formatted register
545 * values. Used when the regmap_config specifies DEFAULT. If this is
546 * DEFAULT, BIG is assumed.
547 * @max_raw_read: Max raw read size that can be used on the bus.
548 * @max_raw_write: Max raw write size that can be used on the bus.
552 regmap_hw_write write;
553 regmap_hw_gather_write gather_write;
554 regmap_hw_async_write async_write;
555 regmap_hw_reg_write reg_write;
556 regmap_hw_reg_update_bits reg_update_bits;
558 regmap_hw_reg_read reg_read;
559 regmap_hw_free_context free_context;
560 regmap_hw_async_alloc async_alloc;
562 enum regmap_endian reg_format_endian_default;
563 enum regmap_endian val_format_endian_default;
565 size_t max_raw_write;
569 * __regmap_init functions.
571 * These functions take a lock key and name parameter, and should not be called
572 * directly. Instead, use the regmap_init macros that generate a key and name
575 struct regmap *__regmap_init(struct device *dev,
576 const struct regmap_bus *bus,
578 const struct regmap_config *config,
579 struct lock_class_key *lock_key,
580 const char *lock_name);
581 struct regmap *__regmap_init_i2c(struct i2c_client *i2c,
582 const struct regmap_config *config,
583 struct lock_class_key *lock_key,
584 const char *lock_name);
585 struct regmap *__regmap_init_sccb(struct i2c_client *i2c,
586 const struct regmap_config *config,
587 struct lock_class_key *lock_key,
588 const char *lock_name);
589 struct regmap *__regmap_init_slimbus(struct slim_device *slimbus,
590 const struct regmap_config *config,
591 struct lock_class_key *lock_key,
592 const char *lock_name);
593 struct regmap *__regmap_init_spi(struct spi_device *dev,
594 const struct regmap_config *config,
595 struct lock_class_key *lock_key,
596 const char *lock_name);
597 struct regmap *__regmap_init_spmi_base(struct spmi_device *dev,
598 const struct regmap_config *config,
599 struct lock_class_key *lock_key,
600 const char *lock_name);
601 struct regmap *__regmap_init_spmi_ext(struct spmi_device *dev,
602 const struct regmap_config *config,
603 struct lock_class_key *lock_key,
604 const char *lock_name);
605 struct regmap *__regmap_init_w1(struct device *w1_dev,
606 const struct regmap_config *config,
607 struct lock_class_key *lock_key,
608 const char *lock_name);
609 struct regmap *__regmap_init_mmio_clk(struct device *dev, const char *clk_id,
611 const struct regmap_config *config,
612 struct lock_class_key *lock_key,
613 const char *lock_name);
614 struct regmap *__regmap_init_ac97(struct snd_ac97 *ac97,
615 const struct regmap_config *config,
616 struct lock_class_key *lock_key,
617 const char *lock_name);
618 struct regmap *__regmap_init_sdw(struct sdw_slave *sdw,
619 const struct regmap_config *config,
620 struct lock_class_key *lock_key,
621 const char *lock_name);
623 struct regmap *__devm_regmap_init(struct device *dev,
624 const struct regmap_bus *bus,
626 const struct regmap_config *config,
627 struct lock_class_key *lock_key,
628 const char *lock_name);
629 struct regmap *__devm_regmap_init_i2c(struct i2c_client *i2c,
630 const struct regmap_config *config,
631 struct lock_class_key *lock_key,
632 const char *lock_name);
633 struct regmap *__devm_regmap_init_sccb(struct i2c_client *i2c,
634 const struct regmap_config *config,
635 struct lock_class_key *lock_key,
636 const char *lock_name);
637 struct regmap *__devm_regmap_init_spi(struct spi_device *dev,
638 const struct regmap_config *config,
639 struct lock_class_key *lock_key,
640 const char *lock_name);
641 struct regmap *__devm_regmap_init_spmi_base(struct spmi_device *dev,
642 const struct regmap_config *config,
643 struct lock_class_key *lock_key,
644 const char *lock_name);
645 struct regmap *__devm_regmap_init_spmi_ext(struct spmi_device *dev,
646 const struct regmap_config *config,
647 struct lock_class_key *lock_key,
648 const char *lock_name);
649 struct regmap *__devm_regmap_init_w1(struct device *w1_dev,
650 const struct regmap_config *config,
651 struct lock_class_key *lock_key,
652 const char *lock_name);
653 struct regmap *__devm_regmap_init_mmio_clk(struct device *dev,
656 const struct regmap_config *config,
657 struct lock_class_key *lock_key,
658 const char *lock_name);
659 struct regmap *__devm_regmap_init_ac97(struct snd_ac97 *ac97,
660 const struct regmap_config *config,
661 struct lock_class_key *lock_key,
662 const char *lock_name);
663 struct regmap *__devm_regmap_init_sdw(struct sdw_slave *sdw,
664 const struct regmap_config *config,
665 struct lock_class_key *lock_key,
666 const char *lock_name);
667 struct regmap *__devm_regmap_init_slimbus(struct slim_device *slimbus,
668 const struct regmap_config *config,
669 struct lock_class_key *lock_key,
670 const char *lock_name);
671 struct regmap *__devm_regmap_init_i3c(struct i3c_device *i3c,
672 const struct regmap_config *config,
673 struct lock_class_key *lock_key,
674 const char *lock_name);
676 * Wrapper for regmap_init macros to include a unique lockdep key and name
677 * for each call. No-op if CONFIG_LOCKDEP is not set.
679 * @fn: Real function to call (in the form __[*_]regmap_init[_*])
680 * @name: Config variable name (#config in the calling macro)
682 #ifdef CONFIG_LOCKDEP
683 #define __regmap_lockdep_wrapper(fn, name, ...) \
686 static struct lock_class_key _key; \
687 fn(__VA_ARGS__, &_key, \
688 KBUILD_BASENAME ":" \
689 __stringify(__LINE__) ":" \
690 "(" name ")->lock"); \
694 #define __regmap_lockdep_wrapper(fn, name, ...) fn(__VA_ARGS__, NULL, NULL)
698 * regmap_init() - Initialise register map
700 * @dev: Device that will be interacted with
701 * @bus: Bus-specific callbacks to use with device
702 * @bus_context: Data passed to bus-specific callbacks
703 * @config: Configuration for register map
705 * The return value will be an ERR_PTR() on error or a valid pointer to
706 * a struct regmap. This function should generally not be called
707 * directly, it should be called by bus-specific init functions.
709 #define regmap_init(dev, bus, bus_context, config) \
710 __regmap_lockdep_wrapper(__regmap_init, #config, \
711 dev, bus, bus_context, config)
712 int regmap_attach_dev(struct device *dev, struct regmap *map,
713 const struct regmap_config *config);
716 * regmap_init_i2c() - Initialise register map
718 * @i2c: Device that will be interacted with
719 * @config: Configuration for register map
721 * The return value will be an ERR_PTR() on error or a valid pointer to
724 #define regmap_init_i2c(i2c, config) \
725 __regmap_lockdep_wrapper(__regmap_init_i2c, #config, \
729 * regmap_init_sccb() - Initialise register map
731 * @i2c: Device that will be interacted with
732 * @config: Configuration for register map
734 * The return value will be an ERR_PTR() on error or a valid pointer to
737 #define regmap_init_sccb(i2c, config) \
738 __regmap_lockdep_wrapper(__regmap_init_sccb, #config, \
742 * regmap_init_slimbus() - Initialise register map
744 * @slimbus: Device that will be interacted with
745 * @config: Configuration for register map
747 * The return value will be an ERR_PTR() on error or a valid pointer to
750 #define regmap_init_slimbus(slimbus, config) \
751 __regmap_lockdep_wrapper(__regmap_init_slimbus, #config, \
755 * regmap_init_spi() - Initialise register map
757 * @dev: Device that will be interacted with
758 * @config: Configuration for register map
760 * The return value will be an ERR_PTR() on error or a valid pointer to
763 #define regmap_init_spi(dev, config) \
764 __regmap_lockdep_wrapper(__regmap_init_spi, #config, \
768 * regmap_init_spmi_base() - Create regmap for the Base register space
770 * @dev: SPMI device that will be interacted with
771 * @config: Configuration for register map
773 * The return value will be an ERR_PTR() on error or a valid pointer to
776 #define regmap_init_spmi_base(dev, config) \
777 __regmap_lockdep_wrapper(__regmap_init_spmi_base, #config, \
781 * regmap_init_spmi_ext() - Create regmap for Ext register space
783 * @dev: Device that will be interacted with
784 * @config: Configuration for register map
786 * The return value will be an ERR_PTR() on error or a valid pointer to
789 #define regmap_init_spmi_ext(dev, config) \
790 __regmap_lockdep_wrapper(__regmap_init_spmi_ext, #config, \
794 * regmap_init_w1() - Initialise register map
796 * @w1_dev: Device that will be interacted with
797 * @config: Configuration for register map
799 * The return value will be an ERR_PTR() on error or a valid pointer to
802 #define regmap_init_w1(w1_dev, config) \
803 __regmap_lockdep_wrapper(__regmap_init_w1, #config, \
807 * regmap_init_mmio_clk() - Initialise register map with register clock
809 * @dev: Device that will be interacted with
810 * @clk_id: register clock consumer ID
811 * @regs: Pointer to memory-mapped IO region
812 * @config: Configuration for register map
814 * The return value will be an ERR_PTR() on error or a valid pointer to
817 #define regmap_init_mmio_clk(dev, clk_id, regs, config) \
818 __regmap_lockdep_wrapper(__regmap_init_mmio_clk, #config, \
819 dev, clk_id, regs, config)
822 * regmap_init_mmio() - Initialise register map
824 * @dev: Device that will be interacted with
825 * @regs: Pointer to memory-mapped IO region
826 * @config: Configuration for register map
828 * The return value will be an ERR_PTR() on error or a valid pointer to
831 #define regmap_init_mmio(dev, regs, config) \
832 regmap_init_mmio_clk(dev, NULL, regs, config)
835 * regmap_init_ac97() - Initialise AC'97 register map
837 * @ac97: Device that will be interacted with
838 * @config: Configuration for register map
840 * The return value will be an ERR_PTR() on error or a valid pointer to
843 #define regmap_init_ac97(ac97, config) \
844 __regmap_lockdep_wrapper(__regmap_init_ac97, #config, \
846 bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg);
849 * regmap_init_sdw() - Initialise register map
851 * @sdw: Device that will be interacted with
852 * @config: Configuration for register map
854 * The return value will be an ERR_PTR() on error or a valid pointer to
857 #define regmap_init_sdw(sdw, config) \
858 __regmap_lockdep_wrapper(__regmap_init_sdw, #config, \
863 * devm_regmap_init() - Initialise managed register map
865 * @dev: Device that will be interacted with
866 * @bus: Bus-specific callbacks to use with device
867 * @bus_context: Data passed to bus-specific callbacks
868 * @config: Configuration for register map
870 * The return value will be an ERR_PTR() on error or a valid pointer
871 * to a struct regmap. This function should generally not be called
872 * directly, it should be called by bus-specific init functions. The
873 * map will be automatically freed by the device management code.
875 #define devm_regmap_init(dev, bus, bus_context, config) \
876 __regmap_lockdep_wrapper(__devm_regmap_init, #config, \
877 dev, bus, bus_context, config)
880 * devm_regmap_init_i2c() - Initialise managed register map
882 * @i2c: Device that will be interacted with
883 * @config: Configuration for register map
885 * The return value will be an ERR_PTR() on error or a valid pointer
886 * to a struct regmap. The regmap will be automatically freed by the
887 * device management code.
889 #define devm_regmap_init_i2c(i2c, config) \
890 __regmap_lockdep_wrapper(__devm_regmap_init_i2c, #config, \
894 * devm_regmap_init_sccb() - Initialise managed register map
896 * @i2c: Device that will be interacted with
897 * @config: Configuration for register map
899 * The return value will be an ERR_PTR() on error or a valid pointer
900 * to a struct regmap. The regmap will be automatically freed by the
901 * device management code.
903 #define devm_regmap_init_sccb(i2c, config) \
904 __regmap_lockdep_wrapper(__devm_regmap_init_sccb, #config, \
908 * devm_regmap_init_spi() - Initialise register map
910 * @dev: Device that will be interacted with
911 * @config: Configuration for register map
913 * The return value will be an ERR_PTR() on error or a valid pointer
914 * to a struct regmap. The map will be automatically freed by the
915 * device management code.
917 #define devm_regmap_init_spi(dev, config) \
918 __regmap_lockdep_wrapper(__devm_regmap_init_spi, #config, \
922 * devm_regmap_init_spmi_base() - Create managed regmap for Base register space
924 * @dev: SPMI device that will be interacted with
925 * @config: Configuration for register map
927 * The return value will be an ERR_PTR() on error or a valid pointer
928 * to a struct regmap. The regmap will be automatically freed by the
929 * device management code.
931 #define devm_regmap_init_spmi_base(dev, config) \
932 __regmap_lockdep_wrapper(__devm_regmap_init_spmi_base, #config, \
936 * devm_regmap_init_spmi_ext() - Create managed regmap for Ext register space
938 * @dev: SPMI device that will be interacted with
939 * @config: Configuration for register map
941 * The return value will be an ERR_PTR() on error or a valid pointer
942 * to a struct regmap. The regmap will be automatically freed by the
943 * device management code.
945 #define devm_regmap_init_spmi_ext(dev, config) \
946 __regmap_lockdep_wrapper(__devm_regmap_init_spmi_ext, #config, \
950 * devm_regmap_init_w1() - Initialise managed register map
952 * @w1_dev: Device that will be interacted with
953 * @config: Configuration for register map
955 * The return value will be an ERR_PTR() on error or a valid pointer
956 * to a struct regmap. The regmap will be automatically freed by the
957 * device management code.
959 #define devm_regmap_init_w1(w1_dev, config) \
960 __regmap_lockdep_wrapper(__devm_regmap_init_w1, #config, \
963 * devm_regmap_init_mmio_clk() - Initialise managed register map with clock
965 * @dev: Device that will be interacted with
966 * @clk_id: register clock consumer ID
967 * @regs: Pointer to memory-mapped IO region
968 * @config: Configuration for register map
970 * The return value will be an ERR_PTR() on error or a valid pointer
971 * to a struct regmap. The regmap will be automatically freed by the
972 * device management code.
974 #define devm_regmap_init_mmio_clk(dev, clk_id, regs, config) \
975 __regmap_lockdep_wrapper(__devm_regmap_init_mmio_clk, #config, \
976 dev, clk_id, regs, config)
979 * devm_regmap_init_mmio() - Initialise managed register map
981 * @dev: Device that will be interacted with
982 * @regs: Pointer to memory-mapped IO region
983 * @config: Configuration for register map
985 * The return value will be an ERR_PTR() on error or a valid pointer
986 * to a struct regmap. The regmap will be automatically freed by the
987 * device management code.
989 #define devm_regmap_init_mmio(dev, regs, config) \
990 devm_regmap_init_mmio_clk(dev, NULL, regs, config)
993 * devm_regmap_init_ac97() - Initialise AC'97 register map
995 * @ac97: Device that will be interacted with
996 * @config: Configuration for register map
998 * The return value will be an ERR_PTR() on error or a valid pointer
999 * to a struct regmap. The regmap will be automatically freed by the
1000 * device management code.
1002 #define devm_regmap_init_ac97(ac97, config) \
1003 __regmap_lockdep_wrapper(__devm_regmap_init_ac97, #config, \
1007 * devm_regmap_init_sdw() - Initialise managed register map
1009 * @sdw: Device that will be interacted with
1010 * @config: Configuration for register map
1012 * The return value will be an ERR_PTR() on error or a valid pointer
1013 * to a struct regmap. The regmap will be automatically freed by the
1014 * device management code.
1016 #define devm_regmap_init_sdw(sdw, config) \
1017 __regmap_lockdep_wrapper(__devm_regmap_init_sdw, #config, \
1021 * devm_regmap_init_slimbus() - Initialise managed register map
1023 * @slimbus: Device that will be interacted with
1024 * @config: Configuration for register map
1026 * The return value will be an ERR_PTR() on error or a valid pointer
1027 * to a struct regmap. The regmap will be automatically freed by the
1028 * device management code.
1030 #define devm_regmap_init_slimbus(slimbus, config) \
1031 __regmap_lockdep_wrapper(__devm_regmap_init_slimbus, #config, \
1035 * devm_regmap_init_i3c() - Initialise managed register map
1037 * @i3c: Device that will be interacted with
1038 * @config: Configuration for register map
1040 * The return value will be an ERR_PTR() on error or a valid pointer
1041 * to a struct regmap. The regmap will be automatically freed by the
1042 * device management code.
1044 #define devm_regmap_init_i3c(i3c, config) \
1045 __regmap_lockdep_wrapper(__devm_regmap_init_i3c, #config, \
1048 int regmap_mmio_attach_clk(struct regmap *map, struct clk *clk);
1049 void regmap_mmio_detach_clk(struct regmap *map);
1050 void regmap_exit(struct regmap *map);
1051 int regmap_reinit_cache(struct regmap *map,
1052 const struct regmap_config *config);
1053 struct regmap *dev_get_regmap(struct device *dev, const char *name);
1054 struct device *regmap_get_device(struct regmap *map);
1055 int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
1056 int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val);
1057 int regmap_raw_write(struct regmap *map, unsigned int reg,
1058 const void *val, size_t val_len);
1059 int regmap_noinc_write(struct regmap *map, unsigned int reg,
1060 const void *val, size_t val_len);
1061 int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
1063 int regmap_multi_reg_write(struct regmap *map, const struct reg_sequence *regs,
1065 int regmap_multi_reg_write_bypassed(struct regmap *map,
1066 const struct reg_sequence *regs,
1068 int regmap_raw_write_async(struct regmap *map, unsigned int reg,
1069 const void *val, size_t val_len);
1070 int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
1071 int regmap_raw_read(struct regmap *map, unsigned int reg,
1072 void *val, size_t val_len);
1073 int regmap_noinc_read(struct regmap *map, unsigned int reg,
1074 void *val, size_t val_len);
1075 int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
1077 int regmap_update_bits_base(struct regmap *map, unsigned int reg,
1078 unsigned int mask, unsigned int val,
1079 bool *change, bool async, bool force);
1080 int regmap_get_val_bytes(struct regmap *map);
1081 int regmap_get_max_register(struct regmap *map);
1082 int regmap_get_reg_stride(struct regmap *map);
1083 int regmap_async_complete(struct regmap *map);
1084 bool regmap_can_raw_write(struct regmap *map);
1085 size_t regmap_get_raw_read_max(struct regmap *map);
1086 size_t regmap_get_raw_write_max(struct regmap *map);
1088 int regcache_sync(struct regmap *map);
1089 int regcache_sync_region(struct regmap *map, unsigned int min,
1091 int regcache_drop_region(struct regmap *map, unsigned int min,
1093 void regcache_cache_only(struct regmap *map, bool enable);
1094 void regcache_cache_bypass(struct regmap *map, bool enable);
1095 void regcache_mark_dirty(struct regmap *map);
1097 bool regmap_check_range_table(struct regmap *map, unsigned int reg,
1098 const struct regmap_access_table *table);
1100 int regmap_register_patch(struct regmap *map, const struct reg_sequence *regs,
1102 int regmap_parse_val(struct regmap *map, const void *buf,
1105 static inline bool regmap_reg_in_range(unsigned int reg,
1106 const struct regmap_range *range)
1108 return reg >= range->range_min && reg <= range->range_max;
1111 bool regmap_reg_in_ranges(unsigned int reg,
1112 const struct regmap_range *ranges,
1113 unsigned int nranges);
1116 * struct reg_field - Description of an register field
1118 * @reg: Offset of the register within the regmap bank
1119 * @lsb: lsb of the register field.
1120 * @msb: msb of the register field.
1121 * @id_size: port size if it has some ports
1122 * @id_offset: address offset for each ports
1128 unsigned int id_size;
1129 unsigned int id_offset;
1132 #define REG_FIELD(_reg, _lsb, _msb) { \
1138 struct regmap_field *regmap_field_alloc(struct regmap *regmap,
1139 struct reg_field reg_field);
1140 void regmap_field_free(struct regmap_field *field);
1142 struct regmap_field *devm_regmap_field_alloc(struct device *dev,
1143 struct regmap *regmap, struct reg_field reg_field);
1144 void devm_regmap_field_free(struct device *dev, struct regmap_field *field);
1146 int regmap_field_read(struct regmap_field *field, unsigned int *val);
1147 int regmap_field_update_bits_base(struct regmap_field *field,
1148 unsigned int mask, unsigned int val,
1149 bool *change, bool async, bool force);
1150 int regmap_fields_read(struct regmap_field *field, unsigned int id,
1152 int regmap_fields_update_bits_base(struct regmap_field *field, unsigned int id,
1153 unsigned int mask, unsigned int val,
1154 bool *change, bool async, bool force);
1156 * struct regmap_irq_type - IRQ type definitions.
1158 * @type_reg_offset: Offset register for the irq type setting.
1159 * @type_rising_val: Register value to configure RISING type irq.
1160 * @type_falling_val: Register value to configure FALLING type irq.
1161 * @type_level_low_val: Register value to configure LEVEL_LOW type irq.
1162 * @type_level_high_val: Register value to configure LEVEL_HIGH type irq.
1163 * @types_supported: logical OR of IRQ_TYPE_* flags indicating supported types.
1165 struct regmap_irq_type {
1166 unsigned int type_reg_offset;
1167 unsigned int type_reg_mask;
1168 unsigned int type_rising_val;
1169 unsigned int type_falling_val;
1170 unsigned int type_level_low_val;
1171 unsigned int type_level_high_val;
1172 unsigned int types_supported;
1176 * struct regmap_irq - Description of an IRQ for the generic regmap irq_chip.
1178 * @reg_offset: Offset of the status/mask register within the bank
1179 * @mask: Mask used to flag/control the register.
1180 * @type: IRQ trigger type setting details if supported.
1183 unsigned int reg_offset;
1185 struct regmap_irq_type type;
1188 #define REGMAP_IRQ_REG(_irq, _off, _mask) \
1189 [_irq] = { .reg_offset = (_off), .mask = (_mask) }
1191 #define REGMAP_IRQ_REG_LINE(_id, _reg_bits) \
1193 .mask = BIT((_id) % (_reg_bits)), \
1194 .reg_offset = (_id) / (_reg_bits), \
1197 #define REGMAP_IRQ_MAIN_REG_OFFSET(arr) \
1198 { .num_regs = ARRAY_SIZE((arr)), .offset = &(arr)[0] }
1200 struct regmap_irq_sub_irq_map {
1201 unsigned int num_regs;
1202 unsigned int *offset;
1206 * struct regmap_irq_chip - Description of a generic regmap irq_chip.
1208 * @name: Descriptive name for IRQ controller.
1210 * @main_status: Base main status register address. For chips which have
1211 * interrupts arranged in separate sub-irq blocks with own IRQ
1212 * registers and which have a main IRQ registers indicating
1213 * sub-irq blocks with unhandled interrupts. For such chips fill
1214 * sub-irq register information in status_base, mask_base and
1216 * @num_main_status_bits: Should be given to chips where number of meaningfull
1217 * main status bits differs from num_regs.
1218 * @sub_reg_offsets: arrays of mappings from main register bits to sub irq
1219 * registers. First item in array describes the registers
1220 * for first main status bit. Second array for second bit etc.
1221 * Offset is given as sub register status offset to
1222 * status_base. Should contain num_regs arrays.
1223 * Can be provided for chips with more complex mapping than
1224 * 1.st bit to 1.st sub-reg, 2.nd bit to 2.nd sub-reg, ...
1225 * @num_main_regs: Number of 'main status' irq registers for chips which have
1228 * @status_base: Base status register address.
1229 * @mask_base: Base mask register address.
1230 * @mask_writeonly: Base mask register is write only.
1231 * @unmask_base: Base unmask register address. for chips who have
1232 * separate mask and unmask registers
1233 * @ack_base: Base ack address. If zero then the chip is clear on read.
1234 * Using zero value is possible with @use_ack bit.
1235 * @wake_base: Base address for wake enables. If zero unsupported.
1236 * @type_base: Base address for irq type. If zero unsupported.
1237 * @irq_reg_stride: Stride to use for chips where registers are not contiguous.
1238 * @init_ack_masked: Ack all masked interrupts once during initalization.
1239 * @mask_invert: Inverted mask register: cleared bits are masked out.
1240 * @use_ack: Use @ack register even if it is zero.
1241 * @ack_invert: Inverted ack register: cleared bits for ack.
1242 * @wake_invert: Inverted wake register: cleared bits are wake enabled.
1243 * @type_invert: Invert the type flags.
1244 * @type_in_mask: Use the mask registers for controlling irq type. For
1245 * interrupts defining type_rising/falling_mask use mask_base
1246 * for edge configuration and never update bits in type_base.
1247 * @clear_on_unmask: For chips with interrupts cleared on read: read the status
1248 * registers before unmasking interrupts to clear any bits
1249 * set when they were masked.
1250 * @runtime_pm: Hold a runtime PM lock on the device when accessing it.
1252 * @num_regs: Number of registers in each control bank.
1253 * @irqs: Descriptors for individual IRQs. Interrupt numbers are
1254 * assigned based on the index in the array of the interrupt.
1255 * @num_irqs: Number of descriptors.
1256 * @num_type_reg: Number of type registers.
1257 * @type_reg_stride: Stride to use for chips where type registers are not
1259 * @handle_pre_irq: Driver specific callback to handle interrupt from device
1260 * before regmap_irq_handler process the interrupts.
1261 * @handle_post_irq: Driver specific callback to handle interrupt from device
1262 * after handling the interrupts in regmap_irq_handler().
1263 * @irq_drv_data: Driver specific IRQ data which is passed as parameter when
1264 * driver specific pre/post interrupt handler is called.
1266 * This is not intended to handle every possible interrupt controller, but
1267 * it should handle a substantial proportion of those that are found in the
1270 struct regmap_irq_chip {
1273 unsigned int main_status;
1274 unsigned int num_main_status_bits;
1275 struct regmap_irq_sub_irq_map *sub_reg_offsets;
1278 unsigned int status_base;
1279 unsigned int mask_base;
1280 unsigned int unmask_base;
1281 unsigned int ack_base;
1282 unsigned int wake_base;
1283 unsigned int type_base;
1284 unsigned int irq_reg_stride;
1285 bool mask_writeonly:1;
1286 bool init_ack_masked:1;
1293 bool type_in_mask:1;
1294 bool clear_on_unmask:1;
1298 const struct regmap_irq *irqs;
1302 unsigned int type_reg_stride;
1304 int (*handle_pre_irq)(void *irq_drv_data);
1305 int (*handle_post_irq)(void *irq_drv_data);
1309 struct regmap_irq_chip_data;
1311 int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
1312 int irq_base, const struct regmap_irq_chip *chip,
1313 struct regmap_irq_chip_data **data);
1314 int regmap_add_irq_chip_np(struct device_node *np, struct regmap *map, int irq,
1315 int irq_flags, int irq_base,
1316 const struct regmap_irq_chip *chip,
1317 struct regmap_irq_chip_data **data);
1318 void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
1320 int devm_regmap_add_irq_chip(struct device *dev, struct regmap *map, int irq,
1321 int irq_flags, int irq_base,
1322 const struct regmap_irq_chip *chip,
1323 struct regmap_irq_chip_data **data);
1324 int devm_regmap_add_irq_chip_np(struct device *dev, struct device_node *np,
1325 struct regmap *map, int irq, int irq_flags,
1327 const struct regmap_irq_chip *chip,
1328 struct regmap_irq_chip_data **data);
1329 void devm_regmap_del_irq_chip(struct device *dev, int irq,
1330 struct regmap_irq_chip_data *data);
1332 int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
1333 int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq);
1334 struct irq_domain *regmap_irq_get_domain(struct regmap_irq_chip_data *data);
1339 * These stubs should only ever be called by generic code which has
1340 * regmap based facilities, if they ever get called at runtime
1341 * something is going wrong and something probably needs to select
1345 static inline int regmap_write(struct regmap *map, unsigned int reg,
1348 WARN_ONCE(1, "regmap API is disabled");
1352 static inline int regmap_write_async(struct regmap *map, unsigned int reg,
1355 WARN_ONCE(1, "regmap API is disabled");
1359 static inline int regmap_raw_write(struct regmap *map, unsigned int reg,
1360 const void *val, size_t val_len)
1362 WARN_ONCE(1, "regmap API is disabled");
1366 static inline int regmap_raw_write_async(struct regmap *map, unsigned int reg,
1367 const void *val, size_t val_len)
1369 WARN_ONCE(1, "regmap API is disabled");
1373 static inline int regmap_noinc_write(struct regmap *map, unsigned int reg,
1374 const void *val, size_t val_len)
1376 WARN_ONCE(1, "regmap API is disabled");
1380 static inline int regmap_bulk_write(struct regmap *map, unsigned int reg,
1381 const void *val, size_t val_count)
1383 WARN_ONCE(1, "regmap API is disabled");
1387 static inline int regmap_read(struct regmap *map, unsigned int reg,
1390 WARN_ONCE(1, "regmap API is disabled");
1394 static inline int regmap_raw_read(struct regmap *map, unsigned int reg,
1395 void *val, size_t val_len)
1397 WARN_ONCE(1, "regmap API is disabled");
1401 static inline int regmap_noinc_read(struct regmap *map, unsigned int reg,
1402 void *val, size_t val_len)
1404 WARN_ONCE(1, "regmap API is disabled");
1408 static inline int regmap_bulk_read(struct regmap *map, unsigned int reg,
1409 void *val, size_t val_count)
1411 WARN_ONCE(1, "regmap API is disabled");
1415 static inline int regmap_update_bits_base(struct regmap *map, unsigned int reg,
1416 unsigned int mask, unsigned int val,
1417 bool *change, bool async, bool force)
1419 WARN_ONCE(1, "regmap API is disabled");
1423 static inline int regmap_field_update_bits_base(struct regmap_field *field,
1424 unsigned int mask, unsigned int val,
1425 bool *change, bool async, bool force)
1427 WARN_ONCE(1, "regmap API is disabled");
1431 static inline int regmap_fields_update_bits_base(struct regmap_field *field,
1433 unsigned int mask, unsigned int val,
1434 bool *change, bool async, bool force)
1436 WARN_ONCE(1, "regmap API is disabled");
1440 static inline int regmap_get_val_bytes(struct regmap *map)
1442 WARN_ONCE(1, "regmap API is disabled");
1446 static inline int regmap_get_max_register(struct regmap *map)
1448 WARN_ONCE(1, "regmap API is disabled");
1452 static inline int regmap_get_reg_stride(struct regmap *map)
1454 WARN_ONCE(1, "regmap API is disabled");
1458 static inline int regcache_sync(struct regmap *map)
1460 WARN_ONCE(1, "regmap API is disabled");
1464 static inline int regcache_sync_region(struct regmap *map, unsigned int min,
1467 WARN_ONCE(1, "regmap API is disabled");
1471 static inline int regcache_drop_region(struct regmap *map, unsigned int min,
1474 WARN_ONCE(1, "regmap API is disabled");
1478 static inline void regcache_cache_only(struct regmap *map, bool enable)
1480 WARN_ONCE(1, "regmap API is disabled");
1483 static inline void regcache_cache_bypass(struct regmap *map, bool enable)
1485 WARN_ONCE(1, "regmap API is disabled");
1488 static inline void regcache_mark_dirty(struct regmap *map)
1490 WARN_ONCE(1, "regmap API is disabled");
1493 static inline void regmap_async_complete(struct regmap *map)
1495 WARN_ONCE(1, "regmap API is disabled");
1498 static inline int regmap_register_patch(struct regmap *map,
1499 const struct reg_sequence *regs,
1502 WARN_ONCE(1, "regmap API is disabled");
1506 static inline int regmap_parse_val(struct regmap *map, const void *buf,
1509 WARN_ONCE(1, "regmap API is disabled");
1513 static inline struct regmap *dev_get_regmap(struct device *dev,
1519 static inline struct device *regmap_get_device(struct regmap *map)
1521 WARN_ONCE(1, "regmap API is disabled");