Skip to contentSkip to conversation

fixes for latest bq27xxx driver and OpenPandora DT nodes

PATCH Superseded H. Nikolaus Schaller 2 participants 7 messages Aug 31, 2017

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

v3 cover fixes for latest bq27xxx driver and OpenPandora DT nodes

Latest bq27xxx drivers allow to write RAM/NVRAM parameters of the fuel gauge chip from values defined in board specific device tree.

This allows to specify the battery properties of a standard battery.

This patch set enables this for two chips where I have tested it on real devices:

bq27421: Pyra handheld prototype
bq27500: OpenPandora 600 Mhz standard device

Since the Pyra DT is not yet mainlined, there are only DT patches for the OpenPandora.

H. Nikolaus Schaller (4):
power: supply: bq27xxx: enable writing capacity values for bq27421
power: supply: bq27xxx: enable writing capacity values for bq27500
DT: OpenPandora: add battery node to describe OpenPandora battery
DT: OpenPandora: fix for configuration of bq27500 fuel gauge

 arch/arm/boot/dts/omap3-pandora-common.dtsi | 11 ++++++++++-
 drivers/power/supply/bq27xxx_battery.c      |  8 --------
 2 files changed, 10 insertions(+), 9 deletions(-)
Signature · 1 line
2.12.2
#1 lore raw

PATCH v3 1/4 power: supply: bq27xxx: enable writing capacity values for bq27421

Tested on Pyra prototype with bq27421.

---
 drivers/power/supply/bq27xxx_battery.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/power/supply/bq27xxx_battery.c +0 -4
index ad876a3abe01..e80571cf7be1 100644
@@ -688,15 +688,11 @@ static struct bq27xxx_dm_reg bq27545_dm_regs[] = {
 #define bq27545_dm_regs 0
 #endif
 
-#if 0 /* not yet tested */
 static struct bq27xxx_dm_reg bq27421_dm_regs[] = {
 	[BQ27XXX_DM_DESIGN_CAPACITY]   = { 82, 10, 2,    0,  8000 },
 	[BQ27XXX_DM_DESIGN_ENERGY]     = { 82, 12, 2,    0, 32767 },
 	[BQ27XXX_DM_TERMINATE_VOLTAGE] = { 82, 16, 2, 2500,  3700 },
 };
-#else
-#define bq27421_dm_regs 0
-#endif
 
 static struct bq27xxx_dm_reg bq27425_dm_regs[] = {
 	[BQ27XXX_DM_DESIGN_CAPACITY]   = { 82, 12, 2,    0, 32767 },
Signature · 6 lines
2.12.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

Re: [PATCH v3 1/4] power: supply: bq27xxx: enable writing capacity values for bq27421

Hi,

Quoted 4 lines · H. Nikolaus Schaller

Tested on Pyra prototype with bq27421.

---

Thanks, queued.

-- Sebastian

Quoted 30 lines
 drivers/power/supply/bq27xxx_battery.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/power/supply/bq27xxx_battery.c +0 -4
index ad876a3abe01..e80571cf7be1 100644
@@ -688,15 +688,11 @@ static struct bq27xxx_dm_reg bq27545_dm_regs[] = {
 #define bq27545_dm_regs 0
 #endif
 
-#if 0 /* not yet tested */
 static struct bq27xxx_dm_reg bq27421_dm_regs[] = {
 	[BQ27XXX_DM_DESIGN_CAPACITY]   = { 82, 10, 2,    0,  8000 },
 	[BQ27XXX_DM_DESIGN_ENERGY]     = { 82, 12, 2,    0, 32767 },
 	[BQ27XXX_DM_TERMINATE_VOLTAGE] = { 82, 16, 2, 2500,  3700 },
 };
-#else
-#define bq27421_dm_regs 0
-#endif
 
 static struct bq27xxx_dm_reg bq27425_dm_regs[] = {
 	[BQ27XXX_DM_DESIGN_CAPACITY]   = { 82, 12, 2,    0, 32767 },
Signature · 6 lines
2.12.2

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

PATCH v3 2/4 power: supply: bq27xxx: enable writing capacity values for bq27500

In reply to H. Nikolaus Schaller

Tested on OpenPandora with bq27500.

---
 drivers/power/supply/bq27xxx_battery.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/power/supply/bq27xxx_battery.c +0 -4
index e80571cf7be1..5562f998330f 100644
@@ -653,15 +653,11 @@ enum bq27xxx_dm_reg_id {
 #define bq2751x_dm_regs 0
 #define bq2752x_dm_regs 0
 
-#if 0 /* not yet tested */
 static struct bq27xxx_dm_reg bq27500_dm_regs[] = {
 	[BQ27XXX_DM_DESIGN_CAPACITY]   = { 48, 10, 2,    0, 65535 },
 	[BQ27XXX_DM_DESIGN_ENERGY]     = { }, /* missing on chip */
 	[BQ27XXX_DM_TERMINATE_VOLTAGE] = { 80, 48, 2, 1000, 32767 },
 };
-#else
-#define bq27500_dm_regs 0
-#endif
 
 /* todo create data memory definitions from datasheets and test on chips */
 #define bq27510g1_dm_regs 0
Signature · 1 line
2.12.2
#4 lore raw

Re: [PATCH v3 2/4] power: supply: bq27xxx: enable writing capacity values for bq27500

Hi,

Quoted 4 lines · H. Nikolaus Schaller

Tested on OpenPandora with bq27500.

---

Thanks, queued.

-- Sebastian

Quoted 26 lines
 drivers/power/supply/bq27xxx_battery.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/power/supply/bq27xxx_battery.c +0 -4
index e80571cf7be1..5562f998330f 100644
@@ -653,15 +653,11 @@ enum bq27xxx_dm_reg_id {
 #define bq2751x_dm_regs 0
 #define bq2752x_dm_regs 0
 
-#if 0 /* not yet tested */
 static struct bq27xxx_dm_reg bq27500_dm_regs[] = {
 	[BQ27XXX_DM_DESIGN_CAPACITY]   = { 48, 10, 2,    0, 65535 },
 	[BQ27XXX_DM_DESIGN_ENERGY]     = { }, /* missing on chip */
 	[BQ27XXX_DM_TERMINATE_VOLTAGE] = { 80, 48, 2, 1000, 32767 },
 };
-#else
-#define bq27500_dm_regs 0
-#endif
 
 /* todo create data memory definitions from datasheets and test on chips */
 #define bq27510g1_dm_regs 0
Signature · 1 line
2.12.2
#5 lore raw

PATCH v3 3/4 DT: OpenPandora: add battery node to describe OpenPandora battery

In reply to H. Nikolaus Schaller

Add DT node to describe the standard OpenPandora battery PB-4000-001 so that its properties can be used by the fuel gauge driver.

---
 arch/arm/boot/dts/omap3-pandora-common.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/boot/dts/omap3-pandora-common.dtsi +8 -0
index 582e1fe25602..154865289dba 100644
@@ -273,6 +273,14 @@
 		enable-active-high;
 		gpio = <&twl_gpio 13 GPIO_ACTIVE_HIGH>;
 	};
+
+	/* standard OpenPandora battery (PB-4000-001) */
+	bat: battery {
+		compatible = "simple-battery", "openpandora-battery";
+		voltage-min-design-microvolt = <3200000>;
+		energy-full-design-microwatt-hours = <14800000>;
+		charge-full-design-microamp-hours = <4000000>;
+	};
 };
 
 &omap3_pmx_core {
Signature · 1 line
2.12.2
#6 lore raw

PATCH v3 4/4 DT: OpenPandora: fix for configuration of bq27500 fuel gauge

In reply to H. Nikolaus Schaller

Using the latest driver features requires to use "ti,bq27500-1" instead of "ti,bq27500" as the compatible property.

Also add a reference to the monitored-battery.

---
 arch/arm/boot/dts/omap3-pandora-common.dtsi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/boot/dts/omap3-pandora-common.dtsi +2 -1
index 154865289dba..bdf082246f9b 100644
@@ -545,8 +545,9 @@
 	clock-frequency = <100000>;
 
 	bq27500@55 {
-		compatible = "ti,bq27500";
+		compatible = "ti,bq27500-1";
 		reg = <0x55>;
+		monitored-battery = <&bat>;
 	};
 
 };
Signature · 1 line
2.12.2