From: Laxman Dewangan <ldewangan@nvidia.com>
To: <grant.likely@secretlab.ca>, <linus.walleij@stericsson.com>,
<sameo@linux.intel.com>
Cc: <linux-kernel@vger.kernel.org>, <swarren@nvidia.com>,
<broonie@opensource.wolfsonmicro.com>,
Laxman Dewangan <ldewangan@nvidia.com>
Subject: [PATCH V2 3/6] mfd: tps6586x: cache register through regmap
Date: Mon, 16 Jul 2012 12:21:47 +0530 [thread overview]
Message-ID: <1342421510-10638-4-git-send-email-ldewangan@nvidia.com> (raw)
In-Reply-To: <1342421510-10638-1-git-send-email-ldewangan@nvidia.com>
To cache the interrupt mask register, use the regmap RB_TREE
cache-ing mechanism in place of implementing it locally.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
Changes V1 -> V2:
No change, generated new patch for V2 series.
drivers/mfd/tps6586x.c | 24 ++++++++++++++++--------
1 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index fb0c109..7210fa7 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -104,7 +104,6 @@ struct tps6586x {
struct mutex irq_lock;
int irq_base;
u32 irq_en;
- u8 mask_cache[5];
u8 mask_reg[5];
};
@@ -276,12 +275,11 @@ static void tps6586x_irq_sync_unlock(struct irq_data *data)
int i;
for (i = 0; i < ARRAY_SIZE(tps6586x->mask_reg); i++) {
- if (tps6586x->mask_reg[i] != tps6586x->mask_cache[i]) {
- if (!WARN_ON(tps6586x_write(tps6586x->dev,
- TPS6586X_INT_MASK1 + i,
- tps6586x->mask_reg[i])))
- tps6586x->mask_cache[i] = tps6586x->mask_reg[i];
- }
+ int ret;
+ ret = tps6586x_write(tps6586x->dev,
+ TPS6586X_INT_MASK1 + i,
+ tps6586x->mask_reg[i]);
+ WARN_ON(ret);
}
mutex_unlock(&tps6586x->irq_lock);
@@ -328,7 +326,6 @@ static int __devinit tps6586x_irq_init(struct tps6586x *tps6586x, int irq,
mutex_init(&tps6586x->irq_lock);
for (i = 0; i < 5; i++) {
- tps6586x->mask_cache[i] = 0xff;
tps6586x->mask_reg[i] = 0xff;
tps6586x_write(tps6586x->dev, TPS6586X_INT_MASK1 + i, 0xff);
}
@@ -478,10 +475,21 @@ static struct tps6586x_platform_data *tps6586x_parse_dt(struct i2c_client *clien
}
#endif
+static bool is_volatile_reg(struct device *dev, unsigned int reg)
+{
+ /* Cache all interrupt mask register */
+ if ((reg >= TPS6586X_INT_MASK1) && (reg <= TPS6586X_INT_MASK5))
+ return false;
+
+ return true;
+}
+
static const struct regmap_config tps6586x_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
.max_register = TPS6586X_MAX_REGISTER - 1,
+ .volatile_reg = is_volatile_reg,
+ .cache_type = REGCACHE_RBTREE,
};
static int __devinit tps6586x_i2c_probe(struct i2c_client *client,
--
1.7.1.1
next prev parent reply other threads:[~2012-07-16 7:01 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-16 6:51 [PATCH V2 0/6] mfd: tp6586x: enhancements in the driver Laxman Dewangan
2012-07-16 6:51 ` [PATCH V2 1/6] mfd: tps6586x:use devm managed resources Laxman Dewangan
2012-07-16 20:01 ` Mark Brown
2012-07-17 4:42 ` Laxman Dewangan
2012-07-17 16:53 ` Mark Brown
2012-07-18 5:33 ` Laxman Dewangan
2012-07-16 6:51 ` [PATCH V2 2/6] mfd: Use regmap for tps6586x register access Laxman Dewangan
2012-07-16 20:02 ` Mark Brown
2012-07-16 6:51 ` Laxman Dewangan [this message]
2012-07-16 20:03 ` [PATCH V2 3/6] mfd: tps6586x: cache register through regmap Mark Brown
2012-07-17 4:28 ` Laxman Dewangan
2012-07-16 6:51 ` [PATCH V2 4/6] gpio: tps6586x: add gpio support through platform driver Laxman Dewangan
2012-07-16 6:51 ` [PATCH V2 5/6] ARM: tegra: defconfig: enable tps6586x gpio Laxman Dewangan
2012-07-16 22:35 ` Linus Walleij
2012-07-16 6:51 ` [PATCH V2 6/6] mfd: tps6586x: remove gpio support from core driver Laxman Dewangan
2012-07-16 22:35 ` Linus Walleij
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=1342421510-10638-4-git-send-email-ldewangan@nvidia.com \
--to=ldewangan@nvidia.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=grant.likely@secretlab.ca \
--cc=linus.walleij@stericsson.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sameo@linux.intel.com \
--cc=swarren@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).