From: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: linux-kernel@vger.kernel.org, Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 7/8] regmap: Implement regcache_cache_bypass helper function
Date: Thu, 29 Sep 2011 10:39:12 +0100 [thread overview]
Message-ID: <1317289153-21123-7-git-send-email-dp@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1317289153-21123-1-git-send-email-dp@opensource.wolfsonmicro.com>
Ensure we've got a function so users can enable/disable the
cache bypass option.
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
---
drivers/base/regmap/regcache.c | 19 +++++++++++++++++++
include/linux/regmap.h | 1 +
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index f91bc7b..eaa2e20 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -286,6 +286,25 @@ void regcache_cache_only(struct regmap *map, bool enable)
}
EXPORT_SYMBOL_GPL(regcache_cache_only);
+/**
+ * regcache_cache_bypass: Put a register map into cache bypass mode
+ *
+ * @map: map to configure
+ * @cache_only: flag if changes should not be written to the hardware
+ *
+ * When a register map is marked with the cache bypass option, writes
+ * to the register map API will only update the hardware and not the
+ * the cache directly. This is useful when syncing the cache back to
+ * the hardware.
+ */
+void regcache_cache_bypass(struct regmap *map, bool enable)
+{
+ mutex_lock(&map->lock);
+ map->cache_bypass = enable;
+ mutex_unlock(&map->lock);
+}
+EXPORT_SYMBOL_GPL(regcache_cache_bypass);
+
bool regcache_set_val(void *base, unsigned int idx,
unsigned int val, unsigned int word_size)
{
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 76ac255..3daac2d 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -142,5 +142,6 @@ int regmap_update_bits(struct regmap *map, unsigned int reg,
int regcache_sync(struct regmap *map);
void regcache_cache_only(struct regmap *map, bool enable);
+void regcache_cache_bypass(struct regmap *map, bool enable);
#endif
--
1.7.6.4
next prev parent reply other threads:[~2011-09-29 9:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-29 9:39 [PATCH 1/8] Revert "regmap: Grab the lock in regcache_cache_only()" Dimitris Papastamos
2011-09-29 9:39 ` [PATCH 2/8] regmap: Make _regmap_write() global Dimitris Papastamos
2011-09-29 10:19 ` Mark Brown
2011-09-29 10:20 ` Mark Brown
2011-09-29 9:39 ` [PATCH 3/8] regmap: Use the lockless _regmap_write() for syncing Dimitris Papastamos
2011-09-29 9:39 ` [PATCH 4/8] regmap: Guard regcache_sync() with map->lock Dimitris Papastamos
2011-09-29 10:22 ` Mark Brown
2011-09-29 13:26 ` Dimitris Papastamos
2011-09-29 9:39 ` [PATCH 5/8] regmap: Save/restore the bypass state upon syncing Dimitris Papastamos
2011-09-29 9:39 ` [PATCH 6/8] regmap: Grab the lock in regcache_cache_only() Dimitris Papastamos
2011-09-29 9:39 ` Dimitris Papastamos [this message]
2011-09-29 9:39 ` [PATCH 8/8] regmap: Ensure we scream if we enable cache bypass/only at the same time Dimitris Papastamos
2011-09-29 10:25 ` Mark Brown
2011-09-29 13:24 ` Dimitris Papastamos
2011-09-29 10:18 ` [PATCH 1/8] Revert "regmap: Grab the lock in regcache_cache_only()" Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1317289153-21123-7-git-send-email-dp@opensource.wolfsonmicro.com \
--to=dp@opensource.wolfsonmicro.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=lars@metafoo.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox