From: Lars-Peter Clausen <lars@metafoo.de>
To: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Cc: linux-kernel@vger.kernel.org,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Liam Girdwood <lrg@ti.com>, Graeme Gregory <gg@slimlogic.co.uk>,
Samuel Oritz <sameo@linux.intel.com>
Subject: Re: [PATCH 6/6] regmap: Incorporate the regcache core into regmap
Date: Mon, 05 Sep 2011 18:22:36 +0200 [thread overview]
Message-ID: <4E64F74C.1010606@metafoo.de> (raw)
In-Reply-To: <1315230662-12401-7-git-send-email-dp@opensource.wolfsonmicro.com>
On 09/05/2011 03:51 PM, Dimitris Papastamos wrote:
> This patch incorporates the regcache core code into regmap. All previous
> patches have been no-ops essentially up to this point.
>
> The bulk read operation is not supported by regcache at the moment. This
> will be implemented incrementally.
>
> Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
> ---
> drivers/base/regmap/regmap.c | 56 ++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 56 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
> index fa2bd89..df4e00a 100644
> --- a/drivers/base/regmap/regmap.c
> +++ b/drivers/base/regmap/regmap.c
> @@ -146,6 +146,13 @@ struct regmap *regmap_init(struct device *dev,
> map->readable_reg = config->readable_reg;
> map->volatile_reg = config->volatile_reg;
> map->precious_reg = config->precious_reg;
> + map->cache_type = config->cache_type;
> + map->cache_defaults = config->cache_defaults;
> + map->num_cache_defaults = config->num_cache_defaults;
> + map->num_cache_defaults_raw = config->num_cache_defaults_raw;
> + map->cache_defaults_raw = config->cache_defaults_raw;
> + map->cache_size_raw = (config->val_bits / 8) * config->num_cache_defaults_raw;
> + map->cache_word_size = config->val_bits / 8;
>
> switch (config->reg_bits) {
> case 4:
> @@ -201,6 +208,12 @@ struct regmap *regmap_init(struct device *dev,
> goto err_bus;
> }
>
> +#ifdef CONFIG_REGCACHE
CONFIG_REGCACHE is not defined, so we'll end up with no regcache support.
> + ret = regcache_init(map);
> + if (ret < 0)
> + goto err_bus;
> +#endif
> +
> regmap_debugfs_init(map);
>
> return map;
> @@ -219,6 +232,9 @@ EXPORT_SYMBOL_GPL(regmap_init);
> */
> void regmap_exit(struct regmap *map)
> {
> +#ifdef CONFIG_REGCACHE
> + regcache_exit(map);
> +#endif
> regmap_debugfs_exit(map);
> kfree(map->work_buf);
> module_put(map->bus->owner);
> @@ -321,6 +337,20 @@ int regmap_write(struct regmap *map, unsigned int reg, unsigned int val)
>
> mutex_lock(&map->lock);
>
> +#ifdef CONFIG_REGCACHE
> + if (!map->cache_bypass) {
> + ret = regcache_write(map, reg, val);
> + if (ret < 0) {
> + mutex_unlock(&map->lock);
> + return ret;
> + }
> + if (map->cache_only) {
> + mutex_unlock(&map->lock);
> + return 0;
> + }
> + }
> +#endif
> +
> ret = _regmap_write(map, reg, val);
>
> mutex_unlock(&map->lock);
> @@ -422,6 +452,16 @@ int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val)
>
> mutex_lock(&map->lock);
>
> +#ifdef CONFIG_REGCACHE
> + if (!map->cache_bypass) {
> + ret = regcache_read(map, reg, val);
> + if (!ret) {
> + mutex_unlock(&map->lock);
> + return 0;
> + }
> + }
I think this will need tighter integration. For example do we want to fallback
to a hw read when the cached read fails? And also regcache_read will return for
REGCACHE_NONE, which means we neither do a cached read nor a hw read.
> +#endif
> +
> ret = _regmap_read(map, reg, val);
>
> mutex_unlock(&map->lock);
next prev parent reply other threads:[~2011-09-05 16:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-05 13:50 [PATCH 0/6 v2] Introduce caching support for regmap Dimitris Papastamos
2011-09-05 13:50 ` [PATCH 1/6] regmap: Introduce caching support Dimitris Papastamos
2011-09-05 16:14 ` Lars-Peter Clausen
2011-09-05 13:50 ` [PATCH 2/6] regmap: Add the indexed cache support Dimitris Papastamos
2011-09-05 13:50 ` [PATCH 3/6] regmap: Add the rbtree " Dimitris Papastamos
2011-09-05 16:15 ` Lars-Peter Clausen
2011-09-05 13:51 ` [PATCH 4/6] regmap: Add the LZO " Dimitris Papastamos
2011-09-05 16:18 ` Lars-Peter Clausen
2011-09-15 9:35 ` Dimitris Papastamos
2011-09-05 13:51 ` [PATCH 5/6] regmap: Add the regcache_sync trace event Dimitris Papastamos
2011-09-05 13:51 ` [PATCH 6/6] regmap: Incorporate the regcache core into regmap Dimitris Papastamos
2011-09-05 16:22 ` Lars-Peter Clausen [this message]
2011-09-06 1:27 ` Mark Brown
2011-09-06 1:47 ` [PATCH 0/6 v2] Introduce caching support for regmap 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=4E64F74C.1010606@metafoo.de \
--to=lars@metafoo.de \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=dp@opensource.wolfsonmicro.com \
--cc=gg@slimlogic.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@ti.com \
--cc=sameo@linux.intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.