regmap.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. #ifndef __LINUX_REGMAP_H
  2. #define __LINUX_REGMAP_H
  3. /*
  4. * Register map access API
  5. *
  6. * Copyright 2011 Wolfson Microelectronics plc
  7. *
  8. * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <linux/list.h>
  15. #include <linux/rbtree.h>
  16. #include <linux/err.h>
  17. #include <linux/bug.h>
  18. struct module;
  19. struct device;
  20. struct i2c_client;
  21. struct irq_domain;
  22. struct spi_device;
  23. struct regmap;
  24. struct regmap_range_cfg;
  25. struct regmap_field;
  26. /* An enum of all the supported cache types */
  27. enum regcache_type {
  28. REGCACHE_NONE,
  29. REGCACHE_RBTREE,
  30. REGCACHE_COMPRESSED,
  31. REGCACHE_FLAT,
  32. };
  33. /**
  34. * Default value for a register. We use an array of structs rather
  35. * than a simple array as many modern devices have very sparse
  36. * register maps.
  37. *
  38. * @reg: Register address.
  39. * @def: Register default value.
  40. */
  41. struct reg_default {
  42. unsigned int reg;
  43. unsigned int def;
  44. };
  45. #ifdef CONFIG_REGMAP
  46. enum regmap_endian {
  47. /* Unspecified -> 0 -> Backwards compatible default */
  48. REGMAP_ENDIAN_DEFAULT = 0,
  49. REGMAP_ENDIAN_BIG,
  50. REGMAP_ENDIAN_LITTLE,
  51. REGMAP_ENDIAN_NATIVE,
  52. };
  53. /**
  54. * A register range, used for access related checks
  55. * (readable/writeable/volatile/precious checks)
  56. *
  57. * @range_min: address of first register
  58. * @range_max: address of last register
  59. */
  60. struct regmap_range {
  61. unsigned int range_min;
  62. unsigned int range_max;
  63. };
  64. /*
  65. * A table of ranges including some yes ranges and some no ranges.
  66. * If a register belongs to a no_range, the corresponding check function
  67. * will return false. If a register belongs to a yes range, the corresponding
  68. * check function will return true. "no_ranges" are searched first.
  69. *
  70. * @yes_ranges : pointer to an array of regmap ranges used as "yes ranges"
  71. * @n_yes_ranges: size of the above array
  72. * @no_ranges: pointer to an array of regmap ranges used as "no ranges"
  73. * @n_no_ranges: size of the above array
  74. */
  75. struct regmap_access_table {
  76. const struct regmap_range *yes_ranges;
  77. unsigned int n_yes_ranges;
  78. const struct regmap_range *no_ranges;
  79. unsigned int n_no_ranges;
  80. };
  81. typedef void (*regmap_lock)(void *);
  82. typedef void (*regmap_unlock)(void *);
  83. /**
  84. * Configuration for the register map of a device.
  85. *
  86. * @name: Optional name of the regmap. Useful when a device has multiple
  87. * register regions.
  88. *
  89. * @reg_bits: Number of bits in a register address, mandatory.
  90. * @reg_stride: The register address stride. Valid register addresses are a
  91. * multiple of this value. If set to 0, a value of 1 will be
  92. * used.
  93. * @pad_bits: Number of bits of padding between register and value.
  94. * @val_bits: Number of bits in a register value, mandatory.
  95. *
  96. * @writeable_reg: Optional callback returning true if the register
  97. * can be written to. If this field is NULL but wr_table
  98. * (see below) is not, the check is performed on such table
  99. * (a register is writeable if it belongs to one of the ranges
  100. * specified by wr_table).
  101. * @readable_reg: Optional callback returning true if the register
  102. * can be read from. If this field is NULL but rd_table
  103. * (see below) is not, the check is performed on such table
  104. * (a register is readable if it belongs to one of the ranges
  105. * specified by rd_table).
  106. * @volatile_reg: Optional callback returning true if the register
  107. * value can't be cached. If this field is NULL but
  108. * volatile_table (see below) is not, the check is performed on
  109. * such table (a register is volatile if it belongs to one of
  110. * the ranges specified by volatile_table).
  111. * @precious_reg: Optional callback returning true if the rgister
  112. * should not be read outside of a call from the driver
  113. * (eg, a clear on read interrupt status register). If this
  114. * field is NULL but precious_table (see below) is not, the
  115. * check is performed on such table (a register is precious if
  116. * it belongs to one of the ranges specified by precious_table).
  117. * @lock: Optional lock callback (overrides regmap's default lock
  118. * function, based on spinlock or mutex).
  119. * @unlock: As above for unlocking.
  120. * @lock_arg: this field is passed as the only argument of lock/unlock
  121. * functions (ignored in case regular lock/unlock functions
  122. * are not overridden).
  123. * @reg_read: Optional callback that if filled will be used to perform
  124. * all the reads from the registers. Should only be provided for
  125. * devices whos read operation cannot be represented as a simple read
  126. * operation on a bus such as SPI, I2C, etc. Most of the devices do
  127. * not need this.
  128. * @reg_write: Same as above for writing.
  129. * @fast_io: Register IO is fast. Use a spinlock instead of a mutex
  130. * to perform locking. This field is ignored if custom lock/unlock
  131. * functions are used (see fields lock/unlock of struct regmap_config).
  132. * This field is a duplicate of a similar file in
  133. * 'struct regmap_bus' and serves exact same purpose.
  134. * Use it only for "no-bus" cases.
  135. * @max_register: Optional, specifies the maximum valid register index.
  136. * @wr_table: Optional, points to a struct regmap_access_table specifying
  137. * valid ranges for write access.
  138. * @rd_table: As above, for read access.
  139. * @volatile_table: As above, for volatile registers.
  140. * @precious_table: As above, for precious registers.
  141. * @reg_defaults: Power on reset values for registers (for use with
  142. * register cache support).
  143. * @num_reg_defaults: Number of elements in reg_defaults.
  144. *
  145. * @read_flag_mask: Mask to be set in the top byte of the register when doing
  146. * a read.
  147. * @write_flag_mask: Mask to be set in the top byte of the register when doing
  148. * a write. If both read_flag_mask and write_flag_mask are
  149. * empty the regmap_bus default masks are used.
  150. * @use_single_rw: If set, converts the bulk read and write operations into
  151. * a series of single read and write operations. This is useful
  152. * for device that does not support bulk read and write.
  153. *
  154. * @cache_type: The actual cache type.
  155. * @reg_defaults_raw: Power on reset values for registers (for use with
  156. * register cache support).
  157. * @num_reg_defaults_raw: Number of elements in reg_defaults_raw.
  158. * @reg_format_endian: Endianness for formatted register addresses. If this is
  159. * DEFAULT, the @reg_format_endian_default value from the
  160. * regmap bus is used.
  161. * @val_format_endian: Endianness for formatted register values. If this is
  162. * DEFAULT, the @reg_format_endian_default value from the
  163. * regmap bus is used.
  164. *
  165. * @ranges: Array of configuration entries for virtual address ranges.
  166. * @num_ranges: Number of range configuration entries.
  167. */
  168. struct regmap_config {
  169. const char *name;
  170. int reg_bits;
  171. int reg_stride;
  172. int pad_bits;
  173. int val_bits;
  174. bool (*writeable_reg)(struct device *dev, unsigned int reg);
  175. bool (*readable_reg)(struct device *dev, unsigned int reg);
  176. bool (*volatile_reg)(struct device *dev, unsigned int reg);
  177. bool (*precious_reg)(struct device *dev, unsigned int reg);
  178. regmap_lock lock;
  179. regmap_unlock unlock;
  180. void *lock_arg;
  181. int (*reg_read)(void *context, unsigned int reg, unsigned int *val);
  182. int (*reg_write)(void *context, unsigned int reg, unsigned int val);
  183. bool fast_io;
  184. unsigned int max_register;
  185. const struct regmap_access_table *wr_table;
  186. const struct regmap_access_table *rd_table;
  187. const struct regmap_access_table *volatile_table;
  188. const struct regmap_access_table *precious_table;
  189. const struct reg_default *reg_defaults;
  190. unsigned int num_reg_defaults;
  191. enum regcache_type cache_type;
  192. const void *reg_defaults_raw;
  193. unsigned int num_reg_defaults_raw;
  194. u8 read_flag_mask;
  195. u8 write_flag_mask;
  196. bool use_single_rw;
  197. enum regmap_endian reg_format_endian;
  198. enum regmap_endian val_format_endian;
  199. const struct regmap_range_cfg *ranges;
  200. unsigned int num_ranges;
  201. };
  202. /**
  203. * Configuration for indirectly accessed or paged registers.
  204. * Registers, mapped to this virtual range, are accessed in two steps:
  205. * 1. page selector register update;
  206. * 2. access through data window registers.
  207. *
  208. * @name: Descriptive name for diagnostics
  209. *
  210. * @range_min: Address of the lowest register address in virtual range.
  211. * @range_max: Address of the highest register in virtual range.
  212. *
  213. * @page_sel_reg: Register with selector field.
  214. * @page_sel_mask: Bit shift for selector value.
  215. * @page_sel_shift: Bit mask for selector value.
  216. *
  217. * @window_start: Address of first (lowest) register in data window.
  218. * @window_len: Number of registers in data window.
  219. */
  220. struct regmap_range_cfg {
  221. const char *name;
  222. /* Registers of virtual address range */
  223. unsigned int range_min;
  224. unsigned int range_max;
  225. /* Page selector for indirect addressing */
  226. unsigned int selector_reg;
  227. unsigned int selector_mask;
  228. int selector_shift;
  229. /* Data window (per each page) */
  230. unsigned int window_start;
  231. unsigned int window_len;
  232. };
  233. struct regmap_async;
  234. typedef int (*regmap_hw_write)(void *context, const void *data,
  235. size_t count);
  236. typedef int (*regmap_hw_gather_write)(void *context,
  237. const void *reg, size_t reg_len,
  238. const void *val, size_t val_len);
  239. typedef int (*regmap_hw_async_write)(void *context,
  240. const void *reg, size_t reg_len,
  241. const void *val, size_t val_len,
  242. struct regmap_async *async);
  243. typedef int (*regmap_hw_read)(void *context,
  244. const void *reg_buf, size_t reg_size,
  245. void *val_buf, size_t val_size);
  246. typedef struct regmap_async *(*regmap_hw_async_alloc)(void);
  247. typedef void (*regmap_hw_free_context)(void *context);
  248. /**
  249. * Description of a hardware bus for the register map infrastructure.
  250. *
  251. * @fast_io: Register IO is fast. Use a spinlock instead of a mutex
  252. * to perform locking. This field is ignored if custom lock/unlock
  253. * functions are used (see fields lock/unlock of
  254. * struct regmap_config).
  255. * @write: Write operation.
  256. * @gather_write: Write operation with split register/value, return -ENOTSUPP
  257. * if not implemented on a given device.
  258. * @async_write: Write operation which completes asynchronously, optional and
  259. * must serialise with respect to non-async I/O.
  260. * @read: Read operation. Data is returned in the buffer used to transmit
  261. * data.
  262. * @async_alloc: Allocate a regmap_async() structure.
  263. * @read_flag_mask: Mask to be set in the top byte of the register when doing
  264. * a read.
  265. * @reg_format_endian_default: Default endianness for formatted register
  266. * addresses. Used when the regmap_config specifies DEFAULT. If this is
  267. * DEFAULT, BIG is assumed.
  268. * @val_format_endian_default: Default endianness for formatted register
  269. * values. Used when the regmap_config specifies DEFAULT. If this is
  270. * DEFAULT, BIG is assumed.
  271. * @async_size: Size of struct used for async work.
  272. */
  273. struct regmap_bus {
  274. bool fast_io;
  275. regmap_hw_write write;
  276. regmap_hw_gather_write gather_write;
  277. regmap_hw_async_write async_write;
  278. regmap_hw_read read;
  279. regmap_hw_free_context free_context;
  280. regmap_hw_async_alloc async_alloc;
  281. u8 read_flag_mask;
  282. enum regmap_endian reg_format_endian_default;
  283. enum regmap_endian val_format_endian_default;
  284. };
  285. struct regmap *regmap_init(struct device *dev,
  286. const struct regmap_bus *bus,
  287. void *bus_context,
  288. const struct regmap_config *config);
  289. struct regmap *regmap_init_i2c(struct i2c_client *i2c,
  290. const struct regmap_config *config);
  291. struct regmap *regmap_init_spi(struct spi_device *dev,
  292. const struct regmap_config *config);
  293. struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id,
  294. void __iomem *regs,
  295. const struct regmap_config *config);
  296. struct regmap *devm_regmap_init(struct device *dev,
  297. const struct regmap_bus *bus,
  298. void *bus_context,
  299. const struct regmap_config *config);
  300. struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,
  301. const struct regmap_config *config);
  302. struct regmap *devm_regmap_init_spi(struct spi_device *dev,
  303. const struct regmap_config *config);
  304. struct regmap *devm_regmap_init_mmio_clk(struct device *dev, const char *clk_id,
  305. void __iomem *regs,
  306. const struct regmap_config *config);
  307. /**
  308. * regmap_init_mmio(): Initialise register map
  309. *
  310. * @dev: Device that will be interacted with
  311. * @regs: Pointer to memory-mapped IO region
  312. * @config: Configuration for register map
  313. *
  314. * The return value will be an ERR_PTR() on error or a valid pointer to
  315. * a struct regmap.
  316. */
  317. static inline struct regmap *regmap_init_mmio(struct device *dev,
  318. void __iomem *regs,
  319. const struct regmap_config *config)
  320. {
  321. return regmap_init_mmio_clk(dev, NULL, regs, config);
  322. }
  323. /**
  324. * devm_regmap_init_mmio(): Initialise managed register map
  325. *
  326. * @dev: Device that will be interacted with
  327. * @regs: Pointer to memory-mapped IO region
  328. * @config: Configuration for register map
  329. *
  330. * The return value will be an ERR_PTR() on error or a valid pointer
  331. * to a struct regmap. The regmap will be automatically freed by the
  332. * device management code.
  333. */
  334. static inline struct regmap *devm_regmap_init_mmio(struct device *dev,
  335. void __iomem *regs,
  336. const struct regmap_config *config)
  337. {
  338. return devm_regmap_init_mmio_clk(dev, NULL, regs, config);
  339. }
  340. void regmap_exit(struct regmap *map);
  341. int regmap_reinit_cache(struct regmap *map,
  342. const struct regmap_config *config);
  343. struct regmap *dev_get_regmap(struct device *dev, const char *name);
  344. int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
  345. int regmap_raw_write(struct regmap *map, unsigned int reg,
  346. const void *val, size_t val_len);
  347. int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
  348. size_t val_count);
  349. int regmap_raw_write_async(struct regmap *map, unsigned int reg,
  350. const void *val, size_t val_len);
  351. int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
  352. int regmap_raw_read(struct regmap *map, unsigned int reg,
  353. void *val, size_t val_len);
  354. int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
  355. size_t val_count);
  356. int regmap_update_bits(struct regmap *map, unsigned int reg,
  357. unsigned int mask, unsigned int val);
  358. int regmap_update_bits_check(struct regmap *map, unsigned int reg,
  359. unsigned int mask, unsigned int val,
  360. bool *change);
  361. int regmap_get_val_bytes(struct regmap *map);
  362. int regmap_async_complete(struct regmap *map);
  363. bool regmap_can_raw_write(struct regmap *map);
  364. int regcache_sync(struct regmap *map);
  365. int regcache_sync_region(struct regmap *map, unsigned int min,
  366. unsigned int max);
  367. int regcache_drop_region(struct regmap *map, unsigned int min,
  368. unsigned int max);
  369. void regcache_cache_only(struct regmap *map, bool enable);
  370. void regcache_cache_bypass(struct regmap *map, bool enable);
  371. void regcache_mark_dirty(struct regmap *map);
  372. bool regmap_check_range_table(struct regmap *map, unsigned int reg,
  373. const struct regmap_access_table *table);
  374. int regmap_register_patch(struct regmap *map, const struct reg_default *regs,
  375. int num_regs);
  376. static inline bool regmap_reg_in_range(unsigned int reg,
  377. const struct regmap_range *range)
  378. {
  379. return reg >= range->range_min && reg <= range->range_max;
  380. }
  381. bool regmap_reg_in_ranges(unsigned int reg,
  382. const struct regmap_range *ranges,
  383. unsigned int nranges);
  384. /**
  385. * Description of an register field
  386. *
  387. * @reg: Offset of the register within the regmap bank
  388. * @lsb: lsb of the register field.
  389. * @reg: msb of the register field.
  390. */
  391. struct reg_field {
  392. unsigned int reg;
  393. unsigned int lsb;
  394. unsigned int msb;
  395. };
  396. #define REG_FIELD(_reg, _lsb, _msb) { \
  397. .reg = _reg, \
  398. .lsb = _lsb, \
  399. .msb = _msb, \
  400. }
  401. struct regmap_field *regmap_field_alloc(struct regmap *regmap,
  402. struct reg_field reg_field);
  403. void regmap_field_free(struct regmap_field *field);
  404. struct regmap_field *devm_regmap_field_alloc(struct device *dev,
  405. struct regmap *regmap, struct reg_field reg_field);
  406. void devm_regmap_field_free(struct device *dev, struct regmap_field *field);
  407. int regmap_field_read(struct regmap_field *field, unsigned int *val);
  408. int regmap_field_write(struct regmap_field *field, unsigned int val);
  409. /**
  410. * Description of an IRQ for the generic regmap irq_chip.
  411. *
  412. * @reg_offset: Offset of the status/mask register within the bank
  413. * @mask: Mask used to flag/control the register.
  414. */
  415. struct regmap_irq {
  416. unsigned int reg_offset;
  417. unsigned int mask;
  418. };
  419. /**
  420. * Description of a generic regmap irq_chip. This is not intended to
  421. * handle every possible interrupt controller, but it should handle a
  422. * substantial proportion of those that are found in the wild.
  423. *
  424. * @name: Descriptive name for IRQ controller.
  425. *
  426. * @status_base: Base status register address.
  427. * @mask_base: Base mask register address.
  428. * @ack_base: Base ack address. If zero then the chip is clear on read.
  429. * @wake_base: Base address for wake enables. If zero unsupported.
  430. * @irq_reg_stride: Stride to use for chips where registers are not contiguous.
  431. * @runtime_pm: Hold a runtime PM lock on the device when accessing it.
  432. *
  433. * @num_regs: Number of registers in each control bank.
  434. * @irqs: Descriptors for individual IRQs. Interrupt numbers are
  435. * assigned based on the index in the array of the interrupt.
  436. * @num_irqs: Number of descriptors.
  437. */
  438. struct regmap_irq_chip {
  439. const char *name;
  440. unsigned int status_base;
  441. unsigned int mask_base;
  442. unsigned int ack_base;
  443. unsigned int wake_base;
  444. unsigned int irq_reg_stride;
  445. unsigned int mask_invert;
  446. unsigned int wake_invert;
  447. bool runtime_pm;
  448. int num_regs;
  449. const struct regmap_irq *irqs;
  450. int num_irqs;
  451. };
  452. struct regmap_irq_chip_data;
  453. int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
  454. int irq_base, const struct regmap_irq_chip *chip,
  455. struct regmap_irq_chip_data **data);
  456. void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
  457. int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
  458. int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq);
  459. struct irq_domain *regmap_irq_get_domain(struct regmap_irq_chip_data *data);
  460. #else
  461. /*
  462. * These stubs should only ever be called by generic code which has
  463. * regmap based facilities, if they ever get called at runtime
  464. * something is going wrong and something probably needs to select
  465. * REGMAP.
  466. */
  467. static inline int regmap_write(struct regmap *map, unsigned int reg,
  468. unsigned int val)
  469. {
  470. WARN_ONCE(1, "regmap API is disabled");
  471. return -EINVAL;
  472. }
  473. static inline int regmap_raw_write(struct regmap *map, unsigned int reg,
  474. const void *val, size_t val_len)
  475. {
  476. WARN_ONCE(1, "regmap API is disabled");
  477. return -EINVAL;
  478. }
  479. static inline int regmap_raw_write_async(struct regmap *map, unsigned int reg,
  480. const void *val, size_t val_len)
  481. {
  482. WARN_ONCE(1, "regmap API is disabled");
  483. return -EINVAL;
  484. }
  485. static inline int regmap_bulk_write(struct regmap *map, unsigned int reg,
  486. const void *val, size_t val_count)
  487. {
  488. WARN_ONCE(1, "regmap API is disabled");
  489. return -EINVAL;
  490. }
  491. static inline int regmap_read(struct regmap *map, unsigned int reg,
  492. unsigned int *val)
  493. {
  494. WARN_ONCE(1, "regmap API is disabled");
  495. return -EINVAL;
  496. }
  497. static inline int regmap_raw_read(struct regmap *map, unsigned int reg,
  498. void *val, size_t val_len)
  499. {
  500. WARN_ONCE(1, "regmap API is disabled");
  501. return -EINVAL;
  502. }
  503. static inline int regmap_bulk_read(struct regmap *map, unsigned int reg,
  504. void *val, size_t val_count)
  505. {
  506. WARN_ONCE(1, "regmap API is disabled");
  507. return -EINVAL;
  508. }
  509. static inline int regmap_update_bits(struct regmap *map, unsigned int reg,
  510. unsigned int mask, unsigned int val)
  511. {
  512. WARN_ONCE(1, "regmap API is disabled");
  513. return -EINVAL;
  514. }
  515. static inline int regmap_update_bits_check(struct regmap *map,
  516. unsigned int reg,
  517. unsigned int mask, unsigned int val,
  518. bool *change)
  519. {
  520. WARN_ONCE(1, "regmap API is disabled");
  521. return -EINVAL;
  522. }
  523. static inline int regmap_get_val_bytes(struct regmap *map)
  524. {
  525. WARN_ONCE(1, "regmap API is disabled");
  526. return -EINVAL;
  527. }
  528. static inline int regcache_sync(struct regmap *map)
  529. {
  530. WARN_ONCE(1, "regmap API is disabled");
  531. return -EINVAL;
  532. }
  533. static inline int regcache_sync_region(struct regmap *map, unsigned int min,
  534. unsigned int max)
  535. {
  536. WARN_ONCE(1, "regmap API is disabled");
  537. return -EINVAL;
  538. }
  539. static inline int regcache_drop_region(struct regmap *map, unsigned int min,
  540. unsigned int max)
  541. {
  542. WARN_ONCE(1, "regmap API is disabled");
  543. return -EINVAL;
  544. }
  545. static inline void regcache_cache_only(struct regmap *map, bool enable)
  546. {
  547. WARN_ONCE(1, "regmap API is disabled");
  548. }
  549. static inline void regcache_cache_bypass(struct regmap *map, bool enable)
  550. {
  551. WARN_ONCE(1, "regmap API is disabled");
  552. }
  553. static inline void regcache_mark_dirty(struct regmap *map)
  554. {
  555. WARN_ONCE(1, "regmap API is disabled");
  556. }
  557. static inline void regmap_async_complete(struct regmap *map)
  558. {
  559. WARN_ONCE(1, "regmap API is disabled");
  560. }
  561. static inline int regmap_register_patch(struct regmap *map,
  562. const struct reg_default *regs,
  563. int num_regs)
  564. {
  565. WARN_ONCE(1, "regmap API is disabled");
  566. return -EINVAL;
  567. }
  568. static inline struct regmap *dev_get_regmap(struct device *dev,
  569. const char *name)
  570. {
  571. return NULL;
  572. }
  573. #endif
  574. #endif