1#ifndef __LINUX_REGMAP_H
2#define __LINUX_REGMAP_H
3
4
5
6
7
8
9
10
11
12
13
14
15
16#include <linux/list.h>
17#include <linux/rbtree.h>
18#include <linux/err.h>
19#include <linux/bug.h>
20#include <linux/lockdep.h>
21
22struct module;
23struct device;
24struct i2c_client;
25struct irq_domain;
26struct spi_device;
27struct spmi_device;
28struct regmap;
29struct regmap_range_cfg;
30struct regmap_field;
31struct snd_ac97;
32
33
34enum regcache_type {
35 REGCACHE_NONE,
36 REGCACHE_RBTREE,
37 REGCACHE_COMPRESSED,
38 REGCACHE_FLAT,
39};
40
41
42
43
44
45
46
47
48
49struct reg_default {
50 unsigned int reg;
51 unsigned int def;
52};
53
54
55
56
57
58
59
60
61
62struct reg_sequence {
63 unsigned int reg;
64 unsigned int def;
65 unsigned int delay_us;
66};
67
68#define regmap_update_bits(map, reg, mask, val) \
69 regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
70#define regmap_update_bits_async(map, reg, mask, val)\
71 regmap_update_bits_base(map, reg, mask, val, NULL, true, false)
72#define regmap_update_bits_check(map, reg, mask, val, change)\
73 regmap_update_bits_base(map, reg, mask, val, change, false, false)
74#define regmap_update_bits_check_async(map, reg, mask, val, change)\
75 regmap_update_bits_base(map, reg, mask, val, change, true, false)
76
77#define regmap_write_bits(map, reg, mask, val) \
78 regmap_update_bits_base(map, reg, mask, val, NULL, false, true)
79
80#define regmap_field_write(field, val) \
81 regmap_field_update_bits_base(field, ~0, val, NULL, false, false)
82#define regmap_field_force_write(field, val) \
83 regmap_field_update_bits_base(field, ~0, val, NULL, false, true)
84#define regmap_field_update_bits(field, mask, val)\
85 regmap_field_update_bits_base(field, mask, val, NULL, false, false)
86#define regmap_field_force_update_bits(field, mask, val) \
87 regmap_field_update_bits_base(field, mask, val, NULL, false, true)
88
89#define regmap_fields_write(field, id, val) \
90 regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, false)
91#define regmap_fields_force_write(field, id, val) \
92 regmap_fields_update_bits_base(field, id, ~0, val, NULL, false, true)
93#define regmap_fields_update_bits(field, id, mask, val)\
94 regmap_fields_update_bits_base(field, id, mask, val, NULL, false, false)
95#define regmap_fields_force_update_bits(field, id, mask, val) \
96 regmap_fields_update_bits_base(field, id, mask, val, NULL, false, true)
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116#define regmap_read_poll_timeout(map, addr, val, cond, sleep_us, timeout_us) \
117({ \
118 ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \
119 int ret; \
120 might_sleep_if(sleep_us); \
121 for (;;) { \
122 ret = regmap_read((map), (addr), &(val)); \
123 if (ret) \
124 break; \
125 if (cond) \
126 break; \
127 if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \
128 ret = regmap_read((map), (addr), &(val)); \
129 break; \
130 } \
131 if (sleep_us) \
132 usleep_range((sleep_us >> 2) + 1, sleep_us); \
133 } \
134 ret ?: ((cond) ? 0 : -ETIMEDOUT); \
135})
136
137#ifdef CONFIG_REGMAP
138
139enum regmap_endian {
140
141 REGMAP_ENDIAN_DEFAULT = 0,
142 REGMAP_ENDIAN_BIG,
143 REGMAP_ENDIAN_LITTLE,
144 REGMAP_ENDIAN_NATIVE,
145};
146
147
148
149
150
151
152
153
154struct regmap_range {
155 unsigned int range_min;
156 unsigned int range_max;
157};
158
159#define regmap_reg_range(low, high) { .range_min = low, .range_max = high, }
160
161
162
163
164
165
166
167
168
169
170
171
172struct regmap_access_table {
173 const struct regmap_range *yes_ranges;
174 unsigned int n_yes_ranges;
175 const struct regmap_range *no_ranges;
176 unsigned int n_no_ranges;
177};
178
179typedef void (*regmap_lock)(void *);
180typedef void (*regmap_unlock)(void *);
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270struct regmap_config {
271 const char *name;
272
273 int reg_bits;
274 int reg_stride;
275 int pad_bits;
276 int val_bits;
277
278 bool (*writeable_reg)(struct device *dev, unsigned int reg);
279 bool (*readable_reg)(struct device *dev, unsigned int reg);
280 bool (*volatile_reg)(struct device *dev, unsigned int reg);
281 bool (*precious_reg)(struct device *dev, unsigned int reg);
282 regmap_lock lock;
283 regmap_unlock unlock;
284 void *lock_arg;
285
286 int (*reg_read)(void *context, unsigned int reg, unsigned int *val);
287 int (*reg_write)(void *context, unsigned int reg, unsigned int val);
288
289 bool fast_io;
290
291 unsigned int max_register;
292 const struct regmap_access_table *wr_table;
293 const struct regmap_access_table *rd_table;
294 const struct regmap_access_table *volatile_table;
295 const struct regmap_access_table *precious_table;
296 const struct reg_default *reg_defaults;
297 unsigned int num_reg_defaults;
298 enum regcache_type cache_type;
299 const void *reg_defaults_raw;
300 unsigned int num_reg_defaults_raw;
301
302 u8 read_flag_mask;
303 u8 write_flag_mask;
304
305 bool use_single_rw;
306 bool can_multi_write;
307
308 enum regmap_endian reg_format_endian;
309 enum regmap_endian val_format_endian;
310
311 const struct regmap_range_cfg *ranges;
312 unsigned int num_ranges;
313};
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333struct regmap_range_cfg {
334 const char *name;
335
336
337 unsigned int range_min;
338 unsigned int range_max;
339
340
341 unsigned int selector_reg;
342 unsigned int selector_mask;
343 int selector_shift;
344
345
346 unsigned int window_start;
347 unsigned int window_len;
348};
349
350struct regmap_async;
351
352typedef int (*regmap_hw_write)(void *context, const void *data,
353 size_t count);
354typedef int (*regmap_hw_gather_write)(void *context,
355 const void *reg, size_t reg_len,
356 const void *val, size_t val_len);
357typedef int (*regmap_hw_async_write)(void *context,
358 const void *reg, size_t reg_len,
359 const void *val, size_t val_len,
360 struct regmap_async *async);
361typedef int (*regmap_hw_read)(void *context,
362 const void *reg_buf, size_t reg_size,
363 void *val_buf, size_t val_size);
364typedef int (*regmap_hw_reg_read)(void *context, unsigned int reg,
365 unsigned int *val);
366typedef int (*regmap_hw_reg_write)(void *context, unsigned int reg,
367 unsigned int val);
368typedef int (*regmap_hw_reg_update_bits)(void *context, unsigned int reg,
369 unsigned int mask, unsigned int val);
370typedef struct regmap_async *(*regmap_hw_async_alloc)(void);
371typedef void (*regmap_hw_free_context)(void *context);
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403struct regmap_bus {
404 bool fast_io;
405 regmap_hw_write write;
406 regmap_hw_gather_write gather_write;
407 regmap_hw_async_write async_write;
408 regmap_hw_reg_write reg_write;
409 regmap_hw_reg_update_bits reg_update_bits;
410 regmap_hw_read read;
411 regmap_hw_reg_read reg_read;
412 regmap_hw_free_context free_context;
413 regmap_hw_async_alloc async_alloc;
414 u8 read_flag_mask;
415 enum regmap_endian reg_format_endian_default;
416 enum regmap_endian val_format_endian_default;
417 size_t max_raw_read;
418 size_t max_raw_write;
419};
420
421
422
423
424
425
426
427
428struct regmap *__regmap_init(struct device *dev,
429 const struct regmap_bus *bus,
430 void *bus_context,
431 const struct regmap_config *config,
432 struct lock_class_key *lock_key,
433 const char *lock_name);
434struct regmap *__regmap_init_i2c(struct i2c_client *i2c,
435 const struct regmap_config *config,
436 struct lock_class_key *lock_key,
437 const char *lock_name);
438struct regmap *__regmap_init_spi(struct spi_device *dev,
439 const struct regmap_config *config,
440 struct lock_class_key *lock_key,
441 const char *lock_name);
442struct regmap *__regmap_init_spmi_base(struct spmi_device *dev,
443 const struct regmap_config *config,
444 struct lock_class_key *lock_key,
445 const char *lock_name);
446struct regmap *__regmap_init_spmi_ext(struct spmi_device *dev,
447 const struct regmap_config *config,
448 struct lock_class_key *lock_key,
449 const char *lock_name);
450struct regmap *__regmap_init_mmio_clk(struct device *dev, const char *clk_id,
451 void __iomem *regs,
452 const struct regmap_config *config,
453 struct lock_class_key *lock_key,
454 const char *lock_name);
455struct regmap *__regmap_init_ac97(struct snd_ac97 *ac97,
456 const struct regmap_config *config,
457 struct lock_class_key *lock_key,
458 const char *lock_name);
459
460struct regmap *__devm_regmap_init(struct device *dev,
461 const struct regmap_bus *bus,
462 void *bus_context,
463 const struct regmap_config *config,
464 struct lock_class_key *lock_key,
465 const char *lock_name);
466struct regmap *__devm_regmap_init_i2c(struct i2c_client *i2c,
467 const struct regmap_config *config,
468 struct lock_class_key *lock_key,
469 const char *lock_name);
470struct regmap *__devm_regmap_init_spi(struct spi_device *dev,
471 const struct regmap_config *config,
472 struct lock_class_key *lock_key,
473 const char *lock_name);
474struct regmap *__devm_regmap_init_spmi_base(struct spmi_device *dev,
475 const struct regmap_config *config,
476 struct lock_class_key *lock_key,
477 const char *lock_name);
478struct regmap *__devm_regmap_init_spmi_ext(struct spmi_device *dev,
479 const struct regmap_config *config,
480 struct lock_class_key *lock_key,
481 const char *lock_name);
482struct regmap *__devm_regmap_init_mmio_clk(struct device *dev,
483 const char *clk_id,
484 void __iomem *regs,
485 const struct regmap_config *config,
486 struct lock_class_key *lock_key,
487 const char *lock_name);
488struct regmap *__devm_regmap_init_ac97(struct snd_ac97 *ac97,
489 const struct regmap_config *config,
490 struct lock_class_key *lock_key,
491 const char *lock_name);
492
493
494
495
496
497
498
499
500#ifdef CONFIG_LOCKDEP
501#define __regmap_lockdep_wrapper(fn, name, ...) \
502( \
503 ({ \
504 static struct lock_class_key _key; \
505 fn(__VA_ARGS__, &_key, \
506 KBUILD_BASENAME ":" \
507 __stringify(__LINE__) ":" \
508 "(" name ")->lock"); \
509 }) \
510)
511#else
512#define __regmap_lockdep_wrapper(fn, name, ...) fn(__VA_ARGS__, NULL, NULL)
513#endif
514
515
516
517
518
519
520
521
522
523
524
525
526
527#define regmap_init(dev, bus, bus_context, config) \
528 __regmap_lockdep_wrapper(__regmap_init, #config, \
529 dev, bus, bus_context, config)
530int regmap_attach_dev(struct device *dev, struct regmap *map,
531 const struct regmap_config *config);
532
533
534
535
536
537
538
539
540
541
542#define regmap_init_i2c(i2c, config) \
543 __regmap_lockdep_wrapper(__regmap_init_i2c, #config, \
544 i2c, config)
545
546
547
548
549
550
551
552
553
554
555#define regmap_init_spi(dev, config) \
556 __regmap_lockdep_wrapper(__regmap_init_spi, #config, \
557 dev, config)
558
559
560
561
562
563
564
565
566
567#define regmap_init_spmi_base(dev, config) \
568 __regmap_lockdep_wrapper(__regmap_init_spmi_base, #config, \
569 dev, config)
570
571
572
573
574
575
576
577
578
579#define regmap_init_spmi_ext(dev, config) \
580 __regmap_lockdep_wrapper(__regmap_init_spmi_ext, #config, \
581 dev, config)
582
583
584
585
586
587
588
589
590
591
592
593
594#define regmap_init_mmio_clk(dev, clk_id, regs, config) \
595 __regmap_lockdep_wrapper(__regmap_init_mmio_clk, #config, \
596 dev, clk_id, regs, config)
597
598
599
600
601
602
603
604
605
606
607
608#define regmap_init_mmio(dev, regs, config) \
609 regmap_init_mmio_clk(dev, NULL, regs, config)
610
611
612
613
614
615
616
617
618
619
620#define regmap_init_ac97(ac97, config) \
621 __regmap_lockdep_wrapper(__regmap_init_ac97, #config, \
622 ac97, config)
623bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg);
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638#define devm_regmap_init(dev, bus, bus_context, config) \
639 __regmap_lockdep_wrapper(__devm_regmap_init, #config, \
640 dev, bus, bus_context, config)
641
642
643
644
645
646
647
648
649
650
651
652#define devm_regmap_init_i2c(i2c, config) \
653 __regmap_lockdep_wrapper(__devm_regmap_init_i2c, #config, \
654 i2c, config)
655
656
657
658
659
660
661
662
663
664
665
666#define devm_regmap_init_spi(dev, config) \
667 __regmap_lockdep_wrapper(__devm_regmap_init_spi, #config, \
668 dev, config)
669
670
671
672
673
674
675
676
677
678
679#define devm_regmap_init_spmi_base(dev, config) \
680 __regmap_lockdep_wrapper(__devm_regmap_init_spmi_base, #config, \
681 dev, config)
682
683
684
685
686
687
688
689
690
691
692#define devm_regmap_init_spmi_ext(dev, config) \
693 __regmap_lockdep_wrapper(__devm_regmap_init_spmi_ext, #config, \
694 dev, config)
695
696
697
698
699
700
701
702
703
704
705
706
707
708#define devm_regmap_init_mmio_clk(dev, clk_id, regs, config) \
709 __regmap_lockdep_wrapper(__devm_regmap_init_mmio_clk, #config, \
710 dev, clk_id, regs, config)
711
712
713
714
715
716
717
718
719
720
721
722
723#define devm_regmap_init_mmio(dev, regs, config) \
724 devm_regmap_init_mmio_clk(dev, NULL, regs, config)
725
726
727
728
729
730
731
732
733
734
735
736#define devm_regmap_init_ac97(ac97, config) \
737 __regmap_lockdep_wrapper(__devm_regmap_init_ac97, #config, \
738 ac97, config)
739
740void regmap_exit(struct regmap *map);
741int regmap_reinit_cache(struct regmap *map,
742 const struct regmap_config *config);
743struct regmap *dev_get_regmap(struct device *dev, const char *name);
744struct device *regmap_get_device(struct regmap *map);
745int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
746int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val);
747int regmap_raw_write(struct regmap *map, unsigned int reg,
748 const void *val, size_t val_len);
749int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
750 size_t val_count);
751int regmap_multi_reg_write(struct regmap *map, const struct reg_sequence *regs,
752 int num_regs);
753int regmap_multi_reg_write_bypassed(struct regmap *map,
754 const struct reg_sequence *regs,
755 int num_regs);
756int regmap_raw_write_async(struct regmap *map, unsigned int reg,
757 const void *val, size_t val_len);
758int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
759int regmap_raw_read(struct regmap *map, unsigned int reg,
760 void *val, size_t val_len);
761int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
762 size_t val_count);
763int regmap_update_bits_base(struct regmap *map, unsigned int reg,
764 unsigned int mask, unsigned int val,
765 bool *change, bool async, bool force);
766int regmap_get_val_bytes(struct regmap *map);
767int regmap_get_max_register(struct regmap *map);
768int regmap_get_reg_stride(struct regmap *map);
769int regmap_async_complete(struct regmap *map);
770bool regmap_can_raw_write(struct regmap *map);
771size_t regmap_get_raw_read_max(struct regmap *map);
772size_t regmap_get_raw_write_max(struct regmap *map);
773
774int regcache_sync(struct regmap *map);
775int regcache_sync_region(struct regmap *map, unsigned int min,
776 unsigned int max);
777int regcache_drop_region(struct regmap *map, unsigned int min,
778 unsigned int max);
779void regcache_cache_only(struct regmap *map, bool enable);
780void regcache_cache_bypass(struct regmap *map, bool enable);
781void regcache_mark_dirty(struct regmap *map);
782
783bool regmap_check_range_table(struct regmap *map, unsigned int reg,
784 const struct regmap_access_table *table);
785
786int regmap_register_patch(struct regmap *map, const struct reg_sequence *regs,
787 int num_regs);
788int regmap_parse_val(struct regmap *map, const void *buf,
789 unsigned int *val);
790
791static inline bool regmap_reg_in_range(unsigned int reg,
792 const struct regmap_range *range)
793{
794 return reg >= range->range_min && reg <= range->range_max;
795}
796
797bool regmap_reg_in_ranges(unsigned int reg,
798 const struct regmap_range *ranges,
799 unsigned int nranges);
800
801
802
803
804
805
806
807
808
809
810struct reg_field {
811 unsigned int reg;
812 unsigned int lsb;
813 unsigned int msb;
814 unsigned int id_size;
815 unsigned int id_offset;
816};
817
818#define REG_FIELD(_reg, _lsb, _msb) { \
819 .reg = _reg, \
820 .lsb = _lsb, \
821 .msb = _msb, \
822 }
823
824struct regmap_field *regmap_field_alloc(struct regmap *regmap,
825 struct reg_field reg_field);
826void regmap_field_free(struct regmap_field *field);
827
828struct regmap_field *devm_regmap_field_alloc(struct device *dev,
829 struct regmap *regmap, struct reg_field reg_field);
830void devm_regmap_field_free(struct device *dev, struct regmap_field *field);
831
832int regmap_field_read(struct regmap_field *field, unsigned int *val);
833int regmap_field_update_bits_base(struct regmap_field *field,
834 unsigned int mask, unsigned int val,
835 bool *change, bool async, bool force);
836int regmap_fields_read(struct regmap_field *field, unsigned int id,
837 unsigned int *val);
838int regmap_fields_update_bits_base(struct regmap_field *field, unsigned int id,
839 unsigned int mask, unsigned int val,
840 bool *change, bool async, bool force);
841
842
843
844
845
846
847
848
849
850
851struct regmap_irq {
852 unsigned int reg_offset;
853 unsigned int mask;
854 unsigned int type_reg_offset;
855 unsigned int type_rising_mask;
856 unsigned int type_falling_mask;
857};
858
859#define REGMAP_IRQ_REG(_irq, _off, _mask) \
860 [_irq] = { .reg_offset = (_off), .mask = (_mask) }
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900struct regmap_irq_chip {
901 const char *name;
902
903 unsigned int status_base;
904 unsigned int mask_base;
905 unsigned int unmask_base;
906 unsigned int ack_base;
907 unsigned int wake_base;
908 unsigned int type_base;
909 unsigned int irq_reg_stride;
910 bool init_ack_masked:1;
911 bool mask_invert:1;
912 bool use_ack:1;
913 bool ack_invert:1;
914 bool wake_invert:1;
915 bool runtime_pm:1;
916 bool type_invert:1;
917
918 int num_regs;
919
920 const struct regmap_irq *irqs;
921 int num_irqs;
922
923 int num_type_reg;
924 unsigned int type_reg_stride;
925
926 int (*handle_pre_irq)(void *irq_drv_data);
927 int (*handle_post_irq)(void *irq_drv_data);
928 void *irq_drv_data;
929};
930
931struct regmap_irq_chip_data;
932
933int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
934 int irq_base, const struct regmap_irq_chip *chip,
935 struct regmap_irq_chip_data **data);
936void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
937
938int devm_regmap_add_irq_chip(struct device *dev, struct regmap *map, int irq,
939 int irq_flags, int irq_base,
940 const struct regmap_irq_chip *chip,
941 struct regmap_irq_chip_data **data);
942void devm_regmap_del_irq_chip(struct device *dev, int irq,
943 struct regmap_irq_chip_data *data);
944
945int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
946int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq);
947struct irq_domain *regmap_irq_get_domain(struct regmap_irq_chip_data *data);
948
949#else
950
951
952
953
954
955
956
957
958static inline int regmap_write(struct regmap *map, unsigned int reg,
959 unsigned int val)
960{
961 WARN_ONCE(1, "regmap API is disabled");
962 return -EINVAL;
963}
964
965static inline int regmap_write_async(struct regmap *map, unsigned int reg,
966 unsigned int val)
967{
968 WARN_ONCE(1, "regmap API is disabled");
969 return -EINVAL;
970}
971
972static inline int regmap_raw_write(struct regmap *map, unsigned int reg,
973 const void *val, size_t val_len)
974{
975 WARN_ONCE(1, "regmap API is disabled");
976 return -EINVAL;
977}
978
979static inline int regmap_raw_write_async(struct regmap *map, unsigned int reg,
980 const void *val, size_t val_len)
981{
982 WARN_ONCE(1, "regmap API is disabled");
983 return -EINVAL;
984}
985
986static inline int regmap_bulk_write(struct regmap *map, unsigned int reg,
987 const void *val, size_t val_count)
988{
989 WARN_ONCE(1, "regmap API is disabled");
990 return -EINVAL;
991}
992
993static inline int regmap_read(struct regmap *map, unsigned int reg,
994 unsigned int *val)
995{
996 WARN_ONCE(1, "regmap API is disabled");
997 return -EINVAL;
998}
999
1000static inline int regmap_raw_read(struct regmap *map, unsigned int reg,
1001 void *val, size_t val_len)
1002{
1003 WARN_ONCE(1, "regmap API is disabled");
1004 return -EINVAL;
1005}
1006
1007static inline int regmap_bulk_read(struct regmap *map, unsigned int reg,
1008 void *val, size_t val_count)
1009{
1010 WARN_ONCE(1, "regmap API is disabled");
1011 return -EINVAL;
1012}
1013
1014static inline int regmap_update_bits_base(struct regmap *map, unsigned int reg,
1015 unsigned int mask, unsigned int val,
1016 bool *change, bool async, bool force)
1017{
1018 WARN_ONCE(1, "regmap API is disabled");
1019 return -EINVAL;
1020}
1021
1022static inline int regmap_field_update_bits_base(struct regmap_field *field,
1023 unsigned int mask, unsigned int val,
1024 bool *change, bool async, bool force)
1025{
1026 WARN_ONCE(1, "regmap API is disabled");
1027 return -EINVAL;
1028}
1029
1030static inline int regmap_fields_update_bits_base(struct regmap_field *field,
1031 unsigned int id,
1032 unsigned int mask, unsigned int val,
1033 bool *change, bool async, bool force)
1034{
1035 WARN_ONCE(1, "regmap API is disabled");
1036 return -EINVAL;
1037}
1038
1039static inline int regmap_get_val_bytes(struct regmap *map)
1040{
1041 WARN_ONCE(1, "regmap API is disabled");
1042 return -EINVAL;
1043}
1044
1045static inline int regmap_get_max_register(struct regmap *map)
1046{
1047 WARN_ONCE(1, "regmap API is disabled");
1048 return -EINVAL;
1049}
1050
1051static inline int regmap_get_reg_stride(struct regmap *map)
1052{
1053 WARN_ONCE(1, "regmap API is disabled");
1054 return -EINVAL;
1055}
1056
1057static inline int regcache_sync(struct regmap *map)
1058{
1059 WARN_ONCE(1, "regmap API is disabled");
1060 return -EINVAL;
1061}
1062
1063static inline int regcache_sync_region(struct regmap *map, unsigned int min,
1064 unsigned int max)
1065{
1066 WARN_ONCE(1, "regmap API is disabled");
1067 return -EINVAL;
1068}
1069
1070static inline int regcache_drop_region(struct regmap *map, unsigned int min,
1071 unsigned int max)
1072{
1073 WARN_ONCE(1, "regmap API is disabled");
1074 return -EINVAL;
1075}
1076
1077static inline void regcache_cache_only(struct regmap *map, bool enable)
1078{
1079 WARN_ONCE(1, "regmap API is disabled");
1080}
1081
1082static inline void regcache_cache_bypass(struct regmap *map, bool enable)
1083{
1084 WARN_ONCE(1, "regmap API is disabled");
1085}
1086
1087static inline void regcache_mark_dirty(struct regmap *map)
1088{
1089 WARN_ONCE(1, "regmap API is disabled");
1090}
1091
1092static inline void regmap_async_complete(struct regmap *map)
1093{
1094 WARN_ONCE(1, "regmap API is disabled");
1095}
1096
1097static inline int regmap_register_patch(struct regmap *map,
1098 const struct reg_sequence *regs,
1099 int num_regs)
1100{
1101 WARN_ONCE(1, "regmap API is disabled");
1102 return -EINVAL;
1103}
1104
1105static inline int regmap_parse_val(struct regmap *map, const void *buf,
1106 unsigned int *val)
1107{
1108 WARN_ONCE(1, "regmap API is disabled");
1109 return -EINVAL;
1110}
1111
1112static inline struct regmap *dev_get_regmap(struct device *dev,
1113 const char *name)
1114{
1115 return NULL;
1116}
1117
1118static inline struct device *regmap_get_device(struct regmap *map)
1119{
1120 WARN_ONCE(1, "regmap API is disabled");
1121 return NULL;
1122}
1123
1124#endif
1125
1126#endif
1127