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
27 * http://www.ti.com/product/bq27510-g327 * http://www.ti.com/product/bq27510-g3
28 * http://www.ti.com/product/bq27520-g428 * http://www.ti.com/product/bq27520-g4
29 * http://www.ti.com/product/bq27520-g129 * http://www.ti.com/product/bq27520-g1
30 * http://www.ti.com/product/bq27520-g2
30 * http://www.ti.com/product/bq27530-g131 * http://www.ti.com/product/bq27530-g1
31 * http://www.ti.com/product/bq27531-g132 * http://www.ti.com/product/bq27531-g1
32 * http://www.ti.com/product/bq27541-g133 * http://www.ti.com/product/bq27541-g1
@@ -281,6 +282,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { · 248 unmodified lines
281 [BQ27XXX_REG_DCAP] = 0x3c,282 [BQ27XXX_REG_DCAP] = 0x3c,
282 [BQ27XXX_REG_AP] = 0x24,283 [BQ27XXX_REG_AP] = 0x24,
283 },284 },
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 },
284 [BQ27530] = {304 [BQ27530] = {
285 [BQ27XXX_REG_CTRL] = 0x00,305 [BQ27XXX_REG_CTRL] = 0x00,
286 [BQ27XXX_REG_TEMP] = 0x06,306 [BQ27XXX_REG_TEMP] = 0x06,
@@ -538,6 +558,27 @@ static enum power_supply_property bq27520g1_battery_props[] = { · 251 unmodified lines
538 POWER_SUPPLY_PROP_MANUFACTURER,558 POWER_SUPPLY_PROP_MANUFACTURER,
539};559};
540 560
561static 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
541static enum power_supply_property bq27530_battery_props[] = {582static enum power_supply_property bq27530_battery_props[] = {
542 POWER_SUPPLY_PROP_STATUS,583 POWER_SUPPLY_PROP_STATUS,
543 POWER_SUPPLY_PROP_PRESENT,584 POWER_SUPPLY_PROP_PRESENT,
@@ -627,6 +668,7 @@ static struct { · 83 unmodified lines
627 BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),668 BQ27XXX_PROP(BQ27510G2, bq27510g2_battery_props),
628 BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),669 BQ27XXX_PROP(BQ27510G3, bq27510g3_battery_props),
629 BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),670 BQ27XXX_PROP(BQ27520G1, bq27520g1_battery_props),
671 BQ27XXX_PROP(BQ27520G2, bq27520g2_battery_props),
630 BQ27XXX_PROP(BQ27530, bq27530_battery_props),672 BQ27XXX_PROP(BQ27530, bq27530_battery_props),
631 BQ27XXX_PROP(BQ27541, bq27541_battery_props),673 BQ27XXX_PROP(BQ27541, bq27541_battery_props),
632 BQ27XXX_PROP(BQ27545, bq27545_battery_props),674 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
886 case BQ27510G2:928 case BQ27510G2:
887 case BQ27510G3:929 case BQ27510G3:
888 case BQ27520G1:930 case BQ27520G1:
931 case BQ27520G2:
889 case BQ27541:932 case BQ27541:
890 case BQ27545:933 case BQ27545:
891 return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD);934 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
156 { "bq27510g2", BQ27510G2 },156 { "bq27510g2", BQ27510G2 },
157 { "bq27510g3", BQ27510G3 },157 { "bq27510g3", BQ27510G3 },
158 { "bq27520g1", BQ27520G1 },158 { "bq27520g1", BQ27520G1 },
159 { "bq27520g2", BQ27520G2 },
159 { "bq27530", BQ27530 },160 { "bq27530", BQ27530 },
160 { "bq27531", BQ27530 },161 { "bq27531", BQ27530 },
161 { "bq27541", BQ27541 },162 { "bq27541", BQ27541 },
@@ -183,6 +184,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = { · 21 unmodified lines
183 { .compatible = "ti,bq27510g2" },184 { .compatible = "ti,bq27510g2" },
184 { .compatible = "ti,bq27510g3" },185 { .compatible = "ti,bq27510g3" },
185 { .compatible = "ti,bq27520g1" },186 { .compatible = "ti,bq27520g1" },
187 { .compatible = "ti,bq27520g2" },
186 { .compatible = "ti,bq27530" },188 { .compatible = "ti,bq27530" },
187 { .compatible = "ti,bq27531" },189 { .compatible = "ti,bq27531" },
188 { .compatible = "ti,bq27541" },190 { .compatible = "ti,bq27541" },
include/linux/power/bq27xxx_battery.h+1−0
@@ -11,6 +11,7 @@ enum bq27xxx_chip { · 10 unmodified lines
11 BQ27510G2, /* bq27510G2 */11 BQ27510G2, /* bq27510G2 */
12 BQ27510G3, /* bq27510G3 */12 BQ27510G3, /* bq27510G3 */
13 BQ27520G1, /* bq27520G1 */13 BQ27520G1, /* bq27520G1 */
14 BQ27520G2, /* bq27520G2 */
14 BQ27530, /* bq27530, bq27531 */15 BQ27530, /* bq27530, bq27531 */
15 BQ27541, /* bq27541, bq27542, bq27546, bq27742 */16 BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
16 BQ27545, /* bq27545 */17 BQ27545, /* bq27545 */