History

power: supply: bq27xxx: adds specific support for bq27520-g2 revision.

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

Chris Lapa committed 9 years ago

Commit a5deb9a1 parent 68f2a813 files · +46 −0Browse files

Unified · Split

3 files
  1. drivers/power/supply/bq27xxx_battery.c +43 −0
  2. drivers/power/supply/bq27xxx_battery_i2c.c +2 −0
  3. include/linux/power/bq27xxx_battery.h +1 −0
drivers/power/supply/bq27xxx_battery.c+43−0
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 * http://www.ti.com/product/bq27510-g3
2828 * http://www.ti.com/product/bq27520-g4
2929 * http://www.ti.com/product/bq27520-g1
30+ * http://www.ti.com/product/bq27520-g2
3031 * http://www.ti.com/product/bq27530-g1
3132 * http://www.ti.com/product/bq27531-g1
3233 * http://www.ti.com/product/bq27541-g1
@@ -281,6 +282,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { · 248 unmodified lines
281282 [BQ27XXX_REG_DCAP] = 0x3c,
282283 [BQ27XXX_REG_AP] = 0x24,
283284 },
285+ [BQ27520G2] = {
286+ [BQ27XXX_REG_CTRL] = 0x00,
287+ [BQ27XXX_REG_TEMP] = 0x06,
288+ [BQ27XXX_REG_INT_TEMP] = 0x36,
289+ [BQ27XXX_REG_VOLT] = 0x08,
290+ [BQ27XXX_REG_AI] = 0x14,
291+ [BQ27XXX_REG_FLAGS] = 0x0a,
292+ [BQ27XXX_REG_TTE] = 0x16,
293+ [BQ27XXX_REG_TTF] = 0x18,
294+ [BQ27XXX_REG_TTES] = 0x1c,
295+ [BQ27XXX_REG_TTECP] = 0x26,
296+ [BQ27XXX_REG_NAC] = 0x0c,
297+ [BQ27XXX_REG_FCC] = 0x12,
298+ [BQ27XXX_REG_CYCT] = 0x2a,
299+ [BQ27XXX_REG_AE] = 0x22,
300+ [BQ27XXX_REG_SOC] = 0x2c,
301+ [BQ27XXX_REG_DCAP] = 0x3c,
302+ [BQ27XXX_REG_AP] = 0x24,
303+ },
284304 [BQ27530] = {
285305 [BQ27XXX_REG_CTRL] = 0x00,
286306 [BQ27XXX_REG_TEMP] = 0x06,
@@ -538,6 +558,27 @@ static enum power_supply_property bq27520g1_battery_props[] = { · 251 unmodified lines
538558 POWER_SUPPLY_PROP_MANUFACTURER,
539559 };
540560
561+static enum power_supply_property bq27520g2_battery_props[] = {
562+ POWER_SUPPLY_PROP_STATUS,
563+ POWER_SUPPLY_PROP_PRESENT,
564+ POWER_SUPPLY_PROP_VOLTAGE_NOW,
565+ POWER_SUPPLY_PROP_CURRENT_NOW,
566+ POWER_SUPPLY_PROP_CAPACITY,
567+ POWER_SUPPLY_PROP_CAPACITY_LEVEL,
568+ POWER_SUPPLY_PROP_TEMP,
569+ POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
570+ POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
571+ POWER_SUPPLY_PROP_TECHNOLOGY,
572+ POWER_SUPPLY_PROP_CHARGE_FULL,
573+ POWER_SUPPLY_PROP_CHARGE_NOW,
574+ POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
575+ POWER_SUPPLY_PROP_CYCLE_COUNT,
576+ POWER_SUPPLY_PROP_ENERGY_NOW,
577+ POWER_SUPPLY_PROP_POWER_AVG,
578+ POWER_SUPPLY_PROP_HEALTH,
579+ POWER_SUPPLY_PROP_MANUFACTURER,
580+};
581+
541582 static enum power_supply_property bq27530_battery_props[] = {
542583 POWER_SUPPLY_PROP_STATUS,
543584 POWER_SUPPLY_PROP_PRESENT,
@@ -627,6 +668,7 @@ static struct { · 83 unmodified lines
627668 BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
628669 BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
629670 BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
671+ BQ27XXX_PROP(BQ27520G2, bq27520g2_battery_props),
630672 BQ27XXX_PROP(BQ27530, bq27530_battery_props),
631673 BQ27XXX_PROP(BQ27541, bq27541_battery_props),
632674 BQ27XXX_PROP(BQ27545, bq27545_battery_props),
@@ -886,6 +928,7 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags) · 253 unmodified lines
886928 case BQ27510G2:
887929 case BQ27510G3:
888930 case BQ27520G1:
931+ case BQ27520G2:
889932 case BQ27541:
890933 case BQ27545:
891934 return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);
drivers/power/supply/bq27xxx_battery_i2c.c+2−0
@@ -156,6 +156,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = { · 155 unmodified lines
156156 { "bq27510g2", BQ27510G2 },
157157 { "bq27510g3", BQ27510G3 },
158158 { "bq27520g1", BQ27520G1 },
159+ { "bq27520g2", BQ27520G2 },
159160 { "bq27530", BQ27530 },
160161 { "bq27531", BQ27530 },
161162 { "bq27541", BQ27541 },
@@ -183,6 +184,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = { · 21 unmodified lines
183184 { .compatible = "ti,bq27510g2" },
184185 { .compatible = "ti,bq27510g3" },
185186 { .compatible = "ti,bq27520g1" },
187+ { .compatible = "ti,bq27520g2" },
186188 { .compatible = "ti,bq27530" },
187189 { .compatible = "ti,bq27531" },
188190 { .compatible = "ti,bq27541" },
include/linux/power/bq27xxx_battery.h+1−0
@@ -11,6 +11,7 @@ enum bq27xxx_chip { · 10 unmodified lines
1111 BQ27510G2, /* bq27510G2 */
1212 BQ27510G3, /* bq27510G3 */
1313 BQ27520G1, /* bq27520G1 */
14+ BQ27520G2, /* bq27520G2 */
1415 BQ27530, /* bq27530, bq27531 */
1516 BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
1617 BQ27545, /* bq27545 */