Skip to contentSkip to conversation

mfd: tps65090: Stop caching most registers

PATCH RESEND In review Doug Anderson 3 participants 7 messages Apr 22, 2014 – Apr 29, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND v3 3/5 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).

---
Changes in v3: None
Changes in v2:
- Leave cache on for the registers that can be cached.
- Move register offsets to mfd header file.

 drivers/mfd/tps65090.c           | 27 ++++++++++++++-------------
 drivers/power/tps65090-charger.c | 11 -----------
 include/linux/mfd/tps65090.h     | 14 ++++++++++++++
 3 files changed, 28 insertions(+), 24 deletions(-)
drivers/mfd/tps65090.c +14 -13
index c3cddb4..1c3e6e2 100644
@@ -32,14 +32,6 @@
 #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 = {
drivers/power/tps65090-charger.c +0 -11
index cc26c12..31a3ba4 100644
@@ -30,17 +30,6 @@
 
 #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)
include/linux/mfd/tps65090.h +14 -0
index 3f43069..45f0f9d 100644
@@ -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;
Signature · 1 line
1.9.1.423.g4596e3a
#1 lore raw
Quoted 3 lines · Doug Anderson

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.

Lee, I don't mind if I apply this and send a pull request to you or I pull a tag from you with this in - what's easiest for you?

#2 lore raw
Quoted 6 lines
Quoted 3 lines

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.

Lee, I don't mind if I apply this and send a pull request to you or I pull a tag from you with this in - what's easiest for you?

I'm happy to do it.

Doug,
Can you send the patch-set again with all of the *-bys and ensure I'm on TO or CC please?

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#3 lore raw

Lee,

Quoted 4 lines · Lee Jones
Quoted 4 lines
Quoted 3 lines

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.

Quoted 8 lines
Quoted 2 lines

Lee, I don't mind if I apply this and send a pull request to you or I pull a tag from you with this in - what's easiest for you?

I'm happy to do it.

Doug,
Can you send the patch-set again with all of the *-bys and ensure I'm on TO or CC please?

It looks as if you've already applied 1, 3, and 4. I've sent up 2 and 5 again with collected tags.

https://patchwork.kernel.org/patch/4042761/
https://patchwork.kernel.org/patch/4042751/

-Doug

#4 lore raw
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

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.

Quoted 8 lines
Quoted 2 lines

Lee, I don't mind if I apply this and send a pull request to you or I pull a tag from you with this in - what's easiest for you?

I'm happy to do it.

Doug,
Can you send the patch-set again with all of the *-bys and ensure I'm on TO or CC please?

Quoted 5 lines

It looks as if you've already applied 1, 3, and 4. I've sent up 2 and 5 again with collected tags.

https://patchwork.kernel.org/patch/4042761/
https://patchwork.kernel.org/patch/4042751/

I think we have this sorted now. I sent a pull-request to Mark this morning.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#5 lore raw

Lee,

Quoted 13 lines · Lee Jones
Quoted 13 lines
Quoted 12 lines
Quoted 6 lines
Quoted 3 lines

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.

Lee, I don't mind if I apply this and send a pull request to you or I pull a tag from you with this in - what's easiest for you?

I'm happy to do it.

Doug,
Can you send the patch-set again with all of the *-bys and ensure I'm on TO or CC please?

Quoted 8 lines
Quoted 5 lines

It looks as if you've already applied 1, 3, and 4. I've sent up 2 and 5 again with collected tags.

https://patchwork.kernel.org/patch/4042761/
https://patchwork.kernel.org/patch/4042751/

I think we have this sorted now. I sent a pull-request to Mark this morning.

Thanks! I'll keep an eye on linux-next to make sure everything is there. It sounds like the charger patch
<https://patchwork.kernel.org/patch/4042751/> wasn't picked up by anyone. I'll see if I can find someone to take that. Luckily that can be applied independently of everything else (it just won't fix everything till all the patches are together).

-Doug

#6 lore raw
Quoted 25 lines · Doug Anderson

Lee,

Quoted 13 lines · Lee Jones
Quoted 13 lines
Quoted 12 lines
Quoted 6 lines
Quoted 3 lines

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.

Lee, I don't mind if I apply this and send a pull request to you or I pull a tag from you with this in - what's easiest for you?

I'm happy to do it.

Doug,
Can you send the patch-set again with all of the *-bys and ensure I'm on TO or CC please?

Quoted 8 lines
Quoted 5 lines

It looks as if you've already applied 1, 3, and 4. I've sent up 2 and 5 again with collected tags.

https://patchwork.kernel.org/patch/4042761/
https://patchwork.kernel.org/patch/4042751/

I think we have this sorted now. I sent a pull-request to Mark this morning.

Quoted 6 lines

Thanks! I'll keep an eye on linux-next to make sure everything is there. It sounds like the charger patch
<https://patchwork.kernel.org/patch/4042751/> wasn't picked up by anyone. I'll see if I can find someone to take that. Luckily that can be applied independently of everything else (it just won't fix everything till all the patches are together).

You still need an Ack from Anton before I can apply that.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog