aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/regmap.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/regmap.h')
-rw-r--r--include/linux/regmap.h68
1 files changed, 67 insertions, 1 deletions
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 15eddc1353ba..6a3aeba40e9e 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -24,12 +24,14 @@ struct module;
24struct device; 24struct device;
25struct i2c_client; 25struct i2c_client;
26struct irq_domain; 26struct irq_domain;
27struct slim_device;
27struct spi_device; 28struct spi_device;
28struct spmi_device; 29struct spmi_device;
29struct regmap; 30struct regmap;
30struct regmap_range_cfg; 31struct regmap_range_cfg;
31struct regmap_field; 32struct regmap_field;
32struct snd_ac97; 33struct snd_ac97;
34struct sdw_slave;
33 35
34/* An enum of all the supported cache types */ 36/* An enum of all the supported cache types */
35enum regcache_type { 37enum regcache_type {
@@ -264,6 +266,9 @@ typedef void (*regmap_unlock)(void *);
264 * field is NULL but precious_table (see below) is not, the 266 * field is NULL but precious_table (see below) is not, the
265 * check is performed on such table (a register is precious if 267 * check is performed on such table (a register is precious if
266 * it belongs to one of the ranges specified by precious_table). 268 * it belongs to one of the ranges specified by precious_table).
269 * @disable_locking: This regmap is either protected by external means or
270 * is guaranteed not be be accessed from multiple threads.
271 * Don't use any locking mechanisms.
267 * @lock: Optional lock callback (overrides regmap's default lock 272 * @lock: Optional lock callback (overrides regmap's default lock
268 * function, based on spinlock or mutex). 273 * function, based on spinlock or mutex).
269 * @unlock: As above for unlocking. 274 * @unlock: As above for unlocking.
@@ -296,7 +301,10 @@ typedef void (*regmap_unlock)(void *);
296 * a read. 301 * a read.
297 * @write_flag_mask: Mask to be set in the top bytes of the register when doing 302 * @write_flag_mask: Mask to be set in the top bytes of the register when doing
298 * a write. If both read_flag_mask and write_flag_mask are 303 * a write. If both read_flag_mask and write_flag_mask are
299 * empty the regmap_bus default masks are used. 304 * empty and zero_flag_mask is not set the regmap_bus default
305 * masks are used.
306 * @zero_flag_mask: If set, read_flag_mask and write_flag_mask are used even
307 * if they are both empty.
300 * @use_single_rw: If set, converts the bulk read and write operations into 308 * @use_single_rw: If set, converts the bulk read and write operations into
301 * a series of single read and write operations. This is useful 309 * a series of single read and write operations. This is useful
302 * for device that does not support bulk read and write. 310 * for device that does not support bulk read and write.
@@ -317,6 +325,7 @@ typedef void (*regmap_unlock)(void *);
317 * 325 *
318 * @ranges: Array of configuration entries for virtual address ranges. 326 * @ranges: Array of configuration entries for virtual address ranges.
319 * @num_ranges: Number of range configuration entries. 327 * @num_ranges: Number of range configuration entries.
328 * @use_hwlock: Indicate if a hardware spinlock should be used.
320 * @hwlock_id: Specify the hardware spinlock id. 329 * @hwlock_id: Specify the hardware spinlock id.
321 * @hwlock_mode: The hardware spinlock mode, should be HWLOCK_IRQSTATE, 330 * @hwlock_mode: The hardware spinlock mode, should be HWLOCK_IRQSTATE,
322 * HWLOCK_IRQ or 0. 331 * HWLOCK_IRQ or 0.
@@ -333,6 +342,8 @@ struct regmap_config {
333 bool (*readable_reg)(struct device *dev, unsigned int reg); 342 bool (*readable_reg)(struct device *dev, unsigned int reg);
334 bool (*volatile_reg)(struct device *dev, unsigned int reg); 343 bool (*volatile_reg)(struct device *dev, unsigned int reg);
335 bool (*precious_reg)(struct device *dev, unsigned int reg); 344 bool (*precious_reg)(struct device *dev, unsigned int reg);
345
346 bool disable_locking;
336 regmap_lock lock; 347 regmap_lock lock;
337 regmap_unlock unlock; 348 regmap_unlock unlock;
338 void *lock_arg; 349 void *lock_arg;
@@ -355,6 +366,7 @@ struct regmap_config {
355 366
356 unsigned long read_flag_mask; 367 unsigned long read_flag_mask;
357 unsigned long write_flag_mask; 368 unsigned long write_flag_mask;
369 bool zero_flag_mask;
358 370
359 bool use_single_rw; 371 bool use_single_rw;
360 bool can_multi_write; 372 bool can_multi_write;
@@ -365,6 +377,7 @@ struct regmap_config {
365 const struct regmap_range_cfg *ranges; 377 const struct regmap_range_cfg *ranges;
366 unsigned int num_ranges; 378 unsigned int num_ranges;
367 379
380 bool use_hwlock;
368 unsigned int hwlock_id; 381 unsigned int hwlock_id;
369 unsigned int hwlock_mode; 382 unsigned int hwlock_mode;
370}; 383};
@@ -499,6 +512,10 @@ struct regmap *__regmap_init_i2c(struct i2c_client *i2c,
499 const struct regmap_config *config, 512 const struct regmap_config *config,
500 struct lock_class_key *lock_key, 513 struct lock_class_key *lock_key,
501 const char *lock_name); 514 const char *lock_name);
515struct regmap *__regmap_init_slimbus(struct slim_device *slimbus,
516 const struct regmap_config *config,
517 struct lock_class_key *lock_key,
518 const char *lock_name);
502struct regmap *__regmap_init_spi(struct spi_device *dev, 519struct regmap *__regmap_init_spi(struct spi_device *dev,
503 const struct regmap_config *config, 520 const struct regmap_config *config,
504 struct lock_class_key *lock_key, 521 struct lock_class_key *lock_key,
@@ -524,6 +541,10 @@ struct regmap *__regmap_init_ac97(struct snd_ac97 *ac97,
524 const struct regmap_config *config, 541 const struct regmap_config *config,
525 struct lock_class_key *lock_key, 542 struct lock_class_key *lock_key,
526 const char *lock_name); 543 const char *lock_name);
544struct regmap *__regmap_init_sdw(struct sdw_slave *sdw,
545 const struct regmap_config *config,
546 struct lock_class_key *lock_key,
547 const char *lock_name);
527 548
528struct regmap *__devm_regmap_init(struct device *dev, 549struct regmap *__devm_regmap_init(struct device *dev,
529 const struct regmap_bus *bus, 550 const struct regmap_bus *bus,
@@ -561,6 +582,10 @@ struct regmap *__devm_regmap_init_ac97(struct snd_ac97 *ac97,
561 const struct regmap_config *config, 582 const struct regmap_config *config,
562 struct lock_class_key *lock_key, 583 struct lock_class_key *lock_key,
563 const char *lock_name); 584 const char *lock_name);
585struct regmap *__devm_regmap_init_sdw(struct sdw_slave *sdw,
586 const struct regmap_config *config,
587 struct lock_class_key *lock_key,
588 const char *lock_name);
564 589
565/* 590/*
566 * Wrapper for regmap_init macros to include a unique lockdep key and name 591 * Wrapper for regmap_init macros to include a unique lockdep key and name
@@ -616,6 +641,19 @@ int regmap_attach_dev(struct device *dev, struct regmap *map,
616 i2c, config) 641 i2c, config)
617 642
618/** 643/**
644 * regmap_init_slimbus() - Initialise register map
645 *
646 * @slimbus: Device that will be interacted with
647 * @config: Configuration for register map
648 *
649 * The return value will be an ERR_PTR() on error or a valid pointer to
650 * a struct regmap.
651 */
652#define regmap_init_slimbus(slimbus, config) \
653 __regmap_lockdep_wrapper(__regmap_init_slimbus, #config, \
654 slimbus, config)
655
656/**
619 * regmap_init_spi() - Initialise register map 657 * regmap_init_spi() - Initialise register map
620 * 658 *
621 * @dev: Device that will be interacted with 659 * @dev: Device that will be interacted with
@@ -710,6 +748,20 @@ int regmap_attach_dev(struct device *dev, struct regmap *map,
710bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); 748bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg);
711 749
712/** 750/**
751 * regmap_init_sdw() - Initialise register map
752 *
753 * @sdw: Device that will be interacted with
754 * @config: Configuration for register map
755 *
756 * The return value will be an ERR_PTR() on error or a valid pointer to
757 * a struct regmap.
758 */
759#define regmap_init_sdw(sdw, config) \
760 __regmap_lockdep_wrapper(__regmap_init_sdw, #config, \
761 sdw, config)
762
763
764/**
713 * devm_regmap_init() - Initialise managed register map 765 * devm_regmap_init() - Initialise managed register map
714 * 766 *
715 * @dev: Device that will be interacted with 767 * @dev: Device that will be interacted with
@@ -839,6 +891,20 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg);
839 __regmap_lockdep_wrapper(__devm_regmap_init_ac97, #config, \ 891 __regmap_lockdep_wrapper(__devm_regmap_init_ac97, #config, \
840 ac97, config) 892 ac97, config)
841 893
894/**
895 * devm_regmap_init_sdw() - Initialise managed register map
896 *
897 * @sdw: Device that will be interacted with
898 * @config: Configuration for register map
899 *
900 * The return value will be an ERR_PTR() on error or a valid pointer
901 * to a struct regmap. The regmap will be automatically freed by the
902 * device management code.
903 */
904#define devm_regmap_init_sdw(sdw, config) \
905 __regmap_lockdep_wrapper(__devm_regmap_init_sdw, #config, \
906 sdw, config)
907
842void regmap_exit(struct regmap *map); 908void regmap_exit(struct regmap *map);
843int regmap_reinit_cache(struct regmap *map, 909int regmap_reinit_cache(struct regmap *map,
844 const struct regmap_config *config); 910 const struct regmap_config *config);