Re: BQ27xxx registers
On 17/1/17 4:43 am, Andrew F. Davis wrote: On 12/21/2016 05:37 PM, Chris Lapa wrote: On 21/12/16 11:46 pm, Pali Rohár wrote: On Wednesday 21 December 2016 03:49:10 Chris Lapa wrote: On 20/12/16 10:34 pm, Pali Rohár wrote: On Tuesday 20 December 2016 07:00:41 Chris Lapa wrote: I can generate a patch to fix this issue, however the bigger problem exists as to which revision fuel gauge the bq27xxx_battery.c driver is intended to support for each family. Hi! I think driver should support all revisions. There can be (and probably really is) hardware which uses old revision and such hardware should be still supported... I agree. However due to the register address changes across the spectrum of revisions, each revision will have to be specified individually. For example, we will need to implement a BQ27510G1, BQ27510G2, BQ27510G3, BQ27520G1, BQ27520G2, BQ27520G3, BQ27520G4 definitions and prospective device tree additions ti,bq27510g1, ti,bq27510g2 etc. The other option is to aim for bottom of the barrel support for all the devices under the BQ27500 definition but my feeling is it would get messier fast and be less maintainable. My preference is to go with the first option if you agree? Yes. If those chips have different register addresses, then those chips are different. Name, generation or suffix does not matter here. Similarly there could be chips with different name, but same addresses, so can use one driver/configuration without any change. So I'm for different name in device tree (or platform data or what is being used) to distinguish between different revisions. I've been working my way through the revision migration datasheets and noticed this could be simplified with the FW_VERSION parameter. It is always located at the same address and is distinctly different between each chip revision. Unfortunately the migration datasheets vs individual revision datasheets firmware version information directly contradict each other. Which makes me wary of committing to using it. BTW, could you give some specific examples of this? I can work with the HW teams to get any documentation problems fixed, so we can in the future use this FW_VERSION parameter if needed. Thanks, Andrew Given that I don't have every single variant of this device to test with, its probably still safest to have the user manually specify each device. I should have some patches ready soon. Thanks, Chris Hi Andrew, I've gone through and made a table based on the migration datasheets and user manuals TI has provided. CHIPMigration D/S User Manual BQ27500/1 N/A 1.06, 1.08 BQ27500-V1001.081.06, 1.08 BQ27500-V1201.201.20 BQ27500-V1301.301.30 BQ27510-G1 1.12Not listed BQ27510-G2 1.23Not listed BQ27510-G3 4.004.00 BQ27520-G1 3.023.01 BQ27520-G2 3.113.11 BQ27520-G3 3.243.23 BQ27520-G4 3.293.29 I suspect the BQ27500/1 and BQ27500-V100 are the same product but they have separate product pages so I treated them separately. I also suspect the different firmware revisions are probably legitimate due bugs being fixed between when the user manual was released vs when the migration datasheet was released. Using the FW_VERSION parameter would be ideal, but some quick googling on golden images indicates that they include firmware. Which might introduce some more firmware variants? Thanks, Chris
Re: BQ27xxx registers
On 17/1/17 4:43 am, Andrew F. Davis wrote: On 12/21/2016 05:37 PM, Chris Lapa wrote: On 21/12/16 11:46 pm, Pali Rohár wrote: On Wednesday 21 December 2016 03:49:10 Chris Lapa wrote: On 20/12/16 10:34 pm, Pali Rohár wrote: On Tuesday 20 December 2016 07:00:41 Chris Lapa wrote: I can generate a patch to fix this issue, however the bigger problem exists as to which revision fuel gauge the bq27xxx_battery.c driver is intended to support for each family. Hi! I think driver should support all revisions. There can be (and probably really is) hardware which uses old revision and such hardware should be still supported... I agree. However due to the register address changes across the spectrum of revisions, each revision will have to be specified individually. For example, we will need to implement a BQ27510G1, BQ27510G2, BQ27510G3, BQ27520G1, BQ27520G2, BQ27520G3, BQ27520G4 definitions and prospective device tree additions ti,bq27510g1, ti,bq27510g2 etc. The other option is to aim for bottom of the barrel support for all the devices under the BQ27500 definition but my feeling is it would get messier fast and be less maintainable. My preference is to go with the first option if you agree? Yes. If those chips have different register addresses, then those chips are different. Name, generation or suffix does not matter here. Similarly there could be chips with different name, but same addresses, so can use one driver/configuration without any change. So I'm for different name in device tree (or platform data or what is being used) to distinguish between different revisions. I've been working my way through the revision migration datasheets and noticed this could be simplified with the FW_VERSION parameter. It is always located at the same address and is distinctly different between each chip revision. Unfortunately the migration datasheets vs individual revision datasheets firmware version information directly contradict each other. Which makes me wary of committing to using it. BTW, could you give some specific examples of this? I can work with the HW teams to get any documentation problems fixed, so we can in the future use this FW_VERSION parameter if needed. Thanks, Andrew Given that I don't have every single variant of this device to test with, its probably still safest to have the user manually specify each device. I should have some patches ready soon. Thanks, Chris Hi Andrew, I've gone through and made a table based on the migration datasheets and user manuals TI has provided. CHIPMigration D/S User Manual BQ27500/1 N/A 1.06, 1.08 BQ27500-V1001.081.06, 1.08 BQ27500-V1201.201.20 BQ27500-V1301.301.30 BQ27510-G1 1.12Not listed BQ27510-G2 1.23Not listed BQ27510-G3 4.004.00 BQ27520-G1 3.023.01 BQ27520-G2 3.113.11 BQ27520-G3 3.243.23 BQ27520-G4 3.293.29 I suspect the BQ27500/1 and BQ27500-V100 are the same product but they have separate product pages so I treated them separately. I also suspect the different firmware revisions are probably legitimate due bugs being fixed between when the user manual was released vs when the migration datasheet was released. Using the FW_VERSION parameter would be ideal, but some quick googling on golden images indicates that they include firmware. Which might introduce some more firmware variants? Thanks, Chris
[PATCH v5 02/11] power: supply: bq27xxx: rename BQ27510 allow for deprecation in future.
From: Chris Lapa <ch...@lapa.com.au> The BQ2751X definition exists only to satisfy backwards compatibility. Signed-off-by: Chris Lapa <ch...@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
[PATCH v5 02/11] power: supply: bq27xxx: rename BQ27510 allow for deprecation in future.
From: Chris Lapa The BQ2751X definition exists only to satisfy backwards compatibility. Signed-off-by: Chris Lapa --- 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
[PATCH v5 03/11] power: supply: bq27xxx: adds specific support for bq27500/1 revision.
From: Chris Lapa <ch...@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 <ch...@lapa.com.au> Acked-by: Pali Rohár <pali.ro...@gmail.com> Reviewed-by: Andrew F. Davis <a...@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, bq2
[PATCH v5 03/11] power: supply: bq27xxx: adds specific support for bq27500/1 revision.
From: Chris Lapa This commit adds the BQ27500 chip definition to specifically match the bq27500/1 functionality as described in the datasheet. Signed-off-by: Chris Lapa Acked-by: Pali Rohár Reviewed-by: Andrew F. Davis --- 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
[PATCH v5 07/11] power: supply: bq27xxx: adds specific support for bq27520-g1 revision.
From: Chris Lapa <ch...@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 <ch...@lapa.com.au> Acked-by: Pali Rohár <pali.ro...@gmail.com> Reviewed-by: Andrew F. Davis <a...@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
[PATCH v5 11/11] power: supply: bq27xxx: adds device tree binding documentation.
From: Chris Lapa <ch...@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 <ch...@lapa.com.au> Acked-by: Pali Rohár <pali.ro...@gmail.com> Reviewed-by: Andrew F. Davis <a...@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 000..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
[PATCH v5 07/11] power: supply: bq27xxx: adds specific support for bq27520-g1 revision.
From: Chris Lapa This commit adds the BQ27520G1 chip definition to specifically match the bq27520-G1 functionality as described in the datasheet. Signed-off-by: Chris Lapa Acked-by: Pali Rohár Reviewed-by: Andrew F. Davis --- 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
[PATCH v5 11/11] power: supply: bq27xxx: adds device tree binding documentation.
From: Chris Lapa 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 Acked-by: Pali Rohár Reviewed-by: Andrew F. Davis --- .../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 000..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
[PATCH v5 08/11] power: supply: bq27xxx: adds specific support for bq27520-g2 revision.
From: Chris Lapa <ch...@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 <ch...@lapa.com.au> Acked-by: Pali Rohár <pali.ro...@gmail.com> Reviewed-by: Andrew F. Davis <a...@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
[PATCH v5 10/11] power: supply: bq27xxx: adds specific support for bq27520-g4 revision.
From: Chris Lapa <ch...@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 <ch...@lapa.com.au> Acked-by: Pali Rohár <pali.ro...@gmail.com> Reviewed-by: Andrew F. Davis <a...@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/powe
[PATCH v5 09/11] power: supply: bq27xxx: adds specific support for bq27520-g3 revision.
From: Chris Lapa <ch...@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 <ch...@lapa.com.au> Acked-by: Pali Rohár <pali.ro...@gmail.com> Reviewed-by: Andrew F. Davis <a...@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/bq2
[PATCH v5 08/11] power: supply: bq27xxx: adds specific support for bq27520-g2 revision.
From: Chris Lapa This commit adds the BQ27520G2 chip definition to specifically match the bq27520-G2 functionality as described in the datasheet. Signed-off-by: Chris Lapa Acked-by: Pali Rohár Reviewed-by: Andrew F. Davis --- 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
[PATCH v5 10/11] power: supply: bq27xxx: adds specific support for bq27520-g4 revision.
From: Chris Lapa This commit adds the BQ27520G4 chip definition to specifically match the bq27520-G4 functionality as described in the datasheet. Signed-off-by: Chris Lapa Acked-by: Pali Rohár Reviewed-by: Andrew F. Davis --- 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
[PATCH v5 09/11] power: supply: bq27xxx: adds specific support for bq27520-g3 revision.
From: Chris Lapa This commit adds the BQ27520G3 chip definition to specifically match the bq27520-G3 functionality as described in the datasheet. Signed-off-by: Chris Lapa Acked-by: Pali Rohár Reviewed-by: Andrew F. Davis --- 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 +++
[PATCH v5 04/11] power: supply: bq27xxx: adds specific support for bq27510-g1 revision.
From: Chris Lapa <ch...@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 <ch...@lapa.com.au> Acked-by: Pali Rohár <pali.ro...@gmail.com> Reviewed-by: Andrew F. Davis <a...@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/b
[PATCH v5 04/11] power: supply: bq27xxx: adds specific support for bq27510-g1 revision.
From: Chris Lapa This commit adds the BQ27510G1 chip definition to specifically match the bq27510-G1 functionality as described in the datasheet. Signed-off-by: Chris Lapa Acked-by: Pali Rohár Reviewed-by: Andrew F. Davis --- 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/inclu
[PATCH v5 06/11] power: supply: bq27xxx: adds specific support for bq27510-g3 revision.
From: Chris Lapa <ch...@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 <ch...@lapa.com.au> Acked-by: Pali Rohár <pali.ro...@gmail.com> Reviewed-by: Andrew F. Davis <a...@ti.com> Tested-by: Chris Lapa <ch...@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
[PATCH v5 05/11] power: supply: bq27xxx: adds specific support for bq27510-g2 revision.
From: Chris Lapa <ch...@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 <ch...@lapa.com.au> Acked-by: Pali Rohár <pali.ro...@gmail.com> Reviewed-by: Andrew F. Davis <a...@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/
[PATCH v5 06/11] power: supply: bq27xxx: adds specific support for bq27510-g3 revision.
From: Chris Lapa This commit adds the BQ27510G3 chip definition to specifically match the bq27510-G3 functionality as described in the datasheet. Signed-off-by: Chris Lapa Acked-by: Pali Rohár Reviewed-by: Andrew F. Davis Tested-by: Chris Lapa --- 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
[PATCH v5 05/11] power: supply: bq27xxx: adds specific support for bq27510-g2 revision.
From: Chris Lapa This commit adds the BQ27510G2 chip definition to specifically match the bq27510-G2 functionality as described in the datasheet. Signed-off-by: Chris Lapa Acked-by: Pali Rohár Reviewed-by: Andrew F. Davis --- 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
[PATCH v5 01/11] power: supply: bq27xxx: rename BQ27500 allow for deprecation in future.
From: Chris Lapa <ch...@lapa.com.au> The BQ2750X definition exists only to satisfy backwards compatibility. Signed-off-by: Chris Lapa <ch...@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
[PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support
From: Chris Lapa <ch...@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
[PATCH v5 01/11] power: supply: bq27xxx: rename BQ27500 allow for deprecation in future.
From: Chris Lapa The BQ2750X definition exists only to satisfy backwards compatibility. Signed-off-by: Chris Lapa --- 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
[PATCH v5 00/11] power: supply: bq27xxx: implement individual chip revision support
From: Chris Lapa 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
Re: [PATCH v4 01/10] power: supplies: bq27xxx: rename BQ27500 allow for deprecation in future.
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 <ch...@lapa.com.au> The BQ275XX definition exists only to satisfy backwards compatibility. tested: yes Instead "tested: yes" we use: "Tested-by: name " line. Signed-off-by: Chris Lapa <ch...@lapa.com.au> Acked-by: Pali Rohár <pali.ro...@gmail.com> Reviewed-by: Andrew F. Davis <a...@ti.com> Doh, I went through the log and thought I saw 'tested: yes' being used previously. Want me to resend? Thanks, Chris Lapa
Re: [PATCH v4 01/10] power: supplies: bq27xxx: rename BQ27500 allow for deprecation in future.
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 The BQ275XX definition exists only to satisfy backwards compatibility. tested: yes Instead "tested: yes" we use: "Tested-by: name " line. Signed-off-by: Chris Lapa Acked-by: Pali Rohár Reviewed-by: Andrew F. Davis Doh, I went through the log and thought I saw 'tested: yes' being used previously. Want me to resend? Thanks, Chris Lapa
[PATCH v4 09/10] power: supplies: bq27xxx: adds specific support for bq27520-g4 revision.
From: Chris Lapa <ch...@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 <ch...@lapa.com.au> Acked-by: Pali Rohár <pali.ro...@gmail.com> Reviewed-by: Andrew F. Davis <a...@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/incl
[PATCH v4 09/10] power: supplies: bq27xxx: adds specific support for bq27520-g4 revision.
From: Chris Lapa 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 Acked-by: Pali Rohár Reviewed-by: Andrew F. Davis --- 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
[PATCH v4 01/10] power: supplies: bq27xxx: rename BQ27500 allow for deprecation in future.
From: Chris Lapa <ch...@lapa.com.au> The BQ275XX definition exists only to satisfy backwards compatibility. tested: yes Signed-off-by: Chris Lapa <ch...@lapa.com.au> Acked-by: Pali Rohár <pali.ro...@gmail.com> Reviewed-by: Andrew F. Davis <a...@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
[PATCH v4 03/10] power: supplies: bq27xxx: adds specific support for bq27510-g1 revision.
From: Chris Lapa <ch...@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 <ch...@lapa.com.au> Acked-by: Pali Rohár <pali.ro...@gmail.com> Reviewed-by: Andrew F. Davis <a...@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/inclu
[PATCH v4 06/10] power: supplies: bq27xxx: adds specific support for bq27520-g1 revision.
From: Chris Lapa <ch...@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 <ch...@lapa.com.au> Acked-by: Pali Rohár <pali.ro...@gmail.com> Reviewed-by: Andrew F. Davis <a...@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_
[PATCH v4 01/10] power: supplies: bq27xxx: rename BQ27500 allow for deprecation in future.
From: Chris Lapa The BQ275XX definition exists only to satisfy backwards compatibility. tested: yes Signed-off-by: Chris Lapa Acked-by: Pali Rohár Reviewed-by: Andrew F. Davis --- 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
[PATCH v4 03/10] power: supplies: bq27xxx: adds specific support for bq27510-g1 revision.
From: Chris Lapa 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 Acked-by: Pali Rohár Reviewed-by: Andrew F. Davis --- 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/bq27xx
[PATCH v4 06/10] power: supplies: bq27xxx: adds specific support for bq27520-g1 revision.
From: Chris Lapa 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 Acked-by: Pali Rohár Reviewed-by: Andrew F. Davis --- 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/inclu
[PATCH v4 10/10] power: supplies: bq27xxx: adds device tree binding documentation.
From: Chris Lapa <ch...@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 <ch...@lapa.com.au> Acked-by: Pali Rohár <pali.ro...@gmail.com> Reviewed-by: Andrew F. Davis <a...@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 000..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
[PATCH v4 08/10] power: supplies: bq27xxx: adds specific support for bq27520-g3 revision.
From: Chris Lapa <ch...@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 <ch...@lapa.com.au> Acked-by: Pali Rohár <pali.ro...@gmail.com> Reviewed-by: Andrew F. Davis <a...@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/li
[PATCH v4 10/10] power: supplies: bq27xxx: adds device tree binding documentation.
From: Chris Lapa 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 Acked-by: Pali Rohár Reviewed-by: Andrew F. Davis --- .../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 000..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
[PATCH v4 08/10] power: supplies: bq27xxx: adds specific support for bq27520-g3 revision.
From: Chris Lapa 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 Acked-by: Pali Rohár Reviewed-by: Andrew F. Davis --- 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_
[PATCH v4 05/10] power: supplies: bq27xxx: adds specific support for bq27510-g3 revision.
From: Chris Lapa <ch...@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 <ch...@lapa.com.au> Acked-by: Pali Rohár <pali.ro...@gmail.com> Reviewed-by: Andrew F. Davis <a...@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
[PATCH v4 07/10] power: supplies: bq27xxx: adds specific support for bq27520-g2 revision.
From: Chris Lapa <ch...@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 <ch...@lapa.com.au> Acked-by: Pali Rohár <pali.ro...@gmail.com> Reviewed-by: Andrew F. Davis <a...@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/li
[PATCH v4 05/10] power: supplies: bq27xxx: adds specific support for bq27510-g3 revision.
From: Chris Lapa 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 Acked-by: Pali Rohár Reviewed-by: Andrew F. Davis --- 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
[PATCH v4 07/10] power: supplies: bq27xxx: adds specific support for bq27520-g2 revision.
From: Chris Lapa 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 Acked-by: Pali Rohár Reviewed-by: Andrew F. Davis --- 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
[PATCH v4 04/10] power: supplies: bq27xxx: adds specific support for bq27510-g2 revision.
From: Chris Lapa <ch...@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 <ch...@lapa.com.au> Acked-by: Pali Rohár <pali.ro...@gmail.com> Reviewed-by: Andrew F. Davis <a...@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.
[PATCH v4 00/10] power: supply: bq27xxx: implement individual chip revision support
From: Chris Lapa <ch...@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
[PATCH v4 02/10] power: supplies: bq27xxx: adds specific support for bq27500/1 revision.
From: Chris Lapa <ch...@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 <ch...@lapa.com.au> Acked-by: Pali Rohár <pali.ro...@gmail.com> Reviewed-by: Andrew F. Davis <a...@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/i
[PATCH v4 04/10] power: supplies: bq27xxx: adds specific support for bq27510-g2 revision.
From: Chris Lapa 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 Acked-by: Pali Rohár Reviewed-by: Andrew F. Davis --- 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
[PATCH v4 00/10] power: supply: bq27xxx: implement individual chip revision support
From: Chris Lapa 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
[PATCH v4 02/10] power: supplies: bq27xxx: adds specific support for bq27500/1 revision.
From: Chris Lapa 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 Acked-by: Pali Rohár Reviewed-by: Andrew F. Davis --- 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
[PATCH v3 02/11] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future.
From: Chris Lapa <ch...@lapa.com.au> The BQ275XX definition exists only to satisfy backwards compatibility. tested: yes Signed-off-by: Chris Lapa <ch...@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
[PATCH v3 02/11] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future.
From: Chris Lapa The BQ275XX definition exists only to satisfy backwards compatibility. tested: yes Signed-off-by: Chris Lapa --- 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
[PATCH v3 07/11] power: supplies: bq275xx: adds specific support for bq27520-g1 revision.
From: Chris Lapa <ch...@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 <ch...@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
[PATCH v3 09/11] power: supplies: bq275xx: adds specific support for bq27520-g3 revision.
From: Chris Lapa <ch...@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 <ch...@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_ba
[PATCH v3 06/11] power: supplies: bq275xx: adds specific support for bq27510-g3 revision.
From: Chris Lapa <ch...@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 <ch...@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
[PATCH v3 06/11] power: supplies: bq275xx: adds specific support for bq27510-g3 revision.
From: Chris Lapa 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 --- 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
[PATCH v3 07/11] power: supplies: bq275xx: adds specific support for bq27520-g1 revision.
From: Chris Lapa 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 --- 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/pow
[PATCH v3 09/11] power: supplies: bq275xx: adds specific support for bq27520-g3 revision.
From: Chris Lapa 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 --- 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_batte
[PATCH v3 10/11] power: supplies: bq275xx: adds specific support for bq27520-g4 revision.
From: Chris Lapa <ch...@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 <ch...@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 @@
[PATCH v3 10/11] power: supplies: bq275xx: adds specific support for bq27520-g4 revision.
From: Chris Lapa 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 --- 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
[PATCH v3 08/11] power: supplies: bq275xx: adds specific support for bq27520-g2 revision.
From: Chris Lapa <ch...@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 <ch...@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 -
[PATCH v3 05/11] power: supplies: bq275xx: adds specific support for bq27510-g2 revision.
From: Chris Lapa <ch...@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 <ch...@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/bq27
[PATCH v3 11/11] power: supplies: bq27xxx: adds device tree binding documentation.
From: Chris Lapa <ch...@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 <ch...@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 000..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
[PATCH v3 08/11] power: supplies: bq275xx: adds specific support for bq27520-g2 revision.
From: Chris Lapa 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 --- 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 +++
[PATCH v3 05/11] power: supplies: bq275xx: adds specific support for bq27510-g2 revision.
From: Chris Lapa 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 --- 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/bq27x
[PATCH v3 11/11] power: supplies: bq27xxx: adds device tree binding documentation.
From: Chris Lapa 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 --- .../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 000..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
[PATCH v3 00/11] power: supply: bq275xx: implement individual chip revision support
From: Chris Lapa <ch...@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
[PATCH v3 00/11] power: supply: bq275xx: implement individual chip revision support
From: Chris Lapa 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
[PATCH v3 04/11] power: supplies: bq275xx: adds specific support for bq27510-g1 revision.
From: Chris Lapa <ch...@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 <ch...@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/bq27xx
[PATCH v3 01/11] power: supplies: bq275xx: move overtemp tests to a switch statement.
From: Chris Lapa <ch...@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 <ch...@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
[PATCH v3 03/11] power: supplies: bq275xx: adds specific support for bq27500/1 revision.
From: Chris Lapa <ch...@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 <ch...@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
[PATCH v3 03/11] power: supplies: bq275xx: adds specific support for bq27500/1 revision.
From: Chris Lapa 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 --- 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
[PATCH v3 04/11] power: supplies: bq275xx: adds specific support for bq27510-g1 revision.
From: Chris Lapa 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 --- 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_b
[PATCH v3 01/11] power: supplies: bq275xx: move overtemp tests to a switch statement.
From: Chris Lapa This is done for readability as the upcoming commits will add a lot of cases. tested: no Signed-off-by: Chris Lapa --- 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
Re: [PATCH v2 11/11] power: supplies: bq275xx: adds device tree binding documentation.
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 <ch...@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.
Re: [PATCH v2 11/11] power: supplies: bq275xx: adds device tree binding documentation.
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 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.
Re: [PATCH v2 01/11] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future.
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 <ch...@lapa.com.au> The BQ275XX definition exists only to satisfy backwards compatibility. tested: yes Signed-off-by: Chris Lapa <ch...@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?
Re: [PATCH v2 01/11] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future.
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 The BQ275XX definition exists only to satisfy backwards compatibility. tested: yes Signed-off-by: Chris Lapa [...] 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?
[PATCH v2 08/11] power: supplies: bq275xx: adds specific support for bq27520-g3 revision.
From: Chris Lapa <ch...@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 <ch...@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" }, { .compa
[PATCH v2 05/11] power: supplies: bq275xx: adds specific support for bq27510-g3 revision.
From: Chris Lapa <ch...@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 <ch...@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 dd
[PATCH v2 08/11] power: supplies: bq275xx: adds specific support for bq27520-g3 revision.
From: Chris Lapa 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 --- 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" }, { .compa
[PATCH v2 05/11] power: supplies: bq275xx: adds specific support for bq27510-g3 revision.
From: Chris Lapa 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 --- 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
[PATCH v2 09/11] power: supplies: bq275xx: adds specific support for bq27520-g4 revision.
From: Chris Lapa <ch...@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 <ch...@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" }, + { .compatibl
[PATCH v2 07/11] power: supplies: bq275xx: adds specific support for bq27520-g2 revision.
From: Chris Lapa <ch...@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 <ch...@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" }, {
[PATCH v2 09/11] power: supplies: bq275xx: adds specific support for bq27520-g4 revision.
From: Chris Lapa 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 --- 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" }, { .co
[PATCH v2 07/11] power: supplies: bq275xx: adds specific support for bq27520-g2 revision.
From: Chris Lapa 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 --- 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" }, + {
[PATCH v2 06/11] power: supplies: bq275xx: adds specific support for bq27520-g1 revision.
From: Chris Lapa <ch...@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 <ch...@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" }, + { .compatib
[PATCH v2 06/11] power: supplies: bq275xx: adds specific support for bq27520-g1 revision.
From: Chris Lapa 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 --- 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
[PATCH v2 04/11] power: supplies: bq275xx: adds specific support for bq27510-g2 revision.
From: Chris Lapa <ch...@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 <ch...@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" }, +
[PATCH v2 10/11] power: supply: bq275xx: cleanup over temperature flag check.
From: Chris Lapa <ch...@lapa.com.au> Separated the check out into its own function to make its functionality easier to understand. Signed-off-by: Chris Lapa <ch...@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
[PATCH v2 11/11] power: supplies: bq275xx: adds device tree binding documentation.
From: Chris Lapa <ch...@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 <ch...@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 000..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
[PATCH v2 04/11] power: supplies: bq275xx: adds specific support for bq27510-g2 revision.
From: Chris Lapa 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 --- 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" },
[PATCH v2 10/11] power: supply: bq275xx: cleanup over temperature flag check.
From: Chris Lapa Separated the check out into its own function to make its functionality easier to understand. Signed-off-by: Chris Lapa --- 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
[PATCH v2 11/11] power: supplies: bq275xx: adds device tree binding documentation.
From: Chris Lapa 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 --- .../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 000..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
[PATCH v2 03/11] power: supplies: bq275xx: adds specific support for bq27510-g1 revision.
From: Chris Lapa <ch...@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 <ch...@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
[PATCH v2 03/11] power: supplies: bq275xx: adds specific support for bq27510-g1 revision.
From: Chris Lapa 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 --- 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 = "t
[PATCH v2 00/11] power: supply: bq275xx: implement individual chip revision support
From: Chris Lapa <ch...@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
[PATCH v2 01/11] power: supplies: bq275xx: rename BQ27500 allow for deprecation in future.
From: Chris Lapa <ch...@lapa.com.au> The BQ275XX definition exists only to satisfy backwards compatibility. tested: yes Signed-off-by: Chris Lapa <ch...@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
[PATCH v2 02/11] power: supplies: bq275xx: adds specific support for bq27500/1 revision.
From: Chris Lapa <ch...@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 <ch...@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_ba
[PATCH v2 00/11] power: supply: bq275xx: implement individual chip revision support
From: Chris Lapa 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