Skip to content

Commit

Permalink
mfd: twl-core: API to set the regcache bypass for a given regmap in twl
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Ujfalusi authored and Lee Jones committed Jan 8, 2014
1 parent 8daf354 commit 3def927
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
21 changes: 21 additions & 0 deletions drivers/mfd/twl-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/*----------------------------------------------------------------------*/

/**
Expand Down
3 changes: 3 additions & 0 deletions include/linux/i2c/twl.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ static inline int twl_class_is_ ##class(void) \
TWL_CLASS_IS(4030, TWL4030_CLASS_ID)
TWL_CLASS_IS(6030, TWL6030_CLASS_ID)

/* Set the regcache bypass for the regmap associated with the nodule */
int twl_set_regcache_bypass(u8 mod_no, bool enable);

/*
* Read and write several 8-bit registers at once.
*/
Expand Down

0 comments on commit 3def927

Please sign in to comment.