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
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>
20 #include <linux/iopoll.h>
33 struct regmap_range_cfg;
38 /* An enum of all the supported cache types */
47 * struct reg_default - Default value for a register.
49 * @reg: Register address.
50 * @def: Register default value.
52 * We use an array of structs rather than a simple array as many modern devices
53 * have very sparse register maps.
61 * struct reg_sequence - An individual write from a sequence of writes.
63 * @reg: Register address.
64 * @def: Register value.
65 * @delay_us: Delay to be applied after the register write in microseconds
67 * Register/value pairs for sequences of writes with an optional delay in
68 * microseconds to be applied after each write.
73 unsigned int delay_us;
76 #define REG_SEQ(_reg, _def, _delay_us) { \
79 .delay_us = _delay_us, \
81 #define REG_SEQ0(_reg, _def) REG_SEQ(_reg, _def, 0)
83 #define regmap_update_bits(map, reg, mask, val) \
84 regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
85 #define regmap_update_bits_async(map, reg, mask, val)\
86 regmap_update_bits_base(map, reg, mask, val, NULL, true, false)
87 #define regmap_update_bits_check(map, reg, mask, val, change)\
88 regmap_update_bits_base(map, reg, mask, val, change, false, false)
89 #define regmap_update_bits_check_async(map, reg, mask, val, change)\
90 regmap_update_bits_base(map, reg, mask, val, change, true, false)
92 #define regmap_write_bits(map, reg, mask, val) \
93 regmap_update_bits_base(map, reg, mask, val, NULL, false, true)
95 #define regmap_field_write(field, val) \
96 regmap_field_update_bits_base(field, ~0, val, NULL, false, false)
97 #define regmap_field_force_write(field, val) \
98 regmap_field_update_bits_base(field, ~0, val, NULL, false, true)
99 #define regmap_field_update_bits(field, mask, val)\
100 regmap_field_update_bits_base(field, mask, val, NULL, false, false)
101 #define regmap_field_force_update_bits(field, mask, val) \
102 regmap_field_update_bits_base(field, mask, val, NULL, false, true)
104 #define regmap_fields_write(field, id, val) \
105 regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, false)
106 #define regmap_fields_force_write(field, id, val) \
107 regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, true)
108 #define regmap_fields_update_bits(field, id, mask, val)\
109 regmap_fields_update_bits_base(field, id, mask, val, NULL, false, false)
110 #define regmap_fields_force_update_bits(field, id, mask, val) \
111 regmap_fields_update_bits_base(field, id, mask, val, NULL, false, true)
114 * regmap_read_poll_timeout - Poll until a condition is met or a timeout occurs
116 * @map: Regmap to read from
117 * @addr: Address to poll
118 * @val: Unsigned integer variable to read the value into
119 * @cond: Break condition (usually involving @val)
120 * @sleep_us: Maximum time to sleep between reads in us (0
121 * tight-loops). Should be less than ~20ms since usleep_range
122 * is used (see Documentation/timers/timers-howto.rst).
123 * @timeout_us: Timeout in us, 0 means never timeout
125 * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_read
126 * error return value in case of a error read. In the two former cases,
127 * the last read value at @addr is stored in @val. Must not be called
128 * from atomic context if sleep_us or timeout_us are used.
130 * This is modelled after the readx_poll_timeout macros in linux/iopoll.h.
132 #define regmap_read_poll_timeout(map, addr, val, cond, sleep_us, timeout_us) \
135 __tmp = read_poll_timeout(regmap_read, __ret, __ret || (cond), \
136 sleep_us, timeout_us, false, (map), (addr), &(val)); \
141 * regmap_read_poll_timeout_atomic - Poll until a condition is met or a timeout occurs
143 * @map: Regmap to read from
144 * @addr: Address to poll
145 * @val: Unsigned integer variable to read the value into
146 * @cond: Break condition (usually involving @val)
147 * @delay_us: Time to udelay between reads in us (0 tight-loops).
148 * Should be less than ~10us since udelay is used
149 * (see Documentation/timers/timers-howto.rst).
150 * @timeout_us: Timeout in us, 0 means never timeout
152 * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_read
153 * error return value in case of a error read. In the two former cases,
154 * the last read value at @addr is stored in @val.
156 * This is modelled after the readx_poll_timeout_atomic macros in linux/iopoll.h.
158 * Note: In general regmap cannot be used in atomic context. If you want to use
159 * this macro then first setup your regmap for atomic use (flat or no cache
162 #define regmap_read_poll_timeout_atomic(map, addr, val, cond, delay_us, timeout_us) \
164 u64 __timeout_us = (timeout_us); \
165 unsigned long __delay_us = (delay_us); \
166 ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \
169 __ret = regmap_read((map), (addr), &(val)); \
174 if ((__timeout_us) && \
175 ktime_compare(ktime_get(), __timeout) > 0) { \
176 __ret = regmap_read((map), (addr), &(val)); \
180 udelay(__delay_us); \
182 __ret ?: ((cond) ? 0 : -ETIMEDOUT); \
186 * regmap_field_read_poll_timeout - Poll until a condition is met or timeout
188 * @field: Regmap field to read from
189 * @val: Unsigned integer variable to read the value into
190 * @cond: Break condition (usually involving @val)
191 * @sleep_us: Maximum time to sleep between reads in us (0
192 * tight-loops). Should be less than ~20ms since usleep_range
193 * is used (see Documentation/timers/timers-howto.rst).
194 * @timeout_us: Timeout in us, 0 means never timeout
196 * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_field_read
197 * error return value in case of a error read. In the two former cases,
198 * the last read value at @addr is stored in @val. Must not be called
199 * from atomic context if sleep_us or timeout_us are used.
201 * This is modelled after the readx_poll_timeout macros in linux/iopoll.h.
203 #define regmap_field_read_poll_timeout(field, val, cond, sleep_us, timeout_us) \
206 __tmp = read_poll_timeout(regmap_field_read, __ret, __ret || (cond), \
207 sleep_us, timeout_us, false, (field), &(val)); \
214 /* Unspecified -> 0 -> Backwards compatible default */
215 REGMAP_ENDIAN_DEFAULT = 0,
217 REGMAP_ENDIAN_LITTLE,
218 REGMAP_ENDIAN_NATIVE,
222 * struct regmap_range - A register range, used for access related checks
223 * (readable/writeable/volatile/precious checks)
225 * @range_min: address of first register
226 * @range_max: address of last register
228 struct regmap_range {
229 unsigned int range_min;
230 unsigned int range_max;
233 #define regmap_reg_range(low, high) { .range_min = low, .range_max = high, }
236 * struct regmap_access_table - A table of register ranges for access checks
238 * @yes_ranges : pointer to an array of regmap ranges used as "yes ranges"
239 * @n_yes_ranges: size of the above array
240 * @no_ranges: pointer to an array of regmap ranges used as "no ranges"
241 * @n_no_ranges: size of the above array
243 * A table of ranges including some yes ranges and some no ranges.
244 * If a register belongs to a no_range, the corresponding check function
245 * will return false. If a register belongs to a yes range, the corresponding
246 * check function will return true. "no_ranges" are searched first.
248 struct regmap_access_table {
249 const struct regmap_range *yes_ranges;
250 unsigned int n_yes_ranges;
251 const struct regmap_range *no_ranges;
252 unsigned int n_no_ranges;
255 typedef void (*regmap_lock)(void *);
256 typedef void (*regmap_unlock)(void *);
259 * struct regmap_config - Configuration for the register map of a device.
261 * @name: Optional name of the regmap. Useful when a device has multiple
264 * @reg_bits: Number of bits in a register address, mandatory.
265 * @reg_stride: The register address stride. Valid register addresses are a
266 * multiple of this value. If set to 0, a value of 1 will be
268 * @pad_bits: Number of bits of padding between register and value.
269 * @val_bits: Number of bits in a register value, mandatory.
271 * @writeable_reg: Optional callback returning true if the register
272 * can be written to. If this field is NULL but wr_table
273 * (see below) is not, the check is performed on such table
274 * (a register is writeable if it belongs to one of the ranges
275 * specified by wr_table).
276 * @readable_reg: Optional callback returning true if the register
277 * can be read from. If this field is NULL but rd_table
278 * (see below) is not, the check is performed on such table
279 * (a register is readable if it belongs to one of the ranges
280 * specified by rd_table).
281 * @volatile_reg: Optional callback returning true if the register
282 * value can't be cached. If this field is NULL but
283 * volatile_table (see below) is not, the check is performed on
284 * such table (a register is volatile if it belongs to one of
285 * the ranges specified by volatile_table).
286 * @precious_reg: Optional callback returning true if the register
287 * should not be read outside of a call from the driver
288 * (e.g., a clear on read interrupt status register). If this
289 * field is NULL but precious_table (see below) is not, the
290 * check is performed on such table (a register is precious if
291 * it belongs to one of the ranges specified by precious_table).
292 * @writeable_noinc_reg: Optional callback returning true if the register
293 * supports multiple write operations without incrementing
294 * the register number. If this field is NULL but
295 * wr_noinc_table (see below) is not, the check is
296 * performed on such table (a register is no increment
297 * writeable if it belongs to one of the ranges specified
298 * by wr_noinc_table).
299 * @readable_noinc_reg: Optional callback returning true if the register
300 * supports multiple read operations without incrementing
301 * the register number. If this field is NULL but
302 * rd_noinc_table (see below) is not, the check is
303 * performed on such table (a register is no increment
304 * readable if it belongs to one of the ranges specified
305 * by rd_noinc_table).
306 * @disable_locking: This regmap is either protected by external means or
307 * is guaranteed not be be accessed from multiple threads.
308 * Don't use any locking mechanisms.
309 * @lock: Optional lock callback (overrides regmap's default lock
310 * function, based on spinlock or mutex).
311 * @unlock: As above for unlocking.
312 * @lock_arg: this field is passed as the only argument of lock/unlock
313 * functions (ignored in case regular lock/unlock functions
314 * are not overridden).
315 * @reg_read: Optional callback that if filled will be used to perform
316 * all the reads from the registers. Should only be provided for
317 * devices whose read operation cannot be represented as a simple
318 * read operation on a bus such as SPI, I2C, etc. Most of the
319 * devices do not need this.
320 * @reg_write: Same as above for writing.
321 * @fast_io: Register IO is fast. Use a spinlock instead of a mutex
322 * to perform locking. This field is ignored if custom lock/unlock
323 * functions are used (see fields lock/unlock of struct regmap_config).
324 * This field is a duplicate of a similar file in
325 * 'struct regmap_bus' and serves exact same purpose.
326 * Use it only for "no-bus" cases.
327 * @max_register: Optional, specifies the maximum valid register address.
328 * @wr_table: Optional, points to a struct regmap_access_table specifying
329 * valid ranges for write access.
330 * @rd_table: As above, for read access.
331 * @volatile_table: As above, for volatile registers.
332 * @precious_table: As above, for precious registers.
333 * @wr_noinc_table: As above, for no increment writeable registers.
334 * @rd_noinc_table: As above, for no increment readable registers.
335 * @reg_defaults: Power on reset values for registers (for use with
336 * register cache support).
337 * @num_reg_defaults: Number of elements in reg_defaults.
339 * @read_flag_mask: Mask to be set in the top bytes of the register when doing
341 * @write_flag_mask: Mask to be set in the top bytes of the register when doing
342 * a write. If both read_flag_mask and write_flag_mask are
343 * empty and zero_flag_mask is not set the regmap_bus default
345 * @zero_flag_mask: If set, read_flag_mask and write_flag_mask are used even
346 * if they are both empty.
347 * @use_single_read: If set, converts the bulk read operation into a series of
348 * single read operations. This is useful for a device that
349 * does not support bulk read.
350 * @use_single_write: If set, converts the bulk write operation into a series of
351 * single write operations. This is useful for a device that
352 * does not support bulk write.
353 * @can_multi_write: If set, the device supports the multi write mode of bulk
354 * write operations, if clear multi write requests will be
355 * split into individual write operations
357 * @cache_type: The actual cache type.
358 * @reg_defaults_raw: Power on reset values for registers (for use with
359 * register cache support).
360 * @num_reg_defaults_raw: Number of elements in reg_defaults_raw.
361 * @reg_format_endian: Endianness for formatted register addresses. If this is
362 * DEFAULT, the @reg_format_endian_default value from the
363 * regmap bus is used.
364 * @val_format_endian: Endianness for formatted register values. If this is
365 * DEFAULT, the @reg_format_endian_default value from the
366 * regmap bus is used.
368 * @ranges: Array of configuration entries for virtual address ranges.
369 * @num_ranges: Number of range configuration entries.
370 * @use_hwlock: Indicate if a hardware spinlock should be used.
371 * @hwlock_id: Specify the hardware spinlock id.
372 * @hwlock_mode: The hardware spinlock mode, should be HWLOCK_IRQSTATE,
375 struct regmap_config {
383 bool (*writeable_reg)(struct device *dev, unsigned int reg);
384 bool (*readable_reg)(struct device *dev, unsigned int reg);
385 bool (*volatile_reg)(struct device *dev, unsigned int reg);
386 bool (*precious_reg)(struct device *dev, unsigned int reg);
387 bool (*writeable_noinc_reg)(struct device *dev, unsigned int reg);
388 bool (*readable_noinc_reg)(struct device *dev, unsigned int reg);
390 bool disable_locking;
392 regmap_unlock unlock;
395 int (*reg_read)(void *context, unsigned int reg, unsigned int *val);
396 int (*reg_write)(void *context, unsigned int reg, unsigned int val);
400 unsigned int max_register;
401 const struct regmap_access_table *wr_table;
402 const struct regmap_access_table *rd_table;
403 const struct regmap_access_table *volatile_table;
404 const struct regmap_access_table *precious_table;
405 const struct regmap_access_table *wr_noinc_table;
406 const struct regmap_access_table *rd_noinc_table;
407 const struct reg_default *reg_defaults;
408 unsigned int num_reg_defaults;
409 enum regcache_type cache_type;
410 const void *reg_defaults_raw;
411 unsigned int num_reg_defaults_raw;
413 unsigned long read_flag_mask;
414 unsigned long write_flag_mask;
417 bool use_single_read;
418 bool use_single_write;
419 bool can_multi_write;
421 enum regmap_endian reg_format_endian;
422 enum regmap_endian val_format_endian;
424 const struct regmap_range_cfg *ranges;
425 unsigned int num_ranges;
428 unsigned int hwlock_id;
429 unsigned int hwlock_mode;
433 * struct regmap_range_cfg - Configuration for indirectly accessed or paged
436 * @name: Descriptive name for diagnostics
438 * @range_min: Address of the lowest register address in virtual range.
439 * @range_max: Address of the highest register in virtual range.
441 * @selector_reg: Register with selector field.
442 * @selector_mask: Bit mask for selector value.
443 * @selector_shift: Bit shift for selector value.
445 * @window_start: Address of first (lowest) register in data window.
446 * @window_len: Number of registers in data window.
448 * Registers, mapped to this virtual range, are accessed in two steps:
449 * 1. page selector register update;
450 * 2. access through data window registers.
452 struct regmap_range_cfg {
455 /* Registers of virtual address range */
456 unsigned int range_min;
457 unsigned int range_max;
459 /* Page selector for indirect addressing */
460 unsigned int selector_reg;
461 unsigned int selector_mask;
464 /* Data window (per each page) */
465 unsigned int window_start;
466 unsigned int window_len;
471 typedef int (*regmap_hw_write)(void *context, const void *data,
473 typedef int (*regmap_hw_gather_write)(void *context,
474 const void *reg, size_t reg_len,
475 const void *val, size_t val_len);
476 typedef int (*regmap_hw_async_write)(void *context,
477 const void *reg, size_t reg_len,
478 const void *val, size_t val_len,
479 struct regmap_async *async);
480 typedef int (*regmap_hw_read)(void *context,
481 const void *reg_buf, size_t reg_size,
482 void *val_buf, size_t val_size);
483 typedef int (*regmap_hw_reg_read)(void *context, unsigned int reg,
485 typedef int (*regmap_hw_reg_write)(void *context, unsigned int reg,
487 typedef int (*regmap_hw_reg_update_bits)(void *context, unsigned int reg,
488 unsigned int mask, unsigned int val);
489 typedef struct regmap_async *(*regmap_hw_async_alloc)(void);
490 typedef void (*regmap_hw_free_context)(void *context);
493 * struct regmap_bus - Description of a hardware bus for the register map
496 * @fast_io: Register IO is fast. Use a spinlock instead of a mutex
497 * to perform locking. This field is ignored if custom lock/unlock
498 * functions are used (see fields lock/unlock of
499 * struct regmap_config).
500 * @write: Write operation.
501 * @gather_write: Write operation with split register/value, return -ENOTSUPP
502 * if not implemented on a given device.
503 * @async_write: Write operation which completes asynchronously, optional and
504 * must serialise with respect to non-async I/O.
505 * @reg_write: Write a single register value to the given register address. This
506 * write operation has to complete when returning from the function.
507 * @reg_update_bits: Update bits operation to be used against volatile
508 * registers, intended for devices supporting some mechanism
509 * for setting clearing bits without having to
511 * @read: Read operation. Data is returned in the buffer used to transmit
513 * @reg_read: Read a single register value from a given register address.
514 * @free_context: Free context.
515 * @async_alloc: Allocate a regmap_async() structure.
516 * @read_flag_mask: Mask to be set in the top byte of the register when doing
518 * @reg_format_endian_default: Default endianness for formatted register
519 * addresses. Used when the regmap_config specifies DEFAULT. If this is
520 * DEFAULT, BIG is assumed.
521 * @val_format_endian_default: Default endianness for formatted register
522 * values. Used when the regmap_config specifies DEFAULT. If this is
523 * DEFAULT, BIG is assumed.
524 * @max_raw_read: Max raw read size that can be used on the bus.
525 * @max_raw_write: Max raw write size that can be used on the bus.
529 regmap_hw_write write;
530 regmap_hw_gather_write gather_write;
531 regmap_hw_async_write async_write;
532 regmap_hw_reg_write reg_write;
533 regmap_hw_reg_update_bits reg_update_bits;
535 regmap_hw_reg_read reg_read;
536 regmap_hw_free_context free_context;
537 regmap_hw_async_alloc async_alloc;
539 enum regmap_endian reg_format_endian_default;
540 enum regmap_endian val_format_endian_default;
542 size_t max_raw_write;
546 * __regmap_init functions.
548 * These functions take a lock key and name parameter, and should not be called
549 * directly. Instead, use the regmap_init macros that generate a key and name
552 struct regmap *__regmap_init(struct device *dev,
553 const struct regmap_bus *bus,
555 const struct regmap_config *config,
556 struct lock_class_key *lock_key,
557 const char *lock_name);
558 struct regmap *__regmap_init_i2c(struct i2c_client *i2c,
559 const struct regmap_config *config,
560 struct lock_class_key *lock_key,
561 const char *lock_name);
562 struct regmap *__regmap_init_sccb(struct i2c_client *i2c,
563 const struct regmap_config *config,
564 struct lock_class_key *lock_key,
565 const char *lock_name);
566 struct regmap *__regmap_init_slimbus(struct slim_device *slimbus,
567 const struct regmap_config *config,
568 struct lock_class_key *lock_key,
569 const char *lock_name);
570 struct regmap *__regmap_init_spi(struct spi_device *dev,
571 const struct regmap_config *config,
572 struct lock_class_key *lock_key,
573 const char *lock_name);
574 struct regmap *__regmap_init_spmi_base(struct spmi_device *dev,
575 const struct regmap_config *config,
576 struct lock_class_key *lock_key,
577 const char *lock_name);
578 struct regmap *__regmap_init_spmi_ext(struct spmi_device *dev,
579 const struct regmap_config *config,
580 struct lock_class_key *lock_key,
581 const char *lock_name);
582 struct regmap *__regmap_init_w1(struct device *w1_dev,
583 const struct regmap_config *config,
584 struct lock_class_key *lock_key,
585 const char *lock_name);
586 struct regmap *__regmap_init_mmio_clk(struct device *dev, const char *clk_id,
588 const struct regmap_config *config,
589 struct lock_class_key *lock_key,
590 const char *lock_name);
591 struct regmap *__regmap_init_ac97(struct snd_ac97 *ac97,
592 const struct regmap_config *config,
593 struct lock_class_key *lock_key,
594 const char *lock_name);
595 struct regmap *__regmap_init_sdw(struct sdw_slave *sdw,
596 const struct regmap_config *config,
597 struct lock_class_key *lock_key,
598 const char *lock_name);
600 struct regmap *__devm_regmap_init(struct device *dev,
601 const struct regmap_bus *bus,
603 const struct regmap_config *config,
604 struct lock_class_key *lock_key,
605 const char *lock_name);
606 struct regmap *__devm_regmap_init_i2c(struct i2c_client *i2c,
607 const struct regmap_config *config,
608 struct lock_class_key *lock_key,
609 const char *lock_name);
610 struct regmap *__devm_regmap_init_sccb(struct i2c_client *i2c,
611 const struct regmap_config *config,
612 struct lock_class_key *lock_key,
613 const char *lock_name);
614 struct regmap *__devm_regmap_init_spi(struct spi_device *dev,
615 const struct regmap_config *config,
616 struct lock_class_key *lock_key,
617 const char *lock_name);
618 struct regmap *__devm_regmap_init_spmi_base(struct spmi_device *dev,
619 const struct regmap_config *config,
620 struct lock_class_key *lock_key,
621 const char *lock_name);
622 struct regmap *__devm_regmap_init_spmi_ext(struct spmi_device *dev,
623 const struct regmap_config *config,
624 struct lock_class_key *lock_key,
625 const char *lock_name);
626 struct regmap *__devm_regmap_init_w1(struct device *w1_dev,
627 const struct regmap_config *config,
628 struct lock_class_key *lock_key,
629 const char *lock_name);
630 struct regmap *__devm_regmap_init_mmio_clk(struct device *dev,
633 const struct regmap_config *config,
634 struct lock_class_key *lock_key,
635 const char *lock_name);
636 struct regmap *__devm_regmap_init_ac97(struct snd_ac97 *ac97,
637 const struct regmap_config *config,
638 struct lock_class_key *lock_key,
639 const char *lock_name);
640 struct regmap *__devm_regmap_init_sdw(struct sdw_slave *sdw,
641 const struct regmap_config *config,
642 struct lock_class_key *lock_key,
643 const char *lock_name);
644 struct regmap *__devm_regmap_init_slimbus(struct slim_device *slimbus,
645 const struct regmap_config *config,
646 struct lock_class_key *lock_key,
647 const char *lock_name);
648 struct regmap *__devm_regmap_init_i3c(struct i3c_device *i3c,
649 const struct regmap_config *config,
650 struct lock_class_key *lock_key,
651 const char *lock_name);
653 * Wrapper for regmap_init macros to include a unique lockdep key and name
654 * for each call. No-op if CONFIG_LOCKDEP is not set.
656 * @fn: Real function to call (in the form __[*_]regmap_init[_*])
657 * @name: Config variable name (#config in the calling macro)
659 #ifdef CONFIG_LOCKDEP
660 #define __regmap_lockdep_wrapper(fn, name, ...) \
663 static struct lock_class_key _key; \
664 fn(__VA_ARGS__, &_key, \
665 KBUILD_BASENAME ":" \
666 __stringify(__LINE__) ":" \
667 "(" name ")->lock"); \
671 #define __regmap_lockdep_wrapper(fn, name, ...) fn(__VA_ARGS__, NULL, NULL)
675 * regmap_init() - Initialise register map
677 * @dev: Device that will be interacted with
678 * @bus: Bus-specific callbacks to use with device
679 * @bus_context: Data passed to bus-specific callbacks
680 * @config: Configuration for register map
682 * The return value will be an ERR_PTR() on error or a valid pointer to
683 * a struct regmap. This function should generally not be called
684 * directly, it should be called by bus-specific init functions.
686 #define regmap_init(dev, bus, bus_context, config) \
687 __regmap_lockdep_wrapper(__regmap_init, #config, \
688 dev, bus, bus_context, config)
689 int regmap_attach_dev(struct device *dev, struct regmap *map,
690 const struct regmap_config *config);
693 * regmap_init_i2c() - Initialise register map
695 * @i2c: Device that will be interacted with
696 * @config: Configuration for register map
698 * The return value will be an ERR_PTR() on error or a valid pointer to
701 #define regmap_init_i2c(i2c, config) \
702 __regmap_lockdep_wrapper(__regmap_init_i2c, #config, \
706 * regmap_init_sccb() - Initialise register map
708 * @i2c: Device that will be interacted with
709 * @config: Configuration for register map
711 * The return value will be an ERR_PTR() on error or a valid pointer to
714 #define regmap_init_sccb(i2c, config) \
715 __regmap_lockdep_wrapper(__regmap_init_sccb, #config, \
719 * regmap_init_slimbus() - Initialise register map
721 * @slimbus: Device that will be interacted with
722 * @config: Configuration for register map
724 * The return value will be an ERR_PTR() on error or a valid pointer to
727 #define regmap_init_slimbus(slimbus, config) \
728 __regmap_lockdep_wrapper(__regmap_init_slimbus, #config, \
732 * regmap_init_spi() - Initialise register map
734 * @dev: Device that will be interacted with
735 * @config: Configuration for register map
737 * The return value will be an ERR_PTR() on error or a valid pointer to
740 #define regmap_init_spi(dev, config) \
741 __regmap_lockdep_wrapper(__regmap_init_spi, #config, \
745 * regmap_init_spmi_base() - Create regmap for the Base register space
747 * @dev: SPMI device that will be interacted with
748 * @config: Configuration for register map
750 * The return value will be an ERR_PTR() on error or a valid pointer to
753 #define regmap_init_spmi_base(dev, config) \
754 __regmap_lockdep_wrapper(__regmap_init_spmi_base, #config, \
758 * regmap_init_spmi_ext() - Create regmap for Ext register space
760 * @dev: Device that will be interacted with
761 * @config: Configuration for register map
763 * The return value will be an ERR_PTR() on error or a valid pointer to
766 #define regmap_init_spmi_ext(dev, config) \
767 __regmap_lockdep_wrapper(__regmap_init_spmi_ext, #config, \
771 * regmap_init_w1() - Initialise register map
773 * @w1_dev: Device that will be interacted with
774 * @config: Configuration for register map
776 * The return value will be an ERR_PTR() on error or a valid pointer to
779 #define regmap_init_w1(w1_dev, config) \
780 __regmap_lockdep_wrapper(__regmap_init_w1, #config, \
784 * regmap_init_mmio_clk() - Initialise register map with register clock
786 * @dev: Device that will be interacted with
787 * @clk_id: register clock consumer ID
788 * @regs: Pointer to memory-mapped IO region
789 * @config: Configuration for register map
791 * The return value will be an ERR_PTR() on error or a valid pointer to
794 #define regmap_init_mmio_clk(dev, clk_id, regs, config) \
795 __regmap_lockdep_wrapper(__regmap_init_mmio_clk, #config, \
796 dev, clk_id, regs, config)
799 * regmap_init_mmio() - Initialise register map
801 * @dev: Device that will be interacted with
802 * @regs: Pointer to memory-mapped IO region
803 * @config: Configuration for register map
805 * The return value will be an ERR_PTR() on error or a valid pointer to
808 #define regmap_init_mmio(dev, regs, config) \
809 regmap_init_mmio_clk(dev, NULL, regs, config)
812 * regmap_init_ac97() - Initialise AC'97 register map
814 * @ac97: Device that will be interacted with
815 * @config: Configuration for register map
817 * The return value will be an ERR_PTR() on error or a valid pointer to
820 #define regmap_init_ac97(ac97, config) \
821 __regmap_lockdep_wrapper(__regmap_init_ac97, #config, \
823 bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg);
826 * regmap_init_sdw() - Initialise register map
828 * @sdw: Device that will be interacted with
829 * @config: Configuration for register map
831 * The return value will be an ERR_PTR() on error or a valid pointer to
834 #define regmap_init_sdw(sdw, config) \
835 __regmap_lockdep_wrapper(__regmap_init_sdw, #config, \
840 * devm_regmap_init() - Initialise managed register map
842 * @dev: Device that will be interacted with
843 * @bus: Bus-specific callbacks to use with device
844 * @bus_context: Data passed to bus-specific callbacks
845 * @config: Configuration for register map
847 * The return value will be an ERR_PTR() on error or a valid pointer
848 * to a struct regmap. This function should generally not be called
849 * directly, it should be called by bus-specific init functions. The
850 * map will be automatically freed by the device management code.
852 #define devm_regmap_init(dev, bus, bus_context, config) \
853 __regmap_lockdep_wrapper(__devm_regmap_init, #config, \
854 dev, bus, bus_context, config)
857 * devm_regmap_init_i2c() - Initialise managed register map
859 * @i2c: Device that will be interacted with
860 * @config: Configuration for register map
862 * The return value will be an ERR_PTR() on error or a valid pointer
863 * to a struct regmap. The regmap will be automatically freed by the
864 * device management code.
866 #define devm_regmap_init_i2c(i2c, config) \
867 __regmap_lockdep_wrapper(__devm_regmap_init_i2c, #config, \
871 * devm_regmap_init_sccb() - Initialise managed register map
873 * @i2c: Device that will be interacted with
874 * @config: Configuration for register map
876 * The return value will be an ERR_PTR() on error or a valid pointer
877 * to a struct regmap. The regmap will be automatically freed by the
878 * device management code.
880 #define devm_regmap_init_sccb(i2c, config) \
881 __regmap_lockdep_wrapper(__devm_regmap_init_sccb, #config, \
885 * devm_regmap_init_spi() - Initialise register map
887 * @dev: Device that will be interacted with
888 * @config: Configuration for register map
890 * The return value will be an ERR_PTR() on error or a valid pointer
891 * to a struct regmap. The map will be automatically freed by the
892 * device management code.
894 #define devm_regmap_init_spi(dev, config) \
895 __regmap_lockdep_wrapper(__devm_regmap_init_spi, #config, \
899 * devm_regmap_init_spmi_base() - Create managed regmap for Base register space
901 * @dev: SPMI device that will be interacted with
902 * @config: Configuration for register map
904 * The return value will be an ERR_PTR() on error or a valid pointer
905 * to a struct regmap. The regmap will be automatically freed by the
906 * device management code.
908 #define devm_regmap_init_spmi_base(dev, config) \
909 __regmap_lockdep_wrapper(__devm_regmap_init_spmi_base, #config, \
913 * devm_regmap_init_spmi_ext() - Create managed regmap for Ext register space
915 * @dev: SPMI device that will be interacted with
916 * @config: Configuration for register map
918 * The return value will be an ERR_PTR() on error or a valid pointer
919 * to a struct regmap. The regmap will be automatically freed by the
920 * device management code.
922 #define devm_regmap_init_spmi_ext(dev, config) \
923 __regmap_lockdep_wrapper(__devm_regmap_init_spmi_ext, #config, \
927 * devm_regmap_init_w1() - Initialise managed register map
929 * @w1_dev: Device that will be interacted with
930 * @config: Configuration for register map
932 * The return value will be an ERR_PTR() on error or a valid pointer
933 * to a struct regmap. The regmap will be automatically freed by the
934 * device management code.
936 #define devm_regmap_init_w1(w1_dev, config) \
937 __regmap_lockdep_wrapper(__devm_regmap_init_w1, #config, \
940 * devm_regmap_init_mmio_clk() - Initialise managed register map with clock
942 * @dev: Device that will be interacted with
943 * @clk_id: register clock consumer ID
944 * @regs: Pointer to memory-mapped IO region
945 * @config: Configuration for register map
947 * The return value will be an ERR_PTR() on error or a valid pointer
948 * to a struct regmap. The regmap will be automatically freed by the
949 * device management code.
951 #define devm_regmap_init_mmio_clk(dev, clk_id, regs, config) \
952 __regmap_lockdep_wrapper(__devm_regmap_init_mmio_clk, #config, \
953 dev, clk_id, regs, config)
956 * devm_regmap_init_mmio() - Initialise managed register map
958 * @dev: Device that will be interacted with
959 * @regs: Pointer to memory-mapped IO region
960 * @config: Configuration for register map
962 * The return value will be an ERR_PTR() on error or a valid pointer
963 * to a struct regmap. The regmap will be automatically freed by the
964 * device management code.
966 #define devm_regmap_init_mmio(dev, regs, config) \
967 devm_regmap_init_mmio_clk(dev, NULL, regs, config)
970 * devm_regmap_init_ac97() - Initialise AC'97 register map
972 * @ac97: Device that will be interacted with
973 * @config: Configuration for register map
975 * The return value will be an ERR_PTR() on error or a valid pointer
976 * to a struct regmap. The regmap will be automatically freed by the
977 * device management code.
979 #define devm_regmap_init_ac97(ac97, config) \
980 __regmap_lockdep_wrapper(__devm_regmap_init_ac97, #config, \
984 * devm_regmap_init_sdw() - Initialise managed register map
986 * @sdw: Device that will be interacted with
987 * @config: Configuration for register map
989 * The return value will be an ERR_PTR() on error or a valid pointer
990 * to a struct regmap. The regmap will be automatically freed by the
991 * device management code.
993 #define devm_regmap_init_sdw(sdw, config) \
994 __regmap_lockdep_wrapper(__devm_regmap_init_sdw, #config, \
998 * devm_regmap_init_slimbus() - Initialise managed register map
1000 * @slimbus: Device that will be interacted with
1001 * @config: Configuration for register map
1003 * The return value will be an ERR_PTR() on error or a valid pointer
1004 * to a struct regmap. The regmap will be automatically freed by the
1005 * device management code.
1007 #define devm_regmap_init_slimbus(slimbus, config) \
1008 __regmap_lockdep_wrapper(__devm_regmap_init_slimbus, #config, \
1012 * devm_regmap_init_i3c() - Initialise managed register map
1014 * @i3c: Device that will be interacted with
1015 * @config: Configuration for register map
1017 * The return value will be an ERR_PTR() on error or a valid pointer
1018 * to a struct regmap. The regmap will be automatically freed by the
1019 * device management code.
1021 #define devm_regmap_init_i3c(i3c, config) \
1022 __regmap_lockdep_wrapper(__devm_regmap_init_i3c, #config, \
1025 int regmap_mmio_attach_clk(struct regmap *map, struct clk *clk);
1026 void regmap_mmio_detach_clk(struct regmap *map);
1027 void regmap_exit(struct regmap *map);
1028 int regmap_reinit_cache(struct regmap *map,
1029 const struct regmap_config *config);
1030 struct regmap *dev_get_regmap(struct device *dev, const char *name);
1031 struct device *regmap_get_device(struct regmap *map);
1032 int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
1033 int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val);
1034 int regmap_raw_write(struct regmap *map, unsigned int reg,
1035 const void *val, size_t val_len);
1036 int regmap_noinc_write(struct regmap *map, unsigned int reg,
1037 const void *val, size_t val_len);
1038 int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
1040 int regmap_multi_reg_write(struct regmap *map, const struct reg_sequence *regs,
1042 int regmap_multi_reg_write_bypassed(struct regmap *map,
1043 const struct reg_sequence *regs,
1045 int regmap_raw_write_async(struct regmap *map, unsigned int reg,
1046 const void *val, size_t val_len);
1047 int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
1048 int regmap_raw_read(struct regmap *map, unsigned int reg,
1049 void *val, size_t val_len);
1050 int regmap_noinc_read(struct regmap *map, unsigned int reg,
1051 void *val, size_t val_len);
1052 int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
1054 int regmap_update_bits_base(struct regmap *map, unsigned int reg,
1055 unsigned int mask, unsigned int val,
1056 bool *change, bool async, bool force);
1057 int regmap_get_val_bytes(struct regmap *map);
1058 int regmap_get_max_register(struct regmap *map);
1059 int regmap_get_reg_stride(struct regmap *map);
1060 int regmap_async_complete(struct regmap *map);
1061 bool regmap_can_raw_write(struct regmap *map);
1062 size_t regmap_get_raw_read_max(struct regmap *map);
1063 size_t regmap_get_raw_write_max(struct regmap *map);
1065 int regcache_sync(struct regmap *map);
1066 int regcache_sync_region(struct regmap *map, unsigned int min,
1068 int regcache_drop_region(struct regmap *map, unsigned int min,
1070 void regcache_cache_only(struct regmap *map, bool enable);
1071 void regcache_cache_bypass(struct regmap *map, bool enable);
1072 void regcache_mark_dirty(struct regmap *map);
1074 bool regmap_check_range_table(struct regmap *map, unsigned int reg,
1075 const struct regmap_access_table *table);
1077 int regmap_register_patch(struct regmap *map, const struct reg_sequence *regs,
1079 int regmap_parse_val(struct regmap *map, const void *buf,
1082 static inline bool regmap_reg_in_range(unsigned int reg,
1083 const struct regmap_range *range)
1085 return reg >= range->range_min && reg <= range->range_max;
1088 bool regmap_reg_in_ranges(unsigned int reg,
1089 const struct regmap_range *ranges,
1090 unsigned int nranges);
1092 static inline int regmap_set_bits(struct regmap *map,
1093 unsigned int reg, unsigned int bits)
1095 return regmap_update_bits_base(map, reg, bits, bits,
1096 NULL, false, false);
1099 static inline int regmap_clear_bits(struct regmap *map,
1100 unsigned int reg, unsigned int bits)
1102 return regmap_update_bits_base(map, reg, bits, 0, NULL, false, false);
1105 int regmap_test_bits(struct regmap *map, unsigned int reg, unsigned int bits);
1108 * struct reg_field - Description of an register field
1110 * @reg: Offset of the register within the regmap bank
1111 * @lsb: lsb of the register field.
1112 * @msb: msb of the register field.
1113 * @id_size: port size if it has some ports
1114 * @id_offset: address offset for each ports
1120 unsigned int id_size;
1121 unsigned int id_offset;
1124 #define REG_FIELD(_reg, _lsb, _msb) { \
1130 #define REG_FIELD_ID(_reg, _lsb, _msb, _size, _offset) { \
1135 .id_offset = _offset, \
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_set_bits(struct regmap *map,
1424 unsigned int reg, unsigned int bits)
1426 WARN_ONCE(1, "regmap API is disabled");
1430 static inline int regmap_clear_bits(struct regmap *map,
1431 unsigned int reg, unsigned int bits)
1433 WARN_ONCE(1, "regmap API is disabled");
1437 static inline int regmap_test_bits(struct regmap *map,
1438 unsigned int reg, unsigned int bits)
1440 WARN_ONCE(1, "regmap API is disabled");
1444 static inline int regmap_field_update_bits_base(struct regmap_field *field,
1445 unsigned int mask, unsigned int val,
1446 bool *change, bool async, bool force)
1448 WARN_ONCE(1, "regmap API is disabled");
1452 static inline int regmap_fields_update_bits_base(struct regmap_field *field,
1454 unsigned int mask, unsigned int val,
1455 bool *change, bool async, bool force)
1457 WARN_ONCE(1, "regmap API is disabled");
1461 static inline int regmap_get_val_bytes(struct regmap *map)
1463 WARN_ONCE(1, "regmap API is disabled");
1467 static inline int regmap_get_max_register(struct regmap *map)
1469 WARN_ONCE(1, "regmap API is disabled");
1473 static inline int regmap_get_reg_stride(struct regmap *map)
1475 WARN_ONCE(1, "regmap API is disabled");
1479 static inline int regcache_sync(struct regmap *map)
1481 WARN_ONCE(1, "regmap API is disabled");
1485 static inline int regcache_sync_region(struct regmap *map, unsigned int min,
1488 WARN_ONCE(1, "regmap API is disabled");
1492 static inline int regcache_drop_region(struct regmap *map, unsigned int min,
1495 WARN_ONCE(1, "regmap API is disabled");
1499 static inline void regcache_cache_only(struct regmap *map, bool enable)
1501 WARN_ONCE(1, "regmap API is disabled");
1504 static inline void regcache_cache_bypass(struct regmap *map, bool enable)
1506 WARN_ONCE(1, "regmap API is disabled");
1509 static inline void regcache_mark_dirty(struct regmap *map)
1511 WARN_ONCE(1, "regmap API is disabled");
1514 static inline void regmap_async_complete(struct regmap *map)
1516 WARN_ONCE(1, "regmap API is disabled");
1519 static inline int regmap_register_patch(struct regmap *map,
1520 const struct reg_sequence *regs,
1523 WARN_ONCE(1, "regmap API is disabled");
1527 static inline int regmap_parse_val(struct regmap *map, const void *buf,
1530 WARN_ONCE(1, "regmap API is disabled");
1534 static inline struct regmap *dev_get_regmap(struct device *dev,
1540 static inline struct device *regmap_get_device(struct regmap *map)
1542 WARN_ONCE(1, "regmap API is disabled");