blob: 3bdb1f9a5b43dcb918f5a11692bcc727579e5dbe [file] [log] [blame]
Mark Brownb83a3132011-05-11 19:59:58 +02001#ifndef __LINUX_REGMAP_H
2#define __LINUX_REGMAP_H
3
4/*
5 * Register map access API
6 *
7 * Copyright 2011 Wolfson Microelectronics plc
8 *
9 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
10 *
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.
14 */
15
Mark Brownb83a3132011-05-11 19:59:58 +020016#include <linux/list.h>
Krystian Garbaciak6863ca62012-06-15 11:23:56 +010017#include <linux/rbtree.h>
Mark Brownb83a3132011-05-11 19:59:58 +020018
Paul Gortmakerde477252011-05-26 13:46:22 -040019struct module;
Paul Gortmaker313162d2012-01-30 11:46:54 -050020struct device;
Mark Brown9943fa32011-06-20 19:02:29 +010021struct i2c_client;
Mark Browna676f082011-05-12 11:42:10 +020022struct spi_device;
Mark Brownb83d2ff2012-03-11 11:49:17 +000023struct regmap;
Krystian Garbaciak6863ca62012-06-15 11:23:56 +010024struct regmap_range_cfg;
Mark Brown9943fa32011-06-20 19:02:29 +010025
Dimitris Papastamos9fabe242011-09-19 14:34:00 +010026/* An enum of all the supported cache types */
27enum regcache_type {
28 REGCACHE_NONE,
Dimitris Papastamos28644c802011-09-19 14:34:02 +010029 REGCACHE_RBTREE,
Mark Brown50b776f2011-11-02 15:00:03 +000030 REGCACHE_COMPRESSED
Dimitris Papastamos9fabe242011-09-19 14:34:00 +010031};
32
Mark Browndd898b22011-07-20 22:28:58 +010033/**
Mark Brownbd20eb52011-08-19 18:09:38 +090034 * 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 */
41struct reg_default {
42 unsigned int reg;
43 unsigned int def;
44};
45
Mark Brownb83d2ff2012-03-11 11:49:17 +000046#ifdef CONFIG_REGMAP
47
Stephen Warren141eba22012-05-24 10:47:26 -060048enum regmap_endian {
49 /* Unspecified -> 0 -> Backwards compatible default */
50 REGMAP_ENDIAN_DEFAULT = 0,
51 REGMAP_ENDIAN_BIG,
52 REGMAP_ENDIAN_LITTLE,
53 REGMAP_ENDIAN_NATIVE,
54};
55
Davide Ciminaghi76aad392012-11-20 15:20:30 +010056/**
57 * A register range, used for access related checks
58 * (readable/writeable/volatile/precious checks)
59 *
60 * @range_min: address of first register
61 * @range_max: address of last register
62 */
63struct regmap_range {
64 unsigned int range_min;
65 unsigned int range_max;
66};
67
68/*
69 * A table of ranges including some yes ranges and some no ranges.
70 * If a register belongs to a no_range, the corresponding check function
71 * will return false. If a register belongs to a yes range, the corresponding
72 * check function will return true. "no_ranges" are searched first.
73 *
74 * @yes_ranges : pointer to an array of regmap ranges used as "yes ranges"
75 * @n_yes_ranges: size of the above array
76 * @no_ranges: pointer to an array of regmap ranges used as "no ranges"
77 * @n_no_ranges: size of the above array
78 */
79struct regmap_access_table {
80 const struct regmap_range *yes_ranges;
81 unsigned int n_yes_ranges;
82 const struct regmap_range *no_ranges;
83 unsigned int n_no_ranges;
84};
85
Davide Ciminaghi0d4529c2012-10-16 15:56:59 +020086typedef void (*regmap_lock)(void *);
87typedef void (*regmap_unlock)(void *);
88
Mark Brownbd20eb52011-08-19 18:09:38 +090089/**
Mark Browndd898b22011-07-20 22:28:58 +010090 * Configuration for the register map of a device.
91 *
Stephen Warrend3c242e2012-04-04 15:48:29 -060092 * @name: Optional name of the regmap. Useful when a device has multiple
93 * register regions.
94 *
Mark Browndd898b22011-07-20 22:28:58 +010095 * @reg_bits: Number of bits in a register address, mandatory.
Stephen Warrenf01ee602012-04-09 13:40:24 -060096 * @reg_stride: The register address stride. Valid register addresses are a
97 * multiple of this value. If set to 0, a value of 1 will be
98 * used.
Mark Brown82159ba2012-01-18 10:52:25 +000099 * @pad_bits: Number of bits of padding between register and value.
Mark Browndd898b22011-07-20 22:28:58 +0100100 * @val_bits: Number of bits in a register value, mandatory.
Mark Brown2e2ae662011-07-20 22:33:39 +0100101 *
Mark Brown3566cc92011-08-09 10:23:22 +0900102 * @writeable_reg: Optional callback returning true if the register
Davide Ciminaghi76aad392012-11-20 15:20:30 +0100103 * can be written to. If this field is NULL but wr_table
104 * (see below) is not, the check is performed on such table
105 * (a register is writeable if it belongs to one of the ranges
106 * specified by wr_table).
Mark Brown3566cc92011-08-09 10:23:22 +0900107 * @readable_reg: Optional callback returning true if the register
Davide Ciminaghi76aad392012-11-20 15:20:30 +0100108 * can be read from. If this field is NULL but rd_table
109 * (see below) is not, the check is performed on such table
110 * (a register is readable if it belongs to one of the ranges
111 * specified by rd_table).
Mark Brown3566cc92011-08-09 10:23:22 +0900112 * @volatile_reg: Optional callback returning true if the register
Davide Ciminaghi76aad392012-11-20 15:20:30 +0100113 * value can't be cached. If this field is NULL but
114 * volatile_table (see below) is not, the check is performed on
115 * such table (a register is volatile if it belongs to one of
116 * the ranges specified by volatile_table).
Mark Brown3566cc92011-08-09 10:23:22 +0900117 * @precious_reg: Optional callback returning true if the rgister
Davide Ciminaghi76aad392012-11-20 15:20:30 +0100118 * should not be read outside of a call from the driver
119 * (eg, a clear on read interrupt status register). If this
120 * field is NULL but precious_table (see below) is not, the
121 * check is performed on such table (a register is precious if
122 * it belongs to one of the ranges specified by precious_table).
123 * @lock: Optional lock callback (overrides regmap's default lock
124 * function, based on spinlock or mutex).
125 * @unlock: As above for unlocking.
126 * @lock_arg: this field is passed as the only argument of lock/unlock
127 * functions (ignored in case regular lock/unlock functions
128 * are not overridden).
Mark Brownbd20eb52011-08-19 18:09:38 +0900129 *
130 * @max_register: Optional, specifies the maximum valid register index.
Davide Ciminaghi76aad392012-11-20 15:20:30 +0100131 * @wr_table: Optional, points to a struct regmap_access_table specifying
132 * valid ranges for write access.
133 * @rd_table: As above, for read access.
134 * @volatile_table: As above, for volatile registers.
135 * @precious_table: As above, for precious registers.
Mark Brownbd20eb52011-08-19 18:09:38 +0900136 * @reg_defaults: Power on reset values for registers (for use with
137 * register cache support).
138 * @num_reg_defaults: Number of elements in reg_defaults.
Lars-Peter Clausen6f306442011-09-05 20:46:32 +0200139 *
140 * @read_flag_mask: Mask to be set in the top byte of the register when doing
141 * a read.
142 * @write_flag_mask: Mask to be set in the top byte of the register when doing
143 * a write. If both read_flag_mask and write_flag_mask are
144 * empty the regmap_bus default masks are used.
Ashish Jangam2e33caf2012-04-30 23:23:40 +0100145 * @use_single_rw: If set, converts the bulk read and write operations into
146 * a series of single read and write operations. This is useful
147 * for device that does not support bulk read and write.
Dimitris Papastamos9fabe242011-09-19 14:34:00 +0100148 *
149 * @cache_type: The actual cache type.
150 * @reg_defaults_raw: Power on reset values for registers (for use with
151 * register cache support).
152 * @num_reg_defaults_raw: Number of elements in reg_defaults_raw.
Stephen Warren141eba22012-05-24 10:47:26 -0600153 * @reg_format_endian: Endianness for formatted register addresses. If this is
154 * DEFAULT, the @reg_format_endian_default value from the
155 * regmap bus is used.
156 * @val_format_endian: Endianness for formatted register values. If this is
157 * DEFAULT, the @reg_format_endian_default value from the
158 * regmap bus is used.
Krystian Garbaciak6863ca62012-06-15 11:23:56 +0100159 *
160 * @ranges: Array of configuration entries for virtual address ranges.
161 * @num_ranges: Number of range configuration entries.
Mark Browndd898b22011-07-20 22:28:58 +0100162 */
Mark Brownb83a3132011-05-11 19:59:58 +0200163struct regmap_config {
Stephen Warrend3c242e2012-04-04 15:48:29 -0600164 const char *name;
165
Mark Brownb83a3132011-05-11 19:59:58 +0200166 int reg_bits;
Stephen Warrenf01ee602012-04-09 13:40:24 -0600167 int reg_stride;
Mark Brown82159ba2012-01-18 10:52:25 +0000168 int pad_bits;
Mark Brownb83a3132011-05-11 19:59:58 +0200169 int val_bits;
Mark Brown2e2ae662011-07-20 22:33:39 +0100170
Mark Brown2e2ae662011-07-20 22:33:39 +0100171 bool (*writeable_reg)(struct device *dev, unsigned int reg);
172 bool (*readable_reg)(struct device *dev, unsigned int reg);
173 bool (*volatile_reg)(struct device *dev, unsigned int reg);
Mark Brown18694882011-08-08 15:40:22 +0900174 bool (*precious_reg)(struct device *dev, unsigned int reg);
Davide Ciminaghi0d4529c2012-10-16 15:56:59 +0200175 regmap_lock lock;
176 regmap_unlock unlock;
177 void *lock_arg;
Mark Brownbd20eb52011-08-19 18:09:38 +0900178
179 unsigned int max_register;
Davide Ciminaghi76aad392012-11-20 15:20:30 +0100180 const struct regmap_access_table *wr_table;
181 const struct regmap_access_table *rd_table;
182 const struct regmap_access_table *volatile_table;
183 const struct regmap_access_table *precious_table;
Lars-Peter Clausen720e4612011-11-16 16:28:17 +0100184 const struct reg_default *reg_defaults;
Dimitris Papastamos9fabe242011-09-19 14:34:00 +0100185 unsigned int num_reg_defaults;
186 enum regcache_type cache_type;
187 const void *reg_defaults_raw;
188 unsigned int num_reg_defaults_raw;
Lars-Peter Clausen6f306442011-09-05 20:46:32 +0200189
190 u8 read_flag_mask;
191 u8 write_flag_mask;
Ashish Jangam2e33caf2012-04-30 23:23:40 +0100192
193 bool use_single_rw;
Stephen Warren141eba22012-05-24 10:47:26 -0600194
195 enum regmap_endian reg_format_endian;
196 enum regmap_endian val_format_endian;
Mark Brown38e23192012-07-22 19:26:07 +0100197
Krystian Garbaciak6863ca62012-06-15 11:23:56 +0100198 const struct regmap_range_cfg *ranges;
Mark Browne3549cd2012-10-02 20:17:15 +0100199 unsigned int num_ranges;
Krystian Garbaciak6863ca62012-06-15 11:23:56 +0100200};
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 *
Mark Brownd058bb42012-10-03 12:40:47 +0100208 * @name: Descriptive name for diagnostics
209 *
Krystian Garbaciak6863ca62012-06-15 11:23:56 +0100210 * @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 */
220struct regmap_range_cfg {
Mark Brownd058bb42012-10-03 12:40:47 +0100221 const char *name;
222
Krystian Garbaciak6863ca62012-06-15 11:23:56 +0100223 /* Registers of virtual address range */
224 unsigned int range_min;
225 unsigned int range_max;
226
227 /* Page selector for indirect addressing */
228 unsigned int selector_reg;
229 unsigned int selector_mask;
230 int selector_shift;
231
232 /* Data window (per each page) */
233 unsigned int window_start;
234 unsigned int window_len;
Mark Brownb83a3132011-05-11 19:59:58 +0200235};
236
Stephen Warren0135bbc2012-04-04 15:48:30 -0600237typedef int (*regmap_hw_write)(void *context, const void *data,
Mark Brownb83a3132011-05-11 19:59:58 +0200238 size_t count);
Stephen Warren0135bbc2012-04-04 15:48:30 -0600239typedef int (*regmap_hw_gather_write)(void *context,
Mark Brownb83a3132011-05-11 19:59:58 +0200240 const void *reg, size_t reg_len,
241 const void *val, size_t val_len);
Stephen Warren0135bbc2012-04-04 15:48:30 -0600242typedef int (*regmap_hw_read)(void *context,
Mark Brownb83a3132011-05-11 19:59:58 +0200243 const void *reg_buf, size_t reg_size,
244 void *val_buf, size_t val_size);
Stephen Warren0135bbc2012-04-04 15:48:30 -0600245typedef void (*regmap_hw_free_context)(void *context);
Mark Brownb83a3132011-05-11 19:59:58 +0200246
247/**
248 * Description of a hardware bus for the register map infrastructure.
249 *
Stephen Warrenbacdbe02012-04-04 15:48:28 -0600250 * @fast_io: Register IO is fast. Use a spinlock instead of a mutex
Davide Ciminaghi0d4529c2012-10-16 15:56:59 +0200251 * to perform locking. This field is ignored if custom lock/unlock
252 * functions are used (see fields lock/unlock of
253 * struct regmap_config).
Mark Brownb83a3132011-05-11 19:59:58 +0200254 * @write: Write operation.
255 * @gather_write: Write operation with split register/value, return -ENOTSUPP
256 * if not implemented on a given device.
257 * @read: Read operation. Data is returned in the buffer used to transmit
258 * data.
Mark Brownb83a3132011-05-11 19:59:58 +0200259 * @read_flag_mask: Mask to be set in the top byte of the register when doing
260 * a read.
Stephen Warren141eba22012-05-24 10:47:26 -0600261 * @reg_format_endian_default: Default endianness for formatted register
262 * addresses. Used when the regmap_config specifies DEFAULT. If this is
263 * DEFAULT, BIG is assumed.
264 * @val_format_endian_default: Default endianness for formatted register
265 * values. Used when the regmap_config specifies DEFAULT. If this is
266 * DEFAULT, BIG is assumed.
Mark Brownb83a3132011-05-11 19:59:58 +0200267 */
268struct regmap_bus {
Stephen Warrenbacdbe02012-04-04 15:48:28 -0600269 bool fast_io;
Mark Brownb83a3132011-05-11 19:59:58 +0200270 regmap_hw_write write;
271 regmap_hw_gather_write gather_write;
272 regmap_hw_read read;
Stephen Warren0135bbc2012-04-04 15:48:30 -0600273 regmap_hw_free_context free_context;
Mark Brownb83a3132011-05-11 19:59:58 +0200274 u8 read_flag_mask;
Stephen Warren141eba22012-05-24 10:47:26 -0600275 enum regmap_endian reg_format_endian_default;
276 enum regmap_endian val_format_endian_default;
Mark Brownb83a3132011-05-11 19:59:58 +0200277};
278
279struct regmap *regmap_init(struct device *dev,
280 const struct regmap_bus *bus,
Stephen Warren0135bbc2012-04-04 15:48:30 -0600281 void *bus_context,
Mark Brownb83a3132011-05-11 19:59:58 +0200282 const struct regmap_config *config);
Mark Brown9943fa32011-06-20 19:02:29 +0100283struct regmap *regmap_init_i2c(struct i2c_client *i2c,
284 const struct regmap_config *config);
Mark Browna676f082011-05-12 11:42:10 +0200285struct regmap *regmap_init_spi(struct spi_device *dev,
286 const struct regmap_config *config);
Stephen Warren45f5ff82012-04-04 15:48:31 -0600287struct regmap *regmap_init_mmio(struct device *dev,
288 void __iomem *regs,
289 const struct regmap_config *config);
Mark Browna676f082011-05-12 11:42:10 +0200290
Mark Brownc0eb4672012-01-30 19:56:52 +0000291struct regmap *devm_regmap_init(struct device *dev,
292 const struct regmap_bus *bus,
Stephen Warren0135bbc2012-04-04 15:48:30 -0600293 void *bus_context,
Mark Brownc0eb4672012-01-30 19:56:52 +0000294 const struct regmap_config *config);
295struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,
296 const struct regmap_config *config);
297struct regmap *devm_regmap_init_spi(struct spi_device *dev,
298 const struct regmap_config *config);
Stephen Warren45f5ff82012-04-04 15:48:31 -0600299struct regmap *devm_regmap_init_mmio(struct device *dev,
300 void __iomem *regs,
301 const struct regmap_config *config);
Mark Brownc0eb4672012-01-30 19:56:52 +0000302
Mark Brownb83a3132011-05-11 19:59:58 +0200303void regmap_exit(struct regmap *map);
Mark Brownbf315172011-12-03 17:06:20 +0000304int regmap_reinit_cache(struct regmap *map,
305 const struct regmap_config *config);
Mark Brown72b39f62012-05-08 17:44:40 +0100306struct regmap *dev_get_regmap(struct device *dev, const char *name);
Mark Brownb83a3132011-05-11 19:59:58 +0200307int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
308int regmap_raw_write(struct regmap *map, unsigned int reg,
309 const void *val, size_t val_len);
Laxman Dewangan8eaeb212012-02-12 19:49:43 +0530310int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
311 size_t val_count);
Mark Brownb83a3132011-05-11 19:59:58 +0200312int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
313int regmap_raw_read(struct regmap *map, unsigned int reg,
314 void *val, size_t val_len);
315int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
316 size_t val_count);
317int regmap_update_bits(struct regmap *map, unsigned int reg,
318 unsigned int mask, unsigned int val);
Mark Brown018690d2011-11-29 20:10:36 +0000319int regmap_update_bits_check(struct regmap *map, unsigned int reg,
320 unsigned int mask, unsigned int val,
321 bool *change);
Mark Browna6539c32012-02-17 14:20:14 -0800322int regmap_get_val_bytes(struct regmap *map);
Mark Brownb83a3132011-05-11 19:59:58 +0200323
Mark Brown39a58432011-09-19 18:21:49 +0100324int regcache_sync(struct regmap *map);
Mark Brown4d4cfd12012-02-23 20:53:37 +0000325int regcache_sync_region(struct regmap *map, unsigned int min,
326 unsigned int max);
Mark Brown92afb282011-09-19 18:22:14 +0100327void regcache_cache_only(struct regmap *map, bool enable);
Dimitris Papastamos6eb0f5e2011-09-29 14:36:27 +0100328void regcache_cache_bypass(struct regmap *map, bool enable);
Mark Brown8ae0d7e2011-10-26 10:34:22 +0200329void regcache_mark_dirty(struct regmap *map);
Mark Brown92afb282011-09-19 18:22:14 +0100330
Mark Brown22f0d902012-01-21 12:01:14 +0000331int regmap_register_patch(struct regmap *map, const struct reg_default *regs,
332 int num_regs);
333
Davide Ciminaghi76aad392012-11-20 15:20:30 +0100334static inline bool regmap_reg_in_range(unsigned int reg,
335 const struct regmap_range *range)
336{
337 return reg >= range->range_min && reg <= range->range_max;
338}
339
340bool regmap_reg_in_ranges(unsigned int reg,
341 const struct regmap_range *ranges,
342 unsigned int nranges);
343
Mark Brownf8beab22011-10-28 23:50:49 +0200344/**
345 * Description of an IRQ for the generic regmap irq_chip.
346 *
347 * @reg_offset: Offset of the status/mask register within the bank
348 * @mask: Mask used to flag/control the register.
349 */
350struct regmap_irq {
351 unsigned int reg_offset;
352 unsigned int mask;
353};
354
355/**
356 * Description of a generic regmap irq_chip. This is not intended to
357 * handle every possible interrupt controller, but it should handle a
358 * substantial proportion of those that are found in the wild.
359 *
360 * @name: Descriptive name for IRQ controller.
361 *
362 * @status_base: Base status register address.
363 * @mask_base: Base mask register address.
364 * @ack_base: Base ack address. If zero then the chip is clear on read.
Mark Browna43fd502012-06-05 14:34:03 +0100365 * @wake_base: Base address for wake enables. If zero unsupported.
Graeme Gregory022f926a2012-05-14 22:40:43 +0900366 * @irq_reg_stride: Stride to use for chips where registers are not contiguous.
Mark Brown0c00c502012-07-24 15:41:19 +0100367 * @runtime_pm: Hold a runtime PM lock on the device when accessing it.
Mark Brownf8beab22011-10-28 23:50:49 +0200368 *
369 * @num_regs: Number of registers in each control bank.
370 * @irqs: Descriptors for individual IRQs. Interrupt numbers are
371 * assigned based on the index in the array of the interrupt.
372 * @num_irqs: Number of descriptors.
373 */
374struct regmap_irq_chip {
375 const char *name;
376
377 unsigned int status_base;
378 unsigned int mask_base;
379 unsigned int ack_base;
Mark Browna43fd502012-06-05 14:34:03 +0100380 unsigned int wake_base;
Graeme Gregory022f926a2012-05-14 22:40:43 +0900381 unsigned int irq_reg_stride;
Xiaofan Tian36ac9142012-08-30 17:03:35 +0800382 unsigned int mask_invert;
Mark Brown0c00c502012-07-24 15:41:19 +0100383 bool runtime_pm;
Mark Brownf8beab22011-10-28 23:50:49 +0200384
385 int num_regs;
386
387 const struct regmap_irq *irqs;
388 int num_irqs;
389};
390
391struct regmap_irq_chip_data;
392
393int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
Mark Brownb026ddb2012-05-31 21:01:46 +0100394 int irq_base, const struct regmap_irq_chip *chip,
Mark Brownf8beab22011-10-28 23:50:49 +0200395 struct regmap_irq_chip_data **data);
396void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
Mark Brown209a6002011-12-05 16:10:15 +0000397int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
Mark Brown4af8be62012-05-13 10:59:56 +0100398int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq);
Mark Brownb83a3132011-05-11 19:59:58 +0200399
Mark Brown9cde5fc2012-02-17 14:49:51 -0800400#else
401
402/*
403 * These stubs should only ever be called by generic code which has
404 * regmap based facilities, if they ever get called at runtime
405 * something is going wrong and something probably needs to select
406 * REGMAP.
407 */
408
409static inline int regmap_write(struct regmap *map, unsigned int reg,
410 unsigned int val)
411{
412 WARN_ONCE(1, "regmap API is disabled");
413 return -EINVAL;
414}
415
416static inline int regmap_raw_write(struct regmap *map, unsigned int reg,
417 const void *val, size_t val_len)
418{
419 WARN_ONCE(1, "regmap API is disabled");
420 return -EINVAL;
421}
422
423static inline int regmap_bulk_write(struct regmap *map, unsigned int reg,
424 const void *val, size_t val_count)
425{
426 WARN_ONCE(1, "regmap API is disabled");
427 return -EINVAL;
428}
429
430static inline int regmap_read(struct regmap *map, unsigned int reg,
431 unsigned int *val)
432{
433 WARN_ONCE(1, "regmap API is disabled");
434 return -EINVAL;
435}
436
437static inline int regmap_raw_read(struct regmap *map, unsigned int reg,
438 void *val, size_t val_len)
439{
440 WARN_ONCE(1, "regmap API is disabled");
441 return -EINVAL;
442}
443
444static inline int regmap_bulk_read(struct regmap *map, unsigned int reg,
445 void *val, size_t val_count)
446{
447 WARN_ONCE(1, "regmap API is disabled");
448 return -EINVAL;
449}
450
451static inline int regmap_update_bits(struct regmap *map, unsigned int reg,
452 unsigned int mask, unsigned int val)
453{
454 WARN_ONCE(1, "regmap API is disabled");
455 return -EINVAL;
456}
457
458static inline int regmap_update_bits_check(struct regmap *map,
459 unsigned int reg,
460 unsigned int mask, unsigned int val,
461 bool *change)
462{
463 WARN_ONCE(1, "regmap API is disabled");
464 return -EINVAL;
465}
466
467static inline int regmap_get_val_bytes(struct regmap *map)
468{
469 WARN_ONCE(1, "regmap API is disabled");
470 return -EINVAL;
471}
472
473static inline int regcache_sync(struct regmap *map)
474{
475 WARN_ONCE(1, "regmap API is disabled");
476 return -EINVAL;
477}
478
Mark Browna313f9f2012-02-23 19:49:43 +0000479static inline int regcache_sync_region(struct regmap *map, unsigned int min,
480 unsigned int max)
481{
482 WARN_ONCE(1, "regmap API is disabled");
483 return -EINVAL;
484}
485
Mark Brown9cde5fc2012-02-17 14:49:51 -0800486static inline void regcache_cache_only(struct regmap *map, bool enable)
487{
488 WARN_ONCE(1, "regmap API is disabled");
489}
490
491static inline void regcache_cache_bypass(struct regmap *map, bool enable)
492{
493 WARN_ONCE(1, "regmap API is disabled");
494}
495
496static inline void regcache_mark_dirty(struct regmap *map)
497{
498 WARN_ONCE(1, "regmap API is disabled");
499}
500
501static inline int regmap_register_patch(struct regmap *map,
502 const struct reg_default *regs,
503 int num_regs)
504{
505 WARN_ONCE(1, "regmap API is disabled");
506 return -EINVAL;
507}
508
Mark Brown72b39f62012-05-08 17:44:40 +0100509static inline struct regmap *dev_get_regmap(struct device *dev,
510 const char *name)
511{
Mark Brown72b39f62012-05-08 17:44:40 +0100512 return NULL;
513}
514
Mark Brown9cde5fc2012-02-17 14:49:51 -0800515#endif
516
Mark Brownb83a3132011-05-11 19:59:58 +0200517#endif