regmap.h 21 KB

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