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/bug.h>
14 #include <linux/cleanup.h>
15 #include <linux/delay.h>
16 #include <linux/err.h>
17 #include <linux/fwnode.h>
18 #include <linux/iopoll.h>
19 #include <linux/ktime.h>
20 #include <linux/list.h>
21 #include <linux/lockdep.h>
22 #include <linux/rbtree.h>
37 struct regmap_range_cfg
;
43 * regmap_mdio address encoding. IEEE 802.3ae clause 45 addresses consist of a
44 * device address and a register address.
46 #define REGMAP_MDIO_C45_DEVAD_SHIFT 16
47 #define REGMAP_MDIO_C45_DEVAD_MASK GENMASK(20, 16)
48 #define REGMAP_MDIO_C45_REGNUM_MASK GENMASK(15, 0)
51 * regmap.reg_shift indicates by how much we must shift registers prior to
52 * performing any operation. It's a signed value, positive numbers means
53 * downshifting the register's address, while negative numbers means upshifting.
55 #define REGMAP_UPSHIFT(s) (-(s))
56 #define REGMAP_DOWNSHIFT(s) (s)
59 * The supported cache types, the default is no cache. Any new caches should
60 * usually use the maple tree cache unless they specifically require that there
61 * are never any allocations at runtime in which case they should use the sparse
62 * flat cache. The rbtree cache *may* have some performance advantage for very
63 * low end systems that make heavy use of cache syncs but is mainly legacy.
64 * These caches are sparse and entries will be initialized from hardware if no
65 * default has been provided.
66 * The non-sparse flat cache is provided for compatibility with existing users
67 * and will zero-initialize cache entries for which no defaults are provided.
68 * New users should use the sparse flat cache.
79 * struct reg_default - Default value for a register.
81 * @reg: Register address.
82 * @def: Register default value.
84 * We use an array of structs rather than a simple array as many modern devices
85 * have very sparse register maps.
93 * struct reg_sequence - An individual write from a sequence of writes.
95 * @reg: Register address.
96 * @def: Register value.
97 * @delay_us: Delay to be applied after the register write in microseconds
99 * Register/value pairs for sequences of writes with an optional delay in
100 * microseconds to be applied after each write.
102 struct reg_sequence
{
105 unsigned int delay_us
;
108 #define REG_SEQ(_reg, _def, _delay_us) { \
111 .delay_us = _delay_us, \
113 #define REG_SEQ0(_reg, _def) REG_SEQ(_reg, _def, 0)
116 * regmap_read_poll_timeout - Poll until a condition is met or a timeout occurs
118 * @map: Regmap to read from
119 * @addr: Address to poll
120 * @val: Unsigned integer variable to read the value into
121 * @cond: Break condition (usually involving @val)
122 * @sleep_us: Maximum time to sleep between reads in us (0 tight-loops). Please
123 * read usleep_range() function description for details and
125 * @timeout_us: Timeout in us, 0 means never timeout
127 * This is modelled after the readx_poll_timeout macros in linux/iopoll.h.
129 * Returns: 0 on success and -ETIMEDOUT upon a timeout or the regmap_read
130 * error return value in case of a error read. In the two former cases,
131 * the last read value at @addr is stored in @val. Must not be called
132 * from atomic context if sleep_us or timeout_us are used.
134 #define regmap_read_poll_timeout(map, addr, val, cond, sleep_us, timeout_us) \
137 __tmp = read_poll_timeout(regmap_read, __ret, __ret || (cond), \
138 sleep_us, timeout_us, false, (map), (addr), &(val)); \
143 * regmap_read_poll_timeout_atomic - Poll until a condition is met or a timeout occurs
145 * @map: Regmap to read from
146 * @addr: Address to poll
147 * @val: Unsigned integer variable to read the value into
148 * @cond: Break condition (usually involving @val)
149 * @delay_us: Time to udelay between reads in us (0 tight-loops). Please
150 * read udelay() function description for details and
152 * @timeout_us: Timeout in us, 0 means never timeout
154 * This is modelled after the readx_poll_timeout_atomic macros in linux/iopoll.h.
156 * Note: In general regmap cannot be used in atomic context. If you want to use
157 * this macro then first setup your regmap for atomic use (flat or no cache
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 #define regmap_read_poll_timeout_atomic(map, addr, val, cond, delay_us, timeout_us) \
166 u64 __timeout_us = (timeout_us); \
167 unsigned long __delay_us = (delay_us); \
168 ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \
171 __ret = regmap_read((map), (addr), &(val)); \
176 if ((__timeout_us) && \
177 ktime_compare(ktime_get(), __timeout) > 0) { \
178 __ret = regmap_read((map), (addr), &(val)); \
182 udelay(__delay_us); \
184 __ret ?: ((cond) ? 0 : -ETIMEDOUT); \
188 * regmap_field_read_poll_timeout - Poll until a condition is met or timeout
190 * @field: Regmap field to read from
191 * @val: Unsigned integer variable to read the value into
192 * @cond: Break condition (usually involving @val)
193 * @sleep_us: Maximum time to sleep between reads in us (0 tight-loops). Please
194 * read usleep_range() function description for details and
196 * @timeout_us: Timeout in us, 0 means never timeout
198 * This is modelled after the readx_poll_timeout macros in linux/iopoll.h.
200 * Returns: 0 on success and -ETIMEDOUT upon a timeout or the regmap_field_read
201 * error return value in case of a error read. In the two former cases,
202 * the last read value at @addr is stored in @val. Must not be called
203 * from atomic context if sleep_us or timeout_us are used.
205 #define regmap_field_read_poll_timeout(field, val, cond, sleep_us, timeout_us) \
208 __tmp = read_poll_timeout(regmap_field_read, __ret, __ret || (cond), \
209 sleep_us, timeout_us, false, (field), &(val)); \
216 /* Unspecified -> 0 -> Backwards compatible default */
217 REGMAP_ENDIAN_DEFAULT
= 0,
219 REGMAP_ENDIAN_LITTLE
,
220 REGMAP_ENDIAN_NATIVE
,
224 * struct regmap_range - A register range, used for access related checks
225 * (readable/writeable/volatile/precious checks)
227 * @range_min: address of first register
228 * @range_max: address of last register
230 struct regmap_range
{
231 unsigned int range_min
;
232 unsigned int range_max
;
235 #define regmap_reg_range(low, high) { .range_min = low, .range_max = high, }
238 * struct regmap_access_table - A table of register ranges for access checks
240 * @yes_ranges : pointer to an array of regmap ranges used as "yes ranges"
241 * @n_yes_ranges: size of the above array
242 * @no_ranges: pointer to an array of regmap ranges used as "no ranges"
243 * @n_no_ranges: size of the above array
245 * A table of ranges including some yes ranges and some no ranges.
246 * If a register belongs to a no_range, the corresponding check function
247 * will return false. If a register belongs to a yes range, the corresponding
248 * check function will return true. "no_ranges" are searched first.
250 struct regmap_access_table
{
251 const struct regmap_range
*yes_ranges
;
252 unsigned int n_yes_ranges
;
253 const struct regmap_range
*no_ranges
;
254 unsigned int n_no_ranges
;
257 typedef void (*regmap_lock
)(void *);
258 typedef void (*regmap_unlock
)(void *);
261 * struct regmap_config - Configuration for the register map of a device.
263 * @name: Optional name of the regmap. Useful when a device has multiple
266 * @reg_bits: Number of bits in a register address, mandatory.
267 * @reg_stride: The register address stride. Valid register addresses are a
268 * multiple of this value. If set to 0, a value of 1 will be
270 * @reg_shift: The number of bits to shift the register before performing any
271 * operations. Any positive number will be downshifted, and negative
272 * values will be upshifted
273 * @reg_base: Value to be added to every register address before performing any
275 * @pad_bits: Number of bits of padding between register and value.
276 * @val_bits: Number of bits in a register value, mandatory.
278 * @writeable_reg: Optional callback returning true if the register
279 * can be written to. If this field is NULL but wr_table
280 * (see below) is not, the check is performed on such table
281 * (a register is writeable if it belongs to one of the ranges
282 * specified by wr_table).
283 * @readable_reg: Optional callback returning true if the register
284 * can be read from. If this field is NULL but rd_table
285 * (see below) is not, the check is performed on such table
286 * (a register is readable if it belongs to one of the ranges
287 * specified by rd_table).
288 * @volatile_reg: Optional callback returning true if the register
289 * value can't be cached. If this field is NULL but
290 * volatile_table (see below) is not, the check is performed on
291 * such table (a register is volatile if it belongs to one of
292 * the ranges specified by volatile_table).
293 * @precious_reg: Optional callback returning true if the register
294 * should not be read outside of a call from the driver
295 * (e.g., a clear on read interrupt status register). If this
296 * field is NULL but precious_table (see below) is not, the
297 * check is performed on such table (a register is precious if
298 * it belongs to one of the ranges specified by precious_table).
299 * @writeable_noinc_reg: Optional callback returning true if the register
300 * supports multiple write operations without incrementing
301 * the register number. If this field is NULL but
302 * wr_noinc_table (see below) is not, the check is
303 * performed on such table (a register is no increment
304 * writeable if it belongs to one of the ranges specified
305 * by wr_noinc_table).
306 * @readable_noinc_reg: Optional callback returning true if the register
307 * supports multiple read operations without incrementing
308 * the register number. If this field is NULL but
309 * rd_noinc_table (see below) is not, the check is
310 * performed on such table (a register is no increment
311 * readable if it belongs to one of the ranges specified
312 * by rd_noinc_table).
313 * @reg_read: Optional callback that if filled will be used to perform
314 * all the reads from the registers. Should only be provided for
315 * devices whose read operation cannot be represented as a simple
316 * read operation on a bus such as SPI, I2C, etc. Most of the
317 * devices do not need this.
318 * @reg_write: Same as above for writing.
319 * @reg_update_bits: Optional callback that if filled will be used to perform
320 * all the update_bits(rmw) operation. Should only be provided
321 * if the function require special handling with lock and reg
322 * handling and the operation cannot be represented as a simple
323 * update_bits operation on a bus such as SPI, I2C, etc.
324 * @read: Optional callback that if filled will be used to perform all the
325 * bulk reads from the registers. Data is returned in the buffer used
327 * @write: Same as above for writing.
328 * @max_raw_read: Max raw read size that can be used on the device.
329 * @max_raw_write: Max raw write size that can be used on the device.
330 * @can_sleep: Optional, specifies whether regmap operations can sleep.
331 * @fast_io: Register IO is fast. Use a spinlock instead of a mutex
332 * to perform locking. This field is ignored if custom lock/unlock
333 * functions are used (see fields lock/unlock of struct regmap_config).
334 * This field is a duplicate of a similar file in
335 * 'struct regmap_bus' and serves exact same purpose.
336 * Use it only for "no-bus" cases.
337 * @io_port: Support IO port accessors. Makes sense only when MMIO vs. IO port
338 * access can be distinguished.
339 * @disable_locking: This regmap is either protected by external means or
340 * is guaranteed not to be accessed from multiple threads.
341 * Don't use any locking mechanisms.
342 * @lock: Optional lock callback (overrides regmap's default lock
343 * function, based on spinlock or mutex).
344 * @unlock: As above for unlocking.
345 * @lock_arg: This field is passed as the only argument of lock/unlock
346 * functions (ignored in case regular lock/unlock functions
347 * are not overridden).
348 * @max_register: Optional, specifies the maximum valid register address.
349 * @max_register_is_0: Optional, specifies that zero value in @max_register
350 * should be taken into account. This is a workaround to
351 * apply handling of @max_register for regmap that contains
353 * @wr_table: Optional, points to a struct regmap_access_table specifying
354 * valid ranges for write access.
355 * @rd_table: As above, for read access.
356 * @volatile_table: As above, for volatile registers.
357 * @precious_table: As above, for precious registers.
358 * @wr_noinc_table: As above, for no increment writeable registers.
359 * @rd_noinc_table: As above, for no increment readable registers.
360 * @reg_defaults: Power on reset values for registers (for use with
361 * register cache support).
362 * @num_reg_defaults: Number of elements in reg_defaults.
363 * @reg_default_cb: Optional callback to return default values for registers
364 * not listed in reg_defaults. This is only used for
365 * REGCACHE_FLAT population; drivers must ensure the readable_reg/
366 * writeable_reg callbacks are defined to handle holes.
368 * @read_flag_mask: Mask to be set in the top bytes of the register when doing
370 * @write_flag_mask: Mask to be set in the top bytes of the register when doing
371 * a write. If both read_flag_mask and write_flag_mask are
372 * empty and zero_flag_mask is not set the regmap_bus default
374 * @zero_flag_mask: If set, read_flag_mask and write_flag_mask are used even
375 * if they are both empty.
376 * @use_relaxed_mmio: If set, MMIO R/W operations will not use memory barriers.
377 * This can avoid load on devices which don't require strict
378 * orderings, but drivers should carefully add any explicit
379 * memory barriers when they may require them.
380 * @use_single_read: If set, converts the bulk read operation into a series of
381 * single read operations. This is useful for a device that
382 * does not support bulk read.
383 * @use_single_write: If set, converts the bulk write operation into a series of
384 * single write operations. This is useful for a device that
385 * does not support bulk write.
386 * @can_multi_write: If set, the device supports the multi write mode of bulk
387 * write operations, if clear multi write requests will be
388 * split into individual write operations
390 * @cache_type: The actual cache type.
391 * @reg_defaults_raw: Power on reset values for registers (for use with
392 * register cache support).
393 * @num_reg_defaults_raw: Number of elements in reg_defaults_raw.
394 * @use_hwlock: Indicate if a hardware spinlock should be used.
395 * @use_raw_spinlock: Indicate if a raw spinlock should be used.
396 * @hwlock_id: Specify the hardware spinlock id.
397 * @hwlock_mode: The hardware spinlock mode, should be HWLOCK_IRQSTATE,
399 * @reg_format_endian: Endianness for formatted register addresses. If this is
400 * DEFAULT, the @reg_format_endian_default value from the
401 * regmap bus is used.
402 * @val_format_endian: Endianness for formatted register values. If this is
403 * DEFAULT, the @reg_format_endian_default value from the
404 * regmap bus is used.
406 * @ranges: Array of configuration entries for virtual address ranges.
407 * @num_ranges: Number of range configuration entries.
409 struct regmap_config
{
415 unsigned int reg_base
;
419 bool (*writeable_reg
)(struct device
*dev
, unsigned int reg
);
420 bool (*readable_reg
)(struct device
*dev
, unsigned int reg
);
421 bool (*volatile_reg
)(struct device
*dev
, unsigned int reg
);
422 bool (*precious_reg
)(struct device
*dev
, unsigned int reg
);
423 bool (*writeable_noinc_reg
)(struct device
*dev
, unsigned int reg
);
424 bool (*readable_noinc_reg
)(struct device
*dev
, unsigned int reg
);
426 int (*reg_read
)(void *context
, unsigned int reg
, unsigned int *val
);
427 int (*reg_write
)(void *context
, unsigned int reg
, unsigned int val
);
428 int (*reg_update_bits
)(void *context
, unsigned int reg
,
429 unsigned int mask
, unsigned int val
);
430 /* Bulk read/write */
431 int (*read
)(void *context
, const void *reg_buf
, size_t reg_size
,
432 void *val_buf
, size_t val_size
);
433 int (*write
)(void *context
, const void *data
, size_t count
);
435 size_t max_raw_write
;
442 bool disable_locking
;
444 regmap_unlock unlock
;
447 unsigned int max_register
;
448 bool max_register_is_0
;
449 const struct regmap_access_table
*wr_table
;
450 const struct regmap_access_table
*rd_table
;
451 const struct regmap_access_table
*volatile_table
;
452 const struct regmap_access_table
*precious_table
;
453 const struct regmap_access_table
*wr_noinc_table
;
454 const struct regmap_access_table
*rd_noinc_table
;
455 const struct reg_default
*reg_defaults
;
456 unsigned int num_reg_defaults
;
457 int (*reg_default_cb
)(struct device
*dev
, unsigned int reg
,
459 enum regcache_type cache_type
;
460 const void *reg_defaults_raw
;
461 unsigned int num_reg_defaults_raw
;
463 unsigned long read_flag_mask
;
464 unsigned long write_flag_mask
;
467 bool use_single_read
;
468 bool use_single_write
;
469 bool use_relaxed_mmio
;
470 bool can_multi_write
;
473 bool use_raw_spinlock
;
474 unsigned int hwlock_id
;
475 unsigned int hwlock_mode
;
477 enum regmap_endian reg_format_endian
;
478 enum regmap_endian val_format_endian
;
480 const struct regmap_range_cfg
*ranges
;
481 unsigned int num_ranges
;
485 * struct regmap_range_cfg - Configuration for indirectly accessed or paged
488 * @name: Descriptive name for diagnostics
490 * @range_min: Address of the lowest register address in virtual range.
491 * @range_max: Address of the highest register in virtual range.
493 * @selector_reg: Register with selector field.
494 * @selector_mask: Bit mask for selector value.
495 * @selector_shift: Bit shift for selector value.
497 * @window_start: Address of first (lowest) register in data window.
498 * @window_len: Number of registers in data window.
500 * Registers, mapped to this virtual range, are accessed in two steps:
501 * 1. page selector register update;
502 * 2. access through data window registers.
504 struct regmap_range_cfg
{
507 /* Registers of virtual address range */
508 unsigned int range_min
;
509 unsigned int range_max
;
511 /* Page selector for indirect addressing */
512 unsigned int selector_reg
;
513 unsigned int selector_mask
;
516 /* Data window (per each page) */
517 unsigned int window_start
;
518 unsigned int window_len
;
522 * struct regmap_sdw_mbq_cfg - Configuration for Multi-Byte Quantities
524 * @mbq_size: Callback returning the actual size of the given register.
525 * @deferrable: Callback returning true if the hardware can defer
526 * transactions to the given register. Deferral should
527 * only be used by SDCA parts and typically which controls
528 * are deferrable will be specified in either as a hard
529 * coded list or from the DisCo tables in the platform
532 * @timeout_us: The time in microseconds after which waiting for a deferred
533 * transaction should time out.
534 * @retry_us: The time in microseconds between polls of the function busy
535 * status whilst waiting for an opportunity to retry a deferred
538 * Provides additional configuration required for SoundWire MBQ register maps.
540 struct regmap_sdw_mbq_cfg
{
541 int (*mbq_size
)(struct device
*dev
, unsigned int reg
);
542 bool (*deferrable
)(struct device
*dev
, unsigned int reg
);
543 unsigned long timeout_us
;
544 unsigned long retry_us
;
549 typedef int (*regmap_hw_write
)(void *context
, const void *data
,
551 typedef int (*regmap_hw_gather_write
)(void *context
,
552 const void *reg
, size_t reg_len
,
553 const void *val
, size_t val_len
);
554 typedef int (*regmap_hw_async_write
)(void *context
,
555 const void *reg
, size_t reg_len
,
556 const void *val
, size_t val_len
,
557 struct regmap_async
*async
);
558 typedef int (*regmap_hw_read
)(void *context
,
559 const void *reg_buf
, size_t reg_size
,
560 void *val_buf
, size_t val_size
);
561 typedef int (*regmap_hw_reg_read
)(void *context
, unsigned int reg
,
563 typedef int (*regmap_hw_reg_noinc_read
)(void *context
, unsigned int reg
,
564 void *val
, size_t val_count
);
565 typedef int (*regmap_hw_reg_write
)(void *context
, unsigned int reg
,
567 typedef int (*regmap_hw_reg_noinc_write
)(void *context
, unsigned int reg
,
568 const void *val
, size_t val_count
);
569 typedef int (*regmap_hw_reg_update_bits
)(void *context
, unsigned int reg
,
570 unsigned int mask
, unsigned int val
);
571 typedef struct regmap_async
*(*regmap_hw_async_alloc
)(void);
572 typedef void (*regmap_hw_free_context
)(void *context
);
575 * struct regmap_bus - Description of a hardware bus for the register map
578 * @fast_io: Register IO is fast. Use a spinlock instead of a mutex
579 * to perform locking. This field is ignored if custom lock/unlock
580 * functions are used (see fields lock/unlock of
581 * struct regmap_config).
582 * @free_on_exit: kfree this on exit of regmap
583 * @write: Write operation.
584 * @gather_write: Write operation with split register/value, return -ENOTSUPP
585 * if not implemented on a given device.
586 * @async_write: Write operation which completes asynchronously, optional and
587 * must serialise with respect to non-async I/O.
588 * @reg_write: Write a single register value to the given register address. This
589 * write operation has to complete when returning from the function.
590 * @reg_write_noinc: Write multiple register value to the same register. This
591 * write operation has to complete when returning from the function.
592 * @reg_update_bits: Update bits operation to be used against volatile
593 * registers, intended for devices supporting some mechanism
594 * for setting clearing bits without having to
596 * @read: Read operation. Data is returned in the buffer used to transmit
598 * @reg_read: Read a single register value from a given register address.
599 * @free_context: Free context.
600 * @async_alloc: Allocate a regmap_async() structure.
601 * @read_flag_mask: Mask to be set in the top byte of the register when doing
603 * @reg_format_endian_default: Default endianness for formatted register
604 * addresses. Used when the regmap_config specifies DEFAULT. If this is
605 * DEFAULT, BIG is assumed.
606 * @val_format_endian_default: Default endianness for formatted register
607 * values. Used when the regmap_config specifies DEFAULT. If this is
608 * DEFAULT, BIG is assumed.
609 * @max_raw_read: Max raw read size that can be used on the bus.
610 * @max_raw_write: Max raw write size that can be used on the bus.
615 regmap_hw_write write
;
616 regmap_hw_gather_write gather_write
;
617 regmap_hw_async_write async_write
;
618 regmap_hw_reg_write reg_write
;
619 regmap_hw_reg_noinc_write reg_noinc_write
;
620 regmap_hw_reg_update_bits reg_update_bits
;
622 regmap_hw_reg_read reg_read
;
623 regmap_hw_reg_noinc_read reg_noinc_read
;
624 regmap_hw_free_context free_context
;
625 regmap_hw_async_alloc async_alloc
;
627 enum regmap_endian reg_format_endian_default
;
628 enum regmap_endian val_format_endian_default
;
630 size_t max_raw_write
;
634 * __regmap_init functions.
636 * These functions take a lock key and name parameter, and should not be called
637 * directly. Instead, use the regmap_init macros that generate a key and name
640 struct regmap
*__regmap_init(struct device
*dev
,
641 const struct regmap_bus
*bus
,
643 const struct regmap_config
*config
,
644 struct lock_class_key
*lock_key
,
645 const char *lock_name
);
646 struct regmap
*__regmap_init_i2c(struct i2c_client
*i2c
,
647 const struct regmap_config
*config
,
648 struct lock_class_key
*lock_key
,
649 const char *lock_name
);
650 struct regmap
*__regmap_init_mdio(struct mdio_device
*mdio_dev
,
651 const struct regmap_config
*config
,
652 struct lock_class_key
*lock_key
,
653 const char *lock_name
);
654 struct regmap
*__regmap_init_sccb(struct i2c_client
*i2c
,
655 const struct regmap_config
*config
,
656 struct lock_class_key
*lock_key
,
657 const char *lock_name
);
658 struct regmap
*__regmap_init_slimbus(struct slim_device
*slimbus
,
659 const struct regmap_config
*config
,
660 struct lock_class_key
*lock_key
,
661 const char *lock_name
);
662 struct regmap
*__regmap_init_spi(struct spi_device
*dev
,
663 const struct regmap_config
*config
,
664 struct lock_class_key
*lock_key
,
665 const char *lock_name
);
666 struct regmap
*__regmap_init_spmi_base(struct spmi_device
*dev
,
667 const struct regmap_config
*config
,
668 struct lock_class_key
*lock_key
,
669 const char *lock_name
);
670 struct regmap
*__regmap_init_spmi_ext(struct spmi_device
*dev
,
671 const struct regmap_config
*config
,
672 struct lock_class_key
*lock_key
,
673 const char *lock_name
);
674 struct regmap
*__regmap_init_w1(struct device
*w1_dev
,
675 const struct regmap_config
*config
,
676 struct lock_class_key
*lock_key
,
677 const char *lock_name
);
678 struct regmap
*__regmap_init_mmio_clk(struct device
*dev
, const char *clk_id
,
680 const struct regmap_config
*config
,
681 struct lock_class_key
*lock_key
,
682 const char *lock_name
);
683 struct regmap
*__regmap_init_ac97(struct snd_ac97
*ac97
,
684 const struct regmap_config
*config
,
685 struct lock_class_key
*lock_key
,
686 const char *lock_name
);
687 struct regmap
*__regmap_init_sdw(struct sdw_slave
*sdw
,
688 const struct regmap_config
*config
,
689 struct lock_class_key
*lock_key
,
690 const char *lock_name
);
691 struct regmap
*__regmap_init_sdw_mbq(struct device
*dev
, struct sdw_slave
*sdw
,
692 const struct regmap_config
*config
,
693 const struct regmap_sdw_mbq_cfg
*mbq_config
,
694 struct lock_class_key
*lock_key
,
695 const char *lock_name
);
696 struct regmap
*__regmap_init_i3c(struct i3c_device
*i3c
,
697 const struct regmap_config
*config
,
698 struct lock_class_key
*lock_key
,
699 const char *lock_name
);
700 struct regmap
*__regmap_init_spi_avmm(struct spi_device
*spi
,
701 const struct regmap_config
*config
,
702 struct lock_class_key
*lock_key
,
703 const char *lock_name
);
704 struct regmap
*__regmap_init_fsi(struct fsi_device
*fsi_dev
,
705 const struct regmap_config
*config
,
706 struct lock_class_key
*lock_key
,
707 const char *lock_name
);
709 struct regmap
*__devm_regmap_init(struct device
*dev
,
710 const struct regmap_bus
*bus
,
712 const struct regmap_config
*config
,
713 struct lock_class_key
*lock_key
,
714 const char *lock_name
);
715 struct regmap
*__devm_regmap_init_i2c(struct i2c_client
*i2c
,
716 const struct regmap_config
*config
,
717 struct lock_class_key
*lock_key
,
718 const char *lock_name
);
719 struct regmap
*__devm_regmap_init_mdio(struct mdio_device
*mdio_dev
,
720 const struct regmap_config
*config
,
721 struct lock_class_key
*lock_key
,
722 const char *lock_name
);
723 struct regmap
*__devm_regmap_init_sccb(struct i2c_client
*i2c
,
724 const struct regmap_config
*config
,
725 struct lock_class_key
*lock_key
,
726 const char *lock_name
);
727 struct regmap
*__devm_regmap_init_spi(struct spi_device
*dev
,
728 const struct regmap_config
*config
,
729 struct lock_class_key
*lock_key
,
730 const char *lock_name
);
731 struct regmap
*__devm_regmap_init_spmi_base(struct spmi_device
*dev
,
732 const struct regmap_config
*config
,
733 struct lock_class_key
*lock_key
,
734 const char *lock_name
);
735 struct regmap
*__devm_regmap_init_spmi_ext(struct spmi_device
*dev
,
736 const struct regmap_config
*config
,
737 struct lock_class_key
*lock_key
,
738 const char *lock_name
);
739 struct regmap
*__devm_regmap_init_w1(struct device
*w1_dev
,
740 const struct regmap_config
*config
,
741 struct lock_class_key
*lock_key
,
742 const char *lock_name
);
743 struct regmap
*__devm_regmap_init_mmio_clk(struct device
*dev
,
746 const struct regmap_config
*config
,
747 struct lock_class_key
*lock_key
,
748 const char *lock_name
);
749 struct regmap
*__devm_regmap_init_ac97(struct snd_ac97
*ac97
,
750 const struct regmap_config
*config
,
751 struct lock_class_key
*lock_key
,
752 const char *lock_name
);
753 struct regmap
*__devm_regmap_init_sdw(struct sdw_slave
*sdw
,
754 const struct regmap_config
*config
,
755 struct lock_class_key
*lock_key
,
756 const char *lock_name
);
757 struct regmap
*__devm_regmap_init_sdw_mbq(struct device
*dev
, struct sdw_slave
*sdw
,
758 const struct regmap_config
*config
,
759 const struct regmap_sdw_mbq_cfg
*mbq_config
,
760 struct lock_class_key
*lock_key
,
761 const char *lock_name
);
762 struct regmap
*__devm_regmap_init_slimbus(struct slim_device
*slimbus
,
763 const struct regmap_config
*config
,
764 struct lock_class_key
*lock_key
,
765 const char *lock_name
);
766 struct regmap
*__devm_regmap_init_i3c(struct i3c_device
*i3c
,
767 const struct regmap_config
*config
,
768 struct lock_class_key
*lock_key
,
769 const char *lock_name
);
770 struct regmap
*__devm_regmap_init_spi_avmm(struct spi_device
*spi
,
771 const struct regmap_config
*config
,
772 struct lock_class_key
*lock_key
,
773 const char *lock_name
);
774 struct regmap
*__devm_regmap_init_fsi(struct fsi_device
*fsi_dev
,
775 const struct regmap_config
*config
,
776 struct lock_class_key
*lock_key
,
777 const char *lock_name
);
780 * Wrapper for regmap_init macros to include a unique lockdep key and name
781 * for each call. No-op if CONFIG_LOCKDEP is not set.
783 * @fn: Real function to call (in the form __[*_]regmap_init[_*])
784 * @name: Config variable name (#config in the calling macro)
786 #ifdef CONFIG_LOCKDEP
787 #define __regmap_lockdep_wrapper(fn, name, ...) \
790 static struct lock_class_key _key; \
791 fn(__VA_ARGS__, &_key, \
792 KBUILD_BASENAME ":" \
793 __stringify(__LINE__) ":" \
794 "(" name ")->lock"); \
798 #define __regmap_lockdep_wrapper(fn, name, ...) fn(__VA_ARGS__, NULL, NULL)
802 * regmap_init() - Initialise register map
804 * @dev: Device that will be interacted with
805 * @bus: Bus-specific callbacks to use with device
806 * @bus_context: Data passed to bus-specific callbacks
807 * @config: Configuration for register map
809 * The return value will be an ERR_PTR() on error or a valid pointer to
810 * a struct regmap. This function should generally not be called
811 * directly, it should be called by bus-specific init functions.
813 #define regmap_init(dev, bus, bus_context, config) \
814 __regmap_lockdep_wrapper(__regmap_init, #config, \
815 dev, bus, bus_context, config)
816 int regmap_attach_dev(struct device
*dev
, struct regmap
*map
,
817 const struct regmap_config
*config
);
820 * regmap_init_i2c() - Initialise register map
822 * @i2c: Device that will be interacted with
823 * @config: Configuration for register map
825 * The return value will be an ERR_PTR() on error or a valid pointer to
828 #define regmap_init_i2c(i2c, config) \
829 __regmap_lockdep_wrapper(__regmap_init_i2c, #config, \
833 * regmap_init_mdio() - Initialise register map
835 * @mdio_dev: Device that will be interacted with
836 * @config: Configuration for register map
838 * The return value will be an ERR_PTR() on error or a valid pointer to
841 #define regmap_init_mdio(mdio_dev, config) \
842 __regmap_lockdep_wrapper(__regmap_init_mdio, #config, \
846 * regmap_init_sccb() - Initialise register map
848 * @i2c: Device that will be interacted with
849 * @config: Configuration for register map
851 * The return value will be an ERR_PTR() on error or a valid pointer to
854 #define regmap_init_sccb(i2c, config) \
855 __regmap_lockdep_wrapper(__regmap_init_sccb, #config, \
859 * regmap_init_slimbus() - Initialise register map
861 * @slimbus: Device that will be interacted with
862 * @config: Configuration for register map
864 * The return value will be an ERR_PTR() on error or a valid pointer to
867 #define regmap_init_slimbus(slimbus, config) \
868 __regmap_lockdep_wrapper(__regmap_init_slimbus, #config, \
872 * regmap_init_spi() - Initialise register map
874 * @dev: Device that will be interacted with
875 * @config: Configuration for register map
877 * The return value will be an ERR_PTR() on error or a valid pointer to
880 #define regmap_init_spi(dev, config) \
881 __regmap_lockdep_wrapper(__regmap_init_spi, #config, \
885 * regmap_init_spmi_base() - Create regmap for the Base register space
887 * @dev: SPMI 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 to
893 #define regmap_init_spmi_base(dev, config) \
894 __regmap_lockdep_wrapper(__regmap_init_spmi_base, #config, \
898 * regmap_init_spmi_ext() - Create regmap for Ext register space
900 * @dev: Device that will be interacted with
901 * @config: Configuration for register map
903 * The return value will be an ERR_PTR() on error or a valid pointer to
906 #define regmap_init_spmi_ext(dev, config) \
907 __regmap_lockdep_wrapper(__regmap_init_spmi_ext, #config, \
911 * regmap_init_w1() - Initialise register map
913 * @w1_dev: Device that will be interacted with
914 * @config: Configuration for register map
916 * The return value will be an ERR_PTR() on error or a valid pointer to
919 #define regmap_init_w1(w1_dev, config) \
920 __regmap_lockdep_wrapper(__regmap_init_w1, #config, \
924 * regmap_init_mmio_clk() - Initialise register map with register clock
926 * @dev: Device that will be interacted with
927 * @clk_id: register clock consumer ID
928 * @regs: Pointer to memory-mapped IO region
929 * @config: Configuration for register map
931 * The return value will be an ERR_PTR() on error or a valid pointer to
932 * a struct regmap. Implies 'fast_io'.
934 #define regmap_init_mmio_clk(dev, clk_id, regs, config) \
935 __regmap_lockdep_wrapper(__regmap_init_mmio_clk, #config, \
936 dev, clk_id, regs, config)
939 * regmap_init_mmio() - Initialise register map
941 * @dev: Device that will be interacted with
942 * @regs: Pointer to memory-mapped IO region
943 * @config: Configuration for register map
945 * The return value will be an ERR_PTR() on error or a valid pointer to
946 * a struct regmap. Implies 'fast_io'.
948 #define regmap_init_mmio(dev, regs, config) \
949 regmap_init_mmio_clk(dev, NULL, regs, config)
952 * regmap_init_ac97() - Initialise AC'97 register map
954 * @ac97: Device that will be interacted with
955 * @config: Configuration for register map
957 * The return value will be an ERR_PTR() on error or a valid pointer to
960 #define regmap_init_ac97(ac97, config) \
961 __regmap_lockdep_wrapper(__regmap_init_ac97, #config, \
963 bool regmap_ac97_default_volatile(struct device
*dev
, unsigned int reg
);
966 * regmap_init_sdw() - Initialise register map
968 * @sdw: Device that will be interacted with
969 * @config: Configuration for register map
971 * The return value will be an ERR_PTR() on error or a valid pointer to
974 #define regmap_init_sdw(sdw, config) \
975 __regmap_lockdep_wrapper(__regmap_init_sdw, #config, \
979 * regmap_init_sdw_mbq() - Initialise register map
981 * @sdw: Device that will be interacted with
982 * @config: Configuration for register map
984 * The return value will be an ERR_PTR() on error or a valid pointer to
987 #define regmap_init_sdw_mbq(sdw, config) \
988 __regmap_lockdep_wrapper(__regmap_init_sdw_mbq, #config, \
989 &sdw->dev, sdw, config, NULL)
992 * regmap_init_sdw_mbq_cfg() - Initialise MBQ SDW register map with config
994 * @sdw: Device that will be interacted with
995 * @config: Configuration for register map
996 * @mbq_config: Properties for the MBQ registers
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 regmap_init_sdw_mbq_cfg(dev, sdw, config, mbq_config) \
1003 __regmap_lockdep_wrapper(__regmap_init_sdw_mbq, #config, \
1004 dev, sdw, config, mbq_config)
1007 * regmap_init_i3c() - Initialise register map
1009 * @i3c: 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 to
1015 #define regmap_init_i3c(i3c, config) \
1016 __regmap_lockdep_wrapper(__regmap_init_i3c, #config, \
1020 * regmap_init_spi_avmm() - Initialize register map for Intel SPI Slave
1021 * to AVMM Bus Bridge
1023 * @spi: 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.
1029 #define regmap_init_spi_avmm(spi, config) \
1030 __regmap_lockdep_wrapper(__regmap_init_spi_avmm, #config, \
1034 * regmap_init_fsi() - Initialise register map
1036 * @fsi_dev: Device that will be interacted with
1037 * @config: Configuration for register map
1039 * The return value will be an ERR_PTR() on error or a valid pointer to
1042 #define regmap_init_fsi(fsi_dev, config) \
1043 __regmap_lockdep_wrapper(__regmap_init_fsi, #config, fsi_dev, \
1047 * devm_regmap_init() - Initialise managed register map
1049 * @dev: Device that will be interacted with
1050 * @bus: Bus-specific callbacks to use with device
1051 * @bus_context: Data passed to bus-specific callbacks
1052 * @config: Configuration for register map
1054 * The return value will be an ERR_PTR() on error or a valid pointer
1055 * to a struct regmap. This function should generally not be called
1056 * directly, it should be called by bus-specific init functions. The
1057 * map will be automatically freed by the device management code.
1059 #define devm_regmap_init(dev, bus, bus_context, config) \
1060 __regmap_lockdep_wrapper(__devm_regmap_init, #config, \
1061 dev, bus, bus_context, config)
1064 * devm_regmap_init_i2c() - Initialise managed register map
1066 * @i2c: Device that will be interacted with
1067 * @config: Configuration for register map
1069 * The return value will be an ERR_PTR() on error or a valid pointer
1070 * to a struct regmap. The regmap will be automatically freed by the
1071 * device management code.
1073 #define devm_regmap_init_i2c(i2c, config) \
1074 __regmap_lockdep_wrapper(__devm_regmap_init_i2c, #config, \
1078 * devm_regmap_init_mdio() - Initialise managed register map
1080 * @mdio_dev: Device that will be interacted with
1081 * @config: Configuration for register map
1083 * The return value will be an ERR_PTR() on error or a valid pointer
1084 * to a struct regmap. The regmap will be automatically freed by the
1085 * device management code.
1087 #define devm_regmap_init_mdio(mdio_dev, config) \
1088 __regmap_lockdep_wrapper(__devm_regmap_init_mdio, #config, \
1092 * devm_regmap_init_sccb() - Initialise managed register map
1094 * @i2c: Device that will be interacted with
1095 * @config: Configuration for register map
1097 * The return value will be an ERR_PTR() on error or a valid pointer
1098 * to a struct regmap. The regmap will be automatically freed by the
1099 * device management code.
1101 #define devm_regmap_init_sccb(i2c, config) \
1102 __regmap_lockdep_wrapper(__devm_regmap_init_sccb, #config, \
1106 * devm_regmap_init_spi() - Initialise register map
1108 * @dev: Device that will be interacted with
1109 * @config: Configuration for register map
1111 * The return value will be an ERR_PTR() on error or a valid pointer
1112 * to a struct regmap. The map will be automatically freed by the
1113 * device management code.
1115 #define devm_regmap_init_spi(dev, config) \
1116 __regmap_lockdep_wrapper(__devm_regmap_init_spi, #config, \
1120 * devm_regmap_init_spmi_base() - Create managed regmap for Base register space
1122 * @dev: SPMI device that will be interacted with
1123 * @config: Configuration for register map
1125 * The return value will be an ERR_PTR() on error or a valid pointer
1126 * to a struct regmap. The regmap will be automatically freed by the
1127 * device management code.
1129 #define devm_regmap_init_spmi_base(dev, config) \
1130 __regmap_lockdep_wrapper(__devm_regmap_init_spmi_base, #config, \
1134 * devm_regmap_init_spmi_ext() - Create managed regmap for Ext register space
1136 * @dev: SPMI device that will be interacted with
1137 * @config: Configuration for register map
1139 * The return value will be an ERR_PTR() on error or a valid pointer
1140 * to a struct regmap. The regmap will be automatically freed by the
1141 * device management code.
1143 #define devm_regmap_init_spmi_ext(dev, config) \
1144 __regmap_lockdep_wrapper(__devm_regmap_init_spmi_ext, #config, \
1148 * devm_regmap_init_w1() - Initialise managed register map
1150 * @w1_dev: Device that will be interacted with
1151 * @config: Configuration for register map
1153 * The return value will be an ERR_PTR() on error or a valid pointer
1154 * to a struct regmap. The regmap will be automatically freed by the
1155 * device management code.
1157 #define devm_regmap_init_w1(w1_dev, config) \
1158 __regmap_lockdep_wrapper(__devm_regmap_init_w1, #config, \
1161 * devm_regmap_init_mmio_clk() - Initialise managed register map with clock
1163 * @dev: Device that will be interacted with
1164 * @clk_id: register clock consumer ID
1165 * @regs: Pointer to memory-mapped IO region
1166 * @config: Configuration for register map
1168 * The return value will be an ERR_PTR() on error or a valid pointer
1169 * to a struct regmap. The regmap will be automatically freed by the
1170 * device management code. Implies 'fast_io'.
1172 #define devm_regmap_init_mmio_clk(dev, clk_id, regs, config) \
1173 __regmap_lockdep_wrapper(__devm_regmap_init_mmio_clk, #config, \
1174 dev, clk_id, regs, config)
1177 * devm_regmap_init_mmio() - Initialise managed register map
1179 * @dev: Device that will be interacted with
1180 * @regs: Pointer to memory-mapped IO region
1181 * @config: Configuration for register map
1183 * The return value will be an ERR_PTR() on error or a valid pointer
1184 * to a struct regmap. The regmap will be automatically freed by the
1185 * device management code. Implies 'fast_io'.
1187 #define devm_regmap_init_mmio(dev, regs, config) \
1188 devm_regmap_init_mmio_clk(dev, NULL, regs, config)
1191 * devm_regmap_init_ac97() - Initialise AC'97 register map
1193 * @ac97: Device that will be interacted with
1194 * @config: Configuration for register map
1196 * The return value will be an ERR_PTR() on error or a valid pointer
1197 * to a struct regmap. The regmap will be automatically freed by the
1198 * device management code.
1200 #define devm_regmap_init_ac97(ac97, config) \
1201 __regmap_lockdep_wrapper(__devm_regmap_init_ac97, #config, \
1205 * devm_regmap_init_sdw() - Initialise managed register map
1207 * @sdw: Device that will be interacted with
1208 * @config: Configuration for register map
1210 * The return value will be an ERR_PTR() on error or a valid pointer
1211 * to a struct regmap. The regmap will be automatically freed by the
1212 * device management code.
1214 #define devm_regmap_init_sdw(sdw, config) \
1215 __regmap_lockdep_wrapper(__devm_regmap_init_sdw, #config, \
1219 * devm_regmap_init_sdw_mbq() - Initialise managed register map
1221 * @sdw: Device that will be interacted with
1222 * @config: Configuration for register map
1224 * The return value will be an ERR_PTR() on error or a valid pointer
1225 * to a struct regmap. The regmap will be automatically freed by the
1226 * device management code.
1228 #define devm_regmap_init_sdw_mbq(sdw, config) \
1229 __regmap_lockdep_wrapper(__devm_regmap_init_sdw_mbq, #config, \
1230 &sdw->dev, sdw, config, NULL)
1233 * devm_regmap_init_sdw_mbq_cfg() - Initialise managed MBQ SDW register map with config
1235 * @dev: Device that will be interacted with
1236 * @sdw: SoundWire Device that will be interacted with
1237 * @config: Configuration for register map
1238 * @mbq_config: Properties for the MBQ registers
1240 * The return value will be an ERR_PTR() on error or a valid pointer
1241 * to a struct regmap. The regmap will be automatically freed by the
1242 * device management code.
1244 #define devm_regmap_init_sdw_mbq_cfg(dev, sdw, config, mbq_config) \
1245 __regmap_lockdep_wrapper(__devm_regmap_init_sdw_mbq, \
1246 #config, dev, sdw, config, mbq_config)
1249 * devm_regmap_init_slimbus() - Initialise managed register map
1251 * @slimbus: Device that will be interacted with
1252 * @config: Configuration for register map
1254 * The return value will be an ERR_PTR() on error or a valid pointer
1255 * to a struct regmap. The regmap will be automatically freed by the
1256 * device management code.
1258 #define devm_regmap_init_slimbus(slimbus, config) \
1259 __regmap_lockdep_wrapper(__devm_regmap_init_slimbus, #config, \
1263 * devm_regmap_init_i3c() - Initialise managed register map
1265 * @i3c: Device that will be interacted with
1266 * @config: Configuration for register map
1268 * The return value will be an ERR_PTR() on error or a valid pointer
1269 * to a struct regmap. The regmap will be automatically freed by the
1270 * device management code.
1272 #define devm_regmap_init_i3c(i3c, config) \
1273 __regmap_lockdep_wrapper(__devm_regmap_init_i3c, #config, \
1277 * devm_regmap_init_spi_avmm() - Initialize register map for Intel SPI Slave
1278 * to AVMM Bus Bridge
1280 * @spi: Device that will be interacted with
1281 * @config: Configuration for register map
1283 * The return value will be an ERR_PTR() on error or a valid pointer
1284 * to a struct regmap. The map will be automatically freed by the
1285 * device management code.
1287 #define devm_regmap_init_spi_avmm(spi, config) \
1288 __regmap_lockdep_wrapper(__devm_regmap_init_spi_avmm, #config, \
1292 * devm_regmap_init_fsi() - Initialise managed register map
1294 * @fsi_dev: Device that will be interacted with
1295 * @config: Configuration for register map
1297 * The return value will be an ERR_PTR() on error or a valid pointer
1298 * to a struct regmap. The regmap will be automatically freed by the
1299 * device management code.
1301 #define devm_regmap_init_fsi(fsi_dev, config) \
1302 __regmap_lockdep_wrapper(__devm_regmap_init_fsi, #config, \
1305 int regmap_mmio_attach_clk(struct regmap
*map
, struct clk
*clk
);
1306 void regmap_mmio_detach_clk(struct regmap
*map
);
1307 void regmap_exit(struct regmap
*map
);
1308 int regmap_reinit_cache(struct regmap
*map
,
1309 const struct regmap_config
*config
);
1310 struct regmap
*dev_get_regmap(struct device
*dev
, const char *name
);
1311 struct device
*regmap_get_device(struct regmap
*map
);
1312 int regmap_write(struct regmap
*map
, unsigned int reg
, unsigned int val
);
1313 int regmap_write_async(struct regmap
*map
, unsigned int reg
, unsigned int val
);
1314 int regmap_raw_write(struct regmap
*map
, unsigned int reg
,
1315 const void *val
, size_t val_len
);
1316 int regmap_noinc_write(struct regmap
*map
, unsigned int reg
,
1317 const void *val
, size_t val_len
);
1318 int regmap_bulk_write(struct regmap
*map
, unsigned int reg
, const void *val
,
1320 int regmap_multi_reg_write(struct regmap
*map
, const struct reg_sequence
*regs
,
1322 int regmap_multi_reg_write_bypassed(struct regmap
*map
,
1323 const struct reg_sequence
*regs
,
1325 int regmap_raw_write_async(struct regmap
*map
, unsigned int reg
,
1326 const void *val
, size_t val_len
);
1327 int regmap_read(struct regmap
*map
, unsigned int reg
, unsigned int *val
);
1328 int regmap_read_bypassed(struct regmap
*map
, unsigned int reg
, unsigned int *val
);
1329 int regmap_raw_read(struct regmap
*map
, unsigned int reg
,
1330 void *val
, size_t val_len
);
1331 int regmap_noinc_read(struct regmap
*map
, unsigned int reg
,
1332 void *val
, size_t val_len
);
1333 int regmap_bulk_read(struct regmap
*map
, unsigned int reg
, void *val
,
1335 int regmap_multi_reg_read(struct regmap
*map
, const unsigned int *reg
, void *val
,
1337 int regmap_update_bits_base(struct regmap
*map
, unsigned int reg
,
1338 unsigned int mask
, unsigned int val
,
1339 bool *change
, bool async
, bool force
);
1341 static inline int regmap_update_bits(struct regmap
*map
, unsigned int reg
,
1342 unsigned int mask
, unsigned int val
)
1344 return regmap_update_bits_base(map
, reg
, mask
, val
, NULL
, false, false);
1347 static inline int regmap_update_bits_async(struct regmap
*map
, unsigned int reg
,
1348 unsigned int mask
, unsigned int val
)
1350 return regmap_update_bits_base(map
, reg
, mask
, val
, NULL
, true, false);
1353 static inline int regmap_update_bits_check(struct regmap
*map
, unsigned int reg
,
1354 unsigned int mask
, unsigned int val
,
1357 return regmap_update_bits_base(map
, reg
, mask
, val
,
1358 change
, false, false);
1362 regmap_update_bits_check_async(struct regmap
*map
, unsigned int reg
,
1363 unsigned int mask
, unsigned int val
,
1366 return regmap_update_bits_base(map
, reg
, mask
, val
,
1367 change
, true, false);
1370 static inline int regmap_write_bits(struct regmap
*map
, unsigned int reg
,
1371 unsigned int mask
, unsigned int val
)
1373 return regmap_update_bits_base(map
, reg
, mask
, val
, NULL
, false, true);
1376 static inline int regmap_default_zero_cb(struct device
*dev
,
1384 int regmap_get_val_bytes(struct regmap
*map
);
1385 int regmap_get_max_register(struct regmap
*map
);
1386 int regmap_get_reg_stride(struct regmap
*map
);
1387 bool regmap_might_sleep(struct regmap
*map
);
1388 int regmap_async_complete(struct regmap
*map
);
1389 bool regmap_can_raw_write(struct regmap
*map
);
1390 size_t regmap_get_raw_read_max(struct regmap
*map
);
1391 size_t regmap_get_raw_write_max(struct regmap
*map
);
1393 void regcache_sort_defaults(struct reg_default
*defaults
, unsigned int ndefaults
);
1394 int regcache_sync(struct regmap
*map
);
1395 int regcache_sync_region(struct regmap
*map
, unsigned int min
,
1397 int regcache_drop_region(struct regmap
*map
, unsigned int min
,
1399 void regcache_cache_only(struct regmap
*map
, bool enable
);
1400 void regcache_cache_bypass(struct regmap
*map
, bool enable
);
1401 void regcache_mark_dirty(struct regmap
*map
);
1402 bool regcache_reg_cached(struct regmap
*map
, unsigned int reg
);
1404 bool regmap_check_range_table(struct regmap
*map
, unsigned int reg
,
1405 const struct regmap_access_table
*table
);
1407 int regmap_register_patch(struct regmap
*map
, const struct reg_sequence
*regs
,
1409 int regmap_parse_val(struct regmap
*map
, const void *buf
,
1412 static inline bool regmap_reg_in_range(unsigned int reg
,
1413 const struct regmap_range
*range
)
1415 return reg
>= range
->range_min
&& reg
<= range
->range_max
;
1418 bool regmap_reg_in_ranges(unsigned int reg
,
1419 const struct regmap_range
*ranges
,
1420 unsigned int nranges
);
1422 static inline int regmap_set_bits(struct regmap
*map
,
1423 unsigned int reg
, unsigned int bits
)
1425 return regmap_update_bits_base(map
, reg
, bits
, bits
,
1426 NULL
, false, false);
1429 static inline int regmap_clear_bits(struct regmap
*map
,
1430 unsigned int reg
, unsigned int bits
)
1432 return regmap_update_bits_base(map
, reg
, bits
, 0, NULL
, false, false);
1435 static inline int regmap_assign_bits(struct regmap
*map
, unsigned int reg
,
1436 unsigned int bits
, bool value
)
1439 return regmap_set_bits(map
, reg
, bits
);
1441 return regmap_clear_bits(map
, reg
, bits
);
1444 int regmap_test_bits(struct regmap
*map
, unsigned int reg
, unsigned int bits
);
1447 * struct reg_field - Description of an register field
1449 * @reg: Offset of the register within the regmap bank
1450 * @lsb: lsb of the register field.
1451 * @msb: msb of the register field.
1452 * @id_size: port size if it has some ports
1453 * @id_offset: address offset for each ports
1459 unsigned int id_size
;
1460 unsigned int id_offset
;
1463 #define REG_FIELD(_reg, _lsb, _msb) { \
1469 #define REG_FIELD_ID(_reg, _lsb, _msb, _size, _offset) { \
1474 .id_offset = _offset, \
1477 struct regmap_field
*regmap_field_alloc(struct regmap
*regmap
,
1478 struct reg_field reg_field
);
1479 void regmap_field_free(struct regmap_field
*field
);
1481 DEFINE_FREE(regmap_field
, struct regmap_field
*, if (_T
) regmap_field_free(_T
))
1483 struct regmap_field
*devm_regmap_field_alloc(struct device
*dev
,
1484 struct regmap
*regmap
, struct reg_field reg_field
);
1485 void devm_regmap_field_free(struct device
*dev
, struct regmap_field
*field
);
1487 int regmap_field_bulk_alloc(struct regmap
*regmap
,
1488 struct regmap_field
**rm_field
,
1489 const struct reg_field
*reg_field
,
1491 void regmap_field_bulk_free(struct regmap_field
*field
);
1492 int devm_regmap_field_bulk_alloc(struct device
*dev
, struct regmap
*regmap
,
1493 struct regmap_field
**field
,
1494 const struct reg_field
*reg_field
,
1496 void devm_regmap_field_bulk_free(struct device
*dev
,
1497 struct regmap_field
*field
);
1499 int regmap_field_read(struct regmap_field
*field
, unsigned int *val
);
1500 int regmap_field_update_bits_base(struct regmap_field
*field
,
1501 unsigned int mask
, unsigned int val
,
1502 bool *change
, bool async
, bool force
);
1503 int regmap_fields_read(struct regmap_field
*field
, unsigned int id
,
1505 int regmap_fields_update_bits_base(struct regmap_field
*field
, unsigned int id
,
1506 unsigned int mask
, unsigned int val
,
1507 bool *change
, bool async
, bool force
);
1509 static inline int regmap_field_write(struct regmap_field
*field
,
1512 return regmap_field_update_bits_base(field
, ~0, val
,
1513 NULL
, false, false);
1516 static inline int regmap_field_force_write(struct regmap_field
*field
,
1519 return regmap_field_update_bits_base(field
, ~0, val
, NULL
, false, true);
1522 static inline int regmap_field_update_bits(struct regmap_field
*field
,
1523 unsigned int mask
, unsigned int val
)
1525 return regmap_field_update_bits_base(field
, mask
, val
,
1526 NULL
, false, false);
1529 static inline int regmap_field_set_bits(struct regmap_field
*field
,
1532 return regmap_field_update_bits_base(field
, bits
, bits
, NULL
, false,
1536 static inline int regmap_field_clear_bits(struct regmap_field
*field
,
1539 return regmap_field_update_bits_base(field
, bits
, 0, NULL
, false,
1543 int regmap_field_test_bits(struct regmap_field
*field
, unsigned int bits
);
1546 regmap_field_force_update_bits(struct regmap_field
*field
,
1547 unsigned int mask
, unsigned int val
)
1549 return regmap_field_update_bits_base(field
, mask
, val
,
1553 static inline int regmap_fields_write(struct regmap_field
*field
,
1554 unsigned int id
, unsigned int val
)
1556 return regmap_fields_update_bits_base(field
, id
, ~0, val
,
1557 NULL
, false, false);
1560 static inline int regmap_fields_force_write(struct regmap_field
*field
,
1561 unsigned int id
, unsigned int val
)
1563 return regmap_fields_update_bits_base(field
, id
, ~0, val
,
1568 regmap_fields_update_bits(struct regmap_field
*field
, unsigned int id
,
1569 unsigned int mask
, unsigned int val
)
1571 return regmap_fields_update_bits_base(field
, id
, mask
, val
,
1572 NULL
, false, false);
1576 regmap_fields_force_update_bits(struct regmap_field
*field
, unsigned int id
,
1577 unsigned int mask
, unsigned int val
)
1579 return regmap_fields_update_bits_base(field
, id
, mask
, val
,
1584 * struct regmap_irq_type - IRQ type definitions.
1586 * @type_reg_offset: Offset register for the irq type setting.
1587 * @type_rising_val: Register value to configure RISING type irq.
1588 * @type_falling_val: Register value to configure FALLING type irq.
1589 * @type_level_low_val: Register value to configure LEVEL_LOW type irq.
1590 * @type_level_high_val: Register value to configure LEVEL_HIGH type irq.
1591 * @types_supported: logical OR of IRQ_TYPE_* flags indicating supported types.
1593 struct regmap_irq_type
{
1594 unsigned int type_reg_offset
;
1595 unsigned int type_reg_mask
;
1596 unsigned int type_rising_val
;
1597 unsigned int type_falling_val
;
1598 unsigned int type_level_low_val
;
1599 unsigned int type_level_high_val
;
1600 unsigned int types_supported
;
1604 * struct regmap_irq - Description of an IRQ for the generic regmap irq_chip.
1606 * @reg_offset: Offset of the status/mask register within the bank
1607 * @mask: Mask used to flag/control the register.
1608 * @type: IRQ trigger type setting details if supported.
1611 unsigned int reg_offset
;
1613 struct regmap_irq_type type
;
1616 #define REGMAP_IRQ_REG(_irq, _off, _mask) \
1617 [_irq] = { .reg_offset = (_off), .mask = (_mask) }
1619 #define REGMAP_IRQ_REG_LINE(_id, _reg_bits) \
1621 .mask = BIT((_id) % (_reg_bits)), \
1622 .reg_offset = (_id) / (_reg_bits), \
1625 #define REGMAP_IRQ_MAIN_REG_OFFSET(arr) \
1626 { .num_regs = ARRAY_SIZE((arr)), .offset = &(arr)[0] }
1628 struct regmap_irq_sub_irq_map
{
1629 unsigned int num_regs
;
1630 unsigned int *offset
;
1633 struct regmap_irq_chip_data
;
1636 * struct regmap_irq_chip - Description of a generic regmap irq_chip.
1638 * @name: Descriptive name for IRQ controller.
1639 * @domain_suffix: Name suffix to be appended to end of IRQ domain name. Needed
1640 * when multiple regmap-IRQ controllers are created from same
1643 * @main_status: Base main status register address. For chips which have
1644 * interrupts arranged in separate sub-irq blocks with own IRQ
1645 * registers and which have a main IRQ registers indicating
1646 * sub-irq blocks with unhandled interrupts. For such chips fill
1647 * sub-irq register information in status_base, mask_base and
1649 * @num_main_status_bits: Should be given to chips where number of meaningfull
1650 * main status bits differs from num_regs.
1651 * @sub_reg_offsets: arrays of mappings from main register bits to sub irq
1652 * registers. First item in array describes the registers
1653 * for first main status bit. Second array for second bit etc.
1654 * Offset is given as sub register status offset to
1655 * status_base. Should contain num_regs arrays.
1656 * Can be provided for chips with more complex mapping than
1657 * 1.st bit to 1.st sub-reg, 2.nd bit to 2.nd sub-reg, ...
1658 * @num_main_regs: Number of 'main status' irq registers for chips which have
1661 * @status_base: Base status register address.
1662 * @mask_base: Base mask register address. Mask bits are set to 1 when an
1663 * interrupt is masked, 0 when unmasked.
1664 * @unmask_base: Base unmask register address. Unmask bits are set to 1 when
1665 * an interrupt is unmasked and 0 when masked.
1666 * @ack_base: Base ack address. If zero then the chip is clear on read.
1667 * Using zero value is possible with @use_ack bit.
1668 * @wake_base: Base address for wake enables. If zero unsupported.
1669 * @config_base: Base address for IRQ type config regs. If null unsupported.
1670 * @irq_reg_stride: Stride to use for chips where registers are not contiguous.
1671 * @init_ack_masked: Ack all masked interrupts once during initalization.
1672 * @mask_unmask_non_inverted: Controls mask bit inversion for chips that set
1673 * both @mask_base and @unmask_base. If false, mask and unmask bits are
1674 * inverted (which is deprecated behavior); if true, bits will not be
1675 * inverted and the registers keep their normal behavior. Note that if
1676 * you use only one of @mask_base or @unmask_base, this flag has no
1677 * effect and is unnecessary. Any new drivers that set both @mask_base
1678 * and @unmask_base should set this to true to avoid relying on the
1679 * deprecated behavior.
1680 * @use_ack: Use @ack register even if it is zero.
1681 * @ack_invert: Inverted ack register: cleared bits for ack.
1682 * @clear_ack: Use this to set 1 and 0 or vice-versa to clear interrupts.
1683 * @status_invert: Inverted status register: cleared bits are active interrupts.
1684 * @status_is_level: Status register is actuall signal level: Xor status
1685 * register with previous value to get active interrupts.
1686 * @wake_invert: Inverted wake register: cleared bits are wake disabled.
1687 * @type_in_mask: Use the mask registers for controlling irq type. Use this if
1688 * the hardware provides separate bits for rising/falling edge
1689 * or low/high level interrupts and they should be combined into
1690 * a single logical interrupt. Use &struct regmap_irq_type data
1691 * to define the mask bit for each irq type.
1692 * @clear_on_unmask: For chips with interrupts cleared on read: read the status
1693 * registers before unmasking interrupts to clear any bits
1694 * set when they were masked.
1695 * @runtime_pm: Hold a runtime PM lock on the device when accessing it.
1696 * @no_status: No status register: all interrupts assumed generated by device.
1698 * @num_regs: Number of registers in each control bank.
1700 * @irqs: Descriptors for individual IRQs. Interrupt numbers are
1701 * assigned based on the index in the array of the interrupt.
1702 * @num_irqs: Number of descriptors.
1703 * @num_config_bases: Number of config base registers.
1704 * @num_config_regs: Number of config registers for each config base register.
1706 * @handle_pre_irq: Driver specific callback to handle interrupt from device
1707 * before regmap_irq_handler process the interrupts.
1708 * @handle_post_irq: Driver specific callback to handle interrupt from device
1709 * after handling the interrupts in regmap_irq_handler().
1710 * @handle_mask_sync: Callback used to handle IRQ mask syncs. The index will be
1711 * in the range [0, num_regs)
1712 * @set_type_config: Callback used for configuring irq types.
1713 * @get_irq_reg: Callback for mapping (base register, index) pairs to register
1714 * addresses. The base register will be one of @status_base,
1715 * @mask_base, etc., @main_status, or any of @config_base.
1716 * The index will be in the range [0, num_main_regs[ for the
1717 * main status base, [0, num_config_regs[ for any config
1718 * register base, and [0, num_regs[ for any other base.
1719 * If unspecified then regmap_irq_get_irq_reg_linear() is used.
1720 * @irq_drv_data: Driver specific IRQ data which is passed as parameter when
1721 * driver specific pre/post interrupt handler is called.
1723 * This is not intended to handle every possible interrupt controller, but
1724 * it should handle a substantial proportion of those that are found in the
1727 struct regmap_irq_chip
{
1729 const char *domain_suffix
;
1731 unsigned int main_status
;
1732 unsigned int num_main_status_bits
;
1733 const struct regmap_irq_sub_irq_map
*sub_reg_offsets
;
1736 unsigned int status_base
;
1737 unsigned int mask_base
;
1738 unsigned int unmask_base
;
1739 unsigned int ack_base
;
1740 unsigned int wake_base
;
1741 const unsigned int *config_base
;
1742 unsigned int irq_reg_stride
;
1743 unsigned int init_ack_masked
:1;
1744 unsigned int mask_unmask_non_inverted
:1;
1745 unsigned int use_ack
:1;
1746 unsigned int ack_invert
:1;
1747 unsigned int clear_ack
:1;
1748 unsigned int status_invert
:1;
1749 unsigned int status_is_level
:1;
1750 unsigned int wake_invert
:1;
1751 unsigned int type_in_mask
:1;
1752 unsigned int clear_on_unmask
:1;
1753 unsigned int runtime_pm
:1;
1754 unsigned int no_status
:1;
1758 const struct regmap_irq
*irqs
;
1761 int num_config_bases
;
1762 int num_config_regs
;
1764 int (*handle_pre_irq
)(void *irq_drv_data
);
1765 int (*handle_post_irq
)(void *irq_drv_data
);
1766 int (*handle_mask_sync
)(int index
, unsigned int mask_buf_def
,
1767 unsigned int mask_buf
, void *irq_drv_data
);
1768 int (*set_type_config
)(unsigned int **buf
, unsigned int type
,
1769 const struct regmap_irq
*irq_data
, int idx
,
1770 void *irq_drv_data
);
1771 unsigned int (*get_irq_reg
)(struct regmap_irq_chip_data
*data
,
1772 unsigned int base
, int index
);
1776 unsigned int regmap_irq_get_irq_reg_linear(struct regmap_irq_chip_data
*data
,
1777 unsigned int base
, int index
);
1778 int regmap_irq_set_type_config_simple(unsigned int **buf
, unsigned int type
,
1779 const struct regmap_irq
*irq_data
,
1780 int idx
, void *irq_drv_data
);
1782 int regmap_add_irq_chip(struct regmap
*map
, int irq
, int irq_flags
,
1783 int irq_base
, const struct regmap_irq_chip
*chip
,
1784 struct regmap_irq_chip_data
**data
);
1785 int regmap_add_irq_chip_fwnode(struct fwnode_handle
*fwnode
,
1786 struct regmap
*map
, int irq
,
1787 int irq_flags
, int irq_base
,
1788 const struct regmap_irq_chip
*chip
,
1789 struct regmap_irq_chip_data
**data
);
1790 void regmap_del_irq_chip(int irq
, struct regmap_irq_chip_data
*data
);
1792 int devm_regmap_add_irq_chip(struct device
*dev
, struct regmap
*map
, int irq
,
1793 int irq_flags
, int irq_base
,
1794 const struct regmap_irq_chip
*chip
,
1795 struct regmap_irq_chip_data
**data
);
1796 int devm_regmap_add_irq_chip_fwnode(struct device
*dev
,
1797 struct fwnode_handle
*fwnode
,
1798 struct regmap
*map
, int irq
,
1799 int irq_flags
, int irq_base
,
1800 const struct regmap_irq_chip
*chip
,
1801 struct regmap_irq_chip_data
**data
);
1802 void devm_regmap_del_irq_chip(struct device
*dev
, int irq
,
1803 struct regmap_irq_chip_data
*data
);
1805 int regmap_irq_chip_get_base(struct regmap_irq_chip_data
*data
);
1806 int regmap_irq_get_virq(struct regmap_irq_chip_data
*data
, int irq
);
1807 struct irq_domain
*regmap_irq_get_domain(struct regmap_irq_chip_data
*data
);
1812 * These stubs should only ever be called by generic code which has
1813 * regmap based facilities, if they ever get called at runtime
1814 * something is going wrong and something probably needs to select
1818 static inline int regmap_write(struct regmap
*map
, unsigned int reg
,
1821 WARN_ONCE(1, "regmap API is disabled");
1825 static inline int regmap_write_async(struct regmap
*map
, unsigned int reg
,
1828 WARN_ONCE(1, "regmap API is disabled");
1832 static inline int regmap_raw_write(struct regmap
*map
, unsigned int reg
,
1833 const void *val
, size_t val_len
)
1835 WARN_ONCE(1, "regmap API is disabled");
1839 static inline int regmap_raw_write_async(struct regmap
*map
, unsigned int reg
,
1840 const void *val
, size_t val_len
)
1842 WARN_ONCE(1, "regmap API is disabled");
1846 static inline int regmap_noinc_write(struct regmap
*map
, unsigned int reg
,
1847 const void *val
, size_t val_len
)
1849 WARN_ONCE(1, "regmap API is disabled");
1853 static inline int regmap_bulk_write(struct regmap
*map
, unsigned int reg
,
1854 const void *val
, size_t val_count
)
1856 WARN_ONCE(1, "regmap API is disabled");
1860 static inline int regmap_read(struct regmap
*map
, unsigned int reg
,
1863 WARN_ONCE(1, "regmap API is disabled");
1867 static inline int regmap_read_bypassed(struct regmap
*map
, unsigned int reg
,
1870 WARN_ONCE(1, "regmap API is disabled");
1874 static inline int regmap_raw_read(struct regmap
*map
, unsigned int reg
,
1875 void *val
, size_t val_len
)
1877 WARN_ONCE(1, "regmap API is disabled");
1881 static inline int regmap_noinc_read(struct regmap
*map
, unsigned int reg
,
1882 void *val
, size_t val_len
)
1884 WARN_ONCE(1, "regmap API is disabled");
1888 static inline int regmap_bulk_read(struct regmap
*map
, unsigned int reg
,
1889 void *val
, size_t val_count
)
1891 WARN_ONCE(1, "regmap API is disabled");
1895 static inline int regmap_update_bits_base(struct regmap
*map
, unsigned int reg
,
1896 unsigned int mask
, unsigned int val
,
1897 bool *change
, bool async
, bool force
)
1899 WARN_ONCE(1, "regmap API is disabled");
1903 static inline int regmap_set_bits(struct regmap
*map
,
1904 unsigned int reg
, unsigned int bits
)
1906 WARN_ONCE(1, "regmap API is disabled");
1910 static inline int regmap_clear_bits(struct regmap
*map
,
1911 unsigned int reg
, unsigned int bits
)
1913 WARN_ONCE(1, "regmap API is disabled");
1917 static inline int regmap_assign_bits(struct regmap
*map
, unsigned int reg
,
1918 unsigned int bits
, bool value
)
1920 WARN_ONCE(1, "regmap API is disabled");
1924 static inline int regmap_test_bits(struct regmap
*map
,
1925 unsigned int reg
, unsigned int bits
)
1927 WARN_ONCE(1, "regmap API is disabled");
1931 static inline int regmap_field_update_bits_base(struct regmap_field
*field
,
1932 unsigned int mask
, unsigned int val
,
1933 bool *change
, bool async
, bool force
)
1935 WARN_ONCE(1, "regmap API is disabled");
1939 static inline int regmap_fields_update_bits_base(struct regmap_field
*field
,
1941 unsigned int mask
, unsigned int val
,
1942 bool *change
, bool async
, bool force
)
1944 WARN_ONCE(1, "regmap API is disabled");
1948 static inline int regmap_update_bits(struct regmap
*map
, unsigned int reg
,
1949 unsigned int mask
, unsigned int val
)
1951 WARN_ONCE(1, "regmap API is disabled");
1955 static inline int regmap_update_bits_async(struct regmap
*map
, unsigned int reg
,
1956 unsigned int mask
, unsigned int val
)
1958 WARN_ONCE(1, "regmap API is disabled");
1962 static inline int regmap_update_bits_check(struct regmap
*map
, unsigned int reg
,
1963 unsigned int mask
, unsigned int val
,
1966 WARN_ONCE(1, "regmap API is disabled");
1971 regmap_update_bits_check_async(struct regmap
*map
, unsigned int reg
,
1972 unsigned int mask
, unsigned int val
,
1975 WARN_ONCE(1, "regmap API is disabled");
1979 static inline int regmap_write_bits(struct regmap
*map
, unsigned int reg
,
1980 unsigned int mask
, unsigned int val
)
1982 WARN_ONCE(1, "regmap API is disabled");
1986 static inline int regmap_field_write(struct regmap_field
*field
,
1989 WARN_ONCE(1, "regmap API is disabled");
1993 static inline int regmap_field_force_write(struct regmap_field
*field
,
1996 WARN_ONCE(1, "regmap API is disabled");
2000 static inline int regmap_field_update_bits(struct regmap_field
*field
,
2001 unsigned int mask
, unsigned int val
)
2003 WARN_ONCE(1, "regmap API is disabled");
2008 regmap_field_force_update_bits(struct regmap_field
*field
,
2009 unsigned int mask
, unsigned int val
)
2011 WARN_ONCE(1, "regmap API is disabled");
2015 static inline int regmap_field_set_bits(struct regmap_field
*field
,
2018 WARN_ONCE(1, "regmap API is disabled");
2022 static inline int regmap_field_clear_bits(struct regmap_field
*field
,
2025 WARN_ONCE(1, "regmap API is disabled");
2029 static inline int regmap_field_test_bits(struct regmap_field
*field
,
2032 WARN_ONCE(1, "regmap API is disabled");
2036 static inline int regmap_fields_write(struct regmap_field
*field
,
2037 unsigned int id
, unsigned int val
)
2039 WARN_ONCE(1, "regmap API is disabled");
2043 static inline int regmap_fields_force_write(struct regmap_field
*field
,
2044 unsigned int id
, unsigned int val
)
2046 WARN_ONCE(1, "regmap API is disabled");
2051 regmap_fields_update_bits(struct regmap_field
*field
, unsigned int id
,
2052 unsigned int mask
, unsigned int val
)
2054 WARN_ONCE(1, "regmap API is disabled");
2059 regmap_fields_force_update_bits(struct regmap_field
*field
, unsigned int id
,
2060 unsigned int mask
, unsigned int val
)
2062 WARN_ONCE(1, "regmap API is disabled");
2066 static inline int regmap_get_val_bytes(struct regmap
*map
)
2068 WARN_ONCE(1, "regmap API is disabled");
2072 static inline int regmap_get_max_register(struct regmap
*map
)
2074 WARN_ONCE(1, "regmap API is disabled");
2078 static inline int regmap_get_reg_stride(struct regmap
*map
)
2080 WARN_ONCE(1, "regmap API is disabled");
2084 static inline bool regmap_might_sleep(struct regmap
*map
)
2086 WARN_ONCE(1, "regmap API is disabled");
2090 static inline void regcache_sort_defaults(struct reg_default
*defaults
,
2091 unsigned int ndefaults
)
2093 WARN_ONCE(1, "regmap API is disabled");
2096 static inline int regcache_sync(struct regmap
*map
)
2098 WARN_ONCE(1, "regmap API is disabled");
2102 static inline int regcache_sync_region(struct regmap
*map
, unsigned int min
,
2105 WARN_ONCE(1, "regmap API is disabled");
2109 static inline int regcache_drop_region(struct regmap
*map
, unsigned int min
,
2112 WARN_ONCE(1, "regmap API is disabled");
2116 static inline void regcache_cache_only(struct regmap
*map
, bool enable
)
2118 WARN_ONCE(1, "regmap API is disabled");
2121 static inline void regcache_cache_bypass(struct regmap
*map
, bool enable
)
2123 WARN_ONCE(1, "regmap API is disabled");
2126 static inline void regcache_mark_dirty(struct regmap
*map
)
2128 WARN_ONCE(1, "regmap API is disabled");
2131 static inline void regmap_async_complete(struct regmap
*map
)
2133 WARN_ONCE(1, "regmap API is disabled");
2136 static inline int regmap_register_patch(struct regmap
*map
,
2137 const struct reg_sequence
*regs
,
2140 WARN_ONCE(1, "regmap API is disabled");
2144 static inline int regmap_parse_val(struct regmap
*map
, const void *buf
,
2147 WARN_ONCE(1, "regmap API is disabled");
2151 static inline struct regmap
*dev_get_regmap(struct device
*dev
,
2157 static inline struct device
*regmap_get_device(struct regmap
*map
)
2159 WARN_ONCE(1, "regmap API is disabled");