linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] power: supply: bq275xx: implement individual chip revision support
@ 2016-12-22  1:22 Chris Lapa
  2016-12-22  1:22 ` [PATCH 01/10] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future Chris Lapa
                   ` (12 more replies)
  0 siblings, 13 replies; 70+ messages in thread
From: Chris Lapa @ 2016-12-22  1:22 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This patch series separates out support for each revision chip in
the bq27500, bq27510 and bq27520 family. Each revision has enough
register address changes to justify individual register mappings.

Chris Lapa (10):
  power: supplies: bq275xx: rename BQ27500 allow for deprecation in
    future.
  power: supplies: bq275xx: adds specific support for bq27500/1
    revision.
  power: supplies: bq275xx: adds specific support for bq27510-g1
    revision.
  power: supplies: bq275xx: adds specific support for bq27510-g2
    revision.
  power: supplies: bq275xx: adds specific support for bq27510-g3
    revision.
  power: supplies: bq275xx: adds specific support for bq27520-g1
    revision.
  power: supplies: bq275xx: adds specific support for bq27520-g2
    revision.
  power: supplies: bq275xx: adds specific support for bq27520-g3
    revision.
  power: supplies: bq275xx: adds specific support for bq27520-g4
    revision.
  power: supplies: bq275xx: adds device tree binding documentation.

 .../devicetree/bindings/power/supply/bq275xx.txt   |  27 ++
 drivers/power/supply/bq27xxx_battery.c             | 332 ++++++++++++++++++++-
 drivers/power/supply/bq27xxx_battery_i2c.c         |  22 +-
 include/linux/power/bq27xxx_battery.h              |  10 +-
 4 files changed, 385 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/power/supply/bq275xx.txt

-- 
2.1.4

^ permalink raw reply	[flat|nested] 70+ messages in thread

* [PATCH 01/10] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future.
  2016-12-22  1:22 [PATCH 00/10] power: supply: bq275xx: implement individual chip revision support Chris Lapa
@ 2016-12-22  1:22 ` Chris Lapa
  2016-12-22  1:22 ` [PATCH 02/10] power: supplies: bq275xx: adds specific support for bq27500/1 revision Chris Lapa
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2016-12-22  1:22 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

The BQ275XX definition exists only to satisfy backwards compatibility.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 8 ++++----
 drivers/power/supply/bq27xxx_battery_i2c.c | 6 +++---
 include/linux/power/bq27xxx_battery.h      | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 3b0dbc6..312f668 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -145,7 +145,7 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x76,
 		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
 	},
-	[BQ27500] = {
+	[BQ275XX] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
 		[BQ27XXX_REG_INT_TEMP] = 0x28,
@@ -284,7 +284,7 @@ static enum power_supply_property bq27010_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
-static enum power_supply_property bq27500_battery_props[] = {
+static enum power_supply_property bq275xx_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
 	POWER_SUPPLY_PROP_VOLTAGE_NOW,
@@ -384,7 +384,7 @@ static struct {
 } bq27xxx_battery_props[] = {
 	BQ27XXX_PROP(BQ27000, bq27000_battery_props),
 	BQ27XXX_PROP(BQ27010, bq27010_battery_props),
-	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
+	BQ27XXX_PROP(BQ275XX, bq275xx_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -635,7 +635,7 @@ static int bq27xxx_battery_read_pwr_avg(struct bq27xxx_device_info *di)
  */
 static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
-	if (di->chip == BQ27500 || di->chip == BQ27541 || di->chip == BQ27545)
+	if (di->chip == BQ275XX || di->chip == BQ27541 || di->chip == BQ27545)
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
 	if (di->chip == BQ27530 || di->chip == BQ27421)
 		return flags & BQ27XXX_FLAG_OT;
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 85d4ea2..762d96e 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -148,9 +148,9 @@ static int bq27xxx_battery_i2c_remove(struct i2c_client *client)
 static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27200", BQ27000 },
 	{ "bq27210", BQ27010 },
-	{ "bq27500", BQ27500 },
-	{ "bq27510", BQ27500 },
-	{ "bq27520", BQ27500 },
+	{ "bq27500", BQ275XX },
+	{ "bq27510", BQ275XX },
+	{ "bq27520", BQ275XX },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index e30deb0..c452b94 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -4,7 +4,7 @@
 enum bq27xxx_chip {
 	BQ27000 = 1, /* bq27000, bq27200 */
 	BQ27010, /* bq27010, bq27210 */
-	BQ27500, /* bq27500, bq27510, bq27520 */
+	BQ275XX, /* bq27500, bq27510, bq27520 deprecated alias */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH 02/10] power: supplies: bq275xx: adds specific support for bq27500/1 revision.
  2016-12-22  1:22 [PATCH 00/10] power: supply: bq275xx: implement individual chip revision support Chris Lapa
  2016-12-22  1:22 ` [PATCH 01/10] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future Chris Lapa
@ 2016-12-22  1:22 ` Chris Lapa
  2016-12-22  1:22 ` [PATCH 03/10] power: supplies: bq275xx: adds specific support for bq27510-g1 revision Chris Lapa
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2016-12-22  1:22 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27500 chip definition to specifically match the
bq27500/1 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 44 +++++++++++++++++++++++++++++-
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 312f668..5433fda 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -164,6 +164,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
 	},
+	[BQ27500] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -302,6 +321,27 @@ static enum power_supply_property bq275xx_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27500_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -385,6 +425,7 @@ static struct {
 	BQ27XXX_PROP(BQ27000, bq27000_battery_props),
 	BQ27XXX_PROP(BQ27010, bq27010_battery_props),
 	BQ27XXX_PROP(BQ275XX, bq275xx_battery_props),
+	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -635,7 +676,8 @@ static int bq27xxx_battery_read_pwr_avg(struct bq27xxx_device_info *di)
  */
 static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
-	if (di->chip == BQ275XX || di->chip == BQ27541 || di->chip == BQ27545)
+	if (di->chip == BQ275XX || di->chip == BQ27500 || di->chip == BQ27541
+			|| di->chip == BQ27545)
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
 	if (di->chip == BQ27530 || di->chip == BQ27421)
 		return flags & BQ27XXX_FLAG_OT;
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 762d96e..a01b35d 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -151,6 +151,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27500", BQ275XX },
 	{ "bq27510", BQ275XX },
 	{ "bq27520", BQ275XX },
+	{ "bq27500-1", BQ27500 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -173,6 +174,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27500" },
 	{ .compatible = "ti,bq27510" },
 	{ .compatible = "ti,bq27520" },
+	{ .compatible = "ti,bq27500-1" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index c452b94..7d2a415 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -5,6 +5,7 @@ enum bq27xxx_chip {
 	BQ27000 = 1, /* bq27000, bq27200 */
 	BQ27010, /* bq27010, bq27210 */
 	BQ275XX, /* bq27500, bq27510, bq27520 deprecated alias */
+	BQ27500, /* bq27500/1 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH 03/10] power: supplies: bq275xx: adds specific support for bq27510-g1 revision.
  2016-12-22  1:22 [PATCH 00/10] power: supply: bq275xx: implement individual chip revision support Chris Lapa
  2016-12-22  1:22 ` [PATCH 01/10] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future Chris Lapa
  2016-12-22  1:22 ` [PATCH 02/10] power: supplies: bq275xx: adds specific support for bq27500/1 revision Chris Lapa
@ 2016-12-22  1:22 ` Chris Lapa
  2016-12-22  1:22 ` [PATCH 04/10] power: supplies: bq275xx: adds specific support for bq27510-g2 revision Chris Lapa
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2016-12-22  1:22 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27510G1 chip definition to specifically match the
bq27510-G1 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 46 ++++++++++++++++++++++++++++--
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 5433fda..b78881f 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -22,6 +22,7 @@
  * http://www.ti.com/product/bq27010
  * http://www.ti.com/product/bq27210
  * http://www.ti.com/product/bq27500
+ * http://www.ti.com/product/bq27510-g1
  * http://www.ti.com/product/bq27510-g3
  * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27530-g1
@@ -183,6 +184,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27510G1] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -342,6 +362,27 @@ static enum power_supply_property bq27500_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27510g1_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -426,6 +467,7 @@ static struct {
 	BQ27XXX_PROP(BQ27010, bq27010_battery_props),
 	BQ27XXX_PROP(BQ275XX, bq275xx_battery_props),
 	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
+	BQ27XXX_PROP(BQ27510G1, bq27510g1_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -676,8 +718,8 @@ static int bq27xxx_battery_read_pwr_avg(struct bq27xxx_device_info *di)
  */
 static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
-	if (di->chip == BQ275XX || di->chip == BQ27500 || di->chip == BQ27541
-			|| di->chip == BQ27545)
+	if (di->chip == BQ275XX || di->chip == BQ27500 || di->chip == BQ27510G1
+			|| di->chip == BQ27541 || di->chip == BQ27545)
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
 	if (di->chip == BQ27530 || di->chip == BQ27421)
 		return flags & BQ27XXX_FLAG_OT;
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index a01b35d..61f13fd 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -152,6 +152,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27510", BQ275XX },
 	{ "bq27520", BQ275XX },
 	{ "bq27500-1", BQ27500 },
+	{ "bq27510g1", BQ27510G1 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -175,6 +176,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27510" },
 	{ .compatible = "ti,bq27520" },
 	{ .compatible = "ti,bq27500-1" },
+	{ .compatible = "ti,bq27510g1" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 7d2a415..9fa7c86 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -6,6 +6,7 @@ enum bq27xxx_chip {
 	BQ27010, /* bq27010, bq27210 */
 	BQ275XX, /* bq27500, bq27510, bq27520 deprecated alias */
 	BQ27500, /* bq27500/1 */
+	BQ27510G1, /* bq27510G1 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH 04/10] power: supplies: bq275xx: adds specific support for bq27510-g2 revision.
  2016-12-22  1:22 [PATCH 00/10] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                   ` (2 preceding siblings ...)
  2016-12-22  1:22 ` [PATCH 03/10] power: supplies: bq275xx: adds specific support for bq27510-g1 revision Chris Lapa
@ 2016-12-22  1:22 ` Chris Lapa
  2016-12-22  1:22 ` [PATCH 05/10] power: supplies: bq275xx: adds specific support for bq27510-g3 revision Chris Lapa
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2016-12-22  1:22 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27510G2 chip definition to specifically match the
bq27510-G2 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 44 +++++++++++++++++++++++++++++-
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index b78881f..3c60e00 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -23,6 +23,7 @@
  * http://www.ti.com/product/bq27210
  * http://www.ti.com/product/bq27500
  * http://www.ti.com/product/bq27510-g1
+ * http://www.ti.com/product/bq27510-g2
  * http://www.ti.com/product/bq27510-g3
  * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27530-g1
@@ -203,6 +204,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27510G2] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -383,6 +403,27 @@ static enum power_supply_property bq27510g1_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27510g2_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -468,6 +509,7 @@ static struct {
 	BQ27XXX_PROP(BQ275XX, bq275xx_battery_props),
 	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
 	BQ27XXX_PROP(BQ27510G1, bq27510g1_battery_props),
+	BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -719,7 +761,7 @@ static int bq27xxx_battery_read_pwr_avg(struct bq27xxx_device_info *di)
 static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
 	if (di->chip == BQ275XX || di->chip == BQ27500 || di->chip == BQ27510G1
-			|| di->chip == BQ27541 || di->chip == BQ27545)
+			|| di->chip == BQ27510G2 || di->chip == BQ27541 || di->chip == BQ27545)
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
 	if (di->chip == BQ27530 || di->chip == BQ27421)
 		return flags & BQ27XXX_FLAG_OT;
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 61f13fd..5f30d6a 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -153,6 +153,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27520", BQ275XX },
 	{ "bq27500-1", BQ27500 },
 	{ "bq27510g1", BQ27510G1 },
+	{ "bq27510g2", BQ27510G2 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -177,6 +178,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27520" },
 	{ .compatible = "ti,bq27500-1" },
 	{ .compatible = "ti,bq27510g1" },
+	{ .compatible = "ti,bq27510g2" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 9fa7c86..dd5df1e 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -7,6 +7,7 @@ enum bq27xxx_chip {
 	BQ275XX, /* bq27500, bq27510, bq27520 deprecated alias */
 	BQ27500, /* bq27500/1 */
 	BQ27510G1, /* bq27510G1 */
+	BQ27510G2, /* bq27510G2 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH 05/10] power: supplies: bq275xx: adds specific support for bq27510-g3 revision.
  2016-12-22  1:22 [PATCH 00/10] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                   ` (3 preceding siblings ...)
  2016-12-22  1:22 ` [PATCH 04/10] power: supplies: bq275xx: adds specific support for bq27510-g2 revision Chris Lapa
@ 2016-12-22  1:22 ` Chris Lapa
  2016-12-22  1:22 ` [PATCH 06/10] power: supplies: bq275xx: adds specific support for bq27520-g1 revision Chris Lapa
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2016-12-22  1:22 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27510G3 chip definition to specifically match the
bq27510-G3 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 41 +++++++++++++++++++++++++++++-
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 3c60e00..664be30 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -223,6 +223,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27510G3] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = 0x28,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_TTES] = 0x1a,
+		[BQ27XXX_REG_TTECP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x1e,
+		[BQ27XXX_REG_AE] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_SOC] = 0x20,
+		[BQ27XXX_REG_DCAP] = 0x2e,
+		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -424,6 +443,24 @@ static enum power_supply_property bq27510g2_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27510g3_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -510,6 +547,7 @@ static struct {
 	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
 	BQ27XXX_PROP(BQ27510G1, bq27510g1_battery_props),
 	BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
+	BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -761,7 +799,8 @@ static int bq27xxx_battery_read_pwr_avg(struct bq27xxx_device_info *di)
 static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
 	if (di->chip == BQ275XX || di->chip == BQ27500 || di->chip == BQ27510G1
-			|| di->chip == BQ27510G2 || di->chip == BQ27541 || di->chip == BQ27545)
+			|| di->chip == BQ27510G2 || di->chip == BQ27510G3 || di->chip == BQ27541
+			|| di->chip == BQ27545)
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
 	if (di->chip == BQ27530 || di->chip == BQ27421)
 		return flags & BQ27XXX_FLAG_OT;
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 5f30d6a..e601b2b 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -154,6 +154,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27500-1", BQ27500 },
 	{ "bq27510g1", BQ27510G1 },
 	{ "bq27510g2", BQ27510G2 },
+	{ "bq27510g3", BQ27510G3 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -179,6 +180,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27500-1" },
 	{ .compatible = "ti,bq27510g1" },
 	{ .compatible = "ti,bq27510g2" },
+	{ .compatible = "ti,bq27510g3" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index dd5df1e..abec4ce 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -8,6 +8,7 @@ enum bq27xxx_chip {
 	BQ27500, /* bq27500/1 */
 	BQ27510G1, /* bq27510G1 */
 	BQ27510G2, /* bq27510G2 */
+	BQ27510G3, /* bq27510G3 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH 06/10] power: supplies: bq275xx: adds specific support for bq27520-g1 revision.
  2016-12-22  1:22 [PATCH 00/10] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                   ` (4 preceding siblings ...)
  2016-12-22  1:22 ` [PATCH 05/10] power: supplies: bq275xx: adds specific support for bq27510-g3 revision Chris Lapa
@ 2016-12-22  1:22 ` Chris Lapa
  2016-12-22  1:22 ` [PATCH 07/10] power: supplies: bq275xx: adds specific support for bq27520-g2 revision Chris Lapa
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2016-12-22  1:22 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27520G1 chip definition to specifically match the
bq27520-G1 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 43 +++++++++++++++++++++++++++++-
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 664be30..562a9aa 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -26,6 +26,7 @@
  * http://www.ti.com/product/bq27510-g2
  * http://www.ti.com/product/bq27510-g3
  * http://www.ti.com/product/bq27520-g4
+ * http://www.ti.com/product/bq27520-g1
  * http://www.ti.com/product/bq27530-g1
  * http://www.ti.com/product/bq27531-g1
  * http://www.ti.com/product/bq27541-g1
@@ -242,6 +243,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x2e,
 		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
 	},
+	[BQ27520G1] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -461,6 +481,26 @@ static enum power_supply_property bq27510g3_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27520g1_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -548,6 +588,7 @@ static struct {
 	BQ27XXX_PROP(BQ27510G1, bq27510g1_battery_props),
 	BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
 	BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
+	BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -800,7 +841,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
 	if (di->chip == BQ275XX || di->chip == BQ27500 || di->chip == BQ27510G1
 			|| di->chip == BQ27510G2 || di->chip == BQ27510G3 || di->chip == BQ27541
-			|| di->chip == BQ27545)
+			|| di->chip == BQ27520G1 || di->chip == BQ27545)
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
 	if (di->chip == BQ27530 || di->chip == BQ27421)
 		return flags & BQ27XXX_FLAG_OT;
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index e601b2b..33a7d18 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -155,6 +155,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27510g1", BQ27510G1 },
 	{ "bq27510g2", BQ27510G2 },
 	{ "bq27510g3", BQ27510G3 },
+	{ "bq27520g1", BQ27520G1 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -181,6 +182,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27510g1" },
 	{ .compatible = "ti,bq27510g2" },
 	{ .compatible = "ti,bq27510g3" },
+	{ .compatible = "ti,bq27520g1" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index abec4ce..b971401 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -9,6 +9,7 @@ enum bq27xxx_chip {
 	BQ27510G1, /* bq27510G1 */
 	BQ27510G2, /* bq27510G2 */
 	BQ27510G3, /* bq27510G3 */
+	BQ27520G1, /* bq27520G1 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH 07/10] power: supplies: bq275xx: adds specific support for bq27520-g2 revision.
  2016-12-22  1:22 [PATCH 00/10] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                   ` (5 preceding siblings ...)
  2016-12-22  1:22 ` [PATCH 06/10] power: supplies: bq275xx: adds specific support for bq27520-g1 revision Chris Lapa
@ 2016-12-22  1:22 ` Chris Lapa
  2016-12-22  1:22 ` [PATCH 08/10] power: supplies: bq275xx: adds specific support for bq27520-g3 revision Chris Lapa
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2016-12-22  1:22 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27520G2 chip definition to specifically match the
bq27520-G2 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 44 +++++++++++++++++++++++++++++-
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 562a9aa..0c15eed 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -27,6 +27,7 @@
  * http://www.ti.com/product/bq27510-g3
  * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27520-g1
+ * http://www.ti.com/product/bq27520-g2
  * http://www.ti.com/product/bq27530-g1
  * http://www.ti.com/product/bq27531-g1
  * http://www.ti.com/product/bq27541-g1
@@ -262,6 +263,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27520G2] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = 0x36,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -501,6 +521,27 @@ static enum power_supply_property bq27520g1_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27520g2_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -589,6 +630,7 @@ static struct {
 	BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
 	BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
 	BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
+	BQ27XXX_PROP(BQ27520G2, bq27520g2_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -841,7 +883,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
 	if (di->chip == BQ275XX || di->chip == BQ27500 || di->chip == BQ27510G1
 			|| di->chip == BQ27510G2 || di->chip == BQ27510G3 || di->chip == BQ27541
-			|| di->chip == BQ27520G1 || di->chip == BQ27545)
+			|| di->chip == BQ27520G1 || di->chip == BQ27520G2 || di->chip == BQ27545)
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
 	if (di->chip == BQ27530 || di->chip == BQ27421)
 		return flags & BQ27XXX_FLAG_OT;
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 33a7d18..4835523 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -156,6 +156,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27510g2", BQ27510G2 },
 	{ "bq27510g3", BQ27510G3 },
 	{ "bq27520g1", BQ27520G1 },
+	{ "bq27520g2", BQ27520G2 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -183,6 +184,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27510g2" },
 	{ .compatible = "ti,bq27510g3" },
 	{ .compatible = "ti,bq27520g1" },
+	{ .compatible = "ti,bq27520g2" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index b971401..6a1a4ab 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -10,6 +10,7 @@ enum bq27xxx_chip {
 	BQ27510G2, /* bq27510G2 */
 	BQ27510G3, /* bq27510G3 */
 	BQ27520G1, /* bq27520G1 */
+	BQ27520G2, /* bq27520G2 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH 08/10] power: supplies: bq275xx: adds specific support for bq27520-g3 revision.
  2016-12-22  1:22 [PATCH 00/10] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                   ` (6 preceding siblings ...)
  2016-12-22  1:22 ` [PATCH 07/10] power: supplies: bq275xx: adds specific support for bq27520-g2 revision Chris Lapa
@ 2016-12-22  1:22 ` Chris Lapa
  2016-12-22  1:22 ` [PATCH 09/10] power: supplies: bq275xx: adds specific support for bq27520-g4 revision Chris Lapa
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2016-12-22  1:22 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27520G3 chip definition to specifically match the
bq27520-G3 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 44 +++++++++++++++++++++++++++++-
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 0c15eed..d36dc3a 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -28,6 +28,7 @@
  * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27520-g1
  * http://www.ti.com/product/bq27520-g2
+ * http://www.ti.com/product/bq27520-g3
  * http://www.ti.com/product/bq27530-g1
  * http://www.ti.com/product/bq27531-g1
  * http://www.ti.com/product/bq27541-g1
@@ -282,6 +283,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27520G3] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = 0x36,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -542,6 +562,26 @@ static enum power_supply_property bq27520g2_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27520g3_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -631,6 +671,7 @@ static struct {
 	BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
 	BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
 	BQ27XXX_PROP(BQ27520G2, bq27520g2_battery_props),
+	BQ27XXX_PROP(BQ27520G3, bq27520g3_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -883,7 +924,8 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
 	if (di->chip == BQ275XX || di->chip == BQ27500 || di->chip == BQ27510G1
 			|| di->chip == BQ27510G2 || di->chip == BQ27510G3 || di->chip == BQ27541
-			|| di->chip == BQ27520G1 || di->chip == BQ27520G2 || di->chip == BQ27545)
+			|| di->chip == BQ27520G1 || di->chip == BQ27520G2 || di->chip == BQ27520G3
+			|| di->chip == BQ27545)
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
 	if (di->chip == BQ27530 || di->chip == BQ27421)
 		return flags & BQ27XXX_FLAG_OT;
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 4835523..899a846 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -157,6 +157,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27510g3", BQ27510G3 },
 	{ "bq27520g1", BQ27520G1 },
 	{ "bq27520g2", BQ27520G2 },
+	{ "bq27520g3", BQ27520G3 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -185,6 +186,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27510g3" },
 	{ .compatible = "ti,bq27520g1" },
 	{ .compatible = "ti,bq27520g2" },
+	{ .compatible = "ti,bq27520g3" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 6a1a4ab..e61f4fa 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -11,6 +11,7 @@ enum bq27xxx_chip {
 	BQ27510G3, /* bq27510G3 */
 	BQ27520G1, /* bq27520G1 */
 	BQ27520G2, /* bq27520G2 */
+	BQ27520G3, /* bq27520G3 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH 09/10] power: supplies: bq275xx: adds specific support for bq27520-g4 revision.
  2016-12-22  1:22 [PATCH 00/10] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                   ` (7 preceding siblings ...)
  2016-12-22  1:22 ` [PATCH 08/10] power: supplies: bq275xx: adds specific support for bq27520-g3 revision Chris Lapa
@ 2016-12-22  1:22 ` Chris Lapa
  2016-12-22  8:57   ` Pali Rohár
  2016-12-23  0:04 ` [PATCH v2 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                   ` (3 subsequent siblings)
  12 siblings, 1 reply; 70+ messages in thread
From: Chris Lapa @ 2016-12-22  1:22 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27520G4 chip definition to specifically match the
bq27520-G4 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 40 +++++++++++++++++++++++++++++-
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index d36dc3a..c92c809 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -29,6 +29,7 @@
  * http://www.ti.com/product/bq27520-g1
  * http://www.ti.com/product/bq27520-g2
  * http://www.ti.com/product/bq27520-g3
+ * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27530-g1
  * http://www.ti.com/product/bq27531-g1
  * http://www.ti.com/product/bq27541-g1
@@ -302,6 +303,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27520G4] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = 0x28,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x1e,
+		[BQ27XXX_REG_AE] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_SOC] = 0x20,
+		[BQ27XXX_REG_DCAP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -582,6 +602,23 @@ static enum power_supply_property bq27520g3_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27520g4_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -672,6 +709,7 @@ static struct {
 	BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
 	BQ27XXX_PROP(BQ27520G2, bq27520g2_battery_props),
 	BQ27XXX_PROP(BQ27520G3, bq27520g3_battery_props),
+	BQ27XXX_PROP(BQ27520G4, bq27520g4_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -925,7 +963,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	if (di->chip == BQ275XX || di->chip == BQ27500 || di->chip == BQ27510G1
 			|| di->chip == BQ27510G2 || di->chip == BQ27510G3 || di->chip == BQ27541
 			|| di->chip == BQ27520G1 || di->chip == BQ27520G2 || di->chip == BQ27520G3
-			|| di->chip == BQ27545)
+			|| di->chip == BQ27520G4 || di->chip == BQ27545)
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
 	if (di->chip == BQ27530 || di->chip == BQ27421)
 		return flags & BQ27XXX_FLAG_OT;
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 899a846..3878da4 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -158,6 +158,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27520g1", BQ27520G1 },
 	{ "bq27520g2", BQ27520G2 },
 	{ "bq27520g3", BQ27520G3 },
+	{ "bq27520g4", BQ27520G4 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -187,6 +188,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27520g1" },
 	{ .compatible = "ti,bq27520g2" },
 	{ .compatible = "ti,bq27520g3" },
+	{ .compatible = "ti,bq27520g4" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index e61f4fa..09af70d 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -12,6 +12,7 @@ enum bq27xxx_chip {
 	BQ27520G1, /* bq27520G1 */
 	BQ27520G2, /* bq27520G2 */
 	BQ27520G3, /* bq27520G3 */
+	BQ27520G4, /* bq27520G4 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* Re: [PATCH 09/10] power: supplies: bq275xx: adds specific support for bq27520-g4 revision.
  2016-12-22  1:22 ` [PATCH 09/10] power: supplies: bq275xx: adds specific support for bq27520-g4 revision Chris Lapa
@ 2016-12-22  8:57   ` Pali Rohár
  0 siblings, 0 replies; 70+ messages in thread
From: Pali Rohár @ 2016-12-22  8:57 UTC (permalink / raw)
  To: Chris Lapa; +Cc: afd, sre, linux-pm, linux-kernel

[-- Attachment #1: Type: Text/Plain, Size: 575 bytes --]

On Thursday 22 December 2016 02:22:22 Chris Lapa wrote:
> @@ -925,7 +963,7 @@ static bool bq27xxx_battery_overtemp(struct
> if (di->chip == BQ275XX || di->chip == BQ27500 || di->chip == BQ27510G1
> 
>  			|| di->chip == BQ27510G2 || di->chip == BQ27510G3 || di->chip ==
>  			|| BQ27541 di->chip == BQ27520G1 || di->chip == BQ27520G2 ||
>  			|| di->chip == BQ27520G3
> 
> -			|| di->chip == BQ27545)
> +			|| di->chip == BQ27520G4 || di->chip == BQ27545)

Please move this check for BQ275XX into static inline function.

-- 
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 70+ messages in thread

* [PATCH v2 00/11] power: supply: bq275xx: implement individual chip revision support
  2016-12-22  1:22 [PATCH 00/10] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                   ` (8 preceding siblings ...)
  2016-12-22  1:22 ` [PATCH 09/10] power: supplies: bq275xx: adds specific support for bq27520-g4 revision Chris Lapa
@ 2016-12-23  0:04 ` Chris Lapa
  2016-12-23  0:04   ` [PATCH v2 01/11] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future Chris Lapa
                     ` (10 more replies)
  2017-01-09  0:47 ` [PATCH v3 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                   ` (2 subsequent siblings)
  12 siblings, 11 replies; 70+ messages in thread
From: Chris Lapa @ 2016-12-23  0:04 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This patch series separates out support for each revision chip in
the bq27500, bq27510 and bq27520 family. Each revision has enough
register address changes to justify individual register mappings.

It also cleans up the large if statement checking the overtemp flags.

I had a chance to test the deprecated bq27500/10/20 support which still
behaves the same. I also tested the new specific bq27510g3 support
on a custom board I have here and it worked correctly.

Chris Lapa (11):
  power: supplies: bq275xx: rename BQ27500 allow for deprecation in
    future.
  power: supplies: bq275xx: adds specific support for bq27500/1
    revision.
  power: supplies: bq275xx: adds specific support for bq27510-g1
    revision.
  power: supplies: bq275xx: adds specific support for bq27510-g2
    revision.
  power: supplies: bq275xx: adds specific support for bq27510-g3
    revision.
  power: supplies: bq275xx: adds specific support for bq27520-g1
    revision.
  power: supplies: bq275xx: adds specific support for bq27520-g2
    revision.
  power: supplies: bq275xx: adds specific support for bq27520-g3
    revision.
  power: supplies: bq275xx: adds specific support for bq27520-g4
    revision.
  power: supply: bq275xx: cleanup over temperature flag check.
  power: supplies: bq275xx: adds device tree binding documentation.

 .../devicetree/bindings/power/supply/bq275xx.txt   |  27 ++
 drivers/power/supply/bq27xxx_battery.c             | 340 ++++++++++++++++++++-
 drivers/power/supply/bq27xxx_battery_i2c.c         |  22 +-
 include/linux/power/bq27xxx_battery.h              |  10 +-
 4 files changed, 393 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/power/supply/bq275xx.txt

-- 
2.1.4

^ permalink raw reply	[flat|nested] 70+ messages in thread

* [PATCH v2 01/11] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future.
  2016-12-23  0:04 ` [PATCH v2 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
@ 2016-12-23  0:04   ` Chris Lapa
  2017-01-05 23:59     ` Sebastian Reichel
  2016-12-23  0:04   ` [PATCH v2 02/11] power: supplies: bq275xx: adds specific support for bq27500/1 revision Chris Lapa
                     ` (9 subsequent siblings)
  10 siblings, 1 reply; 70+ messages in thread
From: Chris Lapa @ 2016-12-23  0:04 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

The BQ275XX definition exists only to satisfy backwards compatibility.

tested: yes

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 8 ++++----
 drivers/power/supply/bq27xxx_battery_i2c.c | 6 +++---
 include/linux/power/bq27xxx_battery.h      | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 3b0dbc6..312f668 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -145,7 +145,7 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x76,
 		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
 	},
-	[BQ27500] = {
+	[BQ275XX] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
 		[BQ27XXX_REG_INT_TEMP] = 0x28,
@@ -284,7 +284,7 @@ static enum power_supply_property bq27010_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
-static enum power_supply_property bq27500_battery_props[] = {
+static enum power_supply_property bq275xx_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
 	POWER_SUPPLY_PROP_VOLTAGE_NOW,
@@ -384,7 +384,7 @@ static struct {
 } bq27xxx_battery_props[] = {
 	BQ27XXX_PROP(BQ27000, bq27000_battery_props),
 	BQ27XXX_PROP(BQ27010, bq27010_battery_props),
-	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
+	BQ27XXX_PROP(BQ275XX, bq275xx_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -635,7 +635,7 @@ static int bq27xxx_battery_read_pwr_avg(struct bq27xxx_device_info *di)
  */
 static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
-	if (di->chip == BQ27500 || di->chip == BQ27541 || di->chip == BQ27545)
+	if (di->chip == BQ275XX || di->chip == BQ27541 || di->chip == BQ27545)
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
 	if (di->chip == BQ27530 || di->chip == BQ27421)
 		return flags & BQ27XXX_FLAG_OT;
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 85d4ea2..762d96e 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -148,9 +148,9 @@ static int bq27xxx_battery_i2c_remove(struct i2c_client *client)
 static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27200", BQ27000 },
 	{ "bq27210", BQ27010 },
-	{ "bq27500", BQ27500 },
-	{ "bq27510", BQ27500 },
-	{ "bq27520", BQ27500 },
+	{ "bq27500", BQ275XX },
+	{ "bq27510", BQ275XX },
+	{ "bq27520", BQ275XX },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index e30deb0..c452b94 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -4,7 +4,7 @@
 enum bq27xxx_chip {
 	BQ27000 = 1, /* bq27000, bq27200 */
 	BQ27010, /* bq27010, bq27210 */
-	BQ27500, /* bq27500, bq27510, bq27520 */
+	BQ275XX, /* bq27500, bq27510, bq27520 deprecated alias */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v2 02/11] power: supplies: bq275xx: adds specific support for bq27500/1 revision.
  2016-12-23  0:04 ` [PATCH v2 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
  2016-12-23  0:04   ` [PATCH v2 01/11] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future Chris Lapa
@ 2016-12-23  0:04   ` Chris Lapa
  2016-12-23  0:04   ` [PATCH v2 03/11] power: supplies: bq275xx: adds specific support for bq27510-g1 revision Chris Lapa
                     ` (8 subsequent siblings)
  10 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2016-12-23  0:04 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27500 chip definition to specifically match the
bq27500/1 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 44 +++++++++++++++++++++++++++++-
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 312f668..5433fda 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -164,6 +164,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
 	},
+	[BQ27500] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -302,6 +321,27 @@ static enum power_supply_property bq275xx_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27500_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -385,6 +425,7 @@ static struct {
 	BQ27XXX_PROP(BQ27000, bq27000_battery_props),
 	BQ27XXX_PROP(BQ27010, bq27010_battery_props),
 	BQ27XXX_PROP(BQ275XX, bq275xx_battery_props),
+	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -635,7 +676,8 @@ static int bq27xxx_battery_read_pwr_avg(struct bq27xxx_device_info *di)
  */
 static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
-	if (di->chip == BQ275XX || di->chip == BQ27541 || di->chip == BQ27545)
+	if (di->chip == BQ275XX || di->chip == BQ27500 || di->chip == BQ27541
+			|| di->chip == BQ27545)
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
 	if (di->chip == BQ27530 || di->chip == BQ27421)
 		return flags & BQ27XXX_FLAG_OT;
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 762d96e..a01b35d 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -151,6 +151,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27500", BQ275XX },
 	{ "bq27510", BQ275XX },
 	{ "bq27520", BQ275XX },
+	{ "bq27500-1", BQ27500 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -173,6 +174,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27500" },
 	{ .compatible = "ti,bq27510" },
 	{ .compatible = "ti,bq27520" },
+	{ .compatible = "ti,bq27500-1" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index c452b94..7d2a415 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -5,6 +5,7 @@ enum bq27xxx_chip {
 	BQ27000 = 1, /* bq27000, bq27200 */
 	BQ27010, /* bq27010, bq27210 */
 	BQ275XX, /* bq27500, bq27510, bq27520 deprecated alias */
+	BQ27500, /* bq27500/1 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v2 03/11] power: supplies: bq275xx: adds specific support for bq27510-g1 revision.
  2016-12-23  0:04 ` [PATCH v2 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
  2016-12-23  0:04   ` [PATCH v2 01/11] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future Chris Lapa
  2016-12-23  0:04   ` [PATCH v2 02/11] power: supplies: bq275xx: adds specific support for bq27500/1 revision Chris Lapa
@ 2016-12-23  0:04   ` Chris Lapa
  2016-12-23  0:05   ` [PATCH v2 04/11] power: supplies: bq275xx: adds specific support for bq27510-g2 revision Chris Lapa
                     ` (7 subsequent siblings)
  10 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2016-12-23  0:04 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27510G1 chip definition to specifically match the
bq27510-G1 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 46 ++++++++++++++++++++++++++++--
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 5433fda..b78881f 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -22,6 +22,7 @@
  * http://www.ti.com/product/bq27010
  * http://www.ti.com/product/bq27210
  * http://www.ti.com/product/bq27500
+ * http://www.ti.com/product/bq27510-g1
  * http://www.ti.com/product/bq27510-g3
  * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27530-g1
@@ -183,6 +184,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27510G1] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -342,6 +362,27 @@ static enum power_supply_property bq27500_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27510g1_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -426,6 +467,7 @@ static struct {
 	BQ27XXX_PROP(BQ27010, bq27010_battery_props),
 	BQ27XXX_PROP(BQ275XX, bq275xx_battery_props),
 	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
+	BQ27XXX_PROP(BQ27510G1, bq27510g1_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -676,8 +718,8 @@ static int bq27xxx_battery_read_pwr_avg(struct bq27xxx_device_info *di)
  */
 static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
-	if (di->chip == BQ275XX || di->chip == BQ27500 || di->chip == BQ27541
-			|| di->chip == BQ27545)
+	if (di->chip == BQ275XX || di->chip == BQ27500 || di->chip == BQ27510G1
+			|| di->chip == BQ27541 || di->chip == BQ27545)
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
 	if (di->chip == BQ27530 || di->chip == BQ27421)
 		return flags & BQ27XXX_FLAG_OT;
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index a01b35d..61f13fd 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -152,6 +152,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27510", BQ275XX },
 	{ "bq27520", BQ275XX },
 	{ "bq27500-1", BQ27500 },
+	{ "bq27510g1", BQ27510G1 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -175,6 +176,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27510" },
 	{ .compatible = "ti,bq27520" },
 	{ .compatible = "ti,bq27500-1" },
+	{ .compatible = "ti,bq27510g1" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 7d2a415..9fa7c86 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -6,6 +6,7 @@ enum bq27xxx_chip {
 	BQ27010, /* bq27010, bq27210 */
 	BQ275XX, /* bq27500, bq27510, bq27520 deprecated alias */
 	BQ27500, /* bq27500/1 */
+	BQ27510G1, /* bq27510G1 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v2 04/11] power: supplies: bq275xx: adds specific support for bq27510-g2 revision.
  2016-12-23  0:04 ` [PATCH v2 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                     ` (2 preceding siblings ...)
  2016-12-23  0:04   ` [PATCH v2 03/11] power: supplies: bq275xx: adds specific support for bq27510-g1 revision Chris Lapa
@ 2016-12-23  0:05   ` Chris Lapa
  2016-12-23  0:05   ` [PATCH v2 05/11] power: supplies: bq275xx: adds specific support for bq27510-g3 revision Chris Lapa
                     ` (6 subsequent siblings)
  10 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2016-12-23  0:05 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27510G2 chip definition to specifically match the
bq27510-G2 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 44 +++++++++++++++++++++++++++++-
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index b78881f..3c60e00 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -23,6 +23,7 @@
  * http://www.ti.com/product/bq27210
  * http://www.ti.com/product/bq27500
  * http://www.ti.com/product/bq27510-g1
+ * http://www.ti.com/product/bq27510-g2
  * http://www.ti.com/product/bq27510-g3
  * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27530-g1
@@ -203,6 +204,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27510G2] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -383,6 +403,27 @@ static enum power_supply_property bq27510g1_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27510g2_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -468,6 +509,7 @@ static struct {
 	BQ27XXX_PROP(BQ275XX, bq275xx_battery_props),
 	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
 	BQ27XXX_PROP(BQ27510G1, bq27510g1_battery_props),
+	BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -719,7 +761,7 @@ static int bq27xxx_battery_read_pwr_avg(struct bq27xxx_device_info *di)
 static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
 	if (di->chip == BQ275XX || di->chip == BQ27500 || di->chip == BQ27510G1
-			|| di->chip == BQ27541 || di->chip == BQ27545)
+			|| di->chip == BQ27510G2 || di->chip == BQ27541 || di->chip == BQ27545)
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
 	if (di->chip == BQ27530 || di->chip == BQ27421)
 		return flags & BQ27XXX_FLAG_OT;
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 61f13fd..5f30d6a 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -153,6 +153,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27520", BQ275XX },
 	{ "bq27500-1", BQ27500 },
 	{ "bq27510g1", BQ27510G1 },
+	{ "bq27510g2", BQ27510G2 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -177,6 +178,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27520" },
 	{ .compatible = "ti,bq27500-1" },
 	{ .compatible = "ti,bq27510g1" },
+	{ .compatible = "ti,bq27510g2" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 9fa7c86..dd5df1e 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -7,6 +7,7 @@ enum bq27xxx_chip {
 	BQ275XX, /* bq27500, bq27510, bq27520 deprecated alias */
 	BQ27500, /* bq27500/1 */
 	BQ27510G1, /* bq27510G1 */
+	BQ27510G2, /* bq27510G2 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v2 05/11] power: supplies: bq275xx: adds specific support for bq27510-g3 revision.
  2016-12-23  0:04 ` [PATCH v2 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                     ` (3 preceding siblings ...)
  2016-12-23  0:05   ` [PATCH v2 04/11] power: supplies: bq275xx: adds specific support for bq27510-g2 revision Chris Lapa
@ 2016-12-23  0:05   ` Chris Lapa
  2016-12-23  0:05   ` [PATCH v2 06/11] power: supplies: bq275xx: adds specific support for bq27520-g1 revision Chris Lapa
                     ` (5 subsequent siblings)
  10 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2016-12-23  0:05 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27510G3 chip definition to specifically match the
bq27510-G3 functionality as described in the datasheet.

tested: yes

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 41 +++++++++++++++++++++++++++++-
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 3c60e00..664be30 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -223,6 +223,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27510G3] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = 0x28,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_TTES] = 0x1a,
+		[BQ27XXX_REG_TTECP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x1e,
+		[BQ27XXX_REG_AE] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_SOC] = 0x20,
+		[BQ27XXX_REG_DCAP] = 0x2e,
+		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -424,6 +443,24 @@ static enum power_supply_property bq27510g2_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27510g3_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -510,6 +547,7 @@ static struct {
 	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
 	BQ27XXX_PROP(BQ27510G1, bq27510g1_battery_props),
 	BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
+	BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -761,7 +799,8 @@ static int bq27xxx_battery_read_pwr_avg(struct bq27xxx_device_info *di)
 static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
 	if (di->chip == BQ275XX || di->chip == BQ27500 || di->chip == BQ27510G1
-			|| di->chip == BQ27510G2 || di->chip == BQ27541 || di->chip == BQ27545)
+			|| di->chip == BQ27510G2 || di->chip == BQ27510G3 || di->chip == BQ27541
+			|| di->chip == BQ27545)
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
 	if (di->chip == BQ27530 || di->chip == BQ27421)
 		return flags & BQ27XXX_FLAG_OT;
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 5f30d6a..e601b2b 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -154,6 +154,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27500-1", BQ27500 },
 	{ "bq27510g1", BQ27510G1 },
 	{ "bq27510g2", BQ27510G2 },
+	{ "bq27510g3", BQ27510G3 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -179,6 +180,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27500-1" },
 	{ .compatible = "ti,bq27510g1" },
 	{ .compatible = "ti,bq27510g2" },
+	{ .compatible = "ti,bq27510g3" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index dd5df1e..abec4ce 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -8,6 +8,7 @@ enum bq27xxx_chip {
 	BQ27500, /* bq27500/1 */
 	BQ27510G1, /* bq27510G1 */
 	BQ27510G2, /* bq27510G2 */
+	BQ27510G3, /* bq27510G3 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v2 06/11] power: supplies: bq275xx: adds specific support for bq27520-g1 revision.
  2016-12-23  0:04 ` [PATCH v2 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                     ` (4 preceding siblings ...)
  2016-12-23  0:05   ` [PATCH v2 05/11] power: supplies: bq275xx: adds specific support for bq27510-g3 revision Chris Lapa
@ 2016-12-23  0:05   ` Chris Lapa
  2016-12-23  0:05   ` [PATCH v2 07/11] power: supplies: bq275xx: adds specific support for bq27520-g2 revision Chris Lapa
                     ` (4 subsequent siblings)
  10 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2016-12-23  0:05 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27520G1 chip definition to specifically match the
bq27520-G1 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 43 +++++++++++++++++++++++++++++-
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 664be30..562a9aa 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -26,6 +26,7 @@
  * http://www.ti.com/product/bq27510-g2
  * http://www.ti.com/product/bq27510-g3
  * http://www.ti.com/product/bq27520-g4
+ * http://www.ti.com/product/bq27520-g1
  * http://www.ti.com/product/bq27530-g1
  * http://www.ti.com/product/bq27531-g1
  * http://www.ti.com/product/bq27541-g1
@@ -242,6 +243,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x2e,
 		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
 	},
+	[BQ27520G1] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -461,6 +481,26 @@ static enum power_supply_property bq27510g3_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27520g1_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -548,6 +588,7 @@ static struct {
 	BQ27XXX_PROP(BQ27510G1, bq27510g1_battery_props),
 	BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
 	BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
+	BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -800,7 +841,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
 	if (di->chip == BQ275XX || di->chip == BQ27500 || di->chip == BQ27510G1
 			|| di->chip == BQ27510G2 || di->chip == BQ27510G3 || di->chip == BQ27541
-			|| di->chip == BQ27545)
+			|| di->chip == BQ27520G1 || di->chip == BQ27545)
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
 	if (di->chip == BQ27530 || di->chip == BQ27421)
 		return flags & BQ27XXX_FLAG_OT;
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index e601b2b..33a7d18 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -155,6 +155,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27510g1", BQ27510G1 },
 	{ "bq27510g2", BQ27510G2 },
 	{ "bq27510g3", BQ27510G3 },
+	{ "bq27520g1", BQ27520G1 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -181,6 +182,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27510g1" },
 	{ .compatible = "ti,bq27510g2" },
 	{ .compatible = "ti,bq27510g3" },
+	{ .compatible = "ti,bq27520g1" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index abec4ce..b971401 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -9,6 +9,7 @@ enum bq27xxx_chip {
 	BQ27510G1, /* bq27510G1 */
 	BQ27510G2, /* bq27510G2 */
 	BQ27510G3, /* bq27510G3 */
+	BQ27520G1, /* bq27520G1 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v2 07/11] power: supplies: bq275xx: adds specific support for bq27520-g2 revision.
  2016-12-23  0:04 ` [PATCH v2 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                     ` (5 preceding siblings ...)
  2016-12-23  0:05   ` [PATCH v2 06/11] power: supplies: bq275xx: adds specific support for bq27520-g1 revision Chris Lapa
@ 2016-12-23  0:05   ` Chris Lapa
  2016-12-23  0:05   ` [PATCH v2 08/11] power: supplies: bq275xx: adds specific support for bq27520-g3 revision Chris Lapa
                     ` (3 subsequent siblings)
  10 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2016-12-23  0:05 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27520G2 chip definition to specifically match the
bq27520-G2 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 44 +++++++++++++++++++++++++++++-
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 562a9aa..0c15eed 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -27,6 +27,7 @@
  * http://www.ti.com/product/bq27510-g3
  * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27520-g1
+ * http://www.ti.com/product/bq27520-g2
  * http://www.ti.com/product/bq27530-g1
  * http://www.ti.com/product/bq27531-g1
  * http://www.ti.com/product/bq27541-g1
@@ -262,6 +263,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27520G2] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = 0x36,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -501,6 +521,27 @@ static enum power_supply_property bq27520g1_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27520g2_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -589,6 +630,7 @@ static struct {
 	BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
 	BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
 	BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
+	BQ27XXX_PROP(BQ27520G2, bq27520g2_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -841,7 +883,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
 	if (di->chip == BQ275XX || di->chip == BQ27500 || di->chip == BQ27510G1
 			|| di->chip == BQ27510G2 || di->chip == BQ27510G3 || di->chip == BQ27541
-			|| di->chip == BQ27520G1 || di->chip == BQ27545)
+			|| di->chip == BQ27520G1 || di->chip == BQ27520G2 || di->chip == BQ27545)
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
 	if (di->chip == BQ27530 || di->chip == BQ27421)
 		return flags & BQ27XXX_FLAG_OT;
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 33a7d18..4835523 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -156,6 +156,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27510g2", BQ27510G2 },
 	{ "bq27510g3", BQ27510G3 },
 	{ "bq27520g1", BQ27520G1 },
+	{ "bq27520g2", BQ27520G2 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -183,6 +184,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27510g2" },
 	{ .compatible = "ti,bq27510g3" },
 	{ .compatible = "ti,bq27520g1" },
+	{ .compatible = "ti,bq27520g2" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index b971401..6a1a4ab 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -10,6 +10,7 @@ enum bq27xxx_chip {
 	BQ27510G2, /* bq27510G2 */
 	BQ27510G3, /* bq27510G3 */
 	BQ27520G1, /* bq27520G1 */
+	BQ27520G2, /* bq27520G2 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v2 08/11] power: supplies: bq275xx: adds specific support for bq27520-g3 revision.
  2016-12-23  0:04 ` [PATCH v2 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                     ` (6 preceding siblings ...)
  2016-12-23  0:05   ` [PATCH v2 07/11] power: supplies: bq275xx: adds specific support for bq27520-g2 revision Chris Lapa
@ 2016-12-23  0:05   ` Chris Lapa
  2016-12-23  0:05   ` [PATCH v2 09/11] power: supplies: bq275xx: adds specific support for bq27520-g4 revision Chris Lapa
                     ` (2 subsequent siblings)
  10 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2016-12-23  0:05 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27520G3 chip definition to specifically match the
bq27520-G3 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 44 +++++++++++++++++++++++++++++-
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 0c15eed..d36dc3a 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -28,6 +28,7 @@
  * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27520-g1
  * http://www.ti.com/product/bq27520-g2
+ * http://www.ti.com/product/bq27520-g3
  * http://www.ti.com/product/bq27530-g1
  * http://www.ti.com/product/bq27531-g1
  * http://www.ti.com/product/bq27541-g1
@@ -282,6 +283,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27520G3] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = 0x36,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -542,6 +562,26 @@ static enum power_supply_property bq27520g2_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27520g3_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -631,6 +671,7 @@ static struct {
 	BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
 	BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
 	BQ27XXX_PROP(BQ27520G2, bq27520g2_battery_props),
+	BQ27XXX_PROP(BQ27520G3, bq27520g3_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -883,7 +924,8 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
 	if (di->chip == BQ275XX || di->chip == BQ27500 || di->chip == BQ27510G1
 			|| di->chip == BQ27510G2 || di->chip == BQ27510G3 || di->chip == BQ27541
-			|| di->chip == BQ27520G1 || di->chip == BQ27520G2 || di->chip == BQ27545)
+			|| di->chip == BQ27520G1 || di->chip == BQ27520G2 || di->chip == BQ27520G3
+			|| di->chip == BQ27545)
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
 	if (di->chip == BQ27530 || di->chip == BQ27421)
 		return flags & BQ27XXX_FLAG_OT;
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 4835523..899a846 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -157,6 +157,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27510g3", BQ27510G3 },
 	{ "bq27520g1", BQ27520G1 },
 	{ "bq27520g2", BQ27520G2 },
+	{ "bq27520g3", BQ27520G3 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -185,6 +186,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27510g3" },
 	{ .compatible = "ti,bq27520g1" },
 	{ .compatible = "ti,bq27520g2" },
+	{ .compatible = "ti,bq27520g3" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 6a1a4ab..e61f4fa 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -11,6 +11,7 @@ enum bq27xxx_chip {
 	BQ27510G3, /* bq27510G3 */
 	BQ27520G1, /* bq27520G1 */
 	BQ27520G2, /* bq27520G2 */
+	BQ27520G3, /* bq27520G3 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v2 09/11] power: supplies: bq275xx: adds specific support for bq27520-g4 revision.
  2016-12-23  0:04 ` [PATCH v2 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                     ` (7 preceding siblings ...)
  2016-12-23  0:05   ` [PATCH v2 08/11] power: supplies: bq275xx: adds specific support for bq27520-g3 revision Chris Lapa
@ 2016-12-23  0:05   ` Chris Lapa
  2016-12-23  0:05   ` [PATCH v2 10/11] power: supply: bq275xx: cleanup over temperature flag check Chris Lapa
  2016-12-23  0:05   ` [PATCH v2 11/11] power: supplies: bq275xx: adds device tree binding documentation Chris Lapa
  10 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2016-12-23  0:05 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27520G4 chip definition to specifically match the
bq27520-G4 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 40 +++++++++++++++++++++++++++++-
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index d36dc3a..c92c809 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -29,6 +29,7 @@
  * http://www.ti.com/product/bq27520-g1
  * http://www.ti.com/product/bq27520-g2
  * http://www.ti.com/product/bq27520-g3
+ * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27530-g1
  * http://www.ti.com/product/bq27531-g1
  * http://www.ti.com/product/bq27541-g1
@@ -302,6 +303,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27520G4] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = 0x28,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x1e,
+		[BQ27XXX_REG_AE] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_SOC] = 0x20,
+		[BQ27XXX_REG_DCAP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -582,6 +602,23 @@ static enum power_supply_property bq27520g3_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27520g4_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -672,6 +709,7 @@ static struct {
 	BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
 	BQ27XXX_PROP(BQ27520G2, bq27520g2_battery_props),
 	BQ27XXX_PROP(BQ27520G3, bq27520g3_battery_props),
+	BQ27XXX_PROP(BQ27520G4, bq27520g4_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -925,7 +963,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	if (di->chip == BQ275XX || di->chip == BQ27500 || di->chip == BQ27510G1
 			|| di->chip == BQ27510G2 || di->chip == BQ27510G3 || di->chip == BQ27541
 			|| di->chip == BQ27520G1 || di->chip == BQ27520G2 || di->chip == BQ27520G3
-			|| di->chip == BQ27545)
+			|| di->chip == BQ27520G4 || di->chip == BQ27545)
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
 	if (di->chip == BQ27530 || di->chip == BQ27421)
 		return flags & BQ27XXX_FLAG_OT;
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 899a846..3878da4 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -158,6 +158,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27520g1", BQ27520G1 },
 	{ "bq27520g2", BQ27520G2 },
 	{ "bq27520g3", BQ27520G3 },
+	{ "bq27520g4", BQ27520G4 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -187,6 +188,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27520g1" },
 	{ .compatible = "ti,bq27520g2" },
 	{ .compatible = "ti,bq27520g3" },
+	{ .compatible = "ti,bq27520g4" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index e61f4fa..09af70d 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -12,6 +12,7 @@ enum bq27xxx_chip {
 	BQ27520G1, /* bq27520G1 */
 	BQ27520G2, /* bq27520G2 */
 	BQ27520G3, /* bq27520G3 */
+	BQ27520G4, /* bq27520G4 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v2 10/11] power: supply: bq275xx: cleanup over temperature flag check.
  2016-12-23  0:04 ` [PATCH v2 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                     ` (8 preceding siblings ...)
  2016-12-23  0:05   ` [PATCH v2 09/11] power: supplies: bq275xx: adds specific support for bq27520-g4 revision Chris Lapa
@ 2016-12-23  0:05   ` Chris Lapa
  2016-12-23  0:05   ` [PATCH v2 11/11] power: supplies: bq275xx: adds device tree binding documentation Chris Lapa
  10 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2016-12-23  0:05 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

Separated the check out into its own function to make its functionality
easier to understand.

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index c92c809..e647bd1 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -956,14 +956,22 @@ static int bq27xxx_battery_read_pwr_avg(struct bq27xxx_device_info *di)
 }
 
 /*
- * Returns true if a battery over temperature condition is detected
+ * Returns true if the device has multiple over temperature flags
  */
-static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
+static inline bool bq27xxx_has_multiple_overtemp_flags(const struct bq27xxx_device_info *di)
 {
-	if (di->chip == BQ275XX || di->chip == BQ27500 || di->chip == BQ27510G1
+	return di->chip == BQ275XX || di->chip == BQ27500 || di->chip == BQ27510G1
 			|| di->chip == BQ27510G2 || di->chip == BQ27510G3 || di->chip == BQ27541
 			|| di->chip == BQ27520G1 || di->chip == BQ27520G2 || di->chip == BQ27520G3
-			|| di->chip == BQ27520G4 || di->chip == BQ27545)
+			|| di->chip == BQ27520G4 || di->chip == BQ27545;
+}
+
+/*
+ * Returns true if a battery over temperature condition is detected
+ */
+static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
+{
+	if (bq27xxx_has_multiple_overtemp_flags(di))
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
 	if (di->chip == BQ27530 || di->chip == BQ27421)
 		return flags & BQ27XXX_FLAG_OT;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v2 11/11] power: supplies: bq275xx: adds device tree binding documentation.
  2016-12-23  0:04 ` [PATCH v2 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                     ` (9 preceding siblings ...)
  2016-12-23  0:05   ` [PATCH v2 10/11] power: supply: bq275xx: cleanup over temperature flag check Chris Lapa
@ 2016-12-23  0:05   ` Chris Lapa
  2017-01-06  0:06     ` Sebastian Reichel
  10 siblings, 1 reply; 70+ messages in thread
From: Chris Lapa @ 2016-12-23  0:05 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

The bq275xx binding is a standard i2c style binding, however the
deprecated compatible fields and different revisions warrant its own
documentation.

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 .../devicetree/bindings/power/supply/bq275xx.txt   | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/bq275xx.txt

diff --git a/Documentation/devicetree/bindings/power/supply/bq275xx.txt b/Documentation/devicetree/bindings/power/supply/bq275xx.txt
new file mode 100644
index 0000000..8f4f759
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/supply/bq275xx.txt
@@ -0,0 +1,27 @@
+binding for BQ275XX fuel gauge family
+
+Supports revisions listed below in the BQ275XX family of fuel gauges.
+Each revision is slightly different enough to warrant separate
+comapatible fields.
+
+Required properties:
+- compatible:
+    * "ti,bq27500" - deprecated
+    * "ti,bq27510" - deprecated
+    * "ti,bq27520" - deprecated
+    * "ti,bq27500-1" - BQ27500/1
+    * "ti,bq27510g1" - BQ27510-g1
+    * "ti,bq27510g2" - BQ27510-g2
+    * "ti,bq27510g3" - BQ27510-g3
+    * "ti,bq27520g1" - BQ27520-g1
+    * "ti,bq27520g2" - BQ27520-g2
+    * "ti,bq27520g3" - BQ27520-g3
+    * "ti,bq27520g4" - BQ27520-g4
+- reg: The 7-bit I2C address.
+
+Example:
+
+	fuelgauge: bq27510g3@55 {
+		compatible = "ti,bq27510g3";
+		reg = <0x55>;
+	};
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* Re: [PATCH v2 01/11] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future.
  2016-12-23  0:04   ` [PATCH v2 01/11] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future Chris Lapa
@ 2017-01-05 23:59     ` Sebastian Reichel
  2017-01-06  0:29       ` Chris Lapa
  0 siblings, 1 reply; 70+ messages in thread
From: Sebastian Reichel @ 2017-01-05 23:59 UTC (permalink / raw)
  To: Chris Lapa; +Cc: pali.rohar, afd, linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]

Hi Chris,

On Fri, Dec 23, 2016 at 11:04:57AM +1100, Chris Lapa wrote:
> From: Chris Lapa <chris@lapa.com.au>
> 
> The BQ275XX definition exists only to satisfy backwards compatibility.
> 
> tested: yes
> 
> Signed-off-by: Chris Lapa <chris@lapa.com.au>
>
> [...]
>
>  static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
>  {
> -	if (di->chip == BQ27500 || di->chip == BQ27541 || di->chip == BQ27545)
> +	if (di->chip == BQ275XX || di->chip == BQ27541 || di->chip == BQ27545)
>  		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
>  	if (di->chip == BQ27530 || di->chip == BQ27421)
>  		return flags & BQ27XXX_FLAG_OT;

This is really getting out of hands in this patchset. Please
add a patch at the beginning of the patchset, which converts
this construct into the following:

switch (di->chip) {
case A:
case B:
case C:
case D:
    return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
case E:
case F:
    return flags & BQ27XXX_FLAG_OT;
default:
    return false;
}

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [PATCH v2 11/11] power: supplies: bq275xx: adds device tree binding documentation.
  2016-12-23  0:05   ` [PATCH v2 11/11] power: supplies: bq275xx: adds device tree binding documentation Chris Lapa
@ 2017-01-06  0:06     ` Sebastian Reichel
  2017-01-06  0:32       ` Chris Lapa
  0 siblings, 1 reply; 70+ messages in thread
From: Sebastian Reichel @ 2017-01-06  0:06 UTC (permalink / raw)
  To: Chris Lapa; +Cc: pali.rohar, afd, linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 419 bytes --]

Hi,

On Fri, Dec 23, 2016 at 11:05:07AM +1100, Chris Lapa wrote:
> From: Chris Lapa <chris@lapa.com.au>
> 
> The bq275xx binding is a standard i2c style binding, however the
> deprecated compatible fields and different revisions warrant its own
> documentation.

Please add the other supported i2c bq27xxx chips and name the file
bq27xxx.txt. Otherwise maintaining this will become annoying.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [PATCH v2 01/11] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future.
  2017-01-05 23:59     ` Sebastian Reichel
@ 2017-01-06  0:29       ` Chris Lapa
  2017-01-06 17:36         ` Sebastian Reichel
  0 siblings, 1 reply; 70+ messages in thread
From: Chris Lapa @ 2017-01-06  0:29 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: pali.rohar, afd, linux-pm, linux-kernel

On 6/1/17 10:59 am, Sebastian Reichel wrote:
> Hi Chris,
>
> On Fri, Dec 23, 2016 at 11:04:57AM +1100, Chris Lapa wrote:
>> From: Chris Lapa <chris@lapa.com.au>
>>
>> The BQ275XX definition exists only to satisfy backwards compatibility.
>>
>> tested: yes
>>
>> Signed-off-by: Chris Lapa <chris@lapa.com.au>
>>
>> [...]
>>
>>  static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
>>  {
>> -	if (di->chip == BQ27500 || di->chip == BQ27541 || di->chip == BQ27545)
>> +	if (di->chip == BQ275XX || di->chip == BQ27541 || di->chip == BQ27545)
>>  		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
>>  	if (di->chip == BQ27530 || di->chip == BQ27421)
>>  		return flags & BQ27XXX_FLAG_OT;
>
> This is really getting out of hands in this patchset. Please
> add a patch at the beginning of the patchset, which converts
> this construct into the following:
>
> switch (di->chip) {
> case A:
> case B:
> case C:
> case D:
>     return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
> case E:
> case F:
>     return flags & BQ27XXX_FLAG_OT;
> default:
>     return false;
> }
>
> -- Sebastian
>

I was advised to move these tests into a function which I've done in the 
10th patch. I have no issue with changing it to a switch statement, but 
should I drop the bq27xxx_has_multiple_overtemp_flags() function I added?

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [PATCH v2 11/11] power: supplies: bq275xx: adds device tree binding documentation.
  2017-01-06  0:06     ` Sebastian Reichel
@ 2017-01-06  0:32       ` Chris Lapa
  0 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-06  0:32 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: pali.rohar, afd, linux-pm, linux-kernel

On 6/1/17 11:06 am, Sebastian Reichel wrote:
> Hi,
>
> On Fri, Dec 23, 2016 at 11:05:07AM +1100, Chris Lapa wrote:
>> From: Chris Lapa <chris@lapa.com.au>
>>
>> The bq275xx binding is a standard i2c style binding, however the
>> deprecated compatible fields and different revisions warrant its own
>> documentation.
>
> Please add the other supported i2c bq27xxx chips and name the file
> bq27xxx.txt. Otherwise maintaining this will become annoying.
>
> -- Sebastian
>

Makes sense, will do.

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [PATCH v2 01/11] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future.
  2017-01-06  0:29       ` Chris Lapa
@ 2017-01-06 17:36         ` Sebastian Reichel
  0 siblings, 0 replies; 70+ messages in thread
From: Sebastian Reichel @ 2017-01-06 17:36 UTC (permalink / raw)
  To: Chris Lapa; +Cc: pali.rohar, afd, linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1739 bytes --]

Hi,

On Fri, Jan 06, 2017 at 11:29:19AM +1100, Chris Lapa wrote:
> On 6/1/17 10:59 am, Sebastian Reichel wrote:
> > Hi Chris,
> > 
> > On Fri, Dec 23, 2016 at 11:04:57AM +1100, Chris Lapa wrote:
> > > From: Chris Lapa <chris@lapa.com.au>
> > > 
> > > The BQ275XX definition exists only to satisfy backwards compatibility.
> > > 
> > > tested: yes
> > > 
> > > Signed-off-by: Chris Lapa <chris@lapa.com.au>
> > > 
> > > [...]
> > > 
> > >  static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
> > >  {
> > > -	if (di->chip == BQ27500 || di->chip == BQ27541 || di->chip == BQ27545)
> > > +	if (di->chip == BQ275XX || di->chip == BQ27541 || di->chip == BQ27545)
> > >  		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
> > >  	if (di->chip == BQ27530 || di->chip == BQ27421)
> > >  		return flags & BQ27XXX_FLAG_OT;
> > 
> > This is really getting out of hands in this patchset. Please
> > add a patch at the beginning of the patchset, which converts
> > this construct into the following:
> > 
> > switch (di->chip) {
> > case A:
> > case B:
> > case C:
> > case D:
> >     return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
> > case E:
> > case F:
> >     return flags & BQ27XXX_FLAG_OT;
> > default:
> >     return false;
> > }
> > 
> > -- Sebastian
> > 
> 
> I was advised to move these tests into a function which I've done in the
> 10th patch. I have no issue with changing it to a switch statement, but
> should I drop the bq27xxx_has_multiple_overtemp_flags() function I added?

I'm fine with or without the extra function. But please introduce
the switch at the beginning of the patchseries, since it also eases
patch-reviewing.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 70+ messages in thread

* [PATCH v3 00/11]  power: supply: bq275xx: implement individual chip revision support
  2016-12-22  1:22 [PATCH 00/10] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                   ` (9 preceding siblings ...)
  2016-12-23  0:04 ` [PATCH v2 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
@ 2017-01-09  0:47 ` Chris Lapa
  2017-01-09  0:47   ` [PATCH v3 01/11] power: supplies: bq275xx: move overtemp tests to a switch statement Chris Lapa
                     ` (12 more replies)
  2017-01-10  5:25 ` [PATCH v4 00/10] power: supply: bq27xxx: " Chris Lapa
  2017-01-11  1:44 ` [PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support Chris Lapa
  12 siblings, 13 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-09  0:47 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This patch series separates out support for each revision chip in
the bq27500, bq27510 and bq27520 family. Each revision has enough
register address changes to justify individual register mappings.

The series also cleans up the large overtemp if statement to
improve readability and adds devicetree documentation for all
the support bq27xxx series chips.

I had a chance to test the deprecated bq27500/10/20 support which still
behaves the same. I also tested the new specific bq27510g3 support
on a custom board I have here and it worked correctly.

Chris Lapa (11):
  power: supplies: bq275xx: move overtemp tests to a switch statement.
  power: supplies: bq275xx: rename BQ27500 allow for deprecation in
    future.
  power: supplies: bq275xx: adds specific support for bq27500/1
    revision.
  power: supplies: bq275xx: adds specific support for bq27510-g1
    revision.
  power: supplies: bq275xx: adds specific support for bq27510-g2
    revision.
  power: supplies: bq275xx: adds specific support for bq27510-g3
    revision.
  power: supplies: bq275xx: adds specific support for bq27520-g1
    revision.
  power: supplies: bq275xx: adds specific support for bq27520-g2
    revision.
  power: supplies: bq275xx: adds specific support for bq27520-g3
    revision.
  power: supplies: bq275xx: adds specific support for bq27520-g4
    revision.
  power: supplies: bq27xxx: adds device tree binding documentation.

 .../devicetree/bindings/power/supply/bq27xxx.txt   |  36 +++
 drivers/power/supply/bq27xxx_battery.c             | 348 ++++++++++++++++++++-
 drivers/power/supply/bq27xxx_battery_i2c.c         |  22 +-
 include/linux/power/bq27xxx_battery.h              |  10 +-
 4 files changed, 407 insertions(+), 9 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/power/supply/bq27xxx.txt

-- 
2.1.4

^ permalink raw reply	[flat|nested] 70+ messages in thread

* [PATCH v3 01/11] power: supplies: bq275xx: move overtemp tests to a switch statement.
  2017-01-09  0:47 ` [PATCH v3 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
@ 2017-01-09  0:47   ` Chris Lapa
  2017-01-09 15:35     ` Andrew F. Davis
  2017-01-09  0:47   ` [PATCH v3 02/11] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future Chris Lapa
                     ` (11 subsequent siblings)
  12 siblings, 1 reply; 70+ messages in thread
From: Chris Lapa @ 2017-01-09  0:47 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This is done for readability as the upcoming commits will add a lot of
cases.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 3b0dbc6..fd4cc4e 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -635,12 +635,17 @@ static int bq27xxx_battery_read_pwr_avg(struct bq27xxx_device_info *di)
  */
 static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
-	if (di->chip == BQ27500 || di->chip == BQ27541 || di->chip == BQ27545)
+	switch (di->chip) {
+	case BQ27500:
+	case BQ27541:
+	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
-	if (di->chip == BQ27530 || di->chip == BQ27421)
+	case BQ27530:
+	case BQ27421:
 		return flags & BQ27XXX_FLAG_OT;
-
-	return false;
+	default:
+		return false;
+	}
 }
 
 /*
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v3 02/11] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future.
  2017-01-09  0:47 ` [PATCH v3 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
  2017-01-09  0:47   ` [PATCH v3 01/11] power: supplies: bq275xx: move overtemp tests to a switch statement Chris Lapa
@ 2017-01-09  0:47   ` Chris Lapa
  2017-01-09  0:47   ` [PATCH v3 03/11] power: supplies: bq275xx: adds specific support for bq27500/1 revision Chris Lapa
                     ` (10 subsequent siblings)
  12 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-09  0:47 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

The BQ275XX definition exists only to satisfy backwards compatibility.

tested: yes

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 8 ++++----
 drivers/power/supply/bq27xxx_battery_i2c.c | 6 +++---
 include/linux/power/bq27xxx_battery.h      | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index fd4cc4e..b94091e 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -145,7 +145,7 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x76,
 		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
 	},
-	[BQ27500] = {
+	[BQ275XX] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
 		[BQ27XXX_REG_INT_TEMP] = 0x28,
@@ -284,7 +284,7 @@ static enum power_supply_property bq27010_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
-static enum power_supply_property bq27500_battery_props[] = {
+static enum power_supply_property bq275xx_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
 	POWER_SUPPLY_PROP_VOLTAGE_NOW,
@@ -384,7 +384,7 @@ static struct {
 } bq27xxx_battery_props[] = {
 	BQ27XXX_PROP(BQ27000, bq27000_battery_props),
 	BQ27XXX_PROP(BQ27010, bq27010_battery_props),
-	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
+	BQ27XXX_PROP(BQ275XX, bq275xx_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -636,7 +636,7 @@ static int bq27xxx_battery_read_pwr_avg(struct bq27xxx_device_info *di)
 static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
 	switch (di->chip) {
-	case BQ27500:
+	case BQ275XX:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 85d4ea2..762d96e 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -148,9 +148,9 @@ static int bq27xxx_battery_i2c_remove(struct i2c_client *client)
 static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27200", BQ27000 },
 	{ "bq27210", BQ27010 },
-	{ "bq27500", BQ27500 },
-	{ "bq27510", BQ27500 },
-	{ "bq27520", BQ27500 },
+	{ "bq27500", BQ275XX },
+	{ "bq27510", BQ275XX },
+	{ "bq27520", BQ275XX },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index e30deb0..c452b94 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -4,7 +4,7 @@
 enum bq27xxx_chip {
 	BQ27000 = 1, /* bq27000, bq27200 */
 	BQ27010, /* bq27010, bq27210 */
-	BQ27500, /* bq27500, bq27510, bq27520 */
+	BQ275XX, /* bq27500, bq27510, bq27520 deprecated alias */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v3 03/11] power: supplies: bq275xx: adds specific support for bq27500/1 revision.
  2017-01-09  0:47 ` [PATCH v3 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
  2017-01-09  0:47   ` [PATCH v3 01/11] power: supplies: bq275xx: move overtemp tests to a switch statement Chris Lapa
  2017-01-09  0:47   ` [PATCH v3 02/11] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future Chris Lapa
@ 2017-01-09  0:47   ` Chris Lapa
  2017-01-09  0:47   ` [PATCH v3 04/11] power: supplies: bq275xx: adds specific support for bq27510-g1 revision Chris Lapa
                     ` (9 subsequent siblings)
  12 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-09  0:47 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27500 chip definition to specifically match the
bq27500/1 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 42 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 45 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index b94091e..485e1f0 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -164,6 +164,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
 	},
+	[BQ27500] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -302,6 +321,27 @@ static enum power_supply_property bq275xx_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27500_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -385,6 +425,7 @@ static struct {
 	BQ27XXX_PROP(BQ27000, bq27000_battery_props),
 	BQ27XXX_PROP(BQ27010, bq27010_battery_props),
 	BQ27XXX_PROP(BQ275XX, bq275xx_battery_props),
+	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -637,6 +678,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
 	switch (di->chip) {
 	case BQ275XX:
+	case BQ27500:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 762d96e..a01b35d 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -151,6 +151,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27500", BQ275XX },
 	{ "bq27510", BQ275XX },
 	{ "bq27520", BQ275XX },
+	{ "bq27500-1", BQ27500 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -173,6 +174,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27500" },
 	{ .compatible = "ti,bq27510" },
 	{ .compatible = "ti,bq27520" },
+	{ .compatible = "ti,bq27500-1" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index c452b94..7d2a415 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -5,6 +5,7 @@ enum bq27xxx_chip {
 	BQ27000 = 1, /* bq27000, bq27200 */
 	BQ27010, /* bq27010, bq27210 */
 	BQ275XX, /* bq27500, bq27510, bq27520 deprecated alias */
+	BQ27500, /* bq27500/1 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v3 04/11] power: supplies: bq275xx: adds specific support for bq27510-g1 revision.
  2017-01-09  0:47 ` [PATCH v3 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                     ` (2 preceding siblings ...)
  2017-01-09  0:47   ` [PATCH v3 03/11] power: supplies: bq275xx: adds specific support for bq27500/1 revision Chris Lapa
@ 2017-01-09  0:47   ` Chris Lapa
  2017-01-09  0:47   ` [PATCH v3 05/11] power: supplies: bq275xx: adds specific support for bq27510-g2 revision Chris Lapa
                     ` (8 subsequent siblings)
  12 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-09  0:47 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27510G1 chip definition to specifically match the
bq27510-G1 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 43 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 46 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 485e1f0..84d04bb 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -22,6 +22,7 @@
  * http://www.ti.com/product/bq27010
  * http://www.ti.com/product/bq27210
  * http://www.ti.com/product/bq27500
+ * http://www.ti.com/product/bq27510-g1
  * http://www.ti.com/product/bq27510-g3
  * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27530-g1
@@ -183,6 +184,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27510G1] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -342,6 +362,27 @@ static enum power_supply_property bq27500_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27510g1_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -426,6 +467,7 @@ static struct {
 	BQ27XXX_PROP(BQ27010, bq27010_battery_props),
 	BQ27XXX_PROP(BQ275XX, bq275xx_battery_props),
 	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
+	BQ27XXX_PROP(BQ27510G1, bq27510g1_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -679,6 +721,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	switch (di->chip) {
 	case BQ275XX:
 	case BQ27500:
+	case BQ27510G1:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index a01b35d..61f13fd 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -152,6 +152,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27510", BQ275XX },
 	{ "bq27520", BQ275XX },
 	{ "bq27500-1", BQ27500 },
+	{ "bq27510g1", BQ27510G1 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -175,6 +176,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27510" },
 	{ .compatible = "ti,bq27520" },
 	{ .compatible = "ti,bq27500-1" },
+	{ .compatible = "ti,bq27510g1" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 7d2a415..9fa7c86 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -6,6 +6,7 @@ enum bq27xxx_chip {
 	BQ27010, /* bq27010, bq27210 */
 	BQ275XX, /* bq27500, bq27510, bq27520 deprecated alias */
 	BQ27500, /* bq27500/1 */
+	BQ27510G1, /* bq27510G1 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v3 05/11] power: supplies: bq275xx: adds specific support for bq27510-g2 revision.
  2017-01-09  0:47 ` [PATCH v3 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                     ` (3 preceding siblings ...)
  2017-01-09  0:47   ` [PATCH v3 04/11] power: supplies: bq275xx: adds specific support for bq27510-g1 revision Chris Lapa
@ 2017-01-09  0:47   ` Chris Lapa
  2017-01-09  0:47   ` [PATCH v3 06/11] power: supplies: bq275xx: adds specific support for bq27510-g3 revision Chris Lapa
                     ` (7 subsequent siblings)
  12 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-09  0:47 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27510G2 chip definition to specifically match the
bq27510-G2 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 43 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 46 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 84d04bb..e2c28da 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -23,6 +23,7 @@
  * http://www.ti.com/product/bq27210
  * http://www.ti.com/product/bq27500
  * http://www.ti.com/product/bq27510-g1
+ * http://www.ti.com/product/bq27510-g2
  * http://www.ti.com/product/bq27510-g3
  * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27530-g1
@@ -203,6 +204,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27510G2] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -383,6 +403,27 @@ static enum power_supply_property bq27510g1_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27510g2_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -468,6 +509,7 @@ static struct {
 	BQ27XXX_PROP(BQ275XX, bq275xx_battery_props),
 	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
 	BQ27XXX_PROP(BQ27510G1, bq27510g1_battery_props),
+	BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -722,6 +764,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	case BQ275XX:
 	case BQ27500:
 	case BQ27510G1:
+	case BQ27510G2:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 61f13fd..5f30d6a 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -153,6 +153,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27520", BQ275XX },
 	{ "bq27500-1", BQ27500 },
 	{ "bq27510g1", BQ27510G1 },
+	{ "bq27510g2", BQ27510G2 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -177,6 +178,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27520" },
 	{ .compatible = "ti,bq27500-1" },
 	{ .compatible = "ti,bq27510g1" },
+	{ .compatible = "ti,bq27510g2" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 9fa7c86..dd5df1e 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -7,6 +7,7 @@ enum bq27xxx_chip {
 	BQ275XX, /* bq27500, bq27510, bq27520 deprecated alias */
 	BQ27500, /* bq27500/1 */
 	BQ27510G1, /* bq27510G1 */
+	BQ27510G2, /* bq27510G2 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v3 06/11] power: supplies: bq275xx: adds specific support for bq27510-g3 revision.
  2017-01-09  0:47 ` [PATCH v3 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                     ` (4 preceding siblings ...)
  2017-01-09  0:47   ` [PATCH v3 05/11] power: supplies: bq275xx: adds specific support for bq27510-g2 revision Chris Lapa
@ 2017-01-09  0:47   ` Chris Lapa
  2017-01-09  0:47   ` [PATCH v3 07/11] power: supplies: bq275xx: adds specific support for bq27520-g1 revision Chris Lapa
                     ` (6 subsequent siblings)
  12 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-09  0:47 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27510G3 chip definition to specifically match the
bq27510-G3 functionality as described in the datasheet.

tested: yes

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 39 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 42 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index e2c28da..8e72324 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -223,6 +223,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27510G3] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = 0x28,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_TTES] = 0x1a,
+		[BQ27XXX_REG_TTECP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x1e,
+		[BQ27XXX_REG_AE] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_SOC] = 0x20,
+		[BQ27XXX_REG_DCAP] = 0x2e,
+		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -424,6 +443,24 @@ static enum power_supply_property bq27510g2_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27510g3_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -510,6 +547,7 @@ static struct {
 	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
 	BQ27XXX_PROP(BQ27510G1, bq27510g1_battery_props),
 	BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
+	BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -765,6 +803,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	case BQ27500:
 	case BQ27510G1:
 	case BQ27510G2:
+	case BQ27510G3:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 5f30d6a..e601b2b 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -154,6 +154,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27500-1", BQ27500 },
 	{ "bq27510g1", BQ27510G1 },
 	{ "bq27510g2", BQ27510G2 },
+	{ "bq27510g3", BQ27510G3 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -179,6 +180,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27500-1" },
 	{ .compatible = "ti,bq27510g1" },
 	{ .compatible = "ti,bq27510g2" },
+	{ .compatible = "ti,bq27510g3" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index dd5df1e..abec4ce 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -8,6 +8,7 @@ enum bq27xxx_chip {
 	BQ27500, /* bq27500/1 */
 	BQ27510G1, /* bq27510G1 */
 	BQ27510G2, /* bq27510G2 */
+	BQ27510G3, /* bq27510G3 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v3 07/11] power: supplies: bq275xx: adds specific support for bq27520-g1 revision.
  2017-01-09  0:47 ` [PATCH v3 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                     ` (5 preceding siblings ...)
  2017-01-09  0:47   ` [PATCH v3 06/11] power: supplies: bq275xx: adds specific support for bq27510-g3 revision Chris Lapa
@ 2017-01-09  0:47   ` Chris Lapa
  2017-01-09  0:47   ` [PATCH v3 08/11] power: supplies: bq275xx: adds specific support for bq27520-g2 revision Chris Lapa
                     ` (5 subsequent siblings)
  12 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-09  0:47 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27520G1 chip definition to specifically match the
bq27520-G1 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 42 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 45 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 8e72324..676fbe6 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -26,6 +26,7 @@
  * http://www.ti.com/product/bq27510-g2
  * http://www.ti.com/product/bq27510-g3
  * http://www.ti.com/product/bq27520-g4
+ * http://www.ti.com/product/bq27520-g1
  * http://www.ti.com/product/bq27530-g1
  * http://www.ti.com/product/bq27531-g1
  * http://www.ti.com/product/bq27541-g1
@@ -242,6 +243,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x2e,
 		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
 	},
+	[BQ27520G1] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -461,6 +481,26 @@ static enum power_supply_property bq27510g3_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27520g1_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -548,6 +588,7 @@ static struct {
 	BQ27XXX_PROP(BQ27510G1, bq27510g1_battery_props),
 	BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
 	BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
+	BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -804,6 +845,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	case BQ27510G1:
 	case BQ27510G2:
 	case BQ27510G3:
+	case BQ27520G1:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index e601b2b..33a7d18 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -155,6 +155,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27510g1", BQ27510G1 },
 	{ "bq27510g2", BQ27510G2 },
 	{ "bq27510g3", BQ27510G3 },
+	{ "bq27520g1", BQ27520G1 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -181,6 +182,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27510g1" },
 	{ .compatible = "ti,bq27510g2" },
 	{ .compatible = "ti,bq27510g3" },
+	{ .compatible = "ti,bq27520g1" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index abec4ce..b971401 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -9,6 +9,7 @@ enum bq27xxx_chip {
 	BQ27510G1, /* bq27510G1 */
 	BQ27510G2, /* bq27510G2 */
 	BQ27510G3, /* bq27510G3 */
+	BQ27520G1, /* bq27520G1 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v3 08/11] power: supplies: bq275xx: adds specific support for bq27520-g2 revision.
  2017-01-09  0:47 ` [PATCH v3 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                     ` (6 preceding siblings ...)
  2017-01-09  0:47   ` [PATCH v3 07/11] power: supplies: bq275xx: adds specific support for bq27520-g1 revision Chris Lapa
@ 2017-01-09  0:47   ` Chris Lapa
  2017-01-09  0:47   ` [PATCH v3 09/11] power: supplies: bq275xx: adds specific support for bq27520-g3 revision Chris Lapa
                     ` (4 subsequent siblings)
  12 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-09  0:47 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27520G2 chip definition to specifically match the
bq27520-G2 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 43 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 46 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 676fbe6..ac59c24 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -27,6 +27,7 @@
  * http://www.ti.com/product/bq27510-g3
  * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27520-g1
+ * http://www.ti.com/product/bq27520-g2
  * http://www.ti.com/product/bq27530-g1
  * http://www.ti.com/product/bq27531-g1
  * http://www.ti.com/product/bq27541-g1
@@ -262,6 +263,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27520G2] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = 0x36,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -501,6 +521,27 @@ static enum power_supply_property bq27520g1_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27520g2_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -589,6 +630,7 @@ static struct {
 	BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
 	BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
 	BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
+	BQ27XXX_PROP(BQ27520G2, bq27520g2_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -846,6 +888,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	case BQ27510G2:
 	case BQ27510G3:
 	case BQ27520G1:
+	case BQ27520G2:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 33a7d18..4835523 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -156,6 +156,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27510g2", BQ27510G2 },
 	{ "bq27510g3", BQ27510G3 },
 	{ "bq27520g1", BQ27520G1 },
+	{ "bq27520g2", BQ27520G2 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -183,6 +184,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27510g2" },
 	{ .compatible = "ti,bq27510g3" },
 	{ .compatible = "ti,bq27520g1" },
+	{ .compatible = "ti,bq27520g2" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index b971401..6a1a4ab 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -10,6 +10,7 @@ enum bq27xxx_chip {
 	BQ27510G2, /* bq27510G2 */
 	BQ27510G3, /* bq27510G3 */
 	BQ27520G1, /* bq27520G1 */
+	BQ27520G2, /* bq27520G2 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v3 09/11] power: supplies: bq275xx: adds specific support for bq27520-g3 revision.
  2017-01-09  0:47 ` [PATCH v3 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                     ` (7 preceding siblings ...)
  2017-01-09  0:47   ` [PATCH v3 08/11] power: supplies: bq275xx: adds specific support for bq27520-g2 revision Chris Lapa
@ 2017-01-09  0:47   ` Chris Lapa
  2017-01-09  0:47   ` [PATCH v3 10/11] power: supplies: bq275xx: adds specific support for bq27520-g4 revision Chris Lapa
                     ` (3 subsequent siblings)
  12 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-09  0:47 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27520G3 chip definition to specifically match the
bq27520-G3 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 42 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 45 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index ac59c24..0dca4ee 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -28,6 +28,7 @@
  * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27520-g1
  * http://www.ti.com/product/bq27520-g2
+ * http://www.ti.com/product/bq27520-g3
  * http://www.ti.com/product/bq27530-g1
  * http://www.ti.com/product/bq27531-g1
  * http://www.ti.com/product/bq27541-g1
@@ -282,6 +283,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27520G3] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = 0x36,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -542,6 +562,26 @@ static enum power_supply_property bq27520g2_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27520g3_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -631,6 +671,7 @@ static struct {
 	BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
 	BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
 	BQ27XXX_PROP(BQ27520G2, bq27520g2_battery_props),
+	BQ27XXX_PROP(BQ27520G3, bq27520g3_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -889,6 +930,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	case BQ27510G3:
 	case BQ27520G1:
 	case BQ27520G2:
+	case BQ27520G3:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 4835523..899a846 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -157,6 +157,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27510g3", BQ27510G3 },
 	{ "bq27520g1", BQ27520G1 },
 	{ "bq27520g2", BQ27520G2 },
+	{ "bq27520g3", BQ27520G3 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -185,6 +186,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27510g3" },
 	{ .compatible = "ti,bq27520g1" },
 	{ .compatible = "ti,bq27520g2" },
+	{ .compatible = "ti,bq27520g3" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 6a1a4ab..e61f4fa 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -11,6 +11,7 @@ enum bq27xxx_chip {
 	BQ27510G3, /* bq27510G3 */
 	BQ27520G1, /* bq27520G1 */
 	BQ27520G2, /* bq27520G2 */
+	BQ27520G3, /* bq27520G3 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v3 10/11] power: supplies: bq275xx: adds specific support for bq27520-g4 revision.
  2017-01-09  0:47 ` [PATCH v3 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                     ` (8 preceding siblings ...)
  2017-01-09  0:47   ` [PATCH v3 09/11] power: supplies: bq275xx: adds specific support for bq27520-g3 revision Chris Lapa
@ 2017-01-09  0:47   ` Chris Lapa
  2017-01-09  0:47   ` [PATCH v3 11/11] power: supplies: bq27xxx: adds device tree binding documentation Chris Lapa
                     ` (2 subsequent siblings)
  12 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-09  0:47 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27520G4 chip definition to specifically match the
bq27520-G4 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 39 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 42 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 0dca4ee..14ca7e9 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -29,6 +29,7 @@
  * http://www.ti.com/product/bq27520-g1
  * http://www.ti.com/product/bq27520-g2
  * http://www.ti.com/product/bq27520-g3
+ * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27530-g1
  * http://www.ti.com/product/bq27531-g1
  * http://www.ti.com/product/bq27541-g1
@@ -302,6 +303,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27520G4] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = 0x28,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x1e,
+		[BQ27XXX_REG_AE] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_SOC] = 0x20,
+		[BQ27XXX_REG_DCAP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -582,6 +602,23 @@ static enum power_supply_property bq27520g3_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27520g4_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -672,6 +709,7 @@ static struct {
 	BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
 	BQ27XXX_PROP(BQ27520G2, bq27520g2_battery_props),
 	BQ27XXX_PROP(BQ27520G3, bq27520g3_battery_props),
+	BQ27XXX_PROP(BQ27520G4, bq27520g4_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -931,6 +969,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	case BQ27520G1:
 	case BQ27520G2:
 	case BQ27520G3:
+	case BQ27520G4:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 899a846..3878da4 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -158,6 +158,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27520g1", BQ27520G1 },
 	{ "bq27520g2", BQ27520G2 },
 	{ "bq27520g3", BQ27520G3 },
+	{ "bq27520g4", BQ27520G4 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -187,6 +188,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27520g1" },
 	{ .compatible = "ti,bq27520g2" },
 	{ .compatible = "ti,bq27520g3" },
+	{ .compatible = "ti,bq27520g4" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index e61f4fa..09af70d 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -12,6 +12,7 @@ enum bq27xxx_chip {
 	BQ27520G1, /* bq27520G1 */
 	BQ27520G2, /* bq27520G2 */
 	BQ27520G3, /* bq27520G3 */
+	BQ27520G4, /* bq27520G4 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v3 11/11] power: supplies: bq27xxx: adds device tree binding documentation.
  2017-01-09  0:47 ` [PATCH v3 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                     ` (9 preceding siblings ...)
  2017-01-09  0:47   ` [PATCH v3 10/11] power: supplies: bq275xx: adds specific support for bq27520-g4 revision Chris Lapa
@ 2017-01-09  0:47   ` Chris Lapa
  2017-01-09  8:23   ` [PATCH v3 00/11] power: supply: bq275xx: implement individual chip revision support Pali Rohár
  2017-01-10  2:49   ` Sebastian Reichel
  12 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-09  0:47 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

The bq27xxx binding is a standard i2c style binding, however the
deprecated compatible fields and different revisions warrant its own
documentation.

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 .../devicetree/bindings/power/supply/bq27xxx.txt   | 36 ++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/bq27xxx.txt

diff --git a/Documentation/devicetree/bindings/power/supply/bq27xxx.txt b/Documentation/devicetree/bindings/power/supply/bq27xxx.txt
new file mode 100644
index 0000000..b0c95ef
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/supply/bq27xxx.txt
@@ -0,0 +1,36 @@
+Binding for TI BQ27XXX fuel gauge family
+
+Required properties:
+- compatible: Should contain one of the following:
+ * "ti,bq27200" - BQ27200
+ * "ti,bq27210" - BQ27210
+ * "ti,bq27500" - deprecated, use revision specific property below
+ * "ti,bq27510" - deprecated, use revision specific property below
+ * "ti,bq27520" - deprecated, use revision specific property below
+ * "ti,bq27500-1" - BQ27500/1
+ * "ti,bq27510g1" - BQ27510-g1
+ * "ti,bq27510g2" - BQ27510-g2
+ * "ti,bq27510g3" - BQ27510-g3
+ * "ti,bq27520g1" - BQ27520-g1
+ * "ti,bq27520g2" - BQ27520-g2
+ * "ti,bq27520g3" - BQ27520-g3
+ * "ti,bq27520g4" - BQ27520-g4
+ * "ti,bq27530" - BQ27530
+ * "ti,bq27531" - BQ27531
+ * "ti,bq27541" - BQ27541
+ * "ti,bq27542" - BQ27542
+ * "ti,bq27546" - BQ27546
+ * "ti,bq27742" - BQ27742
+ * "ti,bq27545" - BQ27545
+ * "ti,bq27421" - BQ27421
+ * "ti,bq27425" - BQ27425
+ * "ti,bq27441" - BQ27441
+ * "ti,bq27621" - BQ27621
+- reg: integer, i2c address of the device.
+
+Example:
+
+bq27510g3 {
+    compatible = "ti,bq27510g3";
+    reg = <0x55>;
+};
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* Re: [PATCH v3 00/11]  power: supply: bq275xx: implement individual chip revision support
  2017-01-09  0:47 ` [PATCH v3 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                     ` (10 preceding siblings ...)
  2017-01-09  0:47   ` [PATCH v3 11/11] power: supplies: bq27xxx: adds device tree binding documentation Chris Lapa
@ 2017-01-09  8:23   ` Pali Rohár
  2017-01-10  2:49   ` Sebastian Reichel
  12 siblings, 0 replies; 70+ messages in thread
From: Pali Rohár @ 2017-01-09  8:23 UTC (permalink / raw)
  To: Chris Lapa; +Cc: afd, sre, linux-pm, linux-kernel

On Monday 09 January 2017 11:47:34 Chris Lapa wrote:
> From: Chris Lapa <chris@lapa.com.au>
> 
> This patch series separates out support for each revision chip in
> the bq27500, bq27510 and bq27520 family. Each revision has enough
> register address changes to justify individual register mappings.
> 
> The series also cleans up the large overtemp if statement to
> improve readability and adds devicetree documentation for all
> the support bq27xxx series chips.
> 
> I had a chance to test the deprecated bq27500/10/20 support which still
> behaves the same. I also tested the new specific bq27510g3 support
> on a custom board I have here and it worked correctly.
> 
> Chris Lapa (11):
>   power: supplies: bq275xx: move overtemp tests to a switch statement.
>   power: supplies: bq275xx: rename BQ27500 allow for deprecation in
>     future.
>   power: supplies: bq275xx: adds specific support for bq27500/1
>     revision.
>   power: supplies: bq275xx: adds specific support for bq27510-g1
>     revision.
>   power: supplies: bq275xx: adds specific support for bq27510-g2
>     revision.
>   power: supplies: bq275xx: adds specific support for bq27510-g3
>     revision.
>   power: supplies: bq275xx: adds specific support for bq27520-g1
>     revision.
>   power: supplies: bq275xx: adds specific support for bq27520-g2
>     revision.
>   power: supplies: bq275xx: adds specific support for bq27520-g3
>     revision.
>   power: supplies: bq275xx: adds specific support for bq27520-g4
>     revision.
>   power: supplies: bq27xxx: adds device tree binding documentation.
> 
>  .../devicetree/bindings/power/supply/bq27xxx.txt   |  36 +++
>  drivers/power/supply/bq27xxx_battery.c             | 348 ++++++++++++++++++++-
>  drivers/power/supply/bq27xxx_battery_i2c.c         |  22 +-
>  include/linux/power/bq27xxx_battery.h              |  10 +-
>  4 files changed, 407 insertions(+), 9 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/power/supply/bq27xxx.txt

Much better now! You can add my Acked-by.

-- 
Pali Rohár
pali.rohar@gmail.com

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [PATCH v3 01/11] power: supplies: bq275xx: move overtemp tests to a switch statement.
  2017-01-09  0:47   ` [PATCH v3 01/11] power: supplies: bq275xx: move overtemp tests to a switch statement Chris Lapa
@ 2017-01-09 15:35     ` Andrew F. Davis
  0 siblings, 0 replies; 70+ messages in thread
From: Andrew F. Davis @ 2017-01-09 15:35 UTC (permalink / raw)
  To: Chris Lapa, pali.rohar, sre, linux-pm, linux-kernel

On 01/08/2017 06:47 PM, Chris Lapa wrote:
> From: Chris Lapa <chris@lapa.com.au>
> 
> This is done for readability as the upcoming commits will add a lot of
> cases.
> 
> tested: no
> 
> Signed-off-by: Chris Lapa <chris@lapa.com.au>
> ---
>  drivers/power/supply/bq27xxx_battery.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
> index 3b0dbc6..fd4cc4e 100644
> --- a/drivers/power/supply/bq27xxx_battery.c
> +++ b/drivers/power/supply/bq27xxx_battery.c
> @@ -635,12 +635,17 @@ static int bq27xxx_battery_read_pwr_avg(struct bq27xxx_device_info *di)
>   */
>  static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
>  {
> -	if (di->chip == BQ27500 || di->chip == BQ27541 || di->chip == BQ27545)
> +	switch (di->chip) {
> +	case BQ27500:
> +	case BQ27541:
> +	case BQ27545:

As some functions are not long enough to need this refactoring, I feel
we still have some code consistency issues in this driver. At some point
it may be better to add some additional fields to the device definition
structure, then we reference that and not use coded cases for selection.

For now, this and the rest of the series look correct to me:

Reviewed-by: Andrew F. Davis <afd@ti.com>

>  		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
> -	if (di->chip == BQ27530 || di->chip == BQ27421)
> +	case BQ27530:
> +	case BQ27421:
>  		return flags & BQ27XXX_FLAG_OT;
> -
> -	return false;
> +	default:
> +		return false;
> +	}
>  }
>  
>  /*
> 

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [PATCH v3 00/11]  power: supply: bq275xx: implement individual chip revision support
  2017-01-09  0:47 ` [PATCH v3 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                     ` (11 preceding siblings ...)
  2017-01-09  8:23   ` [PATCH v3 00/11] power: supply: bq275xx: implement individual chip revision support Pali Rohár
@ 2017-01-10  2:49   ` Sebastian Reichel
  12 siblings, 0 replies; 70+ messages in thread
From: Sebastian Reichel @ 2017-01-10  2:49 UTC (permalink / raw)
  To: Chris Lapa; +Cc: pali.rohar, afd, linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1217 bytes --]

Hi Chris,

On Mon, Jan 09, 2017 at 11:47:34AM +1100, Chris Lapa wrote:
> This patch series separates out support for each revision chip in
> the bq27500, bq27510 and bq27520 family. Each revision has enough
> register address changes to justify individual register mappings.
> 
> The series also cleans up the large overtemp if statement to
> improve readability and adds devicetree documentation for all
> the support bq27xxx series chips.
> 
> I had a chance to test the deprecated bq27500/10/20 support which still
> behaves the same. I also tested the new specific bq27510g3 support
> on a custom board I have here and it worked correctly.

I tried to queue the patches, but they do not apply on top of
power-supply's for-next branch [0]. I applied the first one, but
please do the rebasing work for the other patches and resend.
While being at it you can add the following to all patches:

Acked-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>

Ah and last but not least: Please use the following as
patch subject prefix: "power: supply: bq27xxx:"

[0] https://git.kernel.org/cgit/linux/kernel/git/sre/linux-power-supply.git/?h=for-next

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 70+ messages in thread

* [PATCH v4 00/10] power: supply: bq27xxx: implement individual chip revision support
  2016-12-22  1:22 [PATCH 00/10] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                   ` (10 preceding siblings ...)
  2017-01-09  0:47 ` [PATCH v3 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
@ 2017-01-10  5:25 ` Chris Lapa
  2017-01-10  5:25   ` [PATCH v4 01/10] power: supplies: bq27xxx: rename BQ27500 allow for deprecation in future Chris Lapa
                     ` (9 more replies)
  2017-01-11  1:44 ` [PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support Chris Lapa
  12 siblings, 10 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-10  5:25 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This patch series renames the patch subject prefix to 'power: supply: bq27xxx'
and also rebases onto sre/linux-power-supply/for-next.

It also drops the overtemp cleanup patch from v3 as it has already been applied.

Otherwise the patch content is the same functionally as the v3 series.

Chris Lapa (10):
  power: supplies: bq27xxx: rename BQ27500 allow for deprecation in
    future.
  power: supplies: bq27xxx: adds specific support for bq27500/1
    revision.
  power: supplies: bq27xxx: adds specific support for bq27510-g1
    revision.
  power: supplies: bq27xxx: adds specific support for bq27510-g2
    revision.
  power: supplies: bq27xxx: adds specific support for bq27510-g3
    revision.
  power: supplies: bq27xxx: adds specific support for bq27520-g1
    revision.
  power: supplies: bq27xxx: adds specific support for bq27520-g2
    revision.
  power: supplies: bq27xxx: adds specific support for bq27520-g3
    revision.
  power: supplies: bq27xxx: adds specific support for bq27520-g4
    revision.
  power: supplies: bq27xxx: adds device tree binding documentation.

 .../devicetree/bindings/power/supply/bq27xxx.txt   |  36 +++
 drivers/power/supply/bq27xxx_battery.c             | 304 ++++++++++++++++++++-
 drivers/power/supply/bq27xxx_battery_i2c.c         |  22 +-
 include/linux/power/bq27xxx_battery.h              |  11 +-
 4 files changed, 363 insertions(+), 10 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/power/supply/bq27xxx.txt

-- 
2.1.4

^ permalink raw reply	[flat|nested] 70+ messages in thread

* [PATCH v4 01/10] power: supplies: bq27xxx: rename BQ27500 allow for deprecation in future.
  2017-01-10  5:25 ` [PATCH v4 00/10] power: supply: bq27xxx: " Chris Lapa
@ 2017-01-10  5:25   ` Chris Lapa
  2017-01-10  8:58     ` Pali Rohár
  2017-01-10  5:25   ` [PATCH v4 02/10] power: supplies: bq27xxx: adds specific support for bq27500/1 revision Chris Lapa
                     ` (8 subsequent siblings)
  9 siblings, 1 reply; 70+ messages in thread
From: Chris Lapa @ 2017-01-10  5:25 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

The BQ275XX definition exists only to satisfy backwards compatibility.

tested: yes

Signed-off-by: Chris Lapa <chris@lapa.com.au>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
---
 drivers/power/supply/bq27xxx_battery.c     | 10 ++++------
 drivers/power/supply/bq27xxx_battery_i2c.c |  6 +++---
 include/linux/power/bq27xxx_battery.h      |  3 +--
 3 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 7272d1e..a86417c 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -145,7 +145,7 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x76,
 		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
 	},
-	[BQ27500] = {
+	[BQ275XX] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
 		[BQ27XXX_REG_INT_TEMP] = 0x28,
@@ -303,7 +303,7 @@ static enum power_supply_property bq27010_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
-static enum power_supply_property bq27500_battery_props[] = {
+static enum power_supply_property bq275xx_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
 	POWER_SUPPLY_PROP_VOLTAGE_NOW,
@@ -421,8 +421,7 @@ static struct {
 } bq27xxx_battery_props[] = {
 	BQ27XXX_PROP(BQ27000, bq27000_battery_props),
 	BQ27XXX_PROP(BQ27010, bq27010_battery_props),
-	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
-	BQ27XXX_PROP(BQ27510, bq27510_battery_props),
+	BQ27XXX_PROP(BQ275XX, bq275xx_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -675,8 +674,7 @@ static int bq27xxx_battery_read_pwr_avg(struct bq27xxx_device_info *di)
 static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
 	switch (di->chip) {
-	case BQ27500:
-	case BQ27510:
+	case BQ275XX:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 5c5c3a6..762d96e 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -148,9 +148,9 @@ static int bq27xxx_battery_i2c_remove(struct i2c_client *client)
 static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27200", BQ27000 },
 	{ "bq27210", BQ27010 },
-	{ "bq27500", BQ27500 },
-	{ "bq27510", BQ27510 },
-	{ "bq27520", BQ27510 },
+	{ "bq27500", BQ275XX },
+	{ "bq27510", BQ275XX },
+	{ "bq27520", BQ275XX },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index bed9557..c452b94 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -4,8 +4,7 @@
 enum bq27xxx_chip {
 	BQ27000 = 1, /* bq27000, bq27200 */
 	BQ27010, /* bq27010, bq27210 */
-	BQ27500, /* bq27500 */
-	BQ27510, /* bq27510, bq27520 */
+	BQ275XX, /* bq27500, bq27510, bq27520 deprecated alias */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v4 02/10] power: supplies: bq27xxx: adds specific support for bq27500/1 revision.
  2017-01-10  5:25 ` [PATCH v4 00/10] power: supply: bq27xxx: " Chris Lapa
  2017-01-10  5:25   ` [PATCH v4 01/10] power: supplies: bq27xxx: rename BQ27500 allow for deprecation in future Chris Lapa
@ 2017-01-10  5:25   ` Chris Lapa
  2017-01-10  5:25   ` [PATCH v4 03/10] power: supplies: bq27xxx: adds specific support for bq27510-g1 revision Chris Lapa
                     ` (7 subsequent siblings)
  9 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-10  5:25 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27500 chip definition to specifically match the
bq27500/1 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
---
 drivers/power/supply/bq27xxx_battery.c     | 27 ++++++++++++++++-----------
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index a86417c..bf0dbf5 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -164,24 +164,24 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
 	},
-	[BQ27510] = {
+	[BQ27500] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
-		[BQ27XXX_REG_INT_TEMP] = 0x28,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
 		[BQ27XXX_REG_VOLT] = 0x08,
 		[BQ27XXX_REG_AI] = 0x14,
 		[BQ27XXX_REG_FLAGS] = 0x0a,
 		[BQ27XXX_REG_TTE] = 0x16,
-		[BQ27XXX_REG_TTF] = INVALID_REG_ADDR,
-		[BQ27XXX_REG_TTES] = 0x1a,
-		[BQ27XXX_REG_TTECP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
 		[BQ27XXX_REG_NAC] = 0x0c,
 		[BQ27XXX_REG_FCC] = 0x12,
-		[BQ27XXX_REG_CYCT] = 0x1e,
-		[BQ27XXX_REG_AE] = INVALID_REG_ADDR,
-		[BQ27XXX_REG_SOC] = 0x20,
-		[BQ27XXX_REG_DCAP] = 0x2e,
-		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
 	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
@@ -321,7 +321,7 @@ static enum power_supply_property bq275xx_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
-static enum power_supply_property bq27510_battery_props[] = {
+static enum power_supply_property bq27500_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
 	POWER_SUPPLY_PROP_VOLTAGE_NOW,
@@ -330,11 +330,14 @@ static enum power_supply_property bq27510_battery_props[] = {
 	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
 	POWER_SUPPLY_PROP_TEMP,
 	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
 	POWER_SUPPLY_PROP_TECHNOLOGY,
 	POWER_SUPPLY_PROP_CHARGE_FULL,
 	POWER_SUPPLY_PROP_CHARGE_NOW,
 	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
 	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
 	POWER_SUPPLY_PROP_HEALTH,
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
@@ -422,6 +425,7 @@ static struct {
 	BQ27XXX_PROP(BQ27000, bq27000_battery_props),
 	BQ27XXX_PROP(BQ27010, bq27010_battery_props),
 	BQ27XXX_PROP(BQ275XX, bq275xx_battery_props),
+	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -675,6 +679,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
 	switch (di->chip) {
 	case BQ275XX:
+	case BQ27500:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 762d96e..a01b35d 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -151,6 +151,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27500", BQ275XX },
 	{ "bq27510", BQ275XX },
 	{ "bq27520", BQ275XX },
+	{ "bq27500-1", BQ27500 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -173,6 +174,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27500" },
 	{ .compatible = "ti,bq27510" },
 	{ .compatible = "ti,bq27520" },
+	{ .compatible = "ti,bq27500-1" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index c452b94..7d2a415 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -5,6 +5,7 @@ enum bq27xxx_chip {
 	BQ27000 = 1, /* bq27000, bq27200 */
 	BQ27010, /* bq27010, bq27210 */
 	BQ275XX, /* bq27500, bq27510, bq27520 deprecated alias */
+	BQ27500, /* bq27500/1 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v4 03/10] power: supplies: bq27xxx: adds specific support for bq27510-g1 revision.
  2017-01-10  5:25 ` [PATCH v4 00/10] power: supply: bq27xxx: " Chris Lapa
  2017-01-10  5:25   ` [PATCH v4 01/10] power: supplies: bq27xxx: rename BQ27500 allow for deprecation in future Chris Lapa
  2017-01-10  5:25   ` [PATCH v4 02/10] power: supplies: bq27xxx: adds specific support for bq27500/1 revision Chris Lapa
@ 2017-01-10  5:25   ` Chris Lapa
  2017-01-10  5:25   ` [PATCH v4 04/10] power: supplies: bq27xxx: adds specific support for bq27510-g2 revision Chris Lapa
                     ` (6 subsequent siblings)
  9 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-10  5:25 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27510G1 chip definition to specifically match the
bq27510-G1 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
---
 drivers/power/supply/bq27xxx_battery.c     | 43 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 46 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index bf0dbf5..376f81e 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -22,6 +22,7 @@
  * http://www.ti.com/product/bq27010
  * http://www.ti.com/product/bq27210
  * http://www.ti.com/product/bq27500
+ * http://www.ti.com/product/bq27510-g1
  * http://www.ti.com/product/bq27510-g3
  * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27530-g1
@@ -183,6 +184,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27510G1] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -342,6 +362,27 @@ static enum power_supply_property bq27500_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27510g1_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -426,6 +467,7 @@ static struct {
 	BQ27XXX_PROP(BQ27010, bq27010_battery_props),
 	BQ27XXX_PROP(BQ275XX, bq275xx_battery_props),
 	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
+	BQ27XXX_PROP(BQ27510G1, bq27510g1_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -680,6 +722,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	switch (di->chip) {
 	case BQ275XX:
 	case BQ27500:
+	case BQ27510G1:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index a01b35d..61f13fd 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -152,6 +152,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27510", BQ275XX },
 	{ "bq27520", BQ275XX },
 	{ "bq27500-1", BQ27500 },
+	{ "bq27510g1", BQ27510G1 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -175,6 +176,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27510" },
 	{ .compatible = "ti,bq27520" },
 	{ .compatible = "ti,bq27500-1" },
+	{ .compatible = "ti,bq27510g1" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 7d2a415..9fa7c86 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -6,6 +6,7 @@ enum bq27xxx_chip {
 	BQ27010, /* bq27010, bq27210 */
 	BQ275XX, /* bq27500, bq27510, bq27520 deprecated alias */
 	BQ27500, /* bq27500/1 */
+	BQ27510G1, /* bq27510G1 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v4 04/10] power: supplies: bq27xxx: adds specific support for bq27510-g2 revision.
  2017-01-10  5:25 ` [PATCH v4 00/10] power: supply: bq27xxx: " Chris Lapa
                     ` (2 preceding siblings ...)
  2017-01-10  5:25   ` [PATCH v4 03/10] power: supplies: bq27xxx: adds specific support for bq27510-g1 revision Chris Lapa
@ 2017-01-10  5:25   ` Chris Lapa
  2017-01-10  5:25   ` [PATCH v4 05/10] power: supplies: bq27xxx: adds specific support for bq27510-g3 revision Chris Lapa
                     ` (5 subsequent siblings)
  9 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-10  5:25 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27510G2 chip definition to specifically match the
bq27510-G2 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
---
 drivers/power/supply/bq27xxx_battery.c     | 43 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 46 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 376f81e..5b896a1 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -23,6 +23,7 @@
  * http://www.ti.com/product/bq27210
  * http://www.ti.com/product/bq27500
  * http://www.ti.com/product/bq27510-g1
+ * http://www.ti.com/product/bq27510-g2
  * http://www.ti.com/product/bq27510-g3
  * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27530-g1
@@ -203,6 +204,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27510G2] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -383,6 +403,27 @@ static enum power_supply_property bq27510g1_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27510g2_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -468,6 +509,7 @@ static struct {
 	BQ27XXX_PROP(BQ275XX, bq275xx_battery_props),
 	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
 	BQ27XXX_PROP(BQ27510G1, bq27510g1_battery_props),
+	BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -723,6 +765,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	case BQ275XX:
 	case BQ27500:
 	case BQ27510G1:
+	case BQ27510G2:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 61f13fd..5f30d6a 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -153,6 +153,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27520", BQ275XX },
 	{ "bq27500-1", BQ27500 },
 	{ "bq27510g1", BQ27510G1 },
+	{ "bq27510g2", BQ27510G2 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -177,6 +178,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27520" },
 	{ .compatible = "ti,bq27500-1" },
 	{ .compatible = "ti,bq27510g1" },
+	{ .compatible = "ti,bq27510g2" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 9fa7c86..dd5df1e 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -7,6 +7,7 @@ enum bq27xxx_chip {
 	BQ275XX, /* bq27500, bq27510, bq27520 deprecated alias */
 	BQ27500, /* bq27500/1 */
 	BQ27510G1, /* bq27510G1 */
+	BQ27510G2, /* bq27510G2 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v4 05/10] power: supplies: bq27xxx: adds specific support for bq27510-g3 revision.
  2017-01-10  5:25 ` [PATCH v4 00/10] power: supply: bq27xxx: " Chris Lapa
                     ` (3 preceding siblings ...)
  2017-01-10  5:25   ` [PATCH v4 04/10] power: supplies: bq27xxx: adds specific support for bq27510-g2 revision Chris Lapa
@ 2017-01-10  5:25   ` Chris Lapa
  2017-01-10  5:25   ` [PATCH v4 06/10] power: supplies: bq27xxx: adds specific support for bq27520-g1 revision Chris Lapa
                     ` (4 subsequent siblings)
  9 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-10  5:25 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27510G3 chip definition to specifically match the
bq27510-G3 functionality as described in the datasheet.

tested: yes

Signed-off-by: Chris Lapa <chris@lapa.com.au>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
---
 drivers/power/supply/bq27xxx_battery.c     | 39 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 42 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 5b896a1..05b9bd7 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -223,6 +223,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27510G3] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = 0x28,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_TTES] = 0x1a,
+		[BQ27XXX_REG_TTECP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x1e,
+		[BQ27XXX_REG_AE] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_SOC] = 0x20,
+		[BQ27XXX_REG_DCAP] = 0x2e,
+		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -424,6 +443,24 @@ static enum power_supply_property bq27510g2_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27510g3_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -510,6 +547,7 @@ static struct {
 	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
 	BQ27XXX_PROP(BQ27510G1, bq27510g1_battery_props),
 	BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
+	BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -766,6 +804,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	case BQ27500:
 	case BQ27510G1:
 	case BQ27510G2:
+	case BQ27510G3:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 5f30d6a..e601b2b 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -154,6 +154,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27500-1", BQ27500 },
 	{ "bq27510g1", BQ27510G1 },
 	{ "bq27510g2", BQ27510G2 },
+	{ "bq27510g3", BQ27510G3 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -179,6 +180,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27500-1" },
 	{ .compatible = "ti,bq27510g1" },
 	{ .compatible = "ti,bq27510g2" },
+	{ .compatible = "ti,bq27510g3" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index dd5df1e..abec4ce 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -8,6 +8,7 @@ enum bq27xxx_chip {
 	BQ27500, /* bq27500/1 */
 	BQ27510G1, /* bq27510G1 */
 	BQ27510G2, /* bq27510G2 */
+	BQ27510G3, /* bq27510G3 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v4 06/10] power: supplies: bq27xxx: adds specific support for bq27520-g1 revision.
  2017-01-10  5:25 ` [PATCH v4 00/10] power: supply: bq27xxx: " Chris Lapa
                     ` (4 preceding siblings ...)
  2017-01-10  5:25   ` [PATCH v4 05/10] power: supplies: bq27xxx: adds specific support for bq27510-g3 revision Chris Lapa
@ 2017-01-10  5:25   ` Chris Lapa
  2017-01-10  5:25   ` [PATCH v4 07/10] power: supplies: bq27xxx: adds specific support for bq27520-g2 revision Chris Lapa
                     ` (3 subsequent siblings)
  9 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-10  5:25 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27520G1 chip definition to specifically match the
bq27520-G1 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
---
 drivers/power/supply/bq27xxx_battery.c     | 42 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 45 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 05b9bd7..ff6f967 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -26,6 +26,7 @@
  * http://www.ti.com/product/bq27510-g2
  * http://www.ti.com/product/bq27510-g3
  * http://www.ti.com/product/bq27520-g4
+ * http://www.ti.com/product/bq27520-g1
  * http://www.ti.com/product/bq27530-g1
  * http://www.ti.com/product/bq27531-g1
  * http://www.ti.com/product/bq27541-g1
@@ -242,6 +243,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x2e,
 		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
 	},
+	[BQ27520G1] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -461,6 +481,26 @@ static enum power_supply_property bq27510g3_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27520g1_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -548,6 +588,7 @@ static struct {
 	BQ27XXX_PROP(BQ27510G1, bq27510g1_battery_props),
 	BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
 	BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
+	BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -805,6 +846,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	case BQ27510G1:
 	case BQ27510G2:
 	case BQ27510G3:
+	case BQ27520G1:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index e601b2b..33a7d18 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -155,6 +155,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27510g1", BQ27510G1 },
 	{ "bq27510g2", BQ27510G2 },
 	{ "bq27510g3", BQ27510G3 },
+	{ "bq27520g1", BQ27520G1 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -181,6 +182,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27510g1" },
 	{ .compatible = "ti,bq27510g2" },
 	{ .compatible = "ti,bq27510g3" },
+	{ .compatible = "ti,bq27520g1" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index abec4ce..b971401 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -9,6 +9,7 @@ enum bq27xxx_chip {
 	BQ27510G1, /* bq27510G1 */
 	BQ27510G2, /* bq27510G2 */
 	BQ27510G3, /* bq27510G3 */
+	BQ27520G1, /* bq27520G1 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v4 07/10] power: supplies: bq27xxx: adds specific support for bq27520-g2 revision.
  2017-01-10  5:25 ` [PATCH v4 00/10] power: supply: bq27xxx: " Chris Lapa
                     ` (5 preceding siblings ...)
  2017-01-10  5:25   ` [PATCH v4 06/10] power: supplies: bq27xxx: adds specific support for bq27520-g1 revision Chris Lapa
@ 2017-01-10  5:25   ` Chris Lapa
  2017-01-10  5:25   ` [PATCH v4 08/10] power: supplies: bq27xxx: adds specific support for bq27520-g3 revision Chris Lapa
                     ` (2 subsequent siblings)
  9 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-10  5:25 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27520G2 chip definition to specifically match the
bq27520-G2 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
---
 drivers/power/supply/bq27xxx_battery.c     | 43 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 46 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index ff6f967..8fa51f4 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -27,6 +27,7 @@
  * http://www.ti.com/product/bq27510-g3
  * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27520-g1
+ * http://www.ti.com/product/bq27520-g2
  * http://www.ti.com/product/bq27530-g1
  * http://www.ti.com/product/bq27531-g1
  * http://www.ti.com/product/bq27541-g1
@@ -262,6 +263,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27520G2] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = 0x36,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -501,6 +521,27 @@ static enum power_supply_property bq27520g1_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27520g2_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -589,6 +630,7 @@ static struct {
 	BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
 	BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
 	BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
+	BQ27XXX_PROP(BQ27520G2, bq27520g2_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -847,6 +889,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	case BQ27510G2:
 	case BQ27510G3:
 	case BQ27520G1:
+	case BQ27520G2:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 33a7d18..4835523 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -156,6 +156,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27510g2", BQ27510G2 },
 	{ "bq27510g3", BQ27510G3 },
 	{ "bq27520g1", BQ27520G1 },
+	{ "bq27520g2", BQ27520G2 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -183,6 +184,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27510g2" },
 	{ .compatible = "ti,bq27510g3" },
 	{ .compatible = "ti,bq27520g1" },
+	{ .compatible = "ti,bq27520g2" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index b971401..6a1a4ab 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -10,6 +10,7 @@ enum bq27xxx_chip {
 	BQ27510G2, /* bq27510G2 */
 	BQ27510G3, /* bq27510G3 */
 	BQ27520G1, /* bq27520G1 */
+	BQ27520G2, /* bq27520G2 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v4 08/10] power: supplies: bq27xxx: adds specific support for bq27520-g3 revision.
  2017-01-10  5:25 ` [PATCH v4 00/10] power: supply: bq27xxx: " Chris Lapa
                     ` (6 preceding siblings ...)
  2017-01-10  5:25   ` [PATCH v4 07/10] power: supplies: bq27xxx: adds specific support for bq27520-g2 revision Chris Lapa
@ 2017-01-10  5:25   ` Chris Lapa
  2017-01-10  5:25   ` [PATCH v4 09/10] power: supplies: bq27xxx: adds specific support for bq27520-g4 revision Chris Lapa
  2017-01-10  5:25   ` [PATCH v4 10/10] power: supplies: bq27xxx: adds device tree binding documentation Chris Lapa
  9 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-10  5:25 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27520G3 chip definition to specifically match the
bq27520-G3 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
---
 drivers/power/supply/bq27xxx_battery.c     | 42 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 45 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 8fa51f4..9b28aa1 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -28,6 +28,7 @@
  * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27520-g1
  * http://www.ti.com/product/bq27520-g2
+ * http://www.ti.com/product/bq27520-g3
  * http://www.ti.com/product/bq27530-g1
  * http://www.ti.com/product/bq27531-g1
  * http://www.ti.com/product/bq27541-g1
@@ -282,6 +283,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27520G3] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = 0x36,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -542,6 +562,26 @@ static enum power_supply_property bq27520g2_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27520g3_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -631,6 +671,7 @@ static struct {
 	BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
 	BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
 	BQ27XXX_PROP(BQ27520G2, bq27520g2_battery_props),
+	BQ27XXX_PROP(BQ27520G3, bq27520g3_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -890,6 +931,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	case BQ27510G3:
 	case BQ27520G1:
 	case BQ27520G2:
+	case BQ27520G3:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 4835523..899a846 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -157,6 +157,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27510g3", BQ27510G3 },
 	{ "bq27520g1", BQ27520G1 },
 	{ "bq27520g2", BQ27520G2 },
+	{ "bq27520g3", BQ27520G3 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -185,6 +186,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27510g3" },
 	{ .compatible = "ti,bq27520g1" },
 	{ .compatible = "ti,bq27520g2" },
+	{ .compatible = "ti,bq27520g3" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 6a1a4ab..e61f4fa 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -11,6 +11,7 @@ enum bq27xxx_chip {
 	BQ27510G3, /* bq27510G3 */
 	BQ27520G1, /* bq27520G1 */
 	BQ27520G2, /* bq27520G2 */
+	BQ27520G3, /* bq27520G3 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v4 09/10] power: supplies: bq27xxx: adds specific support for bq27520-g4 revision.
  2017-01-10  5:25 ` [PATCH v4 00/10] power: supply: bq27xxx: " Chris Lapa
                     ` (7 preceding siblings ...)
  2017-01-10  5:25   ` [PATCH v4 08/10] power: supplies: bq27xxx: adds specific support for bq27520-g3 revision Chris Lapa
@ 2017-01-10  5:25   ` Chris Lapa
  2017-01-10  5:25   ` [PATCH v4 10/10] power: supplies: bq27xxx: adds device tree binding documentation Chris Lapa
  9 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-10  5:25 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27520G4 chip definition to specifically match the
bq27520-G4 functionality as described in the datasheet.

tested: no

Signed-off-by: Chris Lapa <chris@lapa.com.au>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
---
 drivers/power/supply/bq27xxx_battery.c     | 39 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 42 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 9b28aa1..fe9d0fb 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -29,6 +29,7 @@
  * http://www.ti.com/product/bq27520-g1
  * http://www.ti.com/product/bq27520-g2
  * http://www.ti.com/product/bq27520-g3
+ * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27530-g1
  * http://www.ti.com/product/bq27531-g1
  * http://www.ti.com/product/bq27541-g1
@@ -302,6 +303,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27520G4] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = 0x28,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x1e,
+		[BQ27XXX_REG_AE] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_SOC] = 0x20,
+		[BQ27XXX_REG_DCAP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -582,6 +602,23 @@ static enum power_supply_property bq27520g3_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27520g4_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -672,6 +709,7 @@ static struct {
 	BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
 	BQ27XXX_PROP(BQ27520G2, bq27520g2_battery_props),
 	BQ27XXX_PROP(BQ27520G3, bq27520g3_battery_props),
+	BQ27XXX_PROP(BQ27520G4, bq27520g4_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -932,6 +970,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	case BQ27520G1:
 	case BQ27520G2:
 	case BQ27520G3:
+	case BQ27520G4:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 899a846..3878da4 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -158,6 +158,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27520g1", BQ27520G1 },
 	{ "bq27520g2", BQ27520G2 },
 	{ "bq27520g3", BQ27520G3 },
+	{ "bq27520g4", BQ27520G4 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -187,6 +188,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27520g1" },
 	{ .compatible = "ti,bq27520g2" },
 	{ .compatible = "ti,bq27520g3" },
+	{ .compatible = "ti,bq27520g4" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index e61f4fa..09af70d 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -12,6 +12,7 @@ enum bq27xxx_chip {
 	BQ27520G1, /* bq27520G1 */
 	BQ27520G2, /* bq27520G2 */
 	BQ27520G3, /* bq27520G3 */
+	BQ27520G4, /* bq27520G4 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v4 10/10] power: supplies: bq27xxx: adds device tree binding documentation.
  2017-01-10  5:25 ` [PATCH v4 00/10] power: supply: bq27xxx: " Chris Lapa
                     ` (8 preceding siblings ...)
  2017-01-10  5:25   ` [PATCH v4 09/10] power: supplies: bq27xxx: adds specific support for bq27520-g4 revision Chris Lapa
@ 2017-01-10  5:25   ` Chris Lapa
  9 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-10  5:25 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

The bq27xxx binding is a standard i2c style binding, however the
deprecated compatible fields and different revisions warrant its own
documentation.

Signed-off-by: Chris Lapa <chris@lapa.com.au>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
---
 .../devicetree/bindings/power/supply/bq27xxx.txt   | 36 ++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/bq27xxx.txt

diff --git a/Documentation/devicetree/bindings/power/supply/bq27xxx.txt b/Documentation/devicetree/bindings/power/supply/bq27xxx.txt
new file mode 100644
index 0000000..b0c95ef
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/supply/bq27xxx.txt
@@ -0,0 +1,36 @@
+Binding for TI BQ27XXX fuel gauge family
+
+Required properties:
+- compatible: Should contain one of the following:
+ * "ti,bq27200" - BQ27200
+ * "ti,bq27210" - BQ27210
+ * "ti,bq27500" - deprecated, use revision specific property below
+ * "ti,bq27510" - deprecated, use revision specific property below
+ * "ti,bq27520" - deprecated, use revision specific property below
+ * "ti,bq27500-1" - BQ27500/1
+ * "ti,bq27510g1" - BQ27510-g1
+ * "ti,bq27510g2" - BQ27510-g2
+ * "ti,bq27510g3" - BQ27510-g3
+ * "ti,bq27520g1" - BQ27520-g1
+ * "ti,bq27520g2" - BQ27520-g2
+ * "ti,bq27520g3" - BQ27520-g3
+ * "ti,bq27520g4" - BQ27520-g4
+ * "ti,bq27530" - BQ27530
+ * "ti,bq27531" - BQ27531
+ * "ti,bq27541" - BQ27541
+ * "ti,bq27542" - BQ27542
+ * "ti,bq27546" - BQ27546
+ * "ti,bq27742" - BQ27742
+ * "ti,bq27545" - BQ27545
+ * "ti,bq27421" - BQ27421
+ * "ti,bq27425" - BQ27425
+ * "ti,bq27441" - BQ27441
+ * "ti,bq27621" - BQ27621
+- reg: integer, i2c address of the device.
+
+Example:
+
+bq27510g3 {
+    compatible = "ti,bq27510g3";
+    reg = <0x55>;
+};
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* Re: [PATCH v4 01/10] power: supplies: bq27xxx: rename BQ27500 allow for deprecation in future.
  2017-01-10  5:25   ` [PATCH v4 01/10] power: supplies: bq27xxx: rename BQ27500 allow for deprecation in future Chris Lapa
@ 2017-01-10  8:58     ` Pali Rohár
  2017-01-10 22:25       ` Chris Lapa
  0 siblings, 1 reply; 70+ messages in thread
From: Pali Rohár @ 2017-01-10  8:58 UTC (permalink / raw)
  To: Chris Lapa; +Cc: afd, sre, linux-pm, linux-kernel

On Tuesday 10 January 2017 16:25:29 Chris Lapa wrote:
> From: Chris Lapa <chris@lapa.com.au>
> 
> The BQ275XX definition exists only to satisfy backwards compatibility.
> 
> tested: yes

Instead "tested: yes" we use: "Tested-by: name <email>" line.

> Signed-off-by: Chris Lapa <chris@lapa.com.au>
> Acked-by: Pali Rohár <pali.rohar@gmail.com>
> Reviewed-by: Andrew F. Davis <afd@ti.com>

-- 
Pali Rohár
pali.rohar@gmail.com

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [PATCH v4 01/10] power: supplies: bq27xxx: rename BQ27500 allow for deprecation in future.
  2017-01-10  8:58     ` Pali Rohár
@ 2017-01-10 22:25       ` Chris Lapa
  2017-01-10 23:29         ` Sebastian Reichel
  0 siblings, 1 reply; 70+ messages in thread
From: Chris Lapa @ 2017-01-10 22:25 UTC (permalink / raw)
  To: Pali Rohár; +Cc: afd, sre, linux-pm, linux-kernel

On 10/1/17 7:58 pm, Pali Rohár wrote:
> On Tuesday 10 January 2017 16:25:29 Chris Lapa wrote:
>> From: Chris Lapa <chris@lapa.com.au>
>>
>> The BQ275XX definition exists only to satisfy backwards compatibility.
>>
>> tested: yes
>
> Instead "tested: yes" we use: "Tested-by: name <email>" line.
>
>> Signed-off-by: Chris Lapa <chris@lapa.com.au>
>> Acked-by: Pali Rohár <pali.rohar@gmail.com>
>> Reviewed-by: Andrew F. Davis <afd@ti.com>
>

Doh, I went through the log and thought I saw 'tested: yes' being used 
previously. Want me to resend?

Thanks,
Chris Lapa

^ permalink raw reply	[flat|nested] 70+ messages in thread

* Re: [PATCH v4 01/10] power: supplies: bq27xxx: rename BQ27500 allow for deprecation in future.
  2017-01-10 22:25       ` Chris Lapa
@ 2017-01-10 23:29         ` Sebastian Reichel
  0 siblings, 0 replies; 70+ messages in thread
From: Sebastian Reichel @ 2017-01-10 23:29 UTC (permalink / raw)
  To: Chris Lapa; +Cc: Pali Rohár, afd, linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1401 bytes --]

Hi,

On Wed, Jan 11, 2017 at 09:25:01AM +1100, Chris Lapa wrote:
> On 10/1/17 7:58 pm, Pali Rohár wrote:
> > On Tuesday 10 January 2017 16:25:29 Chris Lapa wrote:
> > > From: Chris Lapa <chris@lapa.com.au>
> > > 
> > > The BQ275XX definition exists only to satisfy backwards compatibility.
> > > 
> > > tested: yes
> > 
> > Instead "tested: yes" we use: "Tested-by: name <email>" line.
> > 
> > > Signed-off-by: Chris Lapa <chris@lapa.com.au>
> > > Acked-by: Pali Rohár <pali.rohar@gmail.com>
> > > Reviewed-by: Andrew F. Davis <afd@ti.com>
> > 
> 
> Doh, I went through the log and thought I saw 'tested: yes' being used
> previously. Want me to resend?

If a respin is needed, please fix it. Also the patches still use
"supplies" instead of "supply" in the patch subject. I would have
fixed this while applying, but this (PATCH 1/10) actually looks
fishy to me:

> -       { "bq27500", BQ27500 },
> -       { "bq27510", BQ27510 },
> -       { "bq27520", BQ27510 },
> +       { "bq27500", BQ275XX },
> +       { "bq27510", BQ275XX },
> +       { "bq27520", BQ275XX },

Previously bq27500 and bq27510/bq27520 had different type ids,
while after the patch both use the same. The patch description
does not mention why this is ok and it actually looks incorrect.
I guess we need to introduce BQ2750X and BQ2751X for backwards
compatibility instead?

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 70+ messages in thread

* [PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support
  2016-12-22  1:22 [PATCH 00/10] power: supply: bq275xx: implement individual chip revision support Chris Lapa
                   ` (11 preceding siblings ...)
  2017-01-10  5:25 ` [PATCH v4 00/10] power: supply: bq27xxx: " Chris Lapa
@ 2017-01-11  1:44 ` Chris Lapa
  2017-01-11  1:44   ` [PATCH v5 01/11] power: supply: bq27xxx: rename BQ27500 allow for deprecation in future Chris Lapa
                     ` (11 more replies)
  12 siblings, 12 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-11  1:44 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This patch series correctly renames the patch subject prefix to 'power: supply: bq27xxx'.

It also fixes up the deprecation of the BQ27500 and BQ27510 definitions.

Otherwise the patch content is the same functionally as the v4 series.

Chris Lapa (11):
  power: supply: bq27xxx: rename BQ27500 allow for deprecation in
    future.
  power: supply: bq27xxx: rename BQ27510 allow for deprecation in
    future.
  power: supply: bq27xxx: adds specific support for bq27500/1 revision.
  power: supply: bq27xxx: adds specific support for bq27510-g1 revision.
  power: supply: bq27xxx: adds specific support for bq27510-g2 revision.
  power: supply: bq27xxx: adds specific support for bq27510-g3 revision.
  power: supply: bq27xxx: adds specific support for bq27520-g1 revision.
  power: supply: bq27xxx: adds specific support for bq27520-g2 revision.
  power: supply: bq27xxx: adds specific support for bq27520-g3 revision.
  power: supply: bq27xxx: adds specific support for bq27520-g4 revision.
  power: supply: bq27xxx: adds device tree binding documentation.

 .../devicetree/bindings/power/supply/bq27xxx.txt   |  36 +++
 drivers/power/supply/bq27xxx_battery.c             | 343 ++++++++++++++++++++-
 drivers/power/supply/bq27xxx_battery_i2c.c         |  22 +-
 include/linux/power/bq27xxx_battery.h              |  12 +-
 4 files changed, 403 insertions(+), 10 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/power/supply/bq27xxx.txt

-- 
2.1.4

^ permalink raw reply	[flat|nested] 70+ messages in thread

* [PATCH v5 01/11] power: supply: bq27xxx: rename BQ27500 allow for deprecation in future.
  2017-01-11  1:44 ` [PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support Chris Lapa
@ 2017-01-11  1:44   ` Chris Lapa
  2017-01-11  1:44   ` [PATCH v5 02/11] power: supply: bq27xxx: rename BQ27510 " Chris Lapa
                     ` (10 subsequent siblings)
  11 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-11  1:44 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

The BQ2750X definition exists only to satisfy backwards compatibility.

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 8 ++++----
 drivers/power/supply/bq27xxx_battery_i2c.c | 2 +-
 include/linux/power/bq27xxx_battery.h      | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 7272d1e..103ba3b 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -145,7 +145,7 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x76,
 		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
 	},
-	[BQ27500] = {
+	[BQ2750X] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
 		[BQ27XXX_REG_INT_TEMP] = 0x28,
@@ -303,7 +303,7 @@ static enum power_supply_property bq27010_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
-static enum power_supply_property bq27500_battery_props[] = {
+static enum power_supply_property bq2750x_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
 	POWER_SUPPLY_PROP_VOLTAGE_NOW,
@@ -421,7 +421,7 @@ static struct {
 } bq27xxx_battery_props[] = {
 	BQ27XXX_PROP(BQ27000, bq27000_battery_props),
 	BQ27XXX_PROP(BQ27010, bq27010_battery_props),
-	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
+	BQ27XXX_PROP(BQ2750X, bq2750x_battery_props),
 	BQ27XXX_PROP(BQ27510, bq27510_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
@@ -675,7 +675,7 @@ static int bq27xxx_battery_read_pwr_avg(struct bq27xxx_device_info *di)
 static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
 	switch (di->chip) {
-	case BQ27500:
+	case BQ2750X:
 	case BQ27510:
 	case BQ27541:
 	case BQ27545:
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 5c5c3a6..fb1219b 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -148,7 +148,7 @@ static int bq27xxx_battery_i2c_remove(struct i2c_client *client)
 static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27200", BQ27000 },
 	{ "bq27210", BQ27010 },
-	{ "bq27500", BQ27500 },
+	{ "bq27500", BQ2750X },
 	{ "bq27510", BQ27510 },
 	{ "bq27520", BQ27510 },
 	{ "bq27530", BQ27530 },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index bed9557..4c904d0 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -4,7 +4,7 @@
 enum bq27xxx_chip {
 	BQ27000 = 1, /* bq27000, bq27200 */
 	BQ27010, /* bq27010, bq27210 */
-	BQ27500, /* bq27500 */
+	BQ2750X, /* bq27500 deprecated alias */
 	BQ27510, /* bq27510, bq27520 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v5 02/11] power: supply: bq27xxx: rename BQ27510 allow for deprecation in future.
  2017-01-11  1:44 ` [PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support Chris Lapa
  2017-01-11  1:44   ` [PATCH v5 01/11] power: supply: bq27xxx: rename BQ27500 allow for deprecation in future Chris Lapa
@ 2017-01-11  1:44   ` Chris Lapa
  2017-01-11  1:44   ` [PATCH v5 03/11] power: supply: bq27xxx: adds specific support for bq27500/1 revision Chris Lapa
                     ` (9 subsequent siblings)
  11 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-11  1:44 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

The BQ2751X definition exists only to satisfy backwards compatibility.

Signed-off-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 8 ++++----
 drivers/power/supply/bq27xxx_battery_i2c.c | 4 ++--
 include/linux/power/bq27xxx_battery.h      | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 103ba3b..90a5373 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -164,7 +164,7 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
 	},
-	[BQ27510] = {
+	[BQ2751X] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
 		[BQ27XXX_REG_INT_TEMP] = 0x28,
@@ -321,7 +321,7 @@ static enum power_supply_property bq2750x_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
-static enum power_supply_property bq27510_battery_props[] = {
+static enum power_supply_property bq2751x_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
 	POWER_SUPPLY_PROP_VOLTAGE_NOW,
@@ -422,7 +422,7 @@ static struct {
 	BQ27XXX_PROP(BQ27000, bq27000_battery_props),
 	BQ27XXX_PROP(BQ27010, bq27010_battery_props),
 	BQ27XXX_PROP(BQ2750X, bq2750x_battery_props),
-	BQ27XXX_PROP(BQ27510, bq27510_battery_props),
+	BQ27XXX_PROP(BQ2751X, bq2751x_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -676,7 +676,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 {
 	switch (di->chip) {
 	case BQ2750X:
-	case BQ27510:
+	case BQ2751X:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index fb1219b..5f64e70 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -149,8 +149,8 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27200", BQ27000 },
 	{ "bq27210", BQ27010 },
 	{ "bq27500", BQ2750X },
-	{ "bq27510", BQ27510 },
-	{ "bq27520", BQ27510 },
+	{ "bq27510", BQ2751X },
+	{ "bq27520", BQ2751X },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 4c904d0..651f265 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -5,7 +5,7 @@ enum bq27xxx_chip {
 	BQ27000 = 1, /* bq27000, bq27200 */
 	BQ27010, /* bq27010, bq27210 */
 	BQ2750X, /* bq27500 deprecated alias */
-	BQ27510, /* bq27510, bq27520 */
+	BQ2751X, /* bq27510, bq27520 deprecated alias */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v5 03/11] power: supply: bq27xxx: adds specific support for bq27500/1 revision.
  2017-01-11  1:44 ` [PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support Chris Lapa
  2017-01-11  1:44   ` [PATCH v5 01/11] power: supply: bq27xxx: rename BQ27500 allow for deprecation in future Chris Lapa
  2017-01-11  1:44   ` [PATCH v5 02/11] power: supply: bq27xxx: rename BQ27510 " Chris Lapa
@ 2017-01-11  1:44   ` Chris Lapa
  2017-01-11  1:44   ` [PATCH v5 04/11] power: supply: bq27xxx: adds specific support for bq27510-g1 revision Chris Lapa
                     ` (8 subsequent siblings)
  11 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-11  1:44 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27500 chip definition to specifically match the
bq27500/1 functionality as described in the datasheet.

Signed-off-by: Chris Lapa <chris@lapa.com.au>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
---
 drivers/power/supply/bq27xxx_battery.c     | 42 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 45 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 90a5373..9c9ffe2 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -183,6 +183,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x2e,
 		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
 	},
+	[BQ27500] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -339,6 +358,27 @@ static enum power_supply_property bq2751x_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27500_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -423,6 +463,7 @@ static struct {
 	BQ27XXX_PROP(BQ27010, bq27010_battery_props),
 	BQ27XXX_PROP(BQ2750X, bq2750x_battery_props),
 	BQ27XXX_PROP(BQ2751X, bq2751x_battery_props),
+	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -677,6 +718,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	switch (di->chip) {
 	case BQ2750X:
 	case BQ2751X:
+	case BQ27500:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 5f64e70..ce0f01e 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -151,6 +151,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27500", BQ2750X },
 	{ "bq27510", BQ2751X },
 	{ "bq27520", BQ2751X },
+	{ "bq27500-1", BQ27500 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -173,6 +174,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27500" },
 	{ .compatible = "ti,bq27510" },
 	{ .compatible = "ti,bq27520" },
+	{ .compatible = "ti,bq27500-1" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 651f265..76b623d 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -6,6 +6,7 @@ enum bq27xxx_chip {
 	BQ27010, /* bq27010, bq27210 */
 	BQ2750X, /* bq27500 deprecated alias */
 	BQ2751X, /* bq27510, bq27520 deprecated alias */
+	BQ27500, /* bq27500/1 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v5 04/11] power: supply: bq27xxx: adds specific support for bq27510-g1 revision.
  2017-01-11  1:44 ` [PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support Chris Lapa
                     ` (2 preceding siblings ...)
  2017-01-11  1:44   ` [PATCH v5 03/11] power: supply: bq27xxx: adds specific support for bq27500/1 revision Chris Lapa
@ 2017-01-11  1:44   ` Chris Lapa
  2017-01-11  1:44   ` [PATCH v5 05/11] power: supply: bq27xxx: adds specific support for bq27510-g2 revision Chris Lapa
                     ` (7 subsequent siblings)
  11 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-11  1:44 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27510G1 chip definition to specifically match the
bq27510-G1 functionality as described in the datasheet.

Signed-off-by: Chris Lapa <chris@lapa.com.au>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
---
 drivers/power/supply/bq27xxx_battery.c     | 43 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 46 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 9c9ffe2..44e8aa0 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -22,6 +22,7 @@
  * http://www.ti.com/product/bq27010
  * http://www.ti.com/product/bq27210
  * http://www.ti.com/product/bq27500
+ * http://www.ti.com/product/bq27510-g1
  * http://www.ti.com/product/bq27510-g3
  * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27530-g1
@@ -202,6 +203,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27510G1] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -379,6 +399,27 @@ static enum power_supply_property bq27500_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27510g1_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -464,6 +505,7 @@ static struct {
 	BQ27XXX_PROP(BQ2750X, bq2750x_battery_props),
 	BQ27XXX_PROP(BQ2751X, bq2751x_battery_props),
 	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
+	BQ27XXX_PROP(BQ27510G1, bq27510g1_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -719,6 +761,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	case BQ2750X:
 	case BQ2751X:
 	case BQ27500:
+	case BQ27510G1:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index ce0f01e..11e54c1 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -152,6 +152,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27510", BQ2751X },
 	{ "bq27520", BQ2751X },
 	{ "bq27500-1", BQ27500 },
+	{ "bq27510g1", BQ27510G1 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -175,6 +176,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27510" },
 	{ .compatible = "ti,bq27520" },
 	{ .compatible = "ti,bq27500-1" },
+	{ .compatible = "ti,bq27510g1" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 76b623d..3af0815 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -7,6 +7,7 @@ enum bq27xxx_chip {
 	BQ2750X, /* bq27500 deprecated alias */
 	BQ2751X, /* bq27510, bq27520 deprecated alias */
 	BQ27500, /* bq27500/1 */
+	BQ27510G1, /* bq27510G1 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v5 05/11] power: supply: bq27xxx: adds specific support for bq27510-g2 revision.
  2017-01-11  1:44 ` [PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support Chris Lapa
                     ` (3 preceding siblings ...)
  2017-01-11  1:44   ` [PATCH v5 04/11] power: supply: bq27xxx: adds specific support for bq27510-g1 revision Chris Lapa
@ 2017-01-11  1:44   ` Chris Lapa
  2017-01-11  1:44   ` [PATCH v5 06/11] power: supply: bq27xxx: adds specific support for bq27510-g3 revision Chris Lapa
                     ` (6 subsequent siblings)
  11 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-11  1:44 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27510G2 chip definition to specifically match the
bq27510-G2 functionality as described in the datasheet.

Signed-off-by: Chris Lapa <chris@lapa.com.au>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
---
 drivers/power/supply/bq27xxx_battery.c     | 43 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 46 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 44e8aa0..d378f56 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -23,6 +23,7 @@
  * http://www.ti.com/product/bq27210
  * http://www.ti.com/product/bq27500
  * http://www.ti.com/product/bq27510-g1
+ * http://www.ti.com/product/bq27510-g2
  * http://www.ti.com/product/bq27510-g3
  * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27530-g1
@@ -222,6 +223,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27510G2] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -420,6 +440,27 @@ static enum power_supply_property bq27510g1_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27510g2_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -506,6 +547,7 @@ static struct {
 	BQ27XXX_PROP(BQ2751X, bq2751x_battery_props),
 	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
 	BQ27XXX_PROP(BQ27510G1, bq27510g1_battery_props),
+	BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -762,6 +804,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	case BQ2751X:
 	case BQ27500:
 	case BQ27510G1:
+	case BQ27510G2:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 11e54c1..1a7919d 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -153,6 +153,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27520", BQ2751X },
 	{ "bq27500-1", BQ27500 },
 	{ "bq27510g1", BQ27510G1 },
+	{ "bq27510g2", BQ27510G2 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -177,6 +178,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27520" },
 	{ .compatible = "ti,bq27500-1" },
 	{ .compatible = "ti,bq27510g1" },
+	{ .compatible = "ti,bq27510g2" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 3af0815..79772ca 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -8,6 +8,7 @@ enum bq27xxx_chip {
 	BQ2751X, /* bq27510, bq27520 deprecated alias */
 	BQ27500, /* bq27500/1 */
 	BQ27510G1, /* bq27510G1 */
+	BQ27510G2, /* bq27510G2 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v5 06/11] power: supply: bq27xxx: adds specific support for bq27510-g3 revision.
  2017-01-11  1:44 ` [PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support Chris Lapa
                     ` (4 preceding siblings ...)
  2017-01-11  1:44   ` [PATCH v5 05/11] power: supply: bq27xxx: adds specific support for bq27510-g2 revision Chris Lapa
@ 2017-01-11  1:44   ` Chris Lapa
  2017-01-11  1:44   ` [PATCH v5 07/11] power: supply: bq27xxx: adds specific support for bq27520-g1 revision Chris Lapa
                     ` (5 subsequent siblings)
  11 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-11  1:44 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27510G3 chip definition to specifically match the
bq27510-G3 functionality as described in the datasheet.

Signed-off-by: Chris Lapa <chris@lapa.com.au>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
Tested-by: Chris Lapa <chris@lapa.com.au>
---
 drivers/power/supply/bq27xxx_battery.c     | 39 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 42 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index d378f56..562055d 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -242,6 +242,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27510G3] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = 0x28,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_TTES] = 0x1a,
+		[BQ27XXX_REG_TTECP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x1e,
+		[BQ27XXX_REG_AE] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_SOC] = 0x20,
+		[BQ27XXX_REG_DCAP] = 0x2e,
+		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -461,6 +480,24 @@ static enum power_supply_property bq27510g2_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27510g3_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -548,6 +585,7 @@ static struct {
 	BQ27XXX_PROP(BQ27500, bq27500_battery_props),
 	BQ27XXX_PROP(BQ27510G1, bq27510g1_battery_props),
 	BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
+	BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -805,6 +843,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	case BQ27500:
 	case BQ27510G1:
 	case BQ27510G2:
+	case BQ27510G3:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 1a7919d..289592a 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -154,6 +154,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27500-1", BQ27500 },
 	{ "bq27510g1", BQ27510G1 },
 	{ "bq27510g2", BQ27510G2 },
+	{ "bq27510g3", BQ27510G3 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -179,6 +180,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27500-1" },
 	{ .compatible = "ti,bq27510g1" },
 	{ .compatible = "ti,bq27510g2" },
+	{ .compatible = "ti,bq27510g3" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 79772ca..c45ce71 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -9,6 +9,7 @@ enum bq27xxx_chip {
 	BQ27500, /* bq27500/1 */
 	BQ27510G1, /* bq27510G1 */
 	BQ27510G2, /* bq27510G2 */
+	BQ27510G3, /* bq27510G3 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v5 07/11] power: supply: bq27xxx: adds specific support for bq27520-g1 revision.
  2017-01-11  1:44 ` [PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support Chris Lapa
                     ` (5 preceding siblings ...)
  2017-01-11  1:44   ` [PATCH v5 06/11] power: supply: bq27xxx: adds specific support for bq27510-g3 revision Chris Lapa
@ 2017-01-11  1:44   ` Chris Lapa
  2017-01-11  1:44   ` [PATCH v5 08/11] power: supply: bq27xxx: adds specific support for bq27520-g2 revision Chris Lapa
                     ` (4 subsequent siblings)
  11 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-11  1:44 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27520G1 chip definition to specifically match the
bq27520-G1 functionality as described in the datasheet.

Signed-off-by: Chris Lapa <chris@lapa.com.au>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
---
 drivers/power/supply/bq27xxx_battery.c     | 42 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 45 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 562055d..c5e1bf0 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -26,6 +26,7 @@
  * http://www.ti.com/product/bq27510-g2
  * http://www.ti.com/product/bq27510-g3
  * http://www.ti.com/product/bq27520-g4
+ * http://www.ti.com/product/bq27520-g1
  * http://www.ti.com/product/bq27530-g1
  * http://www.ti.com/product/bq27531-g1
  * http://www.ti.com/product/bq27541-g1
@@ -261,6 +262,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x2e,
 		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
 	},
+	[BQ27520G1] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -498,6 +518,26 @@ static enum power_supply_property bq27510g3_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27520g1_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -586,6 +626,7 @@ static struct {
 	BQ27XXX_PROP(BQ27510G1, bq27510g1_battery_props),
 	BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
 	BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
+	BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -844,6 +885,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	case BQ27510G1:
 	case BQ27510G2:
 	case BQ27510G3:
+	case BQ27520G1:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 289592a..e398ede 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -155,6 +155,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27510g1", BQ27510G1 },
 	{ "bq27510g2", BQ27510G2 },
 	{ "bq27510g3", BQ27510G3 },
+	{ "bq27520g1", BQ27520G1 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -181,6 +182,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27510g1" },
 	{ .compatible = "ti,bq27510g2" },
 	{ .compatible = "ti,bq27510g3" },
+	{ .compatible = "ti,bq27520g1" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index c45ce71..eddd969 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -10,6 +10,7 @@ enum bq27xxx_chip {
 	BQ27510G1, /* bq27510G1 */
 	BQ27510G2, /* bq27510G2 */
 	BQ27510G3, /* bq27510G3 */
+	BQ27520G1, /* bq27520G1 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v5 08/11] power: supply: bq27xxx: adds specific support for bq27520-g2 revision.
  2017-01-11  1:44 ` [PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support Chris Lapa
                     ` (6 preceding siblings ...)
  2017-01-11  1:44   ` [PATCH v5 07/11] power: supply: bq27xxx: adds specific support for bq27520-g1 revision Chris Lapa
@ 2017-01-11  1:44   ` Chris Lapa
  2017-01-11  1:44   ` [PATCH v5 09/11] power: supply: bq27xxx: adds specific support for bq27520-g3 revision Chris Lapa
                     ` (3 subsequent siblings)
  11 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-11  1:44 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27520G2 chip definition to specifically match the
bq27520-G2 functionality as described in the datasheet.

Signed-off-by: Chris Lapa <chris@lapa.com.au>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
---
 drivers/power/supply/bq27xxx_battery.c     | 43 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 46 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index c5e1bf0..cd483ec 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -27,6 +27,7 @@
  * http://www.ti.com/product/bq27510-g3
  * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27520-g1
+ * http://www.ti.com/product/bq27520-g2
  * http://www.ti.com/product/bq27530-g1
  * http://www.ti.com/product/bq27531-g1
  * http://www.ti.com/product/bq27541-g1
@@ -281,6 +282,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27520G2] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = 0x36,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = 0x18,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -538,6 +558,27 @@ static enum power_supply_property bq27520g1_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27520g2_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -627,6 +668,7 @@ static struct {
 	BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
 	BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
 	BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
+	BQ27XXX_PROP(BQ27520G2, bq27520g2_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -886,6 +928,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	case BQ27510G2:
 	case BQ27510G3:
 	case BQ27520G1:
+	case BQ27520G2:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index e398ede..b289899 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -156,6 +156,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27510g2", BQ27510G2 },
 	{ "bq27510g3", BQ27510G3 },
 	{ "bq27520g1", BQ27520G1 },
+	{ "bq27520g2", BQ27520G2 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -183,6 +184,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27510g2" },
 	{ .compatible = "ti,bq27510g3" },
 	{ .compatible = "ti,bq27520g1" },
+	{ .compatible = "ti,bq27520g2" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index eddd969..a3fc34a 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -11,6 +11,7 @@ enum bq27xxx_chip {
 	BQ27510G2, /* bq27510G2 */
 	BQ27510G3, /* bq27510G3 */
 	BQ27520G1, /* bq27520G1 */
+	BQ27520G2, /* bq27520G2 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v5 09/11] power: supply: bq27xxx: adds specific support for bq27520-g3 revision.
  2017-01-11  1:44 ` [PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support Chris Lapa
                     ` (7 preceding siblings ...)
  2017-01-11  1:44   ` [PATCH v5 08/11] power: supply: bq27xxx: adds specific support for bq27520-g2 revision Chris Lapa
@ 2017-01-11  1:44   ` Chris Lapa
  2017-01-11  1:44   ` [PATCH v5 10/11] power: supply: bq27xxx: adds specific support for bq27520-g4 revision Chris Lapa
                     ` (2 subsequent siblings)
  11 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-11  1:44 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27520G3 chip definition to specifically match the
bq27520-G3 functionality as described in the datasheet.

Signed-off-by: Chris Lapa <chris@lapa.com.au>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
---
 drivers/power/supply/bq27xxx_battery.c     | 42 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 45 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index cd483ec..1fe48ea 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -28,6 +28,7 @@
  * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27520-g1
  * http://www.ti.com/product/bq27520-g2
+ * http://www.ti.com/product/bq27520-g3
  * http://www.ti.com/product/bq27530-g1
  * http://www.ti.com/product/bq27531-g1
  * http://www.ti.com/product/bq27541-g1
@@ -301,6 +302,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27520G3] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = 0x36,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = 0x26,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x2a,
+		[BQ27XXX_REG_AE] = 0x22,
+		[BQ27XXX_REG_SOC] = 0x2c,
+		[BQ27XXX_REG_DCAP] = 0x3c,
+		[BQ27XXX_REG_AP] = 0x24,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -579,6 +599,26 @@ static enum power_supply_property bq27520g2_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27520g3_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_ENERGY_NOW,
+	POWER_SUPPLY_PROP_POWER_AVG,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -669,6 +709,7 @@ static struct {
 	BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
 	BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
 	BQ27XXX_PROP(BQ27520G2, bq27520g2_battery_props),
+	BQ27XXX_PROP(BQ27520G3, bq27520g3_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -929,6 +970,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	case BQ27510G3:
 	case BQ27520G1:
 	case BQ27520G2:
+	case BQ27520G3:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index b289899..3712cd9 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -157,6 +157,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27510g3", BQ27510G3 },
 	{ "bq27520g1", BQ27520G1 },
 	{ "bq27520g2", BQ27520G2 },
+	{ "bq27520g3", BQ27520G3 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -185,6 +186,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27510g3" },
 	{ .compatible = "ti,bq27520g1" },
 	{ .compatible = "ti,bq27520g2" },
+	{ .compatible = "ti,bq27520g3" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index a3fc34a..5c12717 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -12,6 +12,7 @@ enum bq27xxx_chip {
 	BQ27510G3, /* bq27510G3 */
 	BQ27520G1, /* bq27520G1 */
 	BQ27520G2, /* bq27520G2 */
+	BQ27520G3, /* bq27520G3 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v5 10/11] power: supply: bq27xxx: adds specific support for bq27520-g4 revision.
  2017-01-11  1:44 ` [PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support Chris Lapa
                     ` (8 preceding siblings ...)
  2017-01-11  1:44   ` [PATCH v5 09/11] power: supply: bq27xxx: adds specific support for bq27520-g3 revision Chris Lapa
@ 2017-01-11  1:44   ` Chris Lapa
  2017-01-11  1:44   ` [PATCH v5 11/11] power: supply: bq27xxx: adds device tree binding documentation Chris Lapa
  2017-01-12  2:54   ` [PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support Sebastian Reichel
  11 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-11  1:44 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

This commit adds the BQ27520G4 chip definition to specifically match the
bq27520-G4 functionality as described in the datasheet.

Signed-off-by: Chris Lapa <chris@lapa.com.au>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
---
 drivers/power/supply/bq27xxx_battery.c     | 39 ++++++++++++++++++++++++++++++
 drivers/power/supply/bq27xxx_battery_i2c.c |  2 ++
 include/linux/power/bq27xxx_battery.h      |  1 +
 3 files changed, 42 insertions(+)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 1fe48ea..398801a 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -29,6 +29,7 @@
  * http://www.ti.com/product/bq27520-g1
  * http://www.ti.com/product/bq27520-g2
  * http://www.ti.com/product/bq27520-g3
+ * http://www.ti.com/product/bq27520-g4
  * http://www.ti.com/product/bq27530-g1
  * http://www.ti.com/product/bq27531-g1
  * http://www.ti.com/product/bq27541-g1
@@ -321,6 +322,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = {
 		[BQ27XXX_REG_DCAP] = 0x3c,
 		[BQ27XXX_REG_AP] = 0x24,
 	},
+	[BQ27520G4] = {
+		[BQ27XXX_REG_CTRL] = 0x00,
+		[BQ27XXX_REG_TEMP] = 0x06,
+		[BQ27XXX_REG_INT_TEMP] = 0x28,
+		[BQ27XXX_REG_VOLT] = 0x08,
+		[BQ27XXX_REG_AI] = 0x14,
+		[BQ27XXX_REG_FLAGS] = 0x0a,
+		[BQ27XXX_REG_TTE] = 0x16,
+		[BQ27XXX_REG_TTF] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_TTES] = 0x1c,
+		[BQ27XXX_REG_TTECP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_NAC] = 0x0c,
+		[BQ27XXX_REG_FCC] = 0x12,
+		[BQ27XXX_REG_CYCT] = 0x1e,
+		[BQ27XXX_REG_AE] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_SOC] = 0x20,
+		[BQ27XXX_REG_DCAP] = INVALID_REG_ADDR,
+		[BQ27XXX_REG_AP] = INVALID_REG_ADDR,
+	},
 	[BQ27530] = {
 		[BQ27XXX_REG_CTRL] = 0x00,
 		[BQ27XXX_REG_TEMP] = 0x06,
@@ -619,6 +639,23 @@ static enum power_supply_property bq27520g3_battery_props[] = {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static enum power_supply_property bq27520g4_battery_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_VOLTAGE_NOW,
+	POWER_SUPPLY_PROP_CURRENT_NOW,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CHARGE_FULL,
+	POWER_SUPPLY_PROP_CHARGE_NOW,
+	POWER_SUPPLY_PROP_CYCLE_COUNT,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+};
+
 static enum power_supply_property bq27530_battery_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -710,6 +747,7 @@ static struct {
 	BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
 	BQ27XXX_PROP(BQ27520G2, bq27520g2_battery_props),
 	BQ27XXX_PROP(BQ27520G3, bq27520g3_battery_props),
+	BQ27XXX_PROP(BQ27520G4, bq27520g4_battery_props),
 	BQ27XXX_PROP(BQ27530, bq27530_battery_props),
 	BQ27XXX_PROP(BQ27541, bq27541_battery_props),
 	BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -971,6 +1009,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)
 	case BQ27520G1:
 	case BQ27520G2:
 	case BQ27520G3:
+	case BQ27520G4:
 	case BQ27541:
 	case BQ27545:
 		return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 3712cd9..c68fbc3 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -158,6 +158,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
 	{ "bq27520g1", BQ27520G1 },
 	{ "bq27520g2", BQ27520G2 },
 	{ "bq27520g3", BQ27520G3 },
+	{ "bq27520g4", BQ27520G4 },
 	{ "bq27530", BQ27530 },
 	{ "bq27531", BQ27530 },
 	{ "bq27541", BQ27541 },
@@ -187,6 +188,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
 	{ .compatible = "ti,bq27520g1" },
 	{ .compatible = "ti,bq27520g2" },
 	{ .compatible = "ti,bq27520g3" },
+	{ .compatible = "ti,bq27520g4" },
 	{ .compatible = "ti,bq27530" },
 	{ .compatible = "ti,bq27531" },
 	{ .compatible = "ti,bq27541" },
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 5c12717..b312bce 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -13,6 +13,7 @@ enum bq27xxx_chip {
 	BQ27520G1, /* bq27520G1 */
 	BQ27520G2, /* bq27520G2 */
 	BQ27520G3, /* bq27520G3 */
+	BQ27520G4, /* bq27520G4 */
 	BQ27530, /* bq27530, bq27531 */
 	BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
 	BQ27545, /* bq27545 */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* [PATCH v5 11/11] power: supply: bq27xxx: adds device tree binding documentation.
  2017-01-11  1:44 ` [PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support Chris Lapa
                     ` (9 preceding siblings ...)
  2017-01-11  1:44   ` [PATCH v5 10/11] power: supply: bq27xxx: adds specific support for bq27520-g4 revision Chris Lapa
@ 2017-01-11  1:44   ` Chris Lapa
  2017-01-12  2:54   ` [PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support Sebastian Reichel
  11 siblings, 0 replies; 70+ messages in thread
From: Chris Lapa @ 2017-01-11  1:44 UTC (permalink / raw)
  To: pali.rohar, afd, sre, linux-pm, linux-kernel; +Cc: Chris Lapa

From: Chris Lapa <chris@lapa.com.au>

The bq27xxx binding is a standard i2c style binding, however the
deprecated compatible fields and different revisions warrant its own
documentation.

Signed-off-by: Chris Lapa <chris@lapa.com.au>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Andrew F. Davis <afd@ti.com>
---
 .../devicetree/bindings/power/supply/bq27xxx.txt   | 36 ++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/bq27xxx.txt

diff --git a/Documentation/devicetree/bindings/power/supply/bq27xxx.txt b/Documentation/devicetree/bindings/power/supply/bq27xxx.txt
new file mode 100644
index 0000000..b0c95ef
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/supply/bq27xxx.txt
@@ -0,0 +1,36 @@
+Binding for TI BQ27XXX fuel gauge family
+
+Required properties:
+- compatible: Should contain one of the following:
+ * "ti,bq27200" - BQ27200
+ * "ti,bq27210" - BQ27210
+ * "ti,bq27500" - deprecated, use revision specific property below
+ * "ti,bq27510" - deprecated, use revision specific property below
+ * "ti,bq27520" - deprecated, use revision specific property below
+ * "ti,bq27500-1" - BQ27500/1
+ * "ti,bq27510g1" - BQ27510-g1
+ * "ti,bq27510g2" - BQ27510-g2
+ * "ti,bq27510g3" - BQ27510-g3
+ * "ti,bq27520g1" - BQ27520-g1
+ * "ti,bq27520g2" - BQ27520-g2
+ * "ti,bq27520g3" - BQ27520-g3
+ * "ti,bq27520g4" - BQ27520-g4
+ * "ti,bq27530" - BQ27530
+ * "ti,bq27531" - BQ27531
+ * "ti,bq27541" - BQ27541
+ * "ti,bq27542" - BQ27542
+ * "ti,bq27546" - BQ27546
+ * "ti,bq27742" - BQ27742
+ * "ti,bq27545" - BQ27545
+ * "ti,bq27421" - BQ27421
+ * "ti,bq27425" - BQ27425
+ * "ti,bq27441" - BQ27441
+ * "ti,bq27621" - BQ27621
+- reg: integer, i2c address of the device.
+
+Example:
+
+bq27510g3 {
+    compatible = "ti,bq27510g3";
+    reg = <0x55>;
+};
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 70+ messages in thread

* Re: [PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support
  2017-01-11  1:44 ` [PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support Chris Lapa
                     ` (10 preceding siblings ...)
  2017-01-11  1:44   ` [PATCH v5 11/11] power: supply: bq27xxx: adds device tree binding documentation Chris Lapa
@ 2017-01-12  2:54   ` Sebastian Reichel
  11 siblings, 0 replies; 70+ messages in thread
From: Sebastian Reichel @ 2017-01-12  2:54 UTC (permalink / raw)
  To: Chris Lapa; +Cc: pali.rohar, afd, linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1261 bytes --]

Hi,

On Wed, Jan 11, 2017 at 12:44:37PM +1100, Chris Lapa wrote:
> This patch series correctly renames the patch subject prefix to
> 'power: supply: bq27xxx'.
> 
> It also fixes up the deprecation of the BQ27500 and BQ27510 definitions.
> 
> Otherwise the patch content is the same functionally as the v4 series.
> 
> Chris Lapa (11):
>   power: supply: bq27xxx: rename BQ27500 allow for deprecation in
>     future.
>   power: supply: bq27xxx: rename BQ27510 allow for deprecation in
>     future.
>   power: supply: bq27xxx: adds specific support for bq27500/1 revision.
>   power: supply: bq27xxx: adds specific support for bq27510-g1 revision.
>   power: supply: bq27xxx: adds specific support for bq27510-g2 revision.
>   power: supply: bq27xxx: adds specific support for bq27510-g3 revision.
>   power: supply: bq27xxx: adds specific support for bq27520-g1 revision.
>   power: supply: bq27xxx: adds specific support for bq27520-g2 revision.
>   power: supply: bq27xxx: adds specific support for bq27520-g3 revision.
>   power: supply: bq27xxx: adds specific support for bq27520-g4 revision.
>   power: supply: bq27xxx: adds device tree binding documentation.

Thanks, queued into power-supply's for-next branch.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 70+ messages in thread

end of thread, other threads:[~2017-01-12  2:54 UTC | newest]

Thread overview: 70+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-22  1:22 [PATCH 00/10] power: supply: bq275xx: implement individual chip revision support Chris Lapa
2016-12-22  1:22 ` [PATCH 01/10] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future Chris Lapa
2016-12-22  1:22 ` [PATCH 02/10] power: supplies: bq275xx: adds specific support for bq27500/1 revision Chris Lapa
2016-12-22  1:22 ` [PATCH 03/10] power: supplies: bq275xx: adds specific support for bq27510-g1 revision Chris Lapa
2016-12-22  1:22 ` [PATCH 04/10] power: supplies: bq275xx: adds specific support for bq27510-g2 revision Chris Lapa
2016-12-22  1:22 ` [PATCH 05/10] power: supplies: bq275xx: adds specific support for bq27510-g3 revision Chris Lapa
2016-12-22  1:22 ` [PATCH 06/10] power: supplies: bq275xx: adds specific support for bq27520-g1 revision Chris Lapa
2016-12-22  1:22 ` [PATCH 07/10] power: supplies: bq275xx: adds specific support for bq27520-g2 revision Chris Lapa
2016-12-22  1:22 ` [PATCH 08/10] power: supplies: bq275xx: adds specific support for bq27520-g3 revision Chris Lapa
2016-12-22  1:22 ` [PATCH 09/10] power: supplies: bq275xx: adds specific support for bq27520-g4 revision Chris Lapa
2016-12-22  8:57   ` Pali Rohár
2016-12-23  0:04 ` [PATCH v2 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
2016-12-23  0:04   ` [PATCH v2 01/11] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future Chris Lapa
2017-01-05 23:59     ` Sebastian Reichel
2017-01-06  0:29       ` Chris Lapa
2017-01-06 17:36         ` Sebastian Reichel
2016-12-23  0:04   ` [PATCH v2 02/11] power: supplies: bq275xx: adds specific support for bq27500/1 revision Chris Lapa
2016-12-23  0:04   ` [PATCH v2 03/11] power: supplies: bq275xx: adds specific support for bq27510-g1 revision Chris Lapa
2016-12-23  0:05   ` [PATCH v2 04/11] power: supplies: bq275xx: adds specific support for bq27510-g2 revision Chris Lapa
2016-12-23  0:05   ` [PATCH v2 05/11] power: supplies: bq275xx: adds specific support for bq27510-g3 revision Chris Lapa
2016-12-23  0:05   ` [PATCH v2 06/11] power: supplies: bq275xx: adds specific support for bq27520-g1 revision Chris Lapa
2016-12-23  0:05   ` [PATCH v2 07/11] power: supplies: bq275xx: adds specific support for bq27520-g2 revision Chris Lapa
2016-12-23  0:05   ` [PATCH v2 08/11] power: supplies: bq275xx: adds specific support for bq27520-g3 revision Chris Lapa
2016-12-23  0:05   ` [PATCH v2 09/11] power: supplies: bq275xx: adds specific support for bq27520-g4 revision Chris Lapa
2016-12-23  0:05   ` [PATCH v2 10/11] power: supply: bq275xx: cleanup over temperature flag check Chris Lapa
2016-12-23  0:05   ` [PATCH v2 11/11] power: supplies: bq275xx: adds device tree binding documentation Chris Lapa
2017-01-06  0:06     ` Sebastian Reichel
2017-01-06  0:32       ` Chris Lapa
2017-01-09  0:47 ` [PATCH v3 00/11] power: supply: bq275xx: implement individual chip revision support Chris Lapa
2017-01-09  0:47   ` [PATCH v3 01/11] power: supplies: bq275xx: move overtemp tests to a switch statement Chris Lapa
2017-01-09 15:35     ` Andrew F. Davis
2017-01-09  0:47   ` [PATCH v3 02/11] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future Chris Lapa
2017-01-09  0:47   ` [PATCH v3 03/11] power: supplies: bq275xx: adds specific support for bq27500/1 revision Chris Lapa
2017-01-09  0:47   ` [PATCH v3 04/11] power: supplies: bq275xx: adds specific support for bq27510-g1 revision Chris Lapa
2017-01-09  0:47   ` [PATCH v3 05/11] power: supplies: bq275xx: adds specific support for bq27510-g2 revision Chris Lapa
2017-01-09  0:47   ` [PATCH v3 06/11] power: supplies: bq275xx: adds specific support for bq27510-g3 revision Chris Lapa
2017-01-09  0:47   ` [PATCH v3 07/11] power: supplies: bq275xx: adds specific support for bq27520-g1 revision Chris Lapa
2017-01-09  0:47   ` [PATCH v3 08/11] power: supplies: bq275xx: adds specific support for bq27520-g2 revision Chris Lapa
2017-01-09  0:47   ` [PATCH v3 09/11] power: supplies: bq275xx: adds specific support for bq27520-g3 revision Chris Lapa
2017-01-09  0:47   ` [PATCH v3 10/11] power: supplies: bq275xx: adds specific support for bq27520-g4 revision Chris Lapa
2017-01-09  0:47   ` [PATCH v3 11/11] power: supplies: bq27xxx: adds device tree binding documentation Chris Lapa
2017-01-09  8:23   ` [PATCH v3 00/11] power: supply: bq275xx: implement individual chip revision support Pali Rohár
2017-01-10  2:49   ` Sebastian Reichel
2017-01-10  5:25 ` [PATCH v4 00/10] power: supply: bq27xxx: " Chris Lapa
2017-01-10  5:25   ` [PATCH v4 01/10] power: supplies: bq27xxx: rename BQ27500 allow for deprecation in future Chris Lapa
2017-01-10  8:58     ` Pali Rohár
2017-01-10 22:25       ` Chris Lapa
2017-01-10 23:29         ` Sebastian Reichel
2017-01-10  5:25   ` [PATCH v4 02/10] power: supplies: bq27xxx: adds specific support for bq27500/1 revision Chris Lapa
2017-01-10  5:25   ` [PATCH v4 03/10] power: supplies: bq27xxx: adds specific support for bq27510-g1 revision Chris Lapa
2017-01-10  5:25   ` [PATCH v4 04/10] power: supplies: bq27xxx: adds specific support for bq27510-g2 revision Chris Lapa
2017-01-10  5:25   ` [PATCH v4 05/10] power: supplies: bq27xxx: adds specific support for bq27510-g3 revision Chris Lapa
2017-01-10  5:25   ` [PATCH v4 06/10] power: supplies: bq27xxx: adds specific support for bq27520-g1 revision Chris Lapa
2017-01-10  5:25   ` [PATCH v4 07/10] power: supplies: bq27xxx: adds specific support for bq27520-g2 revision Chris Lapa
2017-01-10  5:25   ` [PATCH v4 08/10] power: supplies: bq27xxx: adds specific support for bq27520-g3 revision Chris Lapa
2017-01-10  5:25   ` [PATCH v4 09/10] power: supplies: bq27xxx: adds specific support for bq27520-g4 revision Chris Lapa
2017-01-10  5:25   ` [PATCH v4 10/10] power: supplies: bq27xxx: adds device tree binding documentation Chris Lapa
2017-01-11  1:44 ` [PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support Chris Lapa
2017-01-11  1:44   ` [PATCH v5 01/11] power: supply: bq27xxx: rename BQ27500 allow for deprecation in future Chris Lapa
2017-01-11  1:44   ` [PATCH v5 02/11] power: supply: bq27xxx: rename BQ27510 " Chris Lapa
2017-01-11  1:44   ` [PATCH v5 03/11] power: supply: bq27xxx: adds specific support for bq27500/1 revision Chris Lapa
2017-01-11  1:44   ` [PATCH v5 04/11] power: supply: bq27xxx: adds specific support for bq27510-g1 revision Chris Lapa
2017-01-11  1:44   ` [PATCH v5 05/11] power: supply: bq27xxx: adds specific support for bq27510-g2 revision Chris Lapa
2017-01-11  1:44   ` [PATCH v5 06/11] power: supply: bq27xxx: adds specific support for bq27510-g3 revision Chris Lapa
2017-01-11  1:44   ` [PATCH v5 07/11] power: supply: bq27xxx: adds specific support for bq27520-g1 revision Chris Lapa
2017-01-11  1:44   ` [PATCH v5 08/11] power: supply: bq27xxx: adds specific support for bq27520-g2 revision Chris Lapa
2017-01-11  1:44   ` [PATCH v5 09/11] power: supply: bq27xxx: adds specific support for bq27520-g3 revision Chris Lapa
2017-01-11  1:44   ` [PATCH v5 10/11] power: supply: bq27xxx: adds specific support for bq27520-g4 revision Chris Lapa
2017-01-11  1:44   ` [PATCH v5 11/11] power: supply: bq27xxx: adds device tree binding documentation Chris Lapa
2017-01-12  2:54   ` [PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support Sebastian Reichel

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).