diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2014-01-03 15:27:47 +0200 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2014-01-08 11:37:39 +0000 |
commit | 3def927ea8c0a1983aa9f1499645efc53e005bb6 (patch) | |
tree | 435f2ead61cc9258fbf389603510781cc9da9275 /drivers/mfd/twl-core.c | |
parent | 8daf3540659c22b4d3530512a3695728482ec23f (diff) | |
download | linux-3def927ea8c0a1983aa9f1499645efc53e005bb6.tar.gz linux-3def927ea8c0a1983aa9f1499645efc53e005bb6.tar.bz2 linux-3def927ea8c0a1983aa9f1499645efc53e005bb6.zip |
mfd: twl-core: API to set the regcache bypass for a given regmap in twl
If the regcache is enabled on the regmap module drivers might need to access
to HW register(s) in certain cases in cache bypass mode.
As an example of this is the audio block's ANAMICL register. In normal
operation the content can be cached but during initialization one bit from
the register need to be monitored. With the twl_set_regcache_bypass() the
client driver can switch regcache bypass on and off when it is needed so
we can utilize the regcache for more registers.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/twl-core.c')
-rw-r--r-- | drivers/mfd/twl-core.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index c91cb4367b9b..f0abca79ff34 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c @@ -383,6 +383,27 @@ int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes) } EXPORT_SYMBOL(twl_i2c_read); +/** + * twl_regcache_bypass - Configure the regcache bypass for the regmap associated + * with the module + * @mod_no: module number + * @enable: Regcache bypass state + * + * Returns 0 else failure. + */ +int twl_set_regcache_bypass(u8 mod_no, bool enable) +{ + struct regmap *regmap = twl_get_regmap(mod_no); + + if (!regmap) + return -EPERM; + + regcache_cache_bypass(regmap, enable); + + return 0; +} +EXPORT_SYMBOL(twl_set_regcache_bypass); + /*----------------------------------------------------------------------*/ /** |