Linux 4.19-rc7
[linux-2.6/btrfs-unstable.git] / include / linux / regmap.h
blob379505a53722fdeef727edc9c9d6c58cdbef4d4d
1 #ifndef __LINUX_REGMAP_H
2 #define __LINUX_REGMAP_H
4 /*
5 * Register map access API
7 * Copyright 2011 Wolfson Microelectronics plc
9 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
16 #include <linux/list.h>
17 #include <linux/rbtree.h>
18 #include <linux/ktime.h>
19 #include <linux/delay.h>
20 #include <linux/err.h>
21 #include <linux/bug.h>
22 #include <linux/lockdep.h>
24 struct module;
25 struct clk;
26 struct device;
27 struct i2c_client;
28 struct irq_domain;
29 struct slim_device;
30 struct spi_device;
31 struct spmi_device;
32 struct regmap;
33 struct regmap_range_cfg;
34 struct regmap_field;
35 struct snd_ac97;
36 struct sdw_slave;
38 /* An enum of all the supported cache types */
39 enum regcache_type {
40 REGCACHE_NONE,
41 REGCACHE_RBTREE,
42 REGCACHE_COMPRESSED,
43 REGCACHE_FLAT,
46 /**
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.
55 struct reg_default {
56 unsigned int reg;
57 unsigned int def;
60 /**
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.
70 struct reg_sequence {
71 unsigned int reg;
72 unsigned int def;
73 unsigned int delay_us;
76 #define regmap_update_bits(map, reg, mask, val) \
77 regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
78 #define regmap_update_bits_async(map, reg, mask, val)\
79 regmap_update_bits_base(map, reg, mask, val, NULL, true, false)
80 #define regmap_update_bits_check(map, reg, mask, val, change)\
81 regmap_update_bits_base(map, reg, mask, val, change, false, false)
82 #define regmap_update_bits_check_async(map, reg, mask, val, change)\
83 regmap_update_bits_base(map, reg, mask, val, change, true, false)
85 #define regmap_write_bits(map, reg, mask, val) \
86 regmap_update_bits_base(map, reg, mask, val, NULL, false, true)
88 #define regmap_field_write(field, val) \
89 regmap_field_update_bits_base(field, ~0, val, NULL, false, false)
90 #define regmap_field_force_write(field, val) \
91 regmap_field_update_bits_base(field, ~0, val, NULL, false, true)
92 #define regmap_field_update_bits(field, mask, val)\
93 regmap_field_update_bits_base(field, mask, val, NULL, false, false)
94 #define regmap_field_force_update_bits(field, mask, val) \
95 regmap_field_update_bits_base(field, mask, val, NULL, false, true)
97 #define regmap_fields_write(field, id, val) \
98 regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, false)
99 #define regmap_fields_force_write(field, id, val) \
100 regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, true)
101 #define regmap_fields_update_bits(field, id, mask, val)\
102 regmap_fields_update_bits_base(field, id, mask, val, NULL, false, false)
103 #define regmap_fields_force_update_bits(field, id, mask, val) \
104 regmap_fields_update_bits_base(field, id, mask, val, NULL, false, true)
107 * regmap_read_poll_timeout - Poll until a condition is met or a timeout occurs
109 * @map: Regmap to read from
110 * @addr: Address to poll
111 * @val: Unsigned integer variable to read the value into
112 * @cond: Break condition (usually involving @val)
113 * @sleep_us: Maximum time to sleep between reads in us (0
114 * tight-loops). Should be less than ~20ms since usleep_range
115 * is used (see Documentation/timers/timers-howto.txt).
116 * @timeout_us: Timeout in us, 0 means never timeout
118 * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_read
119 * error return value in case of a error read. In the two former cases,
120 * the last read value at @addr is stored in @val. Must not be called
121 * from atomic context if sleep_us or timeout_us are used.
123 * This is modelled after the readx_poll_timeout macros in linux/iopoll.h.
125 #define regmap_read_poll_timeout(map, addr, val, cond, sleep_us, timeout_us) \
126 ({ \
127 u64 __timeout_us = (timeout_us); \
128 unsigned long __sleep_us = (sleep_us); \
129 ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \
130 int __ret; \
131 might_sleep_if(__sleep_us); \
132 for (;;) { \
133 __ret = regmap_read((map), (addr), &(val)); \
134 if (__ret) \
135 break; \
136 if (cond) \
137 break; \
138 if ((__timeout_us) && \
139 ktime_compare(ktime_get(), __timeout) > 0) { \
140 __ret = regmap_read((map), (addr), &(val)); \
141 break; \
143 if (__sleep_us) \
144 usleep_range((__sleep_us >> 2) + 1, __sleep_us); \
146 __ret ?: ((cond) ? 0 : -ETIMEDOUT); \
150 * regmap_field_read_poll_timeout - Poll until a condition is met or timeout
152 * @field: Regmap field to read from
153 * @val: Unsigned integer variable to read the value into
154 * @cond: Break condition (usually involving @val)
155 * @sleep_us: Maximum time to sleep between reads in us (0
156 * tight-loops). Should be less than ~20ms since usleep_range
157 * is used (see Documentation/timers/timers-howto.txt).
158 * @timeout_us: Timeout in us, 0 means never timeout
160 * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_field_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. Must not be called
163 * from atomic context if sleep_us or timeout_us are used.
165 * This is modelled after the readx_poll_timeout macros in linux/iopoll.h.
167 #define regmap_field_read_poll_timeout(field, val, cond, sleep_us, timeout_us) \
168 ({ \
169 u64 __timeout_us = (timeout_us); \
170 unsigned long __sleep_us = (sleep_us); \
171 ktime_t timeout = ktime_add_us(ktime_get(), __timeout_us); \
172 int pollret; \
173 might_sleep_if(__sleep_us); \
174 for (;;) { \
175 pollret = regmap_field_read((field), &(val)); \
176 if (pollret) \
177 break; \
178 if (cond) \
179 break; \
180 if (__timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \
181 pollret = regmap_field_read((field), &(val)); \
182 break; \
184 if (__sleep_us) \
185 usleep_range((__sleep_us >> 2) + 1, __sleep_us); \
187 pollret ?: ((cond) ? 0 : -ETIMEDOUT); \
190 #ifdef CONFIG_REGMAP
192 enum regmap_endian {
193 /* Unspecified -> 0 -> Backwards compatible default */
194 REGMAP_ENDIAN_DEFAULT = 0,
195 REGMAP_ENDIAN_BIG,
196 REGMAP_ENDIAN_LITTLE,
197 REGMAP_ENDIAN_NATIVE,
201 * struct regmap_range - A register range, used for access related checks
202 * (readable/writeable/volatile/precious checks)
204 * @range_min: address of first register
205 * @range_max: address of last register
207 struct regmap_range {
208 unsigned int range_min;
209 unsigned int range_max;
212 #define regmap_reg_range(low, high) { .range_min = low, .range_max = high, }
215 * struct regmap_access_table - A table of register ranges for access checks
217 * @yes_ranges : pointer to an array of regmap ranges used as "yes ranges"
218 * @n_yes_ranges: size of the above array
219 * @no_ranges: pointer to an array of regmap ranges used as "no ranges"
220 * @n_no_ranges: size of the above array
222 * A table of ranges including some yes ranges and some no ranges.
223 * If a register belongs to a no_range, the corresponding check function
224 * will return false. If a register belongs to a yes range, the corresponding
225 * check function will return true. "no_ranges" are searched first.
227 struct regmap_access_table {
228 const struct regmap_range *yes_ranges;
229 unsigned int n_yes_ranges;
230 const struct regmap_range *no_ranges;
231 unsigned int n_no_ranges;
234 typedef void (*regmap_lock)(void *);
235 typedef void (*regmap_unlock)(void *);
238 * struct regmap_config - Configuration for the register map of a device.
240 * @name: Optional name of the regmap. Useful when a device has multiple
241 * register regions.
243 * @reg_bits: Number of bits in a register address, mandatory.
244 * @reg_stride: The register address stride. Valid register addresses are a
245 * multiple of this value. If set to 0, a value of 1 will be
246 * used.
247 * @pad_bits: Number of bits of padding between register and value.
248 * @val_bits: Number of bits in a register value, mandatory.
250 * @writeable_reg: Optional callback returning true if the register
251 * can be written to. If this field is NULL but wr_table
252 * (see below) is not, the check is performed on such table
253 * (a register is writeable if it belongs to one of the ranges
254 * specified by wr_table).
255 * @readable_reg: Optional callback returning true if the register
256 * can be read from. If this field is NULL but rd_table
257 * (see below) is not, the check is performed on such table
258 * (a register is readable if it belongs to one of the ranges
259 * specified by rd_table).
260 * @volatile_reg: Optional callback returning true if the register
261 * value can't be cached. If this field is NULL but
262 * volatile_table (see below) is not, the check is performed on
263 * such table (a register is volatile if it belongs to one of
264 * the ranges specified by volatile_table).
265 * @precious_reg: Optional callback returning true if the register
266 * should not be read outside of a call from the driver
267 * (e.g., a clear on read interrupt status register). If this
268 * field is NULL but precious_table (see below) is not, the
269 * check is performed on such table (a register is precious if
270 * it belongs to one of the ranges specified by precious_table).
271 * @readable_noinc_reg: Optional callback returning true if the register
272 * supports multiple read operations without incrementing
273 * the register number. If this field is NULL but
274 * rd_noinc_table (see below) is not, the check is
275 * performed on such table (a register is no increment
276 * readable if it belongs to one of the ranges specified
277 * by rd_noinc_table).
278 * @disable_locking: This regmap is either protected by external means or
279 * is guaranteed not be be accessed from multiple threads.
280 * Don't use any locking mechanisms.
281 * @lock: Optional lock callback (overrides regmap's default lock
282 * function, based on spinlock or mutex).
283 * @unlock: As above for unlocking.
284 * @lock_arg: this field is passed as the only argument of lock/unlock
285 * functions (ignored in case regular lock/unlock functions
286 * are not overridden).
287 * @reg_read: Optional callback that if filled will be used to perform
288 * all the reads from the registers. Should only be provided for
289 * devices whose read operation cannot be represented as a simple
290 * read operation on a bus such as SPI, I2C, etc. Most of the
291 * devices do not need this.
292 * @reg_write: Same as above for writing.
293 * @fast_io: Register IO is fast. Use a spinlock instead of a mutex
294 * to perform locking. This field is ignored if custom lock/unlock
295 * functions are used (see fields lock/unlock of struct regmap_config).
296 * This field is a duplicate of a similar file in
297 * 'struct regmap_bus' and serves exact same purpose.
298 * Use it only for "no-bus" cases.
299 * @max_register: Optional, specifies the maximum valid register address.
300 * @wr_table: Optional, points to a struct regmap_access_table specifying
301 * valid ranges for write access.
302 * @rd_table: As above, for read access.
303 * @volatile_table: As above, for volatile registers.
304 * @precious_table: As above, for precious registers.
305 * @rd_noinc_table: As above, for no increment readable registers.
306 * @reg_defaults: Power on reset values for registers (for use with
307 * register cache support).
308 * @num_reg_defaults: Number of elements in reg_defaults.
310 * @read_flag_mask: Mask to be set in the top bytes of the register when doing
311 * a read.
312 * @write_flag_mask: Mask to be set in the top bytes of the register when doing
313 * a write. If both read_flag_mask and write_flag_mask are
314 * empty and zero_flag_mask is not set the regmap_bus default
315 * masks are used.
316 * @zero_flag_mask: If set, read_flag_mask and write_flag_mask are used even
317 * if they are both empty.
318 * @use_single_rw: If set, converts the bulk read and write operations into
319 * a series of single read and write operations. This is useful
320 * for device that does not support bulk read and write.
321 * @can_multi_write: If set, the device supports the multi write mode of bulk
322 * write operations, if clear multi write requests will be
323 * split into individual write operations
325 * @cache_type: The actual cache type.
326 * @reg_defaults_raw: Power on reset values for registers (for use with
327 * register cache support).
328 * @num_reg_defaults_raw: Number of elements in reg_defaults_raw.
329 * @reg_format_endian: Endianness for formatted register addresses. If this is
330 * DEFAULT, the @reg_format_endian_default value from the
331 * regmap bus is used.
332 * @val_format_endian: Endianness for formatted register values. If this is
333 * DEFAULT, the @reg_format_endian_default value from the
334 * regmap bus is used.
336 * @ranges: Array of configuration entries for virtual address ranges.
337 * @num_ranges: Number of range configuration entries.
338 * @use_hwlock: Indicate if a hardware spinlock should be used.
339 * @hwlock_id: Specify the hardware spinlock id.
340 * @hwlock_mode: The hardware spinlock mode, should be HWLOCK_IRQSTATE,
341 * HWLOCK_IRQ or 0.
343 struct regmap_config {
344 const char *name;
346 int reg_bits;
347 int reg_stride;
348 int pad_bits;
349 int val_bits;
351 bool (*writeable_reg)(struct device *dev, unsigned int reg);
352 bool (*readable_reg)(struct device *dev, unsigned int reg);
353 bool (*volatile_reg)(struct device *dev, unsigned int reg);
354 bool (*precious_reg)(struct device *dev, unsigned int reg);
355 bool (*readable_noinc_reg)(struct device *dev, unsigned int reg);
357 bool disable_locking;
358 regmap_lock lock;
359 regmap_unlock unlock;
360 void *lock_arg;
362 int (*reg_read)(void *context, unsigned int reg, unsigned int *val);
363 int (*reg_write)(void *context, unsigned int reg, unsigned int val);
365 bool fast_io;
367 unsigned int max_register;
368 const struct regmap_access_table *wr_table;
369 const struct regmap_access_table *rd_table;
370 const struct regmap_access_table *volatile_table;
371 const struct regmap_access_table *precious_table;
372 const struct regmap_access_table *rd_noinc_table;
373 const struct reg_default *reg_defaults;
374 unsigned int num_reg_defaults;
375 enum regcache_type cache_type;
376 const void *reg_defaults_raw;
377 unsigned int num_reg_defaults_raw;
379 unsigned long read_flag_mask;
380 unsigned long write_flag_mask;
381 bool zero_flag_mask;
383 bool use_single_rw;
384 bool can_multi_write;
386 enum regmap_endian reg_format_endian;
387 enum regmap_endian val_format_endian;
389 const struct regmap_range_cfg *ranges;
390 unsigned int num_ranges;
392 bool use_hwlock;
393 unsigned int hwlock_id;
394 unsigned int hwlock_mode;
398 * struct regmap_range_cfg - Configuration for indirectly accessed or paged
399 * registers.
401 * @name: Descriptive name for diagnostics
403 * @range_min: Address of the lowest register address in virtual range.
404 * @range_max: Address of the highest register in virtual range.
406 * @selector_reg: Register with selector field.
407 * @selector_mask: Bit shift for selector value.
408 * @selector_shift: Bit mask for selector value.
410 * @window_start: Address of first (lowest) register in data window.
411 * @window_len: Number of registers in data window.
413 * Registers, mapped to this virtual range, are accessed in two steps:
414 * 1. page selector register update;
415 * 2. access through data window registers.
417 struct regmap_range_cfg {
418 const char *name;
420 /* Registers of virtual address range */
421 unsigned int range_min;
422 unsigned int range_max;
424 /* Page selector for indirect addressing */
425 unsigned int selector_reg;
426 unsigned int selector_mask;
427 int selector_shift;
429 /* Data window (per each page) */
430 unsigned int window_start;
431 unsigned int window_len;
434 struct regmap_async;
436 typedef int (*regmap_hw_write)(void *context, const void *data,
437 size_t count);
438 typedef int (*regmap_hw_gather_write)(void *context,
439 const void *reg, size_t reg_len,
440 const void *val, size_t val_len);
441 typedef int (*regmap_hw_async_write)(void *context,
442 const void *reg, size_t reg_len,
443 const void *val, size_t val_len,
444 struct regmap_async *async);
445 typedef int (*regmap_hw_read)(void *context,
446 const void *reg_buf, size_t reg_size,
447 void *val_buf, size_t val_size);
448 typedef int (*regmap_hw_reg_read)(void *context, unsigned int reg,
449 unsigned int *val);
450 typedef int (*regmap_hw_reg_write)(void *context, unsigned int reg,
451 unsigned int val);
452 typedef int (*regmap_hw_reg_update_bits)(void *context, unsigned int reg,
453 unsigned int mask, unsigned int val);
454 typedef struct regmap_async *(*regmap_hw_async_alloc)(void);
455 typedef void (*regmap_hw_free_context)(void *context);
458 * struct regmap_bus - Description of a hardware bus for the register map
459 * infrastructure.
461 * @fast_io: Register IO is fast. Use a spinlock instead of a mutex
462 * to perform locking. This field is ignored if custom lock/unlock
463 * functions are used (see fields lock/unlock of
464 * struct regmap_config).
465 * @write: Write operation.
466 * @gather_write: Write operation with split register/value, return -ENOTSUPP
467 * if not implemented on a given device.
468 * @async_write: Write operation which completes asynchronously, optional and
469 * must serialise with respect to non-async I/O.
470 * @reg_write: Write a single register value to the given register address. This
471 * write operation has to complete when returning from the function.
472 * @reg_update_bits: Update bits operation to be used against volatile
473 * registers, intended for devices supporting some mechanism
474 * for setting clearing bits without having to
475 * read/modify/write.
476 * @read: Read operation. Data is returned in the buffer used to transmit
477 * data.
478 * @reg_read: Read a single register value from a given register address.
479 * @free_context: Free context.
480 * @async_alloc: Allocate a regmap_async() structure.
481 * @read_flag_mask: Mask to be set in the top byte of the register when doing
482 * a read.
483 * @reg_format_endian_default: Default endianness for formatted register
484 * addresses. Used when the regmap_config specifies DEFAULT. If this is
485 * DEFAULT, BIG is assumed.
486 * @val_format_endian_default: Default endianness for formatted register
487 * values. Used when the regmap_config specifies DEFAULT. If this is
488 * DEFAULT, BIG is assumed.
489 * @max_raw_read: Max raw read size that can be used on the bus.
490 * @max_raw_write: Max raw write size that can be used on the bus.
492 struct regmap_bus {
493 bool fast_io;
494 regmap_hw_write write;
495 regmap_hw_gather_write gather_write;
496 regmap_hw_async_write async_write;
497 regmap_hw_reg_write reg_write;
498 regmap_hw_reg_update_bits reg_update_bits;
499 regmap_hw_read read;
500 regmap_hw_reg_read reg_read;
501 regmap_hw_free_context free_context;
502 regmap_hw_async_alloc async_alloc;
503 u8 read_flag_mask;
504 enum regmap_endian reg_format_endian_default;
505 enum regmap_endian val_format_endian_default;
506 size_t max_raw_read;
507 size_t max_raw_write;
511 * __regmap_init functions.
513 * These functions take a lock key and name parameter, and should not be called
514 * directly. Instead, use the regmap_init macros that generate a key and name
515 * for each call.
517 struct regmap *__regmap_init(struct device *dev,
518 const struct regmap_bus *bus,
519 void *bus_context,
520 const struct regmap_config *config,
521 struct lock_class_key *lock_key,
522 const char *lock_name);
523 struct regmap *__regmap_init_i2c(struct i2c_client *i2c,
524 const struct regmap_config *config,
525 struct lock_class_key *lock_key,
526 const char *lock_name);
527 struct regmap *__regmap_init_sccb(struct i2c_client *i2c,
528 const struct regmap_config *config,
529 struct lock_class_key *lock_key,
530 const char *lock_name);
531 struct regmap *__regmap_init_slimbus(struct slim_device *slimbus,
532 const struct regmap_config *config,
533 struct lock_class_key *lock_key,
534 const char *lock_name);
535 struct regmap *__regmap_init_spi(struct spi_device *dev,
536 const struct regmap_config *config,
537 struct lock_class_key *lock_key,
538 const char *lock_name);
539 struct regmap *__regmap_init_spmi_base(struct spmi_device *dev,
540 const struct regmap_config *config,
541 struct lock_class_key *lock_key,
542 const char *lock_name);
543 struct regmap *__regmap_init_spmi_ext(struct spmi_device *dev,
544 const struct regmap_config *config,
545 struct lock_class_key *lock_key,
546 const char *lock_name);
547 struct regmap *__regmap_init_w1(struct device *w1_dev,
548 const struct regmap_config *config,
549 struct lock_class_key *lock_key,
550 const char *lock_name);
551 struct regmap *__regmap_init_mmio_clk(struct device *dev, const char *clk_id,
552 void __iomem *regs,
553 const struct regmap_config *config,
554 struct lock_class_key *lock_key,
555 const char *lock_name);
556 struct regmap *__regmap_init_ac97(struct snd_ac97 *ac97,
557 const struct regmap_config *config,
558 struct lock_class_key *lock_key,
559 const char *lock_name);
560 struct regmap *__regmap_init_sdw(struct sdw_slave *sdw,
561 const struct regmap_config *config,
562 struct lock_class_key *lock_key,
563 const char *lock_name);
565 struct regmap *__devm_regmap_init(struct device *dev,
566 const struct regmap_bus *bus,
567 void *bus_context,
568 const struct regmap_config *config,
569 struct lock_class_key *lock_key,
570 const char *lock_name);
571 struct regmap *__devm_regmap_init_i2c(struct i2c_client *i2c,
572 const struct regmap_config *config,
573 struct lock_class_key *lock_key,
574 const char *lock_name);
575 struct regmap *__devm_regmap_init_sccb(struct i2c_client *i2c,
576 const struct regmap_config *config,
577 struct lock_class_key *lock_key,
578 const char *lock_name);
579 struct regmap *__devm_regmap_init_spi(struct spi_device *dev,
580 const struct regmap_config *config,
581 struct lock_class_key *lock_key,
582 const char *lock_name);
583 struct regmap *__devm_regmap_init_spmi_base(struct spmi_device *dev,
584 const struct regmap_config *config,
585 struct lock_class_key *lock_key,
586 const char *lock_name);
587 struct regmap *__devm_regmap_init_spmi_ext(struct spmi_device *dev,
588 const struct regmap_config *config,
589 struct lock_class_key *lock_key,
590 const char *lock_name);
591 struct regmap *__devm_regmap_init_w1(struct device *w1_dev,
592 const struct regmap_config *config,
593 struct lock_class_key *lock_key,
594 const char *lock_name);
595 struct regmap *__devm_regmap_init_mmio_clk(struct device *dev,
596 const char *clk_id,
597 void __iomem *regs,
598 const struct regmap_config *config,
599 struct lock_class_key *lock_key,
600 const char *lock_name);
601 struct regmap *__devm_regmap_init_ac97(struct snd_ac97 *ac97,
602 const struct regmap_config *config,
603 struct lock_class_key *lock_key,
604 const char *lock_name);
605 struct regmap *__devm_regmap_init_sdw(struct sdw_slave *sdw,
606 const struct regmap_config *config,
607 struct lock_class_key *lock_key,
608 const char *lock_name);
609 struct regmap *__devm_regmap_init_slimbus(struct slim_device *slimbus,
610 const struct regmap_config *config,
611 struct lock_class_key *lock_key,
612 const char *lock_name);
614 * Wrapper for regmap_init macros to include a unique lockdep key and name
615 * for each call. No-op if CONFIG_LOCKDEP is not set.
617 * @fn: Real function to call (in the form __[*_]regmap_init[_*])
618 * @name: Config variable name (#config in the calling macro)
620 #ifdef CONFIG_LOCKDEP
621 #define __regmap_lockdep_wrapper(fn, name, ...) \
623 ({ \
624 static struct lock_class_key _key; \
625 fn(__VA_ARGS__, &_key, \
626 KBUILD_BASENAME ":" \
627 __stringify(__LINE__) ":" \
628 "(" name ")->lock"); \
629 }) \
631 #else
632 #define __regmap_lockdep_wrapper(fn, name, ...) fn(__VA_ARGS__, NULL, NULL)
633 #endif
636 * regmap_init() - Initialise register map
638 * @dev: Device that will be interacted with
639 * @bus: Bus-specific callbacks to use with device
640 * @bus_context: Data passed to bus-specific callbacks
641 * @config: Configuration for register map
643 * The return value will be an ERR_PTR() on error or a valid pointer to
644 * a struct regmap. This function should generally not be called
645 * directly, it should be called by bus-specific init functions.
647 #define regmap_init(dev, bus, bus_context, config) \
648 __regmap_lockdep_wrapper(__regmap_init, #config, \
649 dev, bus, bus_context, config)
650 int regmap_attach_dev(struct device *dev, struct regmap *map,
651 const struct regmap_config *config);
654 * regmap_init_i2c() - Initialise register map
656 * @i2c: Device that will be interacted with
657 * @config: Configuration for register map
659 * The return value will be an ERR_PTR() on error or a valid pointer to
660 * a struct regmap.
662 #define regmap_init_i2c(i2c, config) \
663 __regmap_lockdep_wrapper(__regmap_init_i2c, #config, \
664 i2c, config)
667 * regmap_init_sccb() - Initialise register map
669 * @i2c: Device that will be interacted with
670 * @config: Configuration for register map
672 * The return value will be an ERR_PTR() on error or a valid pointer to
673 * a struct regmap.
675 #define regmap_init_sccb(i2c, config) \
676 __regmap_lockdep_wrapper(__regmap_init_sccb, #config, \
677 i2c, config)
680 * regmap_init_slimbus() - Initialise register map
682 * @slimbus: Device that will be interacted with
683 * @config: Configuration for register map
685 * The return value will be an ERR_PTR() on error or a valid pointer to
686 * a struct regmap.
688 #define regmap_init_slimbus(slimbus, config) \
689 __regmap_lockdep_wrapper(__regmap_init_slimbus, #config, \
690 slimbus, config)
693 * regmap_init_spi() - Initialise register map
695 * @dev: 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
699 * a struct regmap.
701 #define regmap_init_spi(dev, config) \
702 __regmap_lockdep_wrapper(__regmap_init_spi, #config, \
703 dev, config)
706 * regmap_init_spmi_base() - Create regmap for the Base register space
708 * @dev: SPMI 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
712 * a struct regmap.
714 #define regmap_init_spmi_base(dev, config) \
715 __regmap_lockdep_wrapper(__regmap_init_spmi_base, #config, \
716 dev, config)
719 * regmap_init_spmi_ext() - Create regmap for Ext register space
721 * @dev: 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
725 * a struct regmap.
727 #define regmap_init_spmi_ext(dev, config) \
728 __regmap_lockdep_wrapper(__regmap_init_spmi_ext, #config, \
729 dev, config)
732 * regmap_init_w1() - Initialise register map
734 * @w1_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
738 * a struct regmap.
740 #define regmap_init_w1(w1_dev, config) \
741 __regmap_lockdep_wrapper(__regmap_init_w1, #config, \
742 w1_dev, config)
745 * regmap_init_mmio_clk() - Initialise register map with register clock
747 * @dev: Device that will be interacted with
748 * @clk_id: register clock consumer ID
749 * @regs: Pointer to memory-mapped IO region
750 * @config: Configuration for register map
752 * The return value will be an ERR_PTR() on error or a valid pointer to
753 * a struct regmap.
755 #define regmap_init_mmio_clk(dev, clk_id, regs, config) \
756 __regmap_lockdep_wrapper(__regmap_init_mmio_clk, #config, \
757 dev, clk_id, regs, config)
760 * regmap_init_mmio() - Initialise register map
762 * @dev: Device that will be interacted with
763 * @regs: Pointer to memory-mapped IO region
764 * @config: Configuration for register map
766 * The return value will be an ERR_PTR() on error or a valid pointer to
767 * a struct regmap.
769 #define regmap_init_mmio(dev, regs, config) \
770 regmap_init_mmio_clk(dev, NULL, regs, config)
773 * regmap_init_ac97() - Initialise AC'97 register map
775 * @ac97: Device that will be interacted with
776 * @config: Configuration for register map
778 * The return value will be an ERR_PTR() on error or a valid pointer to
779 * a struct regmap.
781 #define regmap_init_ac97(ac97, config) \
782 __regmap_lockdep_wrapper(__regmap_init_ac97, #config, \
783 ac97, config)
784 bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg);
787 * regmap_init_sdw() - Initialise register map
789 * @sdw: Device that will be interacted with
790 * @config: Configuration for register map
792 * The return value will be an ERR_PTR() on error or a valid pointer to
793 * a struct regmap.
795 #define regmap_init_sdw(sdw, config) \
796 __regmap_lockdep_wrapper(__regmap_init_sdw, #config, \
797 sdw, config)
801 * devm_regmap_init() - Initialise managed register map
803 * @dev: Device that will be interacted with
804 * @bus: Bus-specific callbacks to use with device
805 * @bus_context: Data passed to bus-specific callbacks
806 * @config: Configuration for register map
808 * The return value will be an ERR_PTR() on error or a valid pointer
809 * to a struct regmap. This function should generally not be called
810 * directly, it should be called by bus-specific init functions. The
811 * map will be automatically freed by the device management code.
813 #define devm_regmap_init(dev, bus, bus_context, config) \
814 __regmap_lockdep_wrapper(__devm_regmap_init, #config, \
815 dev, bus, bus_context, config)
818 * devm_regmap_init_i2c() - Initialise managed register map
820 * @i2c: Device that will be interacted with
821 * @config: Configuration for register map
823 * The return value will be an ERR_PTR() on error or a valid pointer
824 * to a struct regmap. The regmap will be automatically freed by the
825 * device management code.
827 #define devm_regmap_init_i2c(i2c, config) \
828 __regmap_lockdep_wrapper(__devm_regmap_init_i2c, #config, \
829 i2c, config)
832 * devm_regmap_init_sccb() - Initialise managed register map
834 * @i2c: Device that will be interacted with
835 * @config: Configuration for register map
837 * The return value will be an ERR_PTR() on error or a valid pointer
838 * to a struct regmap. The regmap will be automatically freed by the
839 * device management code.
841 #define devm_regmap_init_sccb(i2c, config) \
842 __regmap_lockdep_wrapper(__devm_regmap_init_sccb, #config, \
843 i2c, config)
846 * devm_regmap_init_spi() - Initialise register map
848 * @dev: 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
852 * to a struct regmap. The map will be automatically freed by the
853 * device management code.
855 #define devm_regmap_init_spi(dev, config) \
856 __regmap_lockdep_wrapper(__devm_regmap_init_spi, #config, \
857 dev, config)
860 * devm_regmap_init_spmi_base() - Create managed regmap for Base register space
862 * @dev: SPMI device that will be interacted with
863 * @config: Configuration for register map
865 * The return value will be an ERR_PTR() on error or a valid pointer
866 * to a struct regmap. The regmap will be automatically freed by the
867 * device management code.
869 #define devm_regmap_init_spmi_base(dev, config) \
870 __regmap_lockdep_wrapper(__devm_regmap_init_spmi_base, #config, \
871 dev, config)
874 * devm_regmap_init_spmi_ext() - Create managed regmap for Ext register space
876 * @dev: SPMI device that will be interacted with
877 * @config: Configuration for register map
879 * The return value will be an ERR_PTR() on error or a valid pointer
880 * to a struct regmap. The regmap will be automatically freed by the
881 * device management code.
883 #define devm_regmap_init_spmi_ext(dev, config) \
884 __regmap_lockdep_wrapper(__devm_regmap_init_spmi_ext, #config, \
885 dev, config)
888 * devm_regmap_init_w1() - Initialise managed register map
890 * @w1_dev: Device that will be interacted with
891 * @config: Configuration for register map
893 * The return value will be an ERR_PTR() on error or a valid pointer
894 * to a struct regmap. The regmap will be automatically freed by the
895 * device management code.
897 #define devm_regmap_init_w1(w1_dev, config) \
898 __regmap_lockdep_wrapper(__devm_regmap_init_w1, #config, \
899 w1_dev, config)
901 * devm_regmap_init_mmio_clk() - Initialise managed register map with clock
903 * @dev: Device that will be interacted with
904 * @clk_id: register clock consumer ID
905 * @regs: Pointer to memory-mapped IO region
906 * @config: Configuration for register map
908 * The return value will be an ERR_PTR() on error or a valid pointer
909 * to a struct regmap. The regmap will be automatically freed by the
910 * device management code.
912 #define devm_regmap_init_mmio_clk(dev, clk_id, regs, config) \
913 __regmap_lockdep_wrapper(__devm_regmap_init_mmio_clk, #config, \
914 dev, clk_id, regs, config)
917 * devm_regmap_init_mmio() - Initialise managed register map
919 * @dev: Device that will be interacted with
920 * @regs: Pointer to memory-mapped IO region
921 * @config: Configuration for register map
923 * The return value will be an ERR_PTR() on error or a valid pointer
924 * to a struct regmap. The regmap will be automatically freed by the
925 * device management code.
927 #define devm_regmap_init_mmio(dev, regs, config) \
928 devm_regmap_init_mmio_clk(dev, NULL, regs, config)
931 * devm_regmap_init_ac97() - Initialise AC'97 register map
933 * @ac97: Device that will be interacted with
934 * @config: Configuration for register map
936 * The return value will be an ERR_PTR() on error or a valid pointer
937 * to a struct regmap. The regmap will be automatically freed by the
938 * device management code.
940 #define devm_regmap_init_ac97(ac97, config) \
941 __regmap_lockdep_wrapper(__devm_regmap_init_ac97, #config, \
942 ac97, config)
945 * devm_regmap_init_sdw() - Initialise managed register map
947 * @sdw: Device that will be interacted with
948 * @config: Configuration for register map
950 * The return value will be an ERR_PTR() on error or a valid pointer
951 * to a struct regmap. The regmap will be automatically freed by the
952 * device management code.
954 #define devm_regmap_init_sdw(sdw, config) \
955 __regmap_lockdep_wrapper(__devm_regmap_init_sdw, #config, \
956 sdw, config)
959 * devm_regmap_init_slimbus() - Initialise managed register map
961 * @slimbus: Device that will be interacted with
962 * @config: Configuration for register map
964 * The return value will be an ERR_PTR() on error or a valid pointer
965 * to a struct regmap. The regmap will be automatically freed by the
966 * device management code.
968 #define devm_regmap_init_slimbus(slimbus, config) \
969 __regmap_lockdep_wrapper(__devm_regmap_init_slimbus, #config, \
970 slimbus, config)
971 int regmap_mmio_attach_clk(struct regmap *map, struct clk *clk);
972 void regmap_mmio_detach_clk(struct regmap *map);
973 void regmap_exit(struct regmap *map);
974 int regmap_reinit_cache(struct regmap *map,
975 const struct regmap_config *config);
976 struct regmap *dev_get_regmap(struct device *dev, const char *name);
977 struct device *regmap_get_device(struct regmap *map);
978 int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
979 int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val);
980 int regmap_raw_write(struct regmap *map, unsigned int reg,
981 const void *val, size_t val_len);
982 int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
983 size_t val_count);
984 int regmap_multi_reg_write(struct regmap *map, const struct reg_sequence *regs,
985 int num_regs);
986 int regmap_multi_reg_write_bypassed(struct regmap *map,
987 const struct reg_sequence *regs,
988 int num_regs);
989 int regmap_raw_write_async(struct regmap *map, unsigned int reg,
990 const void *val, size_t val_len);
991 int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
992 int regmap_raw_read(struct regmap *map, unsigned int reg,
993 void *val, size_t val_len);
994 int regmap_noinc_read(struct regmap *map, unsigned int reg,
995 void *val, size_t val_len);
996 int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
997 size_t val_count);
998 int regmap_update_bits_base(struct regmap *map, unsigned int reg,
999 unsigned int mask, unsigned int val,
1000 bool *change, bool async, bool force);
1001 int regmap_get_val_bytes(struct regmap *map);
1002 int regmap_get_max_register(struct regmap *map);
1003 int regmap_get_reg_stride(struct regmap *map);
1004 int regmap_async_complete(struct regmap *map);
1005 bool regmap_can_raw_write(struct regmap *map);
1006 size_t regmap_get_raw_read_max(struct regmap *map);
1007 size_t regmap_get_raw_write_max(struct regmap *map);
1009 int regcache_sync(struct regmap *map);
1010 int regcache_sync_region(struct regmap *map, unsigned int min,
1011 unsigned int max);
1012 int regcache_drop_region(struct regmap *map, unsigned int min,
1013 unsigned int max);
1014 void regcache_cache_only(struct regmap *map, bool enable);
1015 void regcache_cache_bypass(struct regmap *map, bool enable);
1016 void regcache_mark_dirty(struct regmap *map);
1018 bool regmap_check_range_table(struct regmap *map, unsigned int reg,
1019 const struct regmap_access_table *table);
1021 int regmap_register_patch(struct regmap *map, const struct reg_sequence *regs,
1022 int num_regs);
1023 int regmap_parse_val(struct regmap *map, const void *buf,
1024 unsigned int *val);
1026 static inline bool regmap_reg_in_range(unsigned int reg,
1027 const struct regmap_range *range)
1029 return reg >= range->range_min && reg <= range->range_max;
1032 bool regmap_reg_in_ranges(unsigned int reg,
1033 const struct regmap_range *ranges,
1034 unsigned int nranges);
1037 * struct reg_field - Description of an register field
1039 * @reg: Offset of the register within the regmap bank
1040 * @lsb: lsb of the register field.
1041 * @msb: msb of the register field.
1042 * @id_size: port size if it has some ports
1043 * @id_offset: address offset for each ports
1045 struct reg_field {
1046 unsigned int reg;
1047 unsigned int lsb;
1048 unsigned int msb;
1049 unsigned int id_size;
1050 unsigned int id_offset;
1053 #define REG_FIELD(_reg, _lsb, _msb) { \
1054 .reg = _reg, \
1055 .lsb = _lsb, \
1056 .msb = _msb, \
1059 struct regmap_field *regmap_field_alloc(struct regmap *regmap,
1060 struct reg_field reg_field);
1061 void regmap_field_free(struct regmap_field *field);
1063 struct regmap_field *devm_regmap_field_alloc(struct device *dev,
1064 struct regmap *regmap, struct reg_field reg_field);
1065 void devm_regmap_field_free(struct device *dev, struct regmap_field *field);
1067 int regmap_field_read(struct regmap_field *field, unsigned int *val);
1068 int regmap_field_update_bits_base(struct regmap_field *field,
1069 unsigned int mask, unsigned int val,
1070 bool *change, bool async, bool force);
1071 int regmap_fields_read(struct regmap_field *field, unsigned int id,
1072 unsigned int *val);
1073 int regmap_fields_update_bits_base(struct regmap_field *field, unsigned int id,
1074 unsigned int mask, unsigned int val,
1075 bool *change, bool async, bool force);
1078 * struct regmap_irq - Description of an IRQ for the generic regmap irq_chip.
1080 * @reg_offset: Offset of the status/mask register within the bank
1081 * @mask: Mask used to flag/control the register.
1082 * @type_reg_offset: Offset register for the irq type setting.
1083 * @type_rising_mask: Mask bit to configure RISING type irq.
1084 * @type_falling_mask: Mask bit to configure FALLING type irq.
1086 struct regmap_irq {
1087 unsigned int reg_offset;
1088 unsigned int mask;
1089 unsigned int type_reg_offset;
1090 unsigned int type_rising_mask;
1091 unsigned int type_falling_mask;
1094 #define REGMAP_IRQ_REG(_irq, _off, _mask) \
1095 [_irq] = { .reg_offset = (_off), .mask = (_mask) }
1098 * struct regmap_irq_chip - Description of a generic regmap irq_chip.
1100 * @name: Descriptive name for IRQ controller.
1102 * @status_base: Base status register address.
1103 * @mask_base: Base mask register address.
1104 * @mask_writeonly: Base mask register is write only.
1105 * @unmask_base: Base unmask register address. for chips who have
1106 * separate mask and unmask registers
1107 * @ack_base: Base ack address. If zero then the chip is clear on read.
1108 * Using zero value is possible with @use_ack bit.
1109 * @wake_base: Base address for wake enables. If zero unsupported.
1110 * @type_base: Base address for irq type. If zero unsupported.
1111 * @irq_reg_stride: Stride to use for chips where registers are not contiguous.
1112 * @init_ack_masked: Ack all masked interrupts once during initalization.
1113 * @mask_invert: Inverted mask register: cleared bits are masked out.
1114 * @use_ack: Use @ack register even if it is zero.
1115 * @ack_invert: Inverted ack register: cleared bits for ack.
1116 * @wake_invert: Inverted wake register: cleared bits are wake enabled.
1117 * @type_invert: Invert the type flags.
1118 * @runtime_pm: Hold a runtime PM lock on the device when accessing it.
1120 * @num_regs: Number of registers in each control bank.
1121 * @irqs: Descriptors for individual IRQs. Interrupt numbers are
1122 * assigned based on the index in the array of the interrupt.
1123 * @num_irqs: Number of descriptors.
1124 * @num_type_reg: Number of type registers.
1125 * @type_reg_stride: Stride to use for chips where type registers are not
1126 * contiguous.
1127 * @handle_pre_irq: Driver specific callback to handle interrupt from device
1128 * before regmap_irq_handler process the interrupts.
1129 * @handle_post_irq: Driver specific callback to handle interrupt from device
1130 * after handling the interrupts in regmap_irq_handler().
1131 * @irq_drv_data: Driver specific IRQ data which is passed as parameter when
1132 * driver specific pre/post interrupt handler is called.
1134 * This is not intended to handle every possible interrupt controller, but
1135 * it should handle a substantial proportion of those that are found in the
1136 * wild.
1138 struct regmap_irq_chip {
1139 const char *name;
1141 unsigned int status_base;
1142 unsigned int mask_base;
1143 unsigned int unmask_base;
1144 unsigned int ack_base;
1145 unsigned int wake_base;
1146 unsigned int type_base;
1147 unsigned int irq_reg_stride;
1148 bool mask_writeonly:1;
1149 bool init_ack_masked:1;
1150 bool mask_invert:1;
1151 bool use_ack:1;
1152 bool ack_invert:1;
1153 bool wake_invert:1;
1154 bool runtime_pm:1;
1155 bool type_invert:1;
1157 int num_regs;
1159 const struct regmap_irq *irqs;
1160 int num_irqs;
1162 int num_type_reg;
1163 unsigned int type_reg_stride;
1165 int (*handle_pre_irq)(void *irq_drv_data);
1166 int (*handle_post_irq)(void *irq_drv_data);
1167 void *irq_drv_data;
1170 struct regmap_irq_chip_data;
1172 int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
1173 int irq_base, const struct regmap_irq_chip *chip,
1174 struct regmap_irq_chip_data **data);
1175 void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
1177 int devm_regmap_add_irq_chip(struct device *dev, struct regmap *map, int irq,
1178 int irq_flags, int irq_base,
1179 const struct regmap_irq_chip *chip,
1180 struct regmap_irq_chip_data **data);
1181 void devm_regmap_del_irq_chip(struct device *dev, int irq,
1182 struct regmap_irq_chip_data *data);
1184 int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
1185 int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq);
1186 struct irq_domain *regmap_irq_get_domain(struct regmap_irq_chip_data *data);
1188 #else
1191 * These stubs should only ever be called by generic code which has
1192 * regmap based facilities, if they ever get called at runtime
1193 * something is going wrong and something probably needs to select
1194 * REGMAP.
1197 static inline int regmap_write(struct regmap *map, unsigned int reg,
1198 unsigned int val)
1200 WARN_ONCE(1, "regmap API is disabled");
1201 return -EINVAL;
1204 static inline int regmap_write_async(struct regmap *map, unsigned int reg,
1205 unsigned int val)
1207 WARN_ONCE(1, "regmap API is disabled");
1208 return -EINVAL;
1211 static inline int regmap_raw_write(struct regmap *map, unsigned int reg,
1212 const void *val, size_t val_len)
1214 WARN_ONCE(1, "regmap API is disabled");
1215 return -EINVAL;
1218 static inline int regmap_raw_write_async(struct regmap *map, unsigned int reg,
1219 const void *val, size_t val_len)
1221 WARN_ONCE(1, "regmap API is disabled");
1222 return -EINVAL;
1225 static inline int regmap_bulk_write(struct regmap *map, unsigned int reg,
1226 const void *val, size_t val_count)
1228 WARN_ONCE(1, "regmap API is disabled");
1229 return -EINVAL;
1232 static inline int regmap_read(struct regmap *map, unsigned int reg,
1233 unsigned int *val)
1235 WARN_ONCE(1, "regmap API is disabled");
1236 return -EINVAL;
1239 static inline int regmap_raw_read(struct regmap *map, unsigned int reg,
1240 void *val, size_t val_len)
1242 WARN_ONCE(1, "regmap API is disabled");
1243 return -EINVAL;
1246 static inline int regmap_noinc_read(struct regmap *map, unsigned int reg,
1247 void *val, size_t val_len)
1249 WARN_ONCE(1, "regmap API is disabled");
1250 return -EINVAL;
1253 static inline int regmap_bulk_read(struct regmap *map, unsigned int reg,
1254 void *val, size_t val_count)
1256 WARN_ONCE(1, "regmap API is disabled");
1257 return -EINVAL;
1260 static inline int regmap_update_bits_base(struct regmap *map, unsigned int reg,
1261 unsigned int mask, unsigned int val,
1262 bool *change, bool async, bool force)
1264 WARN_ONCE(1, "regmap API is disabled");
1265 return -EINVAL;
1268 static inline int regmap_field_update_bits_base(struct regmap_field *field,
1269 unsigned int mask, unsigned int val,
1270 bool *change, bool async, bool force)
1272 WARN_ONCE(1, "regmap API is disabled");
1273 return -EINVAL;
1276 static inline int regmap_fields_update_bits_base(struct regmap_field *field,
1277 unsigned int id,
1278 unsigned int mask, unsigned int val,
1279 bool *change, bool async, bool force)
1281 WARN_ONCE(1, "regmap API is disabled");
1282 return -EINVAL;
1285 static inline int regmap_get_val_bytes(struct regmap *map)
1287 WARN_ONCE(1, "regmap API is disabled");
1288 return -EINVAL;
1291 static inline int regmap_get_max_register(struct regmap *map)
1293 WARN_ONCE(1, "regmap API is disabled");
1294 return -EINVAL;
1297 static inline int regmap_get_reg_stride(struct regmap *map)
1299 WARN_ONCE(1, "regmap API is disabled");
1300 return -EINVAL;
1303 static inline int regcache_sync(struct regmap *map)
1305 WARN_ONCE(1, "regmap API is disabled");
1306 return -EINVAL;
1309 static inline int regcache_sync_region(struct regmap *map, unsigned int min,
1310 unsigned int max)
1312 WARN_ONCE(1, "regmap API is disabled");
1313 return -EINVAL;
1316 static inline int regcache_drop_region(struct regmap *map, unsigned int min,
1317 unsigned int max)
1319 WARN_ONCE(1, "regmap API is disabled");
1320 return -EINVAL;
1323 static inline void regcache_cache_only(struct regmap *map, bool enable)
1325 WARN_ONCE(1, "regmap API is disabled");
1328 static inline void regcache_cache_bypass(struct regmap *map, bool enable)
1330 WARN_ONCE(1, "regmap API is disabled");
1333 static inline void regcache_mark_dirty(struct regmap *map)
1335 WARN_ONCE(1, "regmap API is disabled");
1338 static inline void regmap_async_complete(struct regmap *map)
1340 WARN_ONCE(1, "regmap API is disabled");
1343 static inline int regmap_register_patch(struct regmap *map,
1344 const struct reg_sequence *regs,
1345 int num_regs)
1347 WARN_ONCE(1, "regmap API is disabled");
1348 return -EINVAL;
1351 static inline int regmap_parse_val(struct regmap *map, const void *buf,
1352 unsigned int *val)
1354 WARN_ONCE(1, "regmap API is disabled");
1355 return -EINVAL;
1358 static inline struct regmap *dev_get_regmap(struct device *dev,
1359 const char *name)
1361 return NULL;
1364 static inline struct device *regmap_get_device(struct regmap *map)
1366 WARN_ONCE(1, "regmap API is disabled");
1367 return NULL;
1370 #endif
1372 #endif