aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-01-29 14:35:24 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-01-29 14:35:24 -0500
commitb5856f97b3cb792806cee5d2b2c747353d238bbf (patch)
tree57cb0ea8b513763074d0bdb95b07421e0be50c71 /include/linux
parentdc38787a5836f272a8c5e018b30a7aa6b273da78 (diff)
parenta75de77211842a7e120ce95ad156e4b3704dcde7 (diff)
Merge tag 'regmap-v4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap
Pull regmap updates from Mark Brown: "A very busy release for regmap, all fairly specialist stuff but useful: - Support for disabling locking from Bartosz Golaszewski, allowing users that handle their own locking to save some overhead. - Support for hwspinlocks in syscons in MFD from Baolin Wang, this is going through the regmap tree since the first users turned up some some cases that needed interface tweaks with 0 being used as a syscon identifier. - Support for devices with no read or write flag from Andrew F. Davis. - Basic support for devices on SoundWire buses from Vinod Koul" * tag 'regmap-v4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap: mfd: syscon: Add hardware spinlock support regmap: Allow empty read/write_flag_mask regcache: flat: Un-inline index lookup from cache access regmap: Add SoundWire bus support regmap: Add one flag to indicate if a hwlock should be used regmap: debugfs: document why we don't create the debugfs entries regmap: debugfs: emit a debug message when locking is disabled regmap: use proper part of work_buf for storing val regmap: potentially duplicate the name string stored in regmap regmap: Disable debugfs when locking is disabled regmap: rename regmap_lock_unlock_empty() to regmap_lock_unlock_none() regmap: allow to disable all locking mechanisms regmap: Remove the redundant config to select hwspinlock
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/regmap.h50
1 files changed, 49 insertions, 1 deletions
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 15eddc1353ba..20268b7d5001 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -30,6 +30,7 @@ struct regmap;
30struct regmap_range_cfg; 30struct regmap_range_cfg;
31struct regmap_field; 31struct regmap_field;
32struct snd_ac97; 32struct snd_ac97;
33struct sdw_slave;
33 34
34/* An enum of all the supported cache types */ 35/* An enum of all the supported cache types */
35enum regcache_type { 36enum regcache_type {
@@ -264,6 +265,9 @@ typedef void (*regmap_unlock)(void *);
264 * field is NULL but precious_table (see below) is not, the 265 * field is NULL but precious_table (see below) is not, the
265 * check is performed on such table (a register is precious if 266 * check is performed on such table (a register is precious if
266 * it belongs to one of the ranges specified by precious_table). 267 * it belongs to one of the ranges specified by precious_table).
268 * @disable_locking: This regmap is either protected by external means or
269 * is guaranteed not be be accessed from multiple threads.
270 * Don't use any locking mechanisms.
267 * @lock: Optional lock callback (overrides regmap's default lock 271 * @lock: Optional lock callback (overrides regmap's default lock
268 * function, based on spinlock or mutex). 272 * function, based on spinlock or mutex).
269 * @unlock: As above for unlocking. 273 * @unlock: As above for unlocking.
@@ -296,7 +300,10 @@ typedef void (*regmap_unlock)(void *);
296 * a read. 300 * a read.
297 * @write_flag_mask: Mask to be set in the top bytes of the register when doing 301 * @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 302 * a write. If both read_flag_mask and write_flag_mask are
299 * empty the regmap_bus default masks are used. 303 * empty and zero_flag_mask is not set the regmap_bus default
304 * masks are used.
305 * @zero_flag_mask: If set, read_flag_mask and write_flag_mask are used even
306 * if they are both empty.
300 * @use_single_rw: If set, converts the bulk read and write operations into 307 * @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 308 * a series of single read and write operations. This is useful
302 * for device that does not support bulk read and write. 309 * for device that does not support bulk read and write.
@@ -317,6 +324,7 @@ typedef void (*regmap_unlock)(void *);
317 * 324 *
318 * @ranges: Array of configuration entries for virtual address ranges. 325 * @ranges: Array of configuration entries for virtual address ranges.
319 * @num_ranges: Number of range configuration entries. 326 * @num_ranges: Number of range configuration entries.
327 * @use_hwlock: Indicate if a hardware spinlock should be used.
320 * @hwlock_id: Specify the hardware spinlock id. 328 * @hwlock_id: Specify the hardware spinlock id.
321 * @hwlock_mode: The hardware spinlock mode, should be HWLOCK_IRQSTATE, 329 * @hwlock_mode: The hardware spinlock mode, should be HWLOCK_IRQSTATE,
322 * HWLOCK_IRQ or 0. 330 * HWLOCK_IRQ or 0.
@@ -333,6 +341,8 @@ struct regmap_config {
333 bool (*readable_reg)(struct device *dev, unsigned int reg); 341 bool (*readable_reg)(struct device *dev, unsigned int reg);
334 bool (*volatile_reg)(struct device *dev, unsigned int reg); 342 bool (*volatile_reg)(struct device *dev, unsigned int reg);
335 bool (*precious_reg)(struct device *dev, unsigned int reg); 343 bool (*precious_reg)(struct device *dev, unsigned int reg);
344
345 bool disable_locking;
336 regmap_lock lock; 346 regmap_lock lock;
337 regmap_unlock unlock; 347 regmap_unlock unlock;
338 void *lock_arg; 348 void *lock_arg;
@@ -355,6 +365,7 @@ struct regmap_config {
355 365
356 unsigned long read_flag_mask; 366 unsigned long read_flag_mask;
357 unsigned long write_flag_mask; 367 unsigned long write_flag_mask;
368 bool zero_flag_mask;
358 369
359 bool use_single_rw; 370 bool use_single_rw;
360 bool can_multi_write; 371 bool can_multi_write;
@@ -365,6 +376,7 @@ struct regmap_config {
365 const struct regmap_range_cfg *ranges; 376 const struct regmap_range_cfg *ranges;
366 unsigned int num_ranges; 377 unsigned int num_ranges;
367 378
379 bool use_hwlock;
368 unsigned int hwlock_id; 380 unsigned int hwlock_id;
369 unsigned int hwlock_mode; 381 unsigned int hwlock_mode;
370}; 382};
@@ -524,6 +536,10 @@ struct regmap *__regmap_init_ac97(struct snd_ac97 *ac97,
524 const struct regmap_config *config, 536 const struct regmap_config *config,
525 struct lock_class_key *lock_key, 537 struct lock_class_key *lock_key,
526 const char *lock_name); 538 const char *lock_name);
539struct regmap *__regmap_init_sdw(struct sdw_slave *sdw,
540 const struct regmap_config *config,
541 struct lock_class_key *lock_key,
542 const char *lock_name);
527 543
528struct regmap *__devm_regmap_init(struct device *dev, 544struct regmap *__devm_regmap_init(struct device *dev,
529 const struct regmap_bus *bus, 545 const struct regmap_bus *bus,
@@ -561,6 +577,10 @@ struct regmap *__devm_regmap_init_ac97(struct snd_ac97 *ac97,
561 const struct regmap_config *config, 577 const struct regmap_config *config,
562 struct lock_class_key *lock_key, 578 struct lock_class_key *lock_key,
563 const char *lock_name); 579 const char *lock_name);
580struct regmap *__devm_regmap_init_sdw(struct sdw_slave *sdw,
581 const struct regmap_config *config,
582 struct lock_class_key *lock_key,
583 const char *lock_name);
564 584
565/* 585/*
566 * Wrapper for regmap_init macros to include a unique lockdep key and name 586 * Wrapper for regmap_init macros to include a unique lockdep key and name
@@ -710,6 +730,20 @@ int regmap_attach_dev(struct device *dev, struct regmap *map,
710bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); 730bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg);
711 731
712/** 732/**
733 * regmap_init_sdw() - Initialise register map
734 *
735 * @sdw: Device that will be interacted with
736 * @config: Configuration for register map
737 *
738 * The return value will be an ERR_PTR() on error or a valid pointer to
739 * a struct regmap.
740 */
741#define regmap_init_sdw(sdw, config) \
742 __regmap_lockdep_wrapper(__regmap_init_sdw, #config, \
743 sdw, config)
744
745
746/**
713 * devm_regmap_init() - Initialise managed register map 747 * devm_regmap_init() - Initialise managed register map
714 * 748 *
715 * @dev: Device that will be interacted with 749 * @dev: Device that will be interacted with
@@ -839,6 +873,20 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg);
839 __regmap_lockdep_wrapper(__devm_regmap_init_ac97, #config, \ 873 __regmap_lockdep_wrapper(__devm_regmap_init_ac97, #config, \
840 ac97, config) 874 ac97, config)
841 875
876/**
877 * devm_regmap_init_sdw() - Initialise managed register map
878 *
879 * @sdw: Device that will be interacted with
880 * @config: Configuration for register map
881 *
882 * The return value will be an ERR_PTR() on error or a valid pointer
883 * to a struct regmap. The regmap will be automatically freed by the
884 * device management code.
885 */
886#define devm_regmap_init_sdw(sdw, config) \
887 __regmap_lockdep_wrapper(__devm_regmap_init_sdw, #config, \
888 sdw, config)
889
842void regmap_exit(struct regmap *map); 890void regmap_exit(struct regmap *map);
843int regmap_reinit_cache(struct regmap *map, 891int regmap_reinit_cache(struct regmap *map,
844 const struct regmap_config *config); 892 const struct regmap_config *config);