diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2015-06-16 04:52:39 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-07-10 06:38:00 -0400 |
commit | fd4b7286ccc469bf5dde22db6b8fcc455c3c4a66 (patch) | |
tree | 04b3b7a077e81f1e8036c723963396b62bb91340 | |
parent | 7ff0589c7bff4ca31b255ac2028f633f14047762 (diff) |
regmap: add regmap_write_bits()
regmap_write_bits() is similar to regmap_update_bits(),
but regmap_write_bits() write data to register even though
it is same value.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | drivers/base/regmap/regmap.c | 23 | ||||
-rw-r--r-- | include/linux/regmap.h | 9 |
2 files changed, 32 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 69ec411ce722..d93bb9a8ab98 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c | |||
@@ -2375,6 +2375,29 @@ int regmap_update_bits(struct regmap *map, unsigned int reg, | |||
2375 | EXPORT_SYMBOL_GPL(regmap_update_bits); | 2375 | EXPORT_SYMBOL_GPL(regmap_update_bits); |
2376 | 2376 | ||
2377 | /** | 2377 | /** |
2378 | * regmap_write_bits: Perform a read/modify/write cycle on the register map | ||
2379 | * | ||
2380 | * @map: Register map to update | ||
2381 | * @reg: Register to update | ||
2382 | * @mask: Bitmask to change | ||
2383 | * @val: New value for bitmask | ||
2384 | * | ||
2385 | * Returns zero for success, a negative number on error. | ||
2386 | */ | ||
2387 | int regmap_write_bits(struct regmap *map, unsigned int reg, | ||
2388 | unsigned int mask, unsigned int val) | ||
2389 | { | ||
2390 | int ret; | ||
2391 | |||
2392 | map->lock(map->lock_arg); | ||
2393 | ret = _regmap_update_bits(map, reg, mask, val, NULL, true); | ||
2394 | map->unlock(map->lock_arg); | ||
2395 | |||
2396 | return ret; | ||
2397 | } | ||
2398 | EXPORT_SYMBOL_GPL(regmap_write_bits); | ||
2399 | |||
2400 | /** | ||
2378 | * regmap_update_bits_async: Perform a read/modify/write cycle on the register | 2401 | * regmap_update_bits_async: Perform a read/modify/write cycle on the register |
2379 | * map asynchronously | 2402 | * map asynchronously |
2380 | * | 2403 | * |
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 59c55ea0f0b5..e4b9ad4f05ef 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h | |||
@@ -424,6 +424,8 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, | |||
424 | size_t val_count); | 424 | size_t val_count); |
425 | int regmap_update_bits(struct regmap *map, unsigned int reg, | 425 | int regmap_update_bits(struct regmap *map, unsigned int reg, |
426 | unsigned int mask, unsigned int val); | 426 | unsigned int mask, unsigned int val); |
427 | int regmap_write_bits(struct regmap *map, unsigned int reg, | ||
428 | unsigned int mask, unsigned int val); | ||
427 | int regmap_update_bits_async(struct regmap *map, unsigned int reg, | 429 | int regmap_update_bits_async(struct regmap *map, unsigned int reg, |
428 | unsigned int mask, unsigned int val); | 430 | unsigned int mask, unsigned int val); |
429 | int regmap_update_bits_check(struct regmap *map, unsigned int reg, | 431 | int regmap_update_bits_check(struct regmap *map, unsigned int reg, |
@@ -645,6 +647,13 @@ static inline int regmap_update_bits(struct regmap *map, unsigned int reg, | |||
645 | return -EINVAL; | 647 | return -EINVAL; |
646 | } | 648 | } |
647 | 649 | ||
650 | static inline int regmap_write_bits(struct regmap *map, unsigned int reg, | ||
651 | unsigned int mask, unsigned int val) | ||
652 | { | ||
653 | WARN_ONCE(1, "regmap API is disabled"); | ||
654 | return -EINVAL; | ||
655 | } | ||
656 | |||
648 | static inline int regmap_update_bits_async(struct regmap *map, | 657 | static inline int regmap_update_bits_async(struct regmap *map, |
649 | unsigned int reg, | 658 | unsigned int reg, |
650 | unsigned int mask, unsigned int val) | 659 | unsigned int mask, unsigned int val) |