mfd: tps65090: Stop caching most registers
authorDoug Anderson <dianders@chromium.org>
Wed, 16 Apr 2014 23:12:27 +0000 (16:12 -0700)
committerLee Jones <lee.jones@linaro.org>
Wed, 23 Apr 2014 11:32:19 +0000 (12:32 +0100)
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>
drivers/mfd/tps65090.c
drivers/power/tps65090-charger.c
include/linux/mfd/tps65090.h

index c3cddb4c3a1aea8431bfbd4f3b62e9c72edfd6c6..1c3e6e2efe410812d7fd0a58b9b940be47a5ecbc 100644 (file)
 #define NUM_INT_REG 2
 #define TOTAL_NUM_REG 0x18
 
-/* interrupt status registers */
-#define TPS65090_INT_STS       0x0
-#define TPS65090_INT_STS2      0x1
-
-/* interrupt mask registers */
-#define TPS65090_INT_MSK       0x2
-#define TPS65090_INT_MSK2      0x3
-
 #define TPS65090_INT1_MASK_VAC_STATUS_CHANGE           1
 #define TPS65090_INT1_MASK_VSYS_STATUS_CHANGE          2
 #define TPS65090_INT1_MASK_BAT_STATUS_CHANGE           3
@@ -144,17 +136,26 @@ static struct regmap_irq_chip tps65090_irq_chip = {
        .irqs = tps65090_irqs,
        .num_irqs = ARRAY_SIZE(tps65090_irqs),
        .num_regs = NUM_INT_REG,
-       .status_base = TPS65090_INT_STS,
-       .mask_base = TPS65090_INT_MSK,
+       .status_base = TPS65090_REG_INTR_STS,
+       .mask_base = TPS65090_REG_INTR_MASK,
        .mask_invert = true,
 };
 
 static bool is_volatile_reg(struct device *dev, unsigned int reg)
 {
-       if ((reg == TPS65090_INT_STS) || (reg == TPS65090_INT_STS2))
-               return true;
-       else
+       /* Nearly all registers have status bits mixed in, except a few */
+       switch (reg) {
+       case TPS65090_REG_INTR_MASK:
+       case TPS65090_REG_INTR_MASK2:
+       case TPS65090_REG_CG_CTRL0:
+       case TPS65090_REG_CG_CTRL1:
+       case TPS65090_REG_CG_CTRL2:
+       case TPS65090_REG_CG_CTRL3:
+       case TPS65090_REG_CG_CTRL4:
+       case TPS65090_REG_CG_CTRL5:
                return false;
+       }
+       return true;
 }
 
 static const struct regmap_config tps65090_regmap_config = {
index 8fc9d6df87f682610187a7ca665c393ef30c6e1d..1685f63b9e5d03c1084bc1436fdf6cce740013ea 100644 (file)
 
 #include <linux/mfd/tps65090.h>
 
-#define TPS65090_REG_INTR_STS  0x00
-#define TPS65090_REG_INTR_MASK 0x02
-#define TPS65090_REG_CG_CTRL0  0x04
-#define TPS65090_REG_CG_CTRL1  0x05
-#define TPS65090_REG_CG_CTRL2  0x06
-#define TPS65090_REG_CG_CTRL3  0x07
-#define TPS65090_REG_CG_CTRL4  0x08
-#define TPS65090_REG_CG_CTRL5  0x09
-#define TPS65090_REG_CG_STATUS1        0x0a
-#define TPS65090_REG_CG_STATUS2        0x0b
-
 #define TPS65090_CHARGER_ENABLE        BIT(0)
 #define TPS65090_VACG          BIT(1)
 #define TPS65090_NOITERM       BIT(5)
index 3f43069413e72dcc2975a14c1e9edf5677365627..45f0f9d2ed25f4eccf240443d0dcb76b0b3d0d41 100644 (file)
@@ -64,6 +64,20 @@ enum {
        TPS65090_REGULATOR_MAX,
 };
 
+/* Register addresses */
+#define TPS65090_REG_INTR_STS  0x00
+#define TPS65090_REG_INTR_STS2 0x01
+#define TPS65090_REG_INTR_MASK 0x02
+#define TPS65090_REG_INTR_MASK2        0x03
+#define TPS65090_REG_CG_CTRL0  0x04
+#define TPS65090_REG_CG_CTRL1  0x05
+#define TPS65090_REG_CG_CTRL2  0x06
+#define TPS65090_REG_CG_CTRL3  0x07
+#define TPS65090_REG_CG_CTRL4  0x08
+#define TPS65090_REG_CG_CTRL5  0x09
+#define TPS65090_REG_CG_STATUS1        0x0a
+#define TPS65090_REG_CG_STATUS2        0x0b
+
 struct tps65090 {
        struct device           *dev;
        struct regmap           *rmap;
This page took 0.027981 seconds and 5 git commands to generate.