0001
0002 #ifndef __LINUX_REGMAP_H
0003 #define __LINUX_REGMAP_H
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include <linux/list.h>
0014 #include <linux/rbtree.h>
0015 #include <linux/ktime.h>
0016 #include <linux/delay.h>
0017 #include <linux/err.h>
0018 #include <linux/bug.h>
0019 #include <linux/lockdep.h>
0020 #include <linux/iopoll.h>
0021 #include <linux/fwnode.h>
0022
0023 struct module;
0024 struct clk;
0025 struct device;
0026 struct device_node;
0027 struct i2c_client;
0028 struct i3c_device;
0029 struct irq_domain;
0030 struct mdio_device;
0031 struct slim_device;
0032 struct spi_device;
0033 struct spmi_device;
0034 struct regmap;
0035 struct regmap_range_cfg;
0036 struct regmap_field;
0037 struct snd_ac97;
0038 struct sdw_slave;
0039
0040
0041 enum regcache_type {
0042 REGCACHE_NONE,
0043 REGCACHE_RBTREE,
0044 REGCACHE_COMPRESSED,
0045 REGCACHE_FLAT,
0046 };
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057 struct reg_default {
0058 unsigned int reg;
0059 unsigned int def;
0060 };
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072 struct reg_sequence {
0073 unsigned int reg;
0074 unsigned int def;
0075 unsigned int delay_us;
0076 };
0077
0078 #define REG_SEQ(_reg, _def, _delay_us) { \
0079 .reg = _reg, \
0080 .def = _def, \
0081 .delay_us = _delay_us, \
0082 }
0083 #define REG_SEQ0(_reg, _def) REG_SEQ(_reg, _def, 0)
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104 #define regmap_read_poll_timeout(map, addr, val, cond, sleep_us, timeout_us) \
0105 ({ \
0106 int __ret, __tmp; \
0107 __tmp = read_poll_timeout(regmap_read, __ret, __ret || (cond), \
0108 sleep_us, timeout_us, false, (map), (addr), &(val)); \
0109 __ret ?: __tmp; \
0110 })
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134 #define regmap_read_poll_timeout_atomic(map, addr, val, cond, delay_us, timeout_us) \
0135 ({ \
0136 u64 __timeout_us = (timeout_us); \
0137 unsigned long __delay_us = (delay_us); \
0138 ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \
0139 int __ret; \
0140 for (;;) { \
0141 __ret = regmap_read((map), (addr), &(val)); \
0142 if (__ret) \
0143 break; \
0144 if (cond) \
0145 break; \
0146 if ((__timeout_us) && \
0147 ktime_compare(ktime_get(), __timeout) > 0) { \
0148 __ret = regmap_read((map), (addr), &(val)); \
0149 break; \
0150 } \
0151 if (__delay_us) \
0152 udelay(__delay_us); \
0153 } \
0154 __ret ?: ((cond) ? 0 : -ETIMEDOUT); \
0155 })
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175 #define regmap_field_read_poll_timeout(field, val, cond, sleep_us, timeout_us) \
0176 ({ \
0177 int __ret, __tmp; \
0178 __tmp = read_poll_timeout(regmap_field_read, __ret, __ret || (cond), \
0179 sleep_us, timeout_us, false, (field), &(val)); \
0180 __ret ?: __tmp; \
0181 })
0182
0183 #ifdef CONFIG_REGMAP
0184
0185 enum regmap_endian {
0186
0187 REGMAP_ENDIAN_DEFAULT = 0,
0188 REGMAP_ENDIAN_BIG,
0189 REGMAP_ENDIAN_LITTLE,
0190 REGMAP_ENDIAN_NATIVE,
0191 };
0192
0193
0194
0195
0196
0197
0198
0199
0200 struct regmap_range {
0201 unsigned int range_min;
0202 unsigned int range_max;
0203 };
0204
0205 #define regmap_reg_range(low, high) { .range_min = low, .range_max = high, }
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220 struct regmap_access_table {
0221 const struct regmap_range *yes_ranges;
0222 unsigned int n_yes_ranges;
0223 const struct regmap_range *no_ranges;
0224 unsigned int n_no_ranges;
0225 };
0226
0227 typedef void (*regmap_lock)(void *);
0228 typedef void (*regmap_unlock)(void *);
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338
0339
0340
0341
0342
0343
0344
0345
0346
0347
0348
0349
0350
0351
0352
0353
0354
0355
0356
0357
0358
0359
0360
0361
0362
0363
0364
0365
0366
0367
0368 struct regmap_config {
0369 const char *name;
0370
0371 int reg_bits;
0372 int reg_stride;
0373 int reg_downshift;
0374 unsigned int reg_base;
0375 int pad_bits;
0376 int val_bits;
0377
0378 bool (*writeable_reg)(struct device *dev, unsigned int reg);
0379 bool (*readable_reg)(struct device *dev, unsigned int reg);
0380 bool (*volatile_reg)(struct device *dev, unsigned int reg);
0381 bool (*precious_reg)(struct device *dev, unsigned int reg);
0382 bool (*writeable_noinc_reg)(struct device *dev, unsigned int reg);
0383 bool (*readable_noinc_reg)(struct device *dev, unsigned int reg);
0384
0385 bool disable_locking;
0386 regmap_lock lock;
0387 regmap_unlock unlock;
0388 void *lock_arg;
0389
0390 int (*reg_read)(void *context, unsigned int reg, unsigned int *val);
0391 int (*reg_write)(void *context, unsigned int reg, unsigned int val);
0392 int (*reg_update_bits)(void *context, unsigned int reg,
0393 unsigned int mask, unsigned int val);
0394
0395 int (*read)(void *context, const void *reg_buf, size_t reg_size,
0396 void *val_buf, size_t val_size);
0397 int (*write)(void *context, const void *data, size_t count);
0398 size_t max_raw_read;
0399 size_t max_raw_write;
0400
0401 bool fast_io;
0402
0403 unsigned int max_register;
0404 const struct regmap_access_table *wr_table;
0405 const struct regmap_access_table *rd_table;
0406 const struct regmap_access_table *volatile_table;
0407 const struct regmap_access_table *precious_table;
0408 const struct regmap_access_table *wr_noinc_table;
0409 const struct regmap_access_table *rd_noinc_table;
0410 const struct reg_default *reg_defaults;
0411 unsigned int num_reg_defaults;
0412 enum regcache_type cache_type;
0413 const void *reg_defaults_raw;
0414 unsigned int num_reg_defaults_raw;
0415
0416 unsigned long read_flag_mask;
0417 unsigned long write_flag_mask;
0418 bool zero_flag_mask;
0419
0420 bool use_single_read;
0421 bool use_single_write;
0422 bool use_relaxed_mmio;
0423 bool can_multi_write;
0424
0425 enum regmap_endian reg_format_endian;
0426 enum regmap_endian val_format_endian;
0427
0428 const struct regmap_range_cfg *ranges;
0429 unsigned int num_ranges;
0430
0431 bool use_hwlock;
0432 bool use_raw_spinlock;
0433 unsigned int hwlock_id;
0434 unsigned int hwlock_mode;
0435
0436 bool can_sleep;
0437 };
0438
0439
0440
0441
0442
0443
0444
0445
0446
0447
0448
0449
0450
0451
0452
0453
0454
0455
0456
0457
0458
0459 struct regmap_range_cfg {
0460 const char *name;
0461
0462
0463 unsigned int range_min;
0464 unsigned int range_max;
0465
0466
0467 unsigned int selector_reg;
0468 unsigned int selector_mask;
0469 int selector_shift;
0470
0471
0472 unsigned int window_start;
0473 unsigned int window_len;
0474 };
0475
0476 struct regmap_async;
0477
0478 typedef int (*regmap_hw_write)(void *context, const void *data,
0479 size_t count);
0480 typedef int (*regmap_hw_gather_write)(void *context,
0481 const void *reg, size_t reg_len,
0482 const void *val, size_t val_len);
0483 typedef int (*regmap_hw_async_write)(void *context,
0484 const void *reg, size_t reg_len,
0485 const void *val, size_t val_len,
0486 struct regmap_async *async);
0487 typedef int (*regmap_hw_read)(void *context,
0488 const void *reg_buf, size_t reg_size,
0489 void *val_buf, size_t val_size);
0490 typedef int (*regmap_hw_reg_read)(void *context, unsigned int reg,
0491 unsigned int *val);
0492 typedef int (*regmap_hw_reg_write)(void *context, unsigned int reg,
0493 unsigned int val);
0494 typedef int (*regmap_hw_reg_update_bits)(void *context, unsigned int reg,
0495 unsigned int mask, unsigned int val);
0496 typedef struct regmap_async *(*regmap_hw_async_alloc)(void);
0497 typedef void (*regmap_hw_free_context)(void *context);
0498
0499
0500
0501
0502
0503
0504
0505
0506
0507
0508
0509
0510
0511
0512
0513
0514
0515
0516
0517
0518
0519
0520
0521
0522
0523
0524
0525
0526
0527
0528
0529
0530
0531
0532
0533
0534
0535 struct regmap_bus {
0536 bool fast_io;
0537 regmap_hw_write write;
0538 regmap_hw_gather_write gather_write;
0539 regmap_hw_async_write async_write;
0540 regmap_hw_reg_write reg_write;
0541 regmap_hw_reg_update_bits reg_update_bits;
0542 regmap_hw_read read;
0543 regmap_hw_reg_read reg_read;
0544 regmap_hw_free_context free_context;
0545 regmap_hw_async_alloc async_alloc;
0546 u8 read_flag_mask;
0547 enum regmap_endian reg_format_endian_default;
0548 enum regmap_endian val_format_endian_default;
0549 size_t max_raw_read;
0550 size_t max_raw_write;
0551 bool free_on_exit;
0552 };
0553
0554
0555
0556
0557
0558
0559
0560
0561 struct regmap *__regmap_init(struct device *dev,
0562 const struct regmap_bus *bus,
0563 void *bus_context,
0564 const struct regmap_config *config,
0565 struct lock_class_key *lock_key,
0566 const char *lock_name);
0567 struct regmap *__regmap_init_i2c(struct i2c_client *i2c,
0568 const struct regmap_config *config,
0569 struct lock_class_key *lock_key,
0570 const char *lock_name);
0571 struct regmap *__regmap_init_mdio(struct mdio_device *mdio_dev,
0572 const struct regmap_config *config,
0573 struct lock_class_key *lock_key,
0574 const char *lock_name);
0575 struct regmap *__regmap_init_sccb(struct i2c_client *i2c,
0576 const struct regmap_config *config,
0577 struct lock_class_key *lock_key,
0578 const char *lock_name);
0579 struct regmap *__regmap_init_slimbus(struct slim_device *slimbus,
0580 const struct regmap_config *config,
0581 struct lock_class_key *lock_key,
0582 const char *lock_name);
0583 struct regmap *__regmap_init_spi(struct spi_device *dev,
0584 const struct regmap_config *config,
0585 struct lock_class_key *lock_key,
0586 const char *lock_name);
0587 struct regmap *__regmap_init_spmi_base(struct spmi_device *dev,
0588 const struct regmap_config *config,
0589 struct lock_class_key *lock_key,
0590 const char *lock_name);
0591 struct regmap *__regmap_init_spmi_ext(struct spmi_device *dev,
0592 const struct regmap_config *config,
0593 struct lock_class_key *lock_key,
0594 const char *lock_name);
0595 struct regmap *__regmap_init_w1(struct device *w1_dev,
0596 const struct regmap_config *config,
0597 struct lock_class_key *lock_key,
0598 const char *lock_name);
0599 struct regmap *__regmap_init_mmio_clk(struct device *dev, const char *clk_id,
0600 void __iomem *regs,
0601 const struct regmap_config *config,
0602 struct lock_class_key *lock_key,
0603 const char *lock_name);
0604 struct regmap *__regmap_init_ac97(struct snd_ac97 *ac97,
0605 const struct regmap_config *config,
0606 struct lock_class_key *lock_key,
0607 const char *lock_name);
0608 struct regmap *__regmap_init_sdw(struct sdw_slave *sdw,
0609 const struct regmap_config *config,
0610 struct lock_class_key *lock_key,
0611 const char *lock_name);
0612 struct regmap *__regmap_init_sdw_mbq(struct sdw_slave *sdw,
0613 const struct regmap_config *config,
0614 struct lock_class_key *lock_key,
0615 const char *lock_name);
0616 struct regmap *__regmap_init_spi_avmm(struct spi_device *spi,
0617 const struct regmap_config *config,
0618 struct lock_class_key *lock_key,
0619 const char *lock_name);
0620
0621 struct regmap *__devm_regmap_init(struct device *dev,
0622 const struct regmap_bus *bus,
0623 void *bus_context,
0624 const struct regmap_config *config,
0625 struct lock_class_key *lock_key,
0626 const char *lock_name);
0627 struct regmap *__devm_regmap_init_i2c(struct i2c_client *i2c,
0628 const struct regmap_config *config,
0629 struct lock_class_key *lock_key,
0630 const char *lock_name);
0631 struct regmap *__devm_regmap_init_mdio(struct mdio_device *mdio_dev,
0632 const struct regmap_config *config,
0633 struct lock_class_key *lock_key,
0634 const char *lock_name);
0635 struct regmap *__devm_regmap_init_sccb(struct i2c_client *i2c,
0636 const struct regmap_config *config,
0637 struct lock_class_key *lock_key,
0638 const char *lock_name);
0639 struct regmap *__devm_regmap_init_spi(struct spi_device *dev,
0640 const struct regmap_config *config,
0641 struct lock_class_key *lock_key,
0642 const char *lock_name);
0643 struct regmap *__devm_regmap_init_spmi_base(struct spmi_device *dev,
0644 const struct regmap_config *config,
0645 struct lock_class_key *lock_key,
0646 const char *lock_name);
0647 struct regmap *__devm_regmap_init_spmi_ext(struct spmi_device *dev,
0648 const struct regmap_config *config,
0649 struct lock_class_key *lock_key,
0650 const char *lock_name);
0651 struct regmap *__devm_regmap_init_w1(struct device *w1_dev,
0652 const struct regmap_config *config,
0653 struct lock_class_key *lock_key,
0654 const char *lock_name);
0655 struct regmap *__devm_regmap_init_mmio_clk(struct device *dev,
0656 const char *clk_id,
0657 void __iomem *regs,
0658 const struct regmap_config *config,
0659 struct lock_class_key *lock_key,
0660 const char *lock_name);
0661 struct regmap *__devm_regmap_init_ac97(struct snd_ac97 *ac97,
0662 const struct regmap_config *config,
0663 struct lock_class_key *lock_key,
0664 const char *lock_name);
0665 struct regmap *__devm_regmap_init_sdw(struct sdw_slave *sdw,
0666 const struct regmap_config *config,
0667 struct lock_class_key *lock_key,
0668 const char *lock_name);
0669 struct regmap *__devm_regmap_init_sdw_mbq(struct sdw_slave *sdw,
0670 const struct regmap_config *config,
0671 struct lock_class_key *lock_key,
0672 const char *lock_name);
0673 struct regmap *__devm_regmap_init_slimbus(struct slim_device *slimbus,
0674 const struct regmap_config *config,
0675 struct lock_class_key *lock_key,
0676 const char *lock_name);
0677 struct regmap *__devm_regmap_init_i3c(struct i3c_device *i3c,
0678 const struct regmap_config *config,
0679 struct lock_class_key *lock_key,
0680 const char *lock_name);
0681 struct regmap *__devm_regmap_init_spi_avmm(struct spi_device *spi,
0682 const struct regmap_config *config,
0683 struct lock_class_key *lock_key,
0684 const char *lock_name);
0685
0686
0687
0688
0689
0690
0691
0692 #ifdef CONFIG_LOCKDEP
0693 #define __regmap_lockdep_wrapper(fn, name, ...) \
0694 ( \
0695 ({ \
0696 static struct lock_class_key _key; \
0697 fn(__VA_ARGS__, &_key, \
0698 KBUILD_BASENAME ":" \
0699 __stringify(__LINE__) ":" \
0700 "(" name ")->lock"); \
0701 }) \
0702 )
0703 #else
0704 #define __regmap_lockdep_wrapper(fn, name, ...) fn(__VA_ARGS__, NULL, NULL)
0705 #endif
0706
0707
0708
0709
0710
0711
0712
0713
0714
0715
0716
0717
0718
0719 #define regmap_init(dev, bus, bus_context, config) \
0720 __regmap_lockdep_wrapper(__regmap_init, #config, \
0721 dev, bus, bus_context, config)
0722 int regmap_attach_dev(struct device *dev, struct regmap *map,
0723 const struct regmap_config *config);
0724
0725
0726
0727
0728
0729
0730
0731
0732
0733
0734 #define regmap_init_i2c(i2c, config) \
0735 __regmap_lockdep_wrapper(__regmap_init_i2c, #config, \
0736 i2c, config)
0737
0738
0739
0740
0741
0742
0743
0744
0745
0746
0747 #define regmap_init_mdio(mdio_dev, config) \
0748 __regmap_lockdep_wrapper(__regmap_init_mdio, #config, \
0749 mdio_dev, config)
0750
0751
0752
0753
0754
0755
0756
0757
0758
0759
0760 #define regmap_init_sccb(i2c, config) \
0761 __regmap_lockdep_wrapper(__regmap_init_sccb, #config, \
0762 i2c, config)
0763
0764
0765
0766
0767
0768
0769
0770
0771
0772
0773 #define regmap_init_slimbus(slimbus, config) \
0774 __regmap_lockdep_wrapper(__regmap_init_slimbus, #config, \
0775 slimbus, config)
0776
0777
0778
0779
0780
0781
0782
0783
0784
0785
0786 #define regmap_init_spi(dev, config) \
0787 __regmap_lockdep_wrapper(__regmap_init_spi, #config, \
0788 dev, config)
0789
0790
0791
0792
0793
0794
0795
0796
0797
0798
0799 #define regmap_init_spmi_base(dev, config) \
0800 __regmap_lockdep_wrapper(__regmap_init_spmi_base, #config, \
0801 dev, config)
0802
0803
0804
0805
0806
0807
0808
0809
0810
0811
0812 #define regmap_init_spmi_ext(dev, config) \
0813 __regmap_lockdep_wrapper(__regmap_init_spmi_ext, #config, \
0814 dev, config)
0815
0816
0817
0818
0819
0820
0821
0822
0823
0824
0825 #define regmap_init_w1(w1_dev, config) \
0826 __regmap_lockdep_wrapper(__regmap_init_w1, #config, \
0827 w1_dev, config)
0828
0829
0830
0831
0832
0833
0834
0835
0836
0837
0838
0839
0840 #define regmap_init_mmio_clk(dev, clk_id, regs, config) \
0841 __regmap_lockdep_wrapper(__regmap_init_mmio_clk, #config, \
0842 dev, clk_id, regs, config)
0843
0844
0845
0846
0847
0848
0849
0850
0851
0852
0853
0854 #define regmap_init_mmio(dev, regs, config) \
0855 regmap_init_mmio_clk(dev, NULL, regs, config)
0856
0857
0858
0859
0860
0861
0862
0863
0864
0865
0866 #define regmap_init_ac97(ac97, config) \
0867 __regmap_lockdep_wrapper(__regmap_init_ac97, #config, \
0868 ac97, config)
0869 bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg);
0870
0871
0872
0873
0874
0875
0876
0877
0878
0879
0880 #define regmap_init_sdw(sdw, config) \
0881 __regmap_lockdep_wrapper(__regmap_init_sdw, #config, \
0882 sdw, config)
0883
0884
0885
0886
0887
0888
0889
0890
0891
0892
0893 #define regmap_init_sdw_mbq(sdw, config) \
0894 __regmap_lockdep_wrapper(__regmap_init_sdw_mbq, #config, \
0895 sdw, config)
0896
0897
0898
0899
0900
0901
0902
0903
0904
0905
0906
0907 #define regmap_init_spi_avmm(spi, config) \
0908 __regmap_lockdep_wrapper(__regmap_init_spi_avmm, #config, \
0909 spi, config)
0910
0911
0912
0913
0914
0915
0916
0917
0918
0919
0920
0921
0922
0923
0924 #define devm_regmap_init(dev, bus, bus_context, config) \
0925 __regmap_lockdep_wrapper(__devm_regmap_init, #config, \
0926 dev, bus, bus_context, config)
0927
0928
0929
0930
0931
0932
0933
0934
0935
0936
0937
0938 #define devm_regmap_init_i2c(i2c, config) \
0939 __regmap_lockdep_wrapper(__devm_regmap_init_i2c, #config, \
0940 i2c, config)
0941
0942
0943
0944
0945
0946
0947
0948
0949
0950
0951
0952 #define devm_regmap_init_mdio(mdio_dev, config) \
0953 __regmap_lockdep_wrapper(__devm_regmap_init_mdio, #config, \
0954 mdio_dev, config)
0955
0956
0957
0958
0959
0960
0961
0962
0963
0964
0965
0966 #define devm_regmap_init_sccb(i2c, config) \
0967 __regmap_lockdep_wrapper(__devm_regmap_init_sccb, #config, \
0968 i2c, config)
0969
0970
0971
0972
0973
0974
0975
0976
0977
0978
0979
0980 #define devm_regmap_init_spi(dev, config) \
0981 __regmap_lockdep_wrapper(__devm_regmap_init_spi, #config, \
0982 dev, config)
0983
0984
0985
0986
0987
0988
0989
0990
0991
0992
0993
0994 #define devm_regmap_init_spmi_base(dev, config) \
0995 __regmap_lockdep_wrapper(__devm_regmap_init_spmi_base, #config, \
0996 dev, config)
0997
0998
0999
1000
1001
1002
1003
1004
1005
1006
1007
1008 #define devm_regmap_init_spmi_ext(dev, config) \
1009 __regmap_lockdep_wrapper(__devm_regmap_init_spmi_ext, #config, \
1010 dev, config)
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022 #define devm_regmap_init_w1(w1_dev, config) \
1023 __regmap_lockdep_wrapper(__devm_regmap_init_w1, #config, \
1024 w1_dev, config)
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037 #define devm_regmap_init_mmio_clk(dev, clk_id, regs, config) \
1038 __regmap_lockdep_wrapper(__devm_regmap_init_mmio_clk, #config, \
1039 dev, clk_id, regs, config)
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052 #define devm_regmap_init_mmio(dev, regs, config) \
1053 devm_regmap_init_mmio_clk(dev, NULL, regs, config)
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065 #define devm_regmap_init_ac97(ac97, config) \
1066 __regmap_lockdep_wrapper(__devm_regmap_init_ac97, #config, \
1067 ac97, config)
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079 #define devm_regmap_init_sdw(sdw, config) \
1080 __regmap_lockdep_wrapper(__devm_regmap_init_sdw, #config, \
1081 sdw, config)
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093 #define devm_regmap_init_sdw_mbq(sdw, config) \
1094 __regmap_lockdep_wrapper(__devm_regmap_init_sdw_mbq, #config, \
1095 sdw, config)
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107 #define devm_regmap_init_slimbus(slimbus, config) \
1108 __regmap_lockdep_wrapper(__devm_regmap_init_slimbus, #config, \
1109 slimbus, config)
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121 #define devm_regmap_init_i3c(i3c, config) \
1122 __regmap_lockdep_wrapper(__devm_regmap_init_i3c, #config, \
1123 i3c, config)
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136 #define devm_regmap_init_spi_avmm(spi, config) \
1137 __regmap_lockdep_wrapper(__devm_regmap_init_spi_avmm, #config, \
1138 spi, config)
1139
1140 int regmap_mmio_attach_clk(struct regmap *map, struct clk *clk);
1141 void regmap_mmio_detach_clk(struct regmap *map);
1142 void regmap_exit(struct regmap *map);
1143 int regmap_reinit_cache(struct regmap *map,
1144 const struct regmap_config *config);
1145 struct regmap *dev_get_regmap(struct device *dev, const char *name);
1146 struct device *regmap_get_device(struct regmap *map);
1147 int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
1148 int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val);
1149 int regmap_raw_write(struct regmap *map, unsigned int reg,
1150 const void *val, size_t val_len);
1151 int regmap_noinc_write(struct regmap *map, unsigned int reg,
1152 const void *val, size_t val_len);
1153 int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
1154 size_t val_count);
1155 int regmap_multi_reg_write(struct regmap *map, const struct reg_sequence *regs,
1156 int num_regs);
1157 int regmap_multi_reg_write_bypassed(struct regmap *map,
1158 const struct reg_sequence *regs,
1159 int num_regs);
1160 int regmap_raw_write_async(struct regmap *map, unsigned int reg,
1161 const void *val, size_t val_len);
1162 int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
1163 int regmap_raw_read(struct regmap *map, unsigned int reg,
1164 void *val, size_t val_len);
1165 int regmap_noinc_read(struct regmap *map, unsigned int reg,
1166 void *val, size_t val_len);
1167 int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
1168 size_t val_count);
1169 int regmap_update_bits_base(struct regmap *map, unsigned int reg,
1170 unsigned int mask, unsigned int val,
1171 bool *change, bool async, bool force);
1172
1173 static inline int regmap_update_bits(struct regmap *map, unsigned int reg,
1174 unsigned int mask, unsigned int val)
1175 {
1176 return regmap_update_bits_base(map, reg, mask, val, NULL, false, false);
1177 }
1178
1179 static inline int regmap_update_bits_async(struct regmap *map, unsigned int reg,
1180 unsigned int mask, unsigned int val)
1181 {
1182 return regmap_update_bits_base(map, reg, mask, val, NULL, true, false);
1183 }
1184
1185 static inline int regmap_update_bits_check(struct regmap *map, unsigned int reg,
1186 unsigned int mask, unsigned int val,
1187 bool *change)
1188 {
1189 return regmap_update_bits_base(map, reg, mask, val,
1190 change, false, false);
1191 }
1192
1193 static inline int
1194 regmap_update_bits_check_async(struct regmap *map, unsigned int reg,
1195 unsigned int mask, unsigned int val,
1196 bool *change)
1197 {
1198 return regmap_update_bits_base(map, reg, mask, val,
1199 change, true, false);
1200 }
1201
1202 static inline int regmap_write_bits(struct regmap *map, unsigned int reg,
1203 unsigned int mask, unsigned int val)
1204 {
1205 return regmap_update_bits_base(map, reg, mask, val, NULL, false, true);
1206 }
1207
1208 int regmap_get_val_bytes(struct regmap *map);
1209 int regmap_get_max_register(struct regmap *map);
1210 int regmap_get_reg_stride(struct regmap *map);
1211 int regmap_async_complete(struct regmap *map);
1212 bool regmap_can_raw_write(struct regmap *map);
1213 size_t regmap_get_raw_read_max(struct regmap *map);
1214 size_t regmap_get_raw_write_max(struct regmap *map);
1215
1216 int regcache_sync(struct regmap *map);
1217 int regcache_sync_region(struct regmap *map, unsigned int min,
1218 unsigned int max);
1219 int regcache_drop_region(struct regmap *map, unsigned int min,
1220 unsigned int max);
1221 void regcache_cache_only(struct regmap *map, bool enable);
1222 void regcache_cache_bypass(struct regmap *map, bool enable);
1223 void regcache_mark_dirty(struct regmap *map);
1224
1225 bool regmap_check_range_table(struct regmap *map, unsigned int reg,
1226 const struct regmap_access_table *table);
1227
1228 int regmap_register_patch(struct regmap *map, const struct reg_sequence *regs,
1229 int num_regs);
1230 int regmap_parse_val(struct regmap *map, const void *buf,
1231 unsigned int *val);
1232
1233 static inline bool regmap_reg_in_range(unsigned int reg,
1234 const struct regmap_range *range)
1235 {
1236 return reg >= range->range_min && reg <= range->range_max;
1237 }
1238
1239 bool regmap_reg_in_ranges(unsigned int reg,
1240 const struct regmap_range *ranges,
1241 unsigned int nranges);
1242
1243 static inline int regmap_set_bits(struct regmap *map,
1244 unsigned int reg, unsigned int bits)
1245 {
1246 return regmap_update_bits_base(map, reg, bits, bits,
1247 NULL, false, false);
1248 }
1249
1250 static inline int regmap_clear_bits(struct regmap *map,
1251 unsigned int reg, unsigned int bits)
1252 {
1253 return regmap_update_bits_base(map, reg, bits, 0, NULL, false, false);
1254 }
1255
1256 int regmap_test_bits(struct regmap *map, unsigned int reg, unsigned int bits);
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267 struct reg_field {
1268 unsigned int reg;
1269 unsigned int lsb;
1270 unsigned int msb;
1271 unsigned int id_size;
1272 unsigned int id_offset;
1273 };
1274
1275 #define REG_FIELD(_reg, _lsb, _msb) { \
1276 .reg = _reg, \
1277 .lsb = _lsb, \
1278 .msb = _msb, \
1279 }
1280
1281 #define REG_FIELD_ID(_reg, _lsb, _msb, _size, _offset) { \
1282 .reg = _reg, \
1283 .lsb = _lsb, \
1284 .msb = _msb, \
1285 .id_size = _size, \
1286 .id_offset = _offset, \
1287 }
1288
1289 struct regmap_field *regmap_field_alloc(struct regmap *regmap,
1290 struct reg_field reg_field);
1291 void regmap_field_free(struct regmap_field *field);
1292
1293 struct regmap_field *devm_regmap_field_alloc(struct device *dev,
1294 struct regmap *regmap, struct reg_field reg_field);
1295 void devm_regmap_field_free(struct device *dev, struct regmap_field *field);
1296
1297 int regmap_field_bulk_alloc(struct regmap *regmap,
1298 struct regmap_field **rm_field,
1299 const struct reg_field *reg_field,
1300 int num_fields);
1301 void regmap_field_bulk_free(struct regmap_field *field);
1302 int devm_regmap_field_bulk_alloc(struct device *dev, struct regmap *regmap,
1303 struct regmap_field **field,
1304 const struct reg_field *reg_field,
1305 int num_fields);
1306 void devm_regmap_field_bulk_free(struct device *dev,
1307 struct regmap_field *field);
1308
1309 int regmap_field_read(struct regmap_field *field, unsigned int *val);
1310 int regmap_field_update_bits_base(struct regmap_field *field,
1311 unsigned int mask, unsigned int val,
1312 bool *change, bool async, bool force);
1313 int regmap_fields_read(struct regmap_field *field, unsigned int id,
1314 unsigned int *val);
1315 int regmap_fields_update_bits_base(struct regmap_field *field, unsigned int id,
1316 unsigned int mask, unsigned int val,
1317 bool *change, bool async, bool force);
1318
1319 static inline int regmap_field_write(struct regmap_field *field,
1320 unsigned int val)
1321 {
1322 return regmap_field_update_bits_base(field, ~0, val,
1323 NULL, false, false);
1324 }
1325
1326 static inline int regmap_field_force_write(struct regmap_field *field,
1327 unsigned int val)
1328 {
1329 return regmap_field_update_bits_base(field, ~0, val, NULL, false, true);
1330 }
1331
1332 static inline int regmap_field_update_bits(struct regmap_field *field,
1333 unsigned int mask, unsigned int val)
1334 {
1335 return regmap_field_update_bits_base(field, mask, val,
1336 NULL, false, false);
1337 }
1338
1339 static inline int regmap_field_set_bits(struct regmap_field *field,
1340 unsigned int bits)
1341 {
1342 return regmap_field_update_bits_base(field, bits, bits, NULL, false,
1343 false);
1344 }
1345
1346 static inline int regmap_field_clear_bits(struct regmap_field *field,
1347 unsigned int bits)
1348 {
1349 return regmap_field_update_bits_base(field, bits, 0, NULL, false,
1350 false);
1351 }
1352
1353 int regmap_field_test_bits(struct regmap_field *field, unsigned int bits);
1354
1355 static inline int
1356 regmap_field_force_update_bits(struct regmap_field *field,
1357 unsigned int mask, unsigned int val)
1358 {
1359 return regmap_field_update_bits_base(field, mask, val,
1360 NULL, false, true);
1361 }
1362
1363 static inline int regmap_fields_write(struct regmap_field *field,
1364 unsigned int id, unsigned int val)
1365 {
1366 return regmap_fields_update_bits_base(field, id, ~0, val,
1367 NULL, false, false);
1368 }
1369
1370 static inline int regmap_fields_force_write(struct regmap_field *field,
1371 unsigned int id, unsigned int val)
1372 {
1373 return regmap_fields_update_bits_base(field, id, ~0, val,
1374 NULL, false, true);
1375 }
1376
1377 static inline int
1378 regmap_fields_update_bits(struct regmap_field *field, unsigned int id,
1379 unsigned int mask, unsigned int val)
1380 {
1381 return regmap_fields_update_bits_base(field, id, mask, val,
1382 NULL, false, false);
1383 }
1384
1385 static inline int
1386 regmap_fields_force_update_bits(struct regmap_field *field, unsigned int id,
1387 unsigned int mask, unsigned int val)
1388 {
1389 return regmap_fields_update_bits_base(field, id, mask, val,
1390 NULL, false, true);
1391 }
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403 struct regmap_irq_type {
1404 unsigned int type_reg_offset;
1405 unsigned int type_reg_mask;
1406 unsigned int type_rising_val;
1407 unsigned int type_falling_val;
1408 unsigned int type_level_low_val;
1409 unsigned int type_level_high_val;
1410 unsigned int types_supported;
1411 };
1412
1413
1414
1415
1416
1417
1418
1419
1420 struct regmap_irq {
1421 unsigned int reg_offset;
1422 unsigned int mask;
1423 struct regmap_irq_type type;
1424 };
1425
1426 #define REGMAP_IRQ_REG(_irq, _off, _mask) \
1427 [_irq] = { .reg_offset = (_off), .mask = (_mask) }
1428
1429 #define REGMAP_IRQ_REG_LINE(_id, _reg_bits) \
1430 [_id] = { \
1431 .mask = BIT((_id) % (_reg_bits)), \
1432 .reg_offset = (_id) / (_reg_bits), \
1433 }
1434
1435 #define REGMAP_IRQ_MAIN_REG_OFFSET(arr) \
1436 { .num_regs = ARRAY_SIZE((arr)), .offset = &(arr)[0] }
1437
1438 struct regmap_irq_sub_irq_map {
1439 unsigned int num_regs;
1440 unsigned int *offset;
1441 };
1442
1443 struct regmap_irq_chip_data;
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552 struct regmap_irq_chip {
1553 const char *name;
1554
1555 unsigned int main_status;
1556 unsigned int num_main_status_bits;
1557 struct regmap_irq_sub_irq_map *sub_reg_offsets;
1558 int num_main_regs;
1559
1560 unsigned int status_base;
1561 unsigned int mask_base;
1562 unsigned int unmask_base;
1563 unsigned int ack_base;
1564 unsigned int wake_base;
1565 unsigned int type_base;
1566 unsigned int *virt_reg_base;
1567 const unsigned int *config_base;
1568 unsigned int irq_reg_stride;
1569 unsigned int init_ack_masked:1;
1570 unsigned int mask_invert:1;
1571 unsigned int mask_unmask_non_inverted:1;
1572 unsigned int use_ack:1;
1573 unsigned int ack_invert:1;
1574 unsigned int clear_ack:1;
1575 unsigned int wake_invert:1;
1576 unsigned int runtime_pm:1;
1577 unsigned int type_invert:1;
1578 unsigned int type_in_mask:1;
1579 unsigned int clear_on_unmask:1;
1580 unsigned int not_fixed_stride:1;
1581 unsigned int status_invert:1;
1582
1583 int num_regs;
1584
1585 const struct regmap_irq *irqs;
1586 int num_irqs;
1587
1588 int num_type_reg;
1589 int num_virt_regs;
1590 int num_config_bases;
1591 int num_config_regs;
1592
1593 int (*handle_pre_irq)(void *irq_drv_data);
1594 int (*handle_post_irq)(void *irq_drv_data);
1595 int (*set_type_virt)(unsigned int **buf, unsigned int type,
1596 unsigned long hwirq, int reg);
1597 int (*set_type_config)(unsigned int **buf, unsigned int type,
1598 const struct regmap_irq *irq_data, int idx);
1599 unsigned int (*get_irq_reg)(struct regmap_irq_chip_data *data,
1600 unsigned int base, int index);
1601 void *irq_drv_data;
1602 };
1603
1604 unsigned int regmap_irq_get_irq_reg_linear(struct regmap_irq_chip_data *data,
1605 unsigned int base, int index);
1606 int regmap_irq_set_type_config_simple(unsigned int **buf, unsigned int type,
1607 const struct regmap_irq *irq_data, int idx);
1608
1609 int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
1610 int irq_base, const struct regmap_irq_chip *chip,
1611 struct regmap_irq_chip_data **data);
1612 int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
1613 struct regmap *map, int irq,
1614 int irq_flags, int irq_base,
1615 const struct regmap_irq_chip *chip,
1616 struct regmap_irq_chip_data **data);
1617 void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
1618
1619 int devm_regmap_add_irq_chip(struct device *dev, struct regmap *map, int irq,
1620 int irq_flags, int irq_base,
1621 const struct regmap_irq_chip *chip,
1622 struct regmap_irq_chip_data **data);
1623 int devm_regmap_add_irq_chip_fwnode(struct device *dev,
1624 struct fwnode_handle *fwnode,
1625 struct regmap *map, int irq,
1626 int irq_flags, int irq_base,
1627 const struct regmap_irq_chip *chip,
1628 struct regmap_irq_chip_data **data);
1629 void devm_regmap_del_irq_chip(struct device *dev, int irq,
1630 struct regmap_irq_chip_data *data);
1631
1632 int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
1633 int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq);
1634 struct irq_domain *regmap_irq_get_domain(struct regmap_irq_chip_data *data);
1635
1636 #else
1637
1638
1639
1640
1641
1642
1643
1644
1645 static inline int regmap_write(struct regmap *map, unsigned int reg,
1646 unsigned int val)
1647 {
1648 WARN_ONCE(1, "regmap API is disabled");
1649 return -EINVAL;
1650 }
1651
1652 static inline int regmap_write_async(struct regmap *map, unsigned int reg,
1653 unsigned int val)
1654 {
1655 WARN_ONCE(1, "regmap API is disabled");
1656 return -EINVAL;
1657 }
1658
1659 static inline int regmap_raw_write(struct regmap *map, unsigned int reg,
1660 const void *val, size_t val_len)
1661 {
1662 WARN_ONCE(1, "regmap API is disabled");
1663 return -EINVAL;
1664 }
1665
1666 static inline int regmap_raw_write_async(struct regmap *map, unsigned int reg,
1667 const void *val, size_t val_len)
1668 {
1669 WARN_ONCE(1, "regmap API is disabled");
1670 return -EINVAL;
1671 }
1672
1673 static inline int regmap_noinc_write(struct regmap *map, unsigned int reg,
1674 const void *val, size_t val_len)
1675 {
1676 WARN_ONCE(1, "regmap API is disabled");
1677 return -EINVAL;
1678 }
1679
1680 static inline int regmap_bulk_write(struct regmap *map, unsigned int reg,
1681 const void *val, size_t val_count)
1682 {
1683 WARN_ONCE(1, "regmap API is disabled");
1684 return -EINVAL;
1685 }
1686
1687 static inline int regmap_read(struct regmap *map, unsigned int reg,
1688 unsigned int *val)
1689 {
1690 WARN_ONCE(1, "regmap API is disabled");
1691 return -EINVAL;
1692 }
1693
1694 static inline int regmap_raw_read(struct regmap *map, unsigned int reg,
1695 void *val, size_t val_len)
1696 {
1697 WARN_ONCE(1, "regmap API is disabled");
1698 return -EINVAL;
1699 }
1700
1701 static inline int regmap_noinc_read(struct regmap *map, unsigned int reg,
1702 void *val, size_t val_len)
1703 {
1704 WARN_ONCE(1, "regmap API is disabled");
1705 return -EINVAL;
1706 }
1707
1708 static inline int regmap_bulk_read(struct regmap *map, unsigned int reg,
1709 void *val, size_t val_count)
1710 {
1711 WARN_ONCE(1, "regmap API is disabled");
1712 return -EINVAL;
1713 }
1714
1715 static inline int regmap_update_bits_base(struct regmap *map, unsigned int reg,
1716 unsigned int mask, unsigned int val,
1717 bool *change, bool async, bool force)
1718 {
1719 WARN_ONCE(1, "regmap API is disabled");
1720 return -EINVAL;
1721 }
1722
1723 static inline int regmap_set_bits(struct regmap *map,
1724 unsigned int reg, unsigned int bits)
1725 {
1726 WARN_ONCE(1, "regmap API is disabled");
1727 return -EINVAL;
1728 }
1729
1730 static inline int regmap_clear_bits(struct regmap *map,
1731 unsigned int reg, unsigned int bits)
1732 {
1733 WARN_ONCE(1, "regmap API is disabled");
1734 return -EINVAL;
1735 }
1736
1737 static inline int regmap_test_bits(struct regmap *map,
1738 unsigned int reg, unsigned int bits)
1739 {
1740 WARN_ONCE(1, "regmap API is disabled");
1741 return -EINVAL;
1742 }
1743
1744 static inline int regmap_field_update_bits_base(struct regmap_field *field,
1745 unsigned int mask, unsigned int val,
1746 bool *change, bool async, bool force)
1747 {
1748 WARN_ONCE(1, "regmap API is disabled");
1749 return -EINVAL;
1750 }
1751
1752 static inline int regmap_fields_update_bits_base(struct regmap_field *field,
1753 unsigned int id,
1754 unsigned int mask, unsigned int val,
1755 bool *change, bool async, bool force)
1756 {
1757 WARN_ONCE(1, "regmap API is disabled");
1758 return -EINVAL;
1759 }
1760
1761 static inline int regmap_update_bits(struct regmap *map, unsigned int reg,
1762 unsigned int mask, unsigned int val)
1763 {
1764 WARN_ONCE(1, "regmap API is disabled");
1765 return -EINVAL;
1766 }
1767
1768 static inline int regmap_update_bits_async(struct regmap *map, unsigned int reg,
1769 unsigned int mask, unsigned int val)
1770 {
1771 WARN_ONCE(1, "regmap API is disabled");
1772 return -EINVAL;
1773 }
1774
1775 static inline int regmap_update_bits_check(struct regmap *map, unsigned int reg,
1776 unsigned int mask, unsigned int val,
1777 bool *change)
1778 {
1779 WARN_ONCE(1, "regmap API is disabled");
1780 return -EINVAL;
1781 }
1782
1783 static inline int
1784 regmap_update_bits_check_async(struct regmap *map, unsigned int reg,
1785 unsigned int mask, unsigned int val,
1786 bool *change)
1787 {
1788 WARN_ONCE(1, "regmap API is disabled");
1789 return -EINVAL;
1790 }
1791
1792 static inline int regmap_write_bits(struct regmap *map, unsigned int reg,
1793 unsigned int mask, unsigned int val)
1794 {
1795 WARN_ONCE(1, "regmap API is disabled");
1796 return -EINVAL;
1797 }
1798
1799 static inline int regmap_field_write(struct regmap_field *field,
1800 unsigned int val)
1801 {
1802 WARN_ONCE(1, "regmap API is disabled");
1803 return -EINVAL;
1804 }
1805
1806 static inline int regmap_field_force_write(struct regmap_field *field,
1807 unsigned int val)
1808 {
1809 WARN_ONCE(1, "regmap API is disabled");
1810 return -EINVAL;
1811 }
1812
1813 static inline int regmap_field_update_bits(struct regmap_field *field,
1814 unsigned int mask, unsigned int val)
1815 {
1816 WARN_ONCE(1, "regmap API is disabled");
1817 return -EINVAL;
1818 }
1819
1820 static inline int
1821 regmap_field_force_update_bits(struct regmap_field *field,
1822 unsigned int mask, unsigned int val)
1823 {
1824 WARN_ONCE(1, "regmap API is disabled");
1825 return -EINVAL;
1826 }
1827
1828 static inline int regmap_field_set_bits(struct regmap_field *field,
1829 unsigned int bits)
1830 {
1831 WARN_ONCE(1, "regmap API is disabled");
1832 return -EINVAL;
1833 }
1834
1835 static inline int regmap_field_clear_bits(struct regmap_field *field,
1836 unsigned int bits)
1837 {
1838 WARN_ONCE(1, "regmap API is disabled");
1839 return -EINVAL;
1840 }
1841
1842 static inline int regmap_field_test_bits(struct regmap_field *field,
1843 unsigned int bits)
1844 {
1845 WARN_ONCE(1, "regmap API is disabled");
1846 return -EINVAL;
1847 }
1848
1849 static inline int regmap_fields_write(struct regmap_field *field,
1850 unsigned int id, unsigned int val)
1851 {
1852 WARN_ONCE(1, "regmap API is disabled");
1853 return -EINVAL;
1854 }
1855
1856 static inline int regmap_fields_force_write(struct regmap_field *field,
1857 unsigned int id, unsigned int val)
1858 {
1859 WARN_ONCE(1, "regmap API is disabled");
1860 return -EINVAL;
1861 }
1862
1863 static inline int
1864 regmap_fields_update_bits(struct regmap_field *field, unsigned int id,
1865 unsigned int mask, unsigned int val)
1866 {
1867 WARN_ONCE(1, "regmap API is disabled");
1868 return -EINVAL;
1869 }
1870
1871 static inline int
1872 regmap_fields_force_update_bits(struct regmap_field *field, unsigned int id,
1873 unsigned int mask, unsigned int val)
1874 {
1875 WARN_ONCE(1, "regmap API is disabled");
1876 return -EINVAL;
1877 }
1878
1879 static inline int regmap_get_val_bytes(struct regmap *map)
1880 {
1881 WARN_ONCE(1, "regmap API is disabled");
1882 return -EINVAL;
1883 }
1884
1885 static inline int regmap_get_max_register(struct regmap *map)
1886 {
1887 WARN_ONCE(1, "regmap API is disabled");
1888 return -EINVAL;
1889 }
1890
1891 static inline int regmap_get_reg_stride(struct regmap *map)
1892 {
1893 WARN_ONCE(1, "regmap API is disabled");
1894 return -EINVAL;
1895 }
1896
1897 static inline int regcache_sync(struct regmap *map)
1898 {
1899 WARN_ONCE(1, "regmap API is disabled");
1900 return -EINVAL;
1901 }
1902
1903 static inline int regcache_sync_region(struct regmap *map, unsigned int min,
1904 unsigned int max)
1905 {
1906 WARN_ONCE(1, "regmap API is disabled");
1907 return -EINVAL;
1908 }
1909
1910 static inline int regcache_drop_region(struct regmap *map, unsigned int min,
1911 unsigned int max)
1912 {
1913 WARN_ONCE(1, "regmap API is disabled");
1914 return -EINVAL;
1915 }
1916
1917 static inline void regcache_cache_only(struct regmap *map, bool enable)
1918 {
1919 WARN_ONCE(1, "regmap API is disabled");
1920 }
1921
1922 static inline void regcache_cache_bypass(struct regmap *map, bool enable)
1923 {
1924 WARN_ONCE(1, "regmap API is disabled");
1925 }
1926
1927 static inline void regcache_mark_dirty(struct regmap *map)
1928 {
1929 WARN_ONCE(1, "regmap API is disabled");
1930 }
1931
1932 static inline void regmap_async_complete(struct regmap *map)
1933 {
1934 WARN_ONCE(1, "regmap API is disabled");
1935 }
1936
1937 static inline int regmap_register_patch(struct regmap *map,
1938 const struct reg_sequence *regs,
1939 int num_regs)
1940 {
1941 WARN_ONCE(1, "regmap API is disabled");
1942 return -EINVAL;
1943 }
1944
1945 static inline int regmap_parse_val(struct regmap *map, const void *buf,
1946 unsigned int *val)
1947 {
1948 WARN_ONCE(1, "regmap API is disabled");
1949 return -EINVAL;
1950 }
1951
1952 static inline struct regmap *dev_get_regmap(struct device *dev,
1953 const char *name)
1954 {
1955 return NULL;
1956 }
1957
1958 static inline struct device *regmap_get_device(struct regmap *map)
1959 {
1960 WARN_ONCE(1, "regmap API is disabled");
1961 return NULL;
1962 }
1963
1964 #endif
1965
1966 #endif