aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Anderson <dianders@chromium.org>2014-04-16 19:12:27 -0400
committerLee Jones <lee.jones@linaro.org>2014-04-23 07:32:19 -0400
commitc42ba72ec3a7a1b6aa30122931f1f4b91b601c31 (patch)
tree7c8eb878e231d35da4a3178db85046d91fd13830
parent7d811771c95ebab358eca8e68b53efe09e3a6a96 (diff)
mfd: tps65090: Stop caching most registers
Nearly all of the registers in tps65090 combine control bits and status bits. Turn off caching of all registers except the select few that can be cached. In order to avoid adding more duplicate #defines, we also move some register offset definitions to the mfd driver (and resolve inconsistent names). Signed-off-by: Doug Anderson <dianders@chromium.org> Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r--drivers/mfd/tps65090.c27
-rw-r--r--drivers/power/tps65090-charger.c11
-rw-r--r--include/linux/mfd/tps65090.h14
3 files changed, 28 insertions, 24 deletions
diff --git a/drivers/mfd/tps65090.c b/drivers/mfd/tps65090.c
index c3cddb4c3a1a..1c3e6e2efe41 100644
--- a/drivers/mfd/tps65090.c
+++ b/drivers/mfd/tps65090.c
@@ -32,14 +32,6 @@
32#define NUM_INT_REG 2 32#define NUM_INT_REG 2
33#define TOTAL_NUM_REG 0x18 33#define TOTAL_NUM_REG 0x18
34 34
35/* interrupt status registers */
36#define TPS65090_INT_STS 0x0
37#define TPS65090_INT_STS2 0x1
38
39/* interrupt mask registers */
40#define TPS65090_INT_MSK 0x2
41#define TPS65090_INT_MSK2 0x3
42
43#define TPS65090_INT1_MASK_VAC_STATUS_CHANGE 1 35#define TPS65090_INT1_MASK_VAC_STATUS_CHANGE 1
44#define TPS65090_INT1_MASK_VSYS_STATUS_CHANGE 2 36#define TPS65090_INT1_MASK_VSYS_STATUS_CHANGE 2
45#define TPS65090_INT1_MASK_BAT_STATUS_CHANGE 3 37#define TPS65090_INT1_MASK_BAT_STATUS_CHANGE 3
@@ -144,17 +136,26 @@ static struct regmap_irq_chip tps65090_irq_chip = {
144 .irqs = tps65090_irqs, 136 .irqs = tps65090_irqs,
145 .num_irqs = ARRAY_SIZE(tps65090_irqs), 137 .num_irqs = ARRAY_SIZE(tps65090_irqs),
146 .num_regs = NUM_INT_REG, 138 .num_regs = NUM_INT_REG,
147 .status_base = TPS65090_INT_STS, 139 .status_base = TPS65090_REG_INTR_STS,
148 .mask_base = TPS65090_INT_MSK, 140 .mask_base = TPS65090_REG_INTR_MASK,
149 .mask_invert = true, 141 .mask_invert = true,
150}; 142};
151 143
152static bool is_volatile_reg(struct device *dev, unsigned int reg) 144static bool is_volatile_reg(struct device *dev, unsigned int reg)
153{ 145{
154 if ((reg == TPS65090_INT_STS) || (reg == TPS65090_INT_STS2)) 146 /* Nearly all registers have status bits mixed in, except a few */
155 return true; 147 switch (reg) {
156 else 148 case TPS65090_REG_INTR_MASK:
149 case TPS65090_REG_INTR_MASK2:
150 case TPS65090_REG_CG_CTRL0:
151 case TPS65090_REG_CG_CTRL1:
152 case TPS65090_REG_CG_CTRL2:
153 case TPS65090_REG_CG_CTRL3:
154 case TPS65090_REG_CG_CTRL4:
155 case TPS65090_REG_CG_CTRL5:
157 return false; 156 return false;
157 }
158 return true;
158} 159}
159 160
160static const struct regmap_config tps65090_regmap_config = { 161static const struct regmap_config tps65090_regmap_config = {
diff --git a/drivers/power/tps65090-charger.c b/drivers/power/tps65090-charger.c
index 8fc9d6df87f6..1685f63b9e5d 100644
--- a/drivers/power/tps65090-charger.c
+++ b/drivers/power/tps65090-charger.c
@@ -28,17 +28,6 @@
28 28
29#include <linux/mfd/tps65090.h> 29#include <linux/mfd/tps65090.h>
30 30
31#define TPS65090_REG_INTR_STS 0x00
32#define TPS65090_REG_INTR_MASK 0x02
33#define TPS65090_REG_CG_CTRL0 0x04
34#define TPS65090_REG_CG_CTRL1 0x05
35#define TPS65090_REG_CG_CTRL2 0x06
36#define TPS65090_REG_CG_CTRL3 0x07
37#define TPS65090_REG_CG_CTRL4 0x08
38#define TPS65090_REG_CG_CTRL5 0x09
39#define TPS65090_REG_CG_STATUS1 0x0a
40#define TPS65090_REG_CG_STATUS2 0x0b
41
42#define TPS65090_CHARGER_ENABLE BIT(0) 31#define TPS65090_CHARGER_ENABLE BIT(0)
43#define TPS65090_VACG BIT(1) 32#define TPS65090_VACG BIT(1)
44#define TPS65090_NOITERM BIT(5) 33#define TPS65090_NOITERM BIT(5)
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h
index 3f43069413e7..45f0f9d2ed25 100644
--- a/include/linux/mfd/tps65090.h
+++ b/include/linux/mfd/tps65090.h
@@ -64,6 +64,20 @@ enum {
64 TPS65090_REGULATOR_MAX, 64 TPS65090_REGULATOR_MAX,
65}; 65};
66 66
67/* Register addresses */
68#define TPS65090_REG_INTR_STS 0x00
69#define TPS65090_REG_INTR_STS2 0x01
70#define TPS65090_REG_INTR_MASK 0x02
71#define TPS65090_REG_INTR_MASK2 0x03
72#define TPS65090_REG_CG_CTRL0 0x04
73#define TPS65090_REG_CG_CTRL1 0x05
74#define TPS65090_REG_CG_CTRL2 0x06
75#define TPS65090_REG_CG_CTRL3 0x07
76#define TPS65090_REG_CG_CTRL4 0x08
77#define TPS65090_REG_CG_CTRL5 0x09
78#define TPS65090_REG_CG_STATUS1 0x0a
79#define TPS65090_REG_CG_STATUS2 0x0b
80
67struct tps65090 { 81struct tps65090 {
68 struct device *dev; 82 struct device *dev;
69 struct regmap *rmap; 83 struct regmap *rmap;