power: bq27xxx_battery: Unique chip IDs
PATCH 1/1 power: bq27xxx_battery: Unique chip IDs
From: Liam Breck <[email protected]>
Assign every chip a unique ID, to enable power_supply_battery_info config for all supported chips. There are no functional changes to the driver.
Depends-on: power: bq27xxx_battery: Add power_supply_battery_info support
---
Andrew, let me know if you'd like me to include this in the other patchset.
drivers/power/supply/bq27xxx_battery.c | 94 +++++++++++++++++------------- drivers/power/supply/bq27xxx_battery_i2c.c | 14 ++--- include/linux/power/bq27xxx_battery.h | 15 +++-- 3 files changed, 71 insertions(+), 52 deletions(-)
drivers/power/supply/bq27xxx_battery.c +53 -41
@@ -117,8 +117,8 @@ enum bq27xxx_reg_index { };/* Register mappings */ -static u8 bq27xxx_regs[][BQ27XXX_REG_MAX ] = { - [BQ27000 ] = { +static u8 + bq27000_regs[BQ27XXX_REG_MAX ] = { [BQ27XXX_REG_CTRL ] =0x00 , [BQ27XXX_REG_TEMP ] =0x06 , [BQ27XXX_REG_INT_TEMP ] =INVALID_REG_ADDR ,
@@ -142,7 +142,7 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { [BQ27XXX_DM_DATA] = INVALID_REG_ADDR, [BQ27XXX_DM_CKSUM ] =INVALID_REG_ADDR , }, - [BQ27010] = { + bq27010_regs[BQ27XXX_REG_MAX ] = { [BQ27XXX_REG_CTRL ] =0x00 , [BQ27XXX_REG_TEMP ] =0x06 , [BQ27XXX_REG_INT_TEMP ] =INVALID_REG_ADDR ,
@@ -166,7 +166,7 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { [BQ27XXX_DM_DATA] = INVALID_REG_ADDR, [BQ27XXX_DM_CKSUM ] =INVALID_REG_ADDR , }, - [BQ27500] = { + bq27500_regs[BQ27XXX_REG_MAX ] = { [BQ27XXX_REG_CTRL ] =0x00 , [BQ27XXX_REG_TEMP ] =0x06 , [BQ27XXX_REG_INT_TEMP ] =0x28 ,
@@ -190,7 +190,7 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { [BQ27XXX_DM_DATA] = 0x40, [BQ27XXX_DM_CKSUM ] =0x60 , }, - [BQ27510] = { + bq27510_regs[BQ27XXX_REG_MAX ] = { [BQ27XXX_REG_CTRL ] =0x00 , [BQ27XXX_REG_TEMP ] =0x06 , [BQ27XXX_REG_INT_TEMP ] =0x28 ,
@@ -214,7 +214,7 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { [BQ27XXX_DM_DATA] = 0x40, [BQ27XXX_DM_CKSUM ] =0x60 , }, - [BQ27530] = { + bq27530_regs[BQ27XXX_REG_MAX ] = { [BQ27XXX_REG_CTRL ] =0x00 , [BQ27XXX_REG_TEMP ] =0x06 , [BQ27XXX_REG_INT_TEMP ] =0x32 ,
@@ -238,7 +238,7 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { [BQ27XXX_DM_DATA] = 0x40, [BQ27XXX_DM_CKSUM ] =0x60 , }, - [BQ27541] = { + bq27541_regs[BQ27XXX_REG_MAX ] = { [BQ27XXX_REG_CTRL ] =0x00 , [BQ27XXX_REG_TEMP ] =0x06 , [BQ27XXX_REG_INT_TEMP ] =0x28 ,
@@ -262,7 +262,7 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { [BQ27XXX_DM_DATA] = 0x40, [BQ27XXX_DM_CKSUM ] =0x60 , }, - [BQ27545] = { + bq27545_regs[BQ27XXX_REG_MAX ] = { [BQ27XXX_REG_CTRL ] =0x00 , [BQ27XXX_REG_TEMP ] =0x06 , [BQ27XXX_REG_INT_TEMP ] =0x28 ,
@@ -286,7 +286,7 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { [BQ27XXX_DM_DATA] = 0x40, [BQ27XXX_DM_CKSUM ] =0x60 , }, - [BQ27421] = { + bq27425_regs[BQ27XXX_REG_MAX ] = { [BQ27XXX_REG_CTRL ] =0x00 , [BQ27XXX_REG_TEMP ] =0x02 , [BQ27XXX_REG_INT_TEMP ] =0x1e ,
@@ -309,31 +309,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { [BQ27XXX_DM_BLOCK] = 0x3f, [BQ27XXX_DM_DATA] = 0x40, [BQ27XXX_DM_CKSUM] = 0x60, - }, - [BQ27425] = { - [BQ27XXX_REG_CTRL] = 0x00, - [BQ27XXX_REG_TEMP] = 0x02, - [BQ27XXX_REG_INT_TEMP] = 0x1e, - [BQ27XXX_REG_VOLT] = 0x04, - [BQ27XXX_REG_AI] = 0x10, - [BQ27XXX_REG_FLAGS] = 0x06, - [BQ27XXX_REG_TTE] = INVALID_REG_ADDR, - [BQ27XXX_REG_TTF] = INVALID_REG_ADDR, - [BQ27XXX_REG_TTES] = INVALID_REG_ADDR, - [BQ27XXX_REG_TTECP] = INVALID_REG_ADDR, - [BQ27XXX_REG_NAC] = 0x08, - [BQ27XXX_REG_FCC] = 0x0e, - [BQ27XXX_REG_CYCT] = INVALID_REG_ADDR, - [BQ27XXX_REG_AE] = INVALID_REG_ADDR, - [BQ27XXX_REG_SOC] = 0x1c, - [BQ27XXX_REG_DCAP] = 0x3c, - [BQ27XXX_REG_AP] = 0x18, - [BQ27XXX_DM_CTRL] = 0x61, - [BQ27XXX_DM_CLASS] = 0x3e, - [BQ27XXX_DM_BLOCK] = 0x3f, - [BQ27XXX_DM_DATA] = 0x40, - [BQ27XXX_DM_CKSUM] = 0x60, - }, + }; + +static u8 * bq27xxx_regs[] = { + [BQ27000 ] = bq27000_regs,/* really bq27200 */ + [BQ27010 ] = bq27010_regs,/* really bq27210 */ + [BQ27500 ] = bq27500_regs, + [BQ27510 ] = bq27510_regs, + [BQ27520 ] = bq27510_regs, + [BQ27530 ] = bq27530_regs, + [BQ27531 ] = bq27530_regs, + [BQ27541 ] = bq27541_regs, + [BQ27542 ] = bq27541_regs, + [BQ27546 ] = bq27541_regs, + [BQ27742 ] = bq27541_regs, + [BQ27545 ] = bq27545_regs, + [BQ27425 ] = bq27425_regs, + [BQ27421 ] = bq27425_regs, + [BQ27441 ] = bq27425_regs, + [BQ27621 ] = bq27425_regs, };static enum power_supply_property bq27000_battery_props[] = {
@@ -469,7 +463,7 @@ static enum power_supply_property bq27545_battery_props[] = { POWER_SUPPLY_PROP_MANUFACTURER, }; -static enum power_supply_property bq27421_battery_props[] = { +static enum power_supply_property bq27425_battery_props[] = {POWER_SUPPLY_PROP_STATUS ,POWER_SUPPLY_PROP_PRESENT ,POWER_SUPPLY_PROP_VOLTAGE_NOW ,
@@ -498,11 +492,18 @@ static struct {BQ27XXX_PROP (BQ27010 , bq27010_battery_props),BQ27XXX_PROP (BQ27500 , bq27500_battery_props),BQ27XXX_PROP (BQ27510 , bq27510_battery_props), +BQ27XXX_PROP (BQ27520 , bq27510_battery_props),BQ27XXX_PROP (BQ27530 , bq27530_battery_props), +BQ27XXX_PROP (BQ27531 , bq27530_battery_props),BQ27XXX_PROP (BQ27541 , bq27541_battery_props), +BQ27XXX_PROP (BQ27542 , bq27541_battery_props), +BQ27XXX_PROP (BQ27546 , bq27541_battery_props), +BQ27XXX_PROP (BQ27742 , bq27541_battery_props),BQ27XXX_PROP (BQ27545 , bq27545_battery_props), -BQ27XXX_PROP (BQ27421 , bq27421_battery_props), - BQ27XXX_PROP(BQ27425, bq27421_battery_props), +BQ27XXX_PROP (BQ27425 , bq27425_battery_props), +BQ27XXX_PROP (BQ27421 , bq27425_battery_props), +BQ27XXX_PROP (BQ27441 , bq27425_battery_props), + BQ27XXX_PROP(BQ27621, bq27425_battery_props), };static DEFINE_MUTEX (bq27xxx_list_lock);
@@ -796,7 +797,8 @@ static int bq27xxx_battery_set_cfgupdate(struct bq27xxx_device_info *di,static int bq27xxx_battery_write_dm_block (struct bq27xxx_device_info *di,struct bq27xxx_dm_buf *buf) { -bool cfgup = di->chip ==BQ27425 || di->chip ==BQ27421 ;/* || BQ27441 || BQ27621 */ +bool cfgup = di->chip ==BQ27425 || di->chip ==BQ27421 + || di->chip ==BQ27441 || di->chip ==BQ27621 ;int ret;if (!buf->updt)
@@ -1169,8 +1171,11 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)case BQ27545 :return flags & (BQ27XXX_FLAG_OTC |BQ27XXX_FLAG_OTD );case BQ27530 : +case BQ27531 :case BQ27421 :case BQ27425 : +case BQ27441 : +case BQ27621 :return flags &BQ27XXX_FLAG_OT ;default :return false;
@@ -1182,10 +1187,17 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)*/ static bool bq27xxx_battery_undertemp (struct bq27xxx_device_info *di,u16 flags) { -if (di->chip ==BQ27530 || di->chip ==BQ27421 || di->chip ==BQ27425 ) +switch (di->chip) { +case BQ27530 : +case BQ27531 : +case BQ27421 : +case BQ27425 : +case BQ27441 : +case BQ27621 :return flags &BQ27XXX_FLAG_UT ; - -return false; +default : +return false; + } }/*
drivers/power/supply/bq27xxx_battery_i2c.c +7 -7
@@ -230,18 +230,18 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = { { "bq27210", BQ27010 }, { "bq27500", BQ27500 }, { "bq27510", BQ27510 }, - { "bq27520", BQ27510 }, + { "bq27520", BQ27520 }, { "bq27530", BQ27530 }, - { "bq27531", BQ27530 }, + { "bq27531", BQ27531 }, { "bq27541", BQ27541 }, - { "bq27542", BQ27541 }, - { "bq27546", BQ27541 }, - { "bq27742", BQ27541 }, + { "bq27542", BQ27542 }, + { "bq27546", BQ27546 }, + { "bq27742", BQ27742 }, { "bq27545", BQ27545 }, { "bq27421", BQ27421 }, { "bq27425", BQ27425 }, - { "bq27441", BQ27425 }, - { "bq27621", BQ27425 }, + { "bq27441", BQ27441 }, + { "bq27621", BQ27621 }, {}, };MODULE_DEVICE_TABLE (i2c, bq27xxx_i2c_id_table);
include/linux/power/bq27xxx_battery.h +11 -4
@@ -2,15 +2,22 @@#define __LINUX_BQ27X00_BATTERY_H__enum bq27xxx_chip { -BQ27000 =1 ,/* bq27000, bq27200 */ -BQ27010 ,/* bq27010, bq27210 */ +BQ27000 =1 ,/* bq27200 */ +BQ27010 ,/* bq27210 */ BQ27500 ,/* bq27500 */ BQ27510 ,/* bq27510, bq27520 */ +BQ27520 ,BQ27530 ,/* bq27530, bq27531 */ +BQ27531 ,BQ27541 ,/* bq27541, bq27542, bq27546, bq27742 */ +BQ27542 , +BQ27546 , +BQ27742 ,BQ27545 ,/* bq27545 */ -BQ27421 ,/* bq27421 */ -BQ27425 ,/* bq27425, bq27441, bq27621 */ +BQ27425 ,/* bq27425, bq27421, bq27441, bq27621 */ +BQ27421 , +BQ27441 , +BQ27621 , };/**
Signature · 1 line
2.9.3
Quoted 11 lines · Liam Breck
From: Liam Breck <[email protected]>
Assign every chip a unique ID, to enable
power_supply_battery_infoconfig for all supported chips. There are no functional changes to the driver.Depends-on: power:
bq27xxx_battery: Addpower_supply_battery_infosupportSigned-off-by Liam Breck <[email protected]>---
Andrew, let me know if you'd like me to include this in the other patchset.
Why do we need this at all? It may be just bit too early for me, but I'm not seeing what this gets us, that couldn't be done before.
Quoted 108 lines
drivers/power/supply/bq27xxx_battery.c | 94 +++++++++++++++++------------- drivers/power/supply/bq27xxx_battery_i2c.c | 14 ++--- include/linux/power/bq27xxx_battery.h | 15 +++-- 3 files changed, 71 insertions(+), 52 deletions(-)drivers/power/supply/bq27xxx_battery.c +9
-29@@ -117,8 +117,8 @@ enum bq27xxx_reg_index { };/* Register mappings */ -static u8 bq27xxx_regs[][BQ27XXX_REG_MAX ] = { - [BQ27000 ] = { +static u8 + bq27000_regs[BQ27XXX_REG_MAX ] = { [BQ27XXX_REG_CTRL ] =0x00 , [BQ27XXX_REG_TEMP ] =0x06 , [BQ27XXX_REG_INT_TEMP ] =INVALID_REG_ADDR ,@@ -142,7 +142,7 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { [BQ27XXX_DM_DATA] = INVALID_REG_ADDR, [BQ27XXX_DM_CKSUM ] =INVALID_REG_ADDR , }, - [BQ27010] = { + bq27010_regs[BQ27XXX_REG_MAX ] = { [BQ27XXX_REG_CTRL ] =0x00 , [BQ27XXX_REG_TEMP ] =0x06 , [BQ27XXX_REG_INT_TEMP ] =INVALID_REG_ADDR ,@@ -166,7 +166,7 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { [BQ27XXX_DM_DATA] = INVALID_REG_ADDR, [BQ27XXX_DM_CKSUM ] =INVALID_REG_ADDR , }, - [BQ27500] = { + bq27500_regs[BQ27XXX_REG_MAX ] = { [BQ27XXX_REG_CTRL ] =0x00 , [BQ27XXX_REG_TEMP ] =0x06 , [BQ27XXX_REG_INT_TEMP ] =0x28 ,@@ -190,7 +190,7 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { [BQ27XXX_DM_DATA] = 0x40, [BQ27XXX_DM_CKSUM ] =0x60 , }, - [BQ27510] = { + bq27510_regs[BQ27XXX_REG_MAX ] = { [BQ27XXX_REG_CTRL ] =0x00 , [BQ27XXX_REG_TEMP ] =0x06 , [BQ27XXX_REG_INT_TEMP ] =0x28 ,@@ -214,7 +214,7 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { [BQ27XXX_DM_DATA] = 0x40, [BQ27XXX_DM_CKSUM ] =0x60 , }, - [BQ27530] = { + bq27530_regs[BQ27XXX_REG_MAX ] = { [BQ27XXX_REG_CTRL ] =0x00 , [BQ27XXX_REG_TEMP ] =0x06 , [BQ27XXX_REG_INT_TEMP ] =0x32 ,@@ -238,7 +238,7 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { [BQ27XXX_DM_DATA] = 0x40, [BQ27XXX_DM_CKSUM ] =0x60 , }, - [BQ27541] = { + bq27541_regs[BQ27XXX_REG_MAX ] = { [BQ27XXX_REG_CTRL ] =0x00 , [BQ27XXX_REG_TEMP ] =0x06 , [BQ27XXX_REG_INT_TEMP ] =0x28 ,@@ -262,7 +262,7 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { [BQ27XXX_DM_DATA] = 0x40, [BQ27XXX_DM_CKSUM ] =0x60 , }, - [BQ27545] = { + bq27545_regs[BQ27XXX_REG_MAX ] = { [BQ27XXX_REG_CTRL ] =0x00 , [BQ27XXX_REG_TEMP ] =0x06 , [BQ27XXX_REG_INT_TEMP ] =0x28 ,@@ -286,7 +286,7 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { [BQ27XXX_DM_DATA] = 0x40, [BQ27XXX_DM_CKSUM ] =0x60 , }, - [BQ27421] = { + bq27425_regs[BQ27XXX_REG_MAX ] = { [BQ27XXX_REG_CTRL ] =0x00 , [BQ27XXX_REG_TEMP ] =0x02 , [BQ27XXX_REG_INT_TEMP ] =0x1e ,@@ -309,31 +309,25 @@ static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { [BQ27XXX_DM_BLOCK] = 0x3f, [BQ27XXX_DM_DATA] = 0x40, [BQ27XXX_DM_CKSUM] = 0x60, - }, - [BQ27425] = { - [BQ27XXX_REG_CTRL ] =0x00 , - [BQ27XXX_REG_TEMP ] =0x02 , - [BQ27XXX_REG_INT_TEMP ] =0x1e , - [BQ27XXX_REG_VOLT ] =0x04 , - [BQ27XXX_REG_AI ] =0x10 , - [BQ27XXX_REG_FLAGS ] =0x06 , - [BQ27XXX_REG_TTE ] =INVALID_REG_ADDR , - [BQ27XXX_REG_TTF ] =INVALID_REG_ADDR , - [BQ27XXX_REG_TTES ] =INVALID_REG_ADDR , - [BQ27XXX_REG_TTECP ] =INVALID_REG_ADDR , - [BQ27XXX_REG_NAC ] =0x08 , - [BQ27XXX_REG_FCC ] =0x0e , - [BQ27XXX_REG_CYCT ] =INVALID_REG_ADDR , - [BQ27XXX_REG_AE ] =INVALID_REG_ADDR , - [BQ27XXX_REG_SOC ] =0x1c , - [BQ27XXX_REG_DCAP ] =0x3c , - [BQ27XXX_REG_AP ] =0x18 , - [BQ27XXX_DM_CTRL ] =0x61 ,
drivers/power/supply/bq27xxx_battery.c static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { · line 316
Quoted 10 lines
drivers/power/supply/bq27xxx_battery.c +5
-5- [BQ27XXX_DM_CLASS] = 0x3e, - [BQ27XXX_DM_BLOCK] = 0x3f, - [BQ27XXX_DM_DATA] = 0x40, - [BQ27XXX_DM_CKSUM] = 0x60, - }, + }; + +static u8 * bq27xxx_regs[] = { + [BQ27000 ] = bq27000_regs,/* really bq27200 */ + [BQ27010 ] = bq27010_regs,/* really bq27210 */
Not strictly true, the bq270x0 and bq272x0 are different chips, one has an HDQ bus and the other I2C, later chips have both ports on each chip.
Andrew
Quoted 152 lines
drivers/power/supply/bq27xxx_battery.c +39
-7+ [BQ27500] = bq27500_regs, + [BQ27510] = bq27510_regs, + [BQ27520] = bq27510_regs, + [BQ27530] = bq27530_regs, + [BQ27531] = bq27530_regs, + [BQ27541] = bq27541_regs, + [BQ27542] = bq27541_regs, + [BQ27546] = bq27541_regs, + [BQ27742] = bq27541_regs, + [BQ27545] = bq27545_regs, + [BQ27425] = bq27425_regs, + [BQ27421] = bq27425_regs, + [BQ27441] = bq27425_regs, + [BQ27621] = bq27425_regs, };static enum power_supply_property bq27000_battery_props[] = {@@ -469,7 +463,7 @@ static enum power_supply_property bq27545_battery_props[] = { POWER_SUPPLY_PROP_MANUFACTURER, }; -static enum power_supply_property bq27421_battery_props[] = { +static enum power_supply_property bq27425_battery_props[] = {POWER_SUPPLY_PROP_STATUS ,POWER_SUPPLY_PROP_PRESENT ,POWER_SUPPLY_PROP_VOLTAGE_NOW ,@@ -498,11 +492,18 @@ static struct {BQ27XXX_PROP (BQ27010 , bq27010_battery_props),BQ27XXX_PROP (BQ27500 , bq27500_battery_props),BQ27XXX_PROP (BQ27510 , bq27510_battery_props), +BQ27XXX_PROP (BQ27520 , bq27510_battery_props),BQ27XXX_PROP (BQ27530 , bq27530_battery_props), +BQ27XXX_PROP (BQ27531 , bq27530_battery_props),BQ27XXX_PROP (BQ27541 , bq27541_battery_props), +BQ27XXX_PROP (BQ27542 , bq27541_battery_props), +BQ27XXX_PROP (BQ27546 , bq27541_battery_props), +BQ27XXX_PROP (BQ27742 , bq27541_battery_props),BQ27XXX_PROP (BQ27545 , bq27545_battery_props), -BQ27XXX_PROP (BQ27421 , bq27421_battery_props), - BQ27XXX_PROP(BQ27425, bq27421_battery_props), +BQ27XXX_PROP (BQ27425 , bq27425_battery_props), +BQ27XXX_PROP (BQ27421 , bq27425_battery_props), +BQ27XXX_PROP (BQ27441 , bq27425_battery_props), + BQ27XXX_PROP(BQ27621, bq27425_battery_props), };static DEFINE_MUTEX (bq27xxx_list_lock);@@ -796,7 +797,8 @@ static int bq27xxx_battery_set_cfgupdate(struct bq27xxx_device_info *di,static int bq27xxx_battery_write_dm_block (struct bq27xxx_device_info *di,struct bq27xxx_dm_buf *buf) { -bool cfgup = di->chip ==BQ27425 || di->chip ==BQ27421 ;/* || BQ27441 || BQ27621 */ +bool cfgup = di->chip ==BQ27425 || di->chip ==BQ27421 + || di->chip ==BQ27441 || di->chip ==BQ27621 ;int ret;if (!buf->updt)@@ -1169,8 +1171,11 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)case BQ27545 :return flags & (BQ27XXX_FLAG_OTC |BQ27XXX_FLAG_OTD );case BQ27530 : +case BQ27531 :case BQ27421 :case BQ27425 : +case BQ27441 : +case BQ27621 :return flags &BQ27XXX_FLAG_OT ;default :return false;@@ -1182,10 +1187,17 @@ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags)*/ static bool bq27xxx_battery_undertemp (struct bq27xxx_device_info *di,u16 flags) { -if (di->chip ==BQ27530 || di->chip ==BQ27421 || di->chip ==BQ27425 ) +switch (di->chip) { +case BQ27530 : +case BQ27531 : +case BQ27421 : +case BQ27425 : +case BQ27441 : +case BQ27621 :return flags &BQ27XXX_FLAG_UT ; - -return false; +default : +return false; + } }/* drivers/power/supply/bq27xxx_battery_i2c.c +7
-7@@ -230,18 +230,18 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = { { "bq27210", BQ27010 }, { "bq27500", BQ27500 }, { "bq27510", BQ27510 }, - { "bq27520", BQ27510 }, + { "bq27520", BQ27520 }, { "bq27530", BQ27530 }, - { "bq27531", BQ27530 }, + { "bq27531", BQ27531 }, { "bq27541", BQ27541 }, - { "bq27542", BQ27541 }, - { "bq27546", BQ27541 }, - { "bq27742", BQ27541 }, + { "bq27542", BQ27542 }, + { "bq27546", BQ27546 }, + { "bq27742", BQ27742 }, { "bq27545", BQ27545 }, { "bq27421", BQ27421 }, { "bq27425", BQ27425 }, - { "bq27441", BQ27425 }, - { "bq27621", BQ27425 }, + { "bq27441", BQ27441 }, + { "bq27621", BQ27621 }, {}, };MODULE_DEVICE_TABLE (i2c, bq27xxx_i2c_id_table);include/linux/power/bq27xxx_battery.h +11
-4@@ -2,15 +2,22 @@#define __LINUX_BQ27X00_BATTERY_H__enum bq27xxx_chip { -BQ27000 =1 ,/* bq27000, bq27200 */ -BQ27010 ,/* bq27010, bq27210 */ +BQ27000 =1 ,/* bq27200 */ +BQ27010 ,/* bq27210 */ BQ27500 ,/* bq27500 */ BQ27510 ,/* bq27510, bq27520 */ +BQ27520 ,BQ27530 ,/* bq27530, bq27531 */ +BQ27531 ,BQ27541 ,/* bq27541, bq27542, bq27546, bq27742 */ +BQ27542 , +BQ27546 , +BQ27742 ,BQ27545 ,/* bq27545 */ -BQ27421 ,/* bq27421 */ -BQ27425 ,/* bq27425, bq27441, bq27621 */ +BQ27425 ,/* bq27425, bq27421, bq27441, bq27621 */ +BQ27421 , +BQ27441 , +BQ27621 , };/**
Quoted 7 lines · Andrew F. Davis
Quoted 6 lines · Liam Breck
From: Liam Breck <[email protected]>
Assign every chip a unique ID, to enable
power_supply_battery_infoconfig for all supported chips. There are no functional changes to the driver.
Quoted 8 lines
Quoted 5 lines
Depends-on: power:
bq27xxx_battery: Addpower_supply_battery_infosupportSigned-off-by Liam Breck <[email protected]>---
Andrew, let me know if you'd like me to include this in the other patchset.Why do we need this at all? It may be just bit too early for me, but I'm not seeing what this gets us, that couldn't be done before.
Sadly, the chips mostly have different dm_reg tables, so we need the real chip ID to give each a table.
My last rev only supported IDs associated with a single chip: 500, 545, 421. In the 421 case, we had to split off that ID.
Quoted 10 lines
Quoted 9 lines
drivers/power/supply/bq27xxx_battery.c | 94 +++++++++++++++++------------- drivers/power/supply/bq27xxx_battery_i2c.c | 14 ++--- include/linux/power/bq27xxx_battery.h | 15 +++-- 3 files changed, 71 insertions(+), 52 deletions(-)drivers/power/supply/bq27xxx_battery.c +0
-0
Quoted 6 lines
drivers/power/supply/bq27xxx_battery.c static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { · line 316
Quoted 3 lines
drivers/power/supply/bq27xxx_battery.c +3
-0+static u8 * bq27xxx_regs[] = { + [BQ27000 ] = bq27000_regs,/* really bq27200 */ + [BQ27010 ] = bq27010_regs,/* really bq27210 */ Not strictly true, the bq270x0 and bq272x0 are different chips, one has an HDQ bus and the other I2C, later chips have both ports on each chip.
Oh, I saw only the 200 & 210 in _i2c.c, and forgot that the driver supports another interface. I'll remove those comments.
I won't separate these IDs as none of them support DM update.
Think you could do some testing soon?
Quoted 14 lines · Liam Breck
Quoted 13 lines · Andrew F. Davis
Quoted 11 lines · Liam Breck
From: Liam Breck <[email protected]>
Assign every chip a unique ID, to enable
power_supply_battery_infoconfig for all supported chips. There are no functional changes to the driver.Depends-on: power:
bq27xxx_battery: Addpower_supply_battery_infosupportSigned-off-by Liam Breck <[email protected]>---
Andrew, let me know if you'd like me to include this in the other patchset.
Quoted 9 lines
Quoted 2 lines
Why do we need this at all? It may be just bit too early for me, but I'm not seeing what this gets us, that couldn't be done before.
Sadly, the chips mostly have different
dm_regtables, so we need the real chip ID to give each a table.My last rev only supported IDs associated with a single chip: 500, 545, 421. In the 421 case, we had to split off that ID.
Okay, then if we need a new ID lets add it. Going back to having a table of pointers is a step back, we used to do it this way, but every-time a new chip appeared or we found a delta in an existing chip(s) (like you are finding now) we would have to re-organize the pointer table and other associated tables, it is much cleaner and easier to review (more important than code size by orders of magnitude IMHO) to just add a new entry into the big master table of registers.
Quoted 18 lines
Quoted 11 lines
Quoted 10 lines
drivers/power/supply/bq27xxx_battery.c | 94 +++++++++++++++++------------- drivers/power/supply/bq27xxx_battery_i2c.c | 14 ++--- include/linux/power/bq27xxx_battery.h | 15 +++-- 3 files changed, 71 insertions(+), 52 deletions(-)drivers/power/supply/bq27xxx_battery.c +0
-0Quoted 6 lines
drivers/power/supply/bq27xxx_battery.c static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { · line 316
Quoted 3 lines
drivers/power/supply/bq27xxx_battery.c +3
-0+static u8 * bq27xxx_regs[] = { + [BQ27000 ] = bq27000_regs,/* really bq27200 */ + [BQ27010 ] = bq27010_regs,/* really bq27210 */ Not strictly true, the bq270x0 and bq272x0 are different chips, one has an HDQ bus and the other I2C, later chips have both ports on each chip.
Quoted 7 lines
Oh, I saw only the 200 & 210 in
_i2c.c, and forgot that the driver supports another interface. I'll remove those comments.I won't separate these IDs as none of them support DM update.
Think you could do some testing soon?
Yeah, I could probably fit some testing into my schedule, I'll see what v9 looks like before I unpack the boards.
Quoted 25 lines · Andrew F. Davis
Quoted 14 lines · Liam Breck
Quoted 13 lines · Andrew F. Davis
Quoted 11 lines · Liam Breck
From: Liam Breck <[email protected]>
Assign every chip a unique ID, to enable
power_supply_battery_infoconfig for all supported chips. There are no functional changes to the driver.Depends-on: power:
bq27xxx_battery: Addpower_supply_battery_infosupportSigned-off-by Liam Breck <[email protected]>---
Andrew, let me know if you'd like me to include this in the other patchset.Quoted 9 lines
Quoted 2 lines
Why do we need this at all? It may be just bit too early for me, but I'm not seeing what this gets us, that couldn't be done before.
Sadly, the chips mostly have different
dm_regtables, so we need the real chip ID to give each a table.My last rev only supported IDs associated with a single chip: 500, 545, 421. In the 421 case, we had to split off that ID.
Quoted 7 lines
Okay, then if we need a new ID lets add it. Going back to having a table of pointers is a step back, we used to do it this way, but every-time a new chip appeared or we found a delta in an existing chip(s) (like you are finding now) we would have to re-organize the pointer table and other associated tables, it is much cleaner and easier to review (more important than code size by orders of magnitude IMHO) to just add a new entry into the big master table of registers.
There were 8 mostly unique reg tables, and you'd need 8 dups to make all the IDs explicit.
You're already using a table of pointers for the property lists.
I don't see how adding an entry to a pointer table is worse than adding an entire reg table. Sure, now and then you'd need to add both.
Quoted 27 lines
Quoted 17 lines
Quoted 10 lines
Quoted 9 lines
drivers/power/supply/bq27xxx_battery.c | 94 +++++++++++++++++------------- drivers/power/supply/bq27xxx_battery_i2c.c | 14 ++--- include/linux/power/bq27xxx_battery.h | 15 +++-- 3 files changed, 71 insertions(+), 52 deletions(-)drivers/power/supply/bq27xxx_battery.c +0
-0Quoted 6 lines
drivers/power/supply/bq27xxx_battery.c static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { · line 316
Quoted 3 lines
drivers/power/supply/bq27xxx_battery.c +3
-0+static u8 * bq27xxx_regs[] = { + [BQ27000 ] = bq27000_regs,/* really bq27200 */ + [BQ27010 ] = bq27010_regs,/* really bq27210 */ Not strictly true, the bq270x0 and bq272x0 are different chips, one has an HDQ bus and the other I2C, later chips have both ports on each chip.
Quoted 7 lines
Oh, I saw only the 200 & 210 in
_i2c.c, and forgot that the driver supports another interface. I'll remove those comments.I won't separate these IDs as none of them support DM update.
Think you could do some testing soon?
Yeah, I could probably fit some testing into my schedule, I'll see what v9 looks like before I unpack the boards.
Quoted 34 lines · Liam Breck
Quoted 25 lines · Andrew F. Davis
Quoted 14 lines · Liam Breck
Quoted 13 lines · Andrew F. Davis
Quoted 11 lines · Liam Breck
From: Liam Breck <[email protected]>
Assign every chip a unique ID, to enable
power_supply_battery_infoconfig for all supported chips. There are no functional changes to the driver.Depends-on: power:
bq27xxx_battery: Addpower_supply_battery_infosupportSigned-off-by Liam Breck <[email protected]>---
Andrew, let me know if you'd like me to include this in the other patchset.Quoted 9 lines
Quoted 2 lines
Why do we need this at all? It may be just bit too early for me, but I'm not seeing what this gets us, that couldn't be done before.
Sadly, the chips mostly have different
dm_regtables, so we need the real chip ID to give each a table.My last rev only supported IDs associated with a single chip: 500, 545, 421. In the 421 case, we had to split off that ID.
Quoted 7 lines
Okay, then if we need a new ID lets add it. Going back to having a table of pointers is a step back, we used to do it this way, but every-time a new chip appeared or we found a delta in an existing chip(s) (like you are finding now) we would have to re-organize the pointer table and other associated tables, it is much cleaner and easier to review (more important than code size by orders of magnitude IMHO) to just add a new entry into the big master table of registers.
Quoted 3 lines
There were 8 mostly unique reg tables, and you'd need 8 dups to make all the IDs explicit.
Why do all IDs need to be explicit, most have the same register set.
Quoted 32 lines
You're already using a table of pointers for the property lists.
I don't see how adding an entry to a pointer table is worse than adding an entire reg table. Sure, now and then you'd need to add both.
Quoted 27 lines
Quoted 17 lines
Quoted 10 lines
Quoted 9 lines
drivers/power/supply/bq27xxx_battery.c | 94 +++++++++++++++++------------- drivers/power/supply/bq27xxx_battery_i2c.c | 14 ++--- include/linux/power/bq27xxx_battery.h | 15 +++-- 3 files changed, 71 insertions(+), 52 deletions(-)drivers/power/supply/bq27xxx_battery.c +0
-0Quoted 6 lines
drivers/power/supply/bq27xxx_battery.c static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { · line 316
Quoted 3 lines
drivers/power/supply/bq27xxx_battery.c +3
-0+static u8 * bq27xxx_regs[] = { + [BQ27000 ] = bq27000_regs,/* really bq27200 */ + [BQ27010 ] = bq27010_regs,/* really bq27210 */ Not strictly true, the bq270x0 and bq272x0 are different chips, one has an HDQ bus and the other I2C, later chips have both ports on each chip.
Quoted 7 lines
Oh, I saw only the 200 & 210 in
_i2c.c, and forgot that the driver supports another interface. I'll remove those comments.I won't separate these IDs as none of them support DM update.
Think you could do some testing soon?
Yeah, I could probably fit some testing into my schedule, I'll see what v9 looks like before I unpack the boards.
Quoted 35 lines · Andrew F. Davis
Quoted 34 lines · Liam Breck
Quoted 32 lines · Andrew F. Davis
Quoted 14 lines · Liam Breck
Quoted 13 lines · Andrew F. Davis
Quoted 11 lines · Liam Breck
From: Liam Breck <[email protected]>
Assign every chip a unique ID, to enable
power_supply_battery_infoconfig for all supported chips. There are no functional changes to the driver.Depends-on: power:
bq27xxx_battery: Addpower_supply_battery_infosupportSigned-off-by Liam Breck <[email protected]>---
Andrew, let me know if you'd like me to include this in the other patchset.Quoted 9 lines
Quoted 2 lines
Why do we need this at all? It may be just bit too early for me, but I'm not seeing what this gets us, that couldn't be done before.
Sadly, the chips mostly have different
dm_regtables, so we need the real chip ID to give each a table.My last rev only supported IDs associated with a single chip: 500, 545, 421. In the 421 case, we had to split off that ID.
Okay, then if we need a new ID lets add it. Going back to having a table of pointers is a step back, we used to do it this way, but every-time a new chip appeared or we found a delta in an existing chip(s) (like you are finding now) we would have to re-organize the pointer table and other associated tables, it is much cleaner and easier to review (more important than code size by orders of magnitude IMHO) to just add a new entry into the big master table of registers.
Quoted 5 lines
Quoted 3 lines
There were 8 mostly unique reg tables, and you'd need 8 dups to make all the IDs explicit.
Why do all IDs need to be explicit, most have the same register set.
The DM registers are different. See:
bq27500_dm_regs[]
bq27545_dm_regs[]
bq27421_dm_regs[]
bq27425_dm_regs[]
bq27621_dm_regs[]
Quoted 32 lines
Quoted 32 lines
You're already using a table of pointers for the property lists.
I don't see how adding an entry to a pointer table is worse than adding an entire reg table. Sure, now and then you'd need to add both.
Quoted 27 lines
Quoted 17 lines
Quoted 10 lines
Quoted 9 lines
drivers/power/supply/bq27xxx_battery.c | 94 +++++++++++++++++------------- drivers/power/supply/bq27xxx_battery_i2c.c | 14 ++--- include/linux/power/bq27xxx_battery.h | 15 +++-- 3 files changed, 71 insertions(+), 52 deletions(-)drivers/power/supply/bq27xxx_battery.c +0
-0Quoted 6 lines
drivers/power/supply/bq27xxx_battery.c static u8 bq27xxx_regs[][BQ27XXX_REG_MAX] = { · line 316
Quoted 3 lines
drivers/power/supply/bq27xxx_battery.c +3
-0+static u8 * bq27xxx_regs[] = { + [BQ27000 ] = bq27000_regs,/* really bq27200 */ + [BQ27010 ] = bq27010_regs,/* really bq27210 */ Not strictly true, the bq270x0 and bq272x0 are different chips, one has an HDQ bus and the other I2C, later chips have both ports on each chip.
Quoted 7 lines
Oh, I saw only the 200 & 210 in
_i2c.c, and forgot that the driver supports another interface. I'll remove those comments.I won't separate these IDs as none of them support DM update.
Think you could do some testing soon?
Yeah, I could probably fit some testing into my schedule, I'll see what v9 looks like before I unpack the boards.
Quoted 40 lines · Liam Breck
Quoted 39 lines · Andrew F. Davis
Quoted 37 lines · Liam Breck
Quoted 25 lines · Andrew F. Davis
Quoted 14 lines · Liam Breck
Quoted 13 lines · Andrew F. Davis
Quoted 11 lines · Liam Breck
From: Liam Breck <[email protected]>
Assign every chip a unique ID, to enable
power_supply_battery_infoconfig for all supported chips. There are no functional changes to the driver.Depends-on: power:
bq27xxx_battery: Addpower_supply_battery_infosupportSigned-off-by Liam Breck <[email protected]>---
Andrew, let me know if you'd like me to include this in the other patchset.Quoted 9 lines
Quoted 2 lines
Why do we need this at all? It may be just bit too early for me, but I'm not seeing what this gets us, that couldn't be done before.
Sadly, the chips mostly have different
dm_regtables, so we need the real chip ID to give each a table.My last rev only supported IDs associated with a single chip: 500, 545, 421. In the 421 case, we had to split off that ID.
Quoted 7 lines
Okay, then if we need a new ID lets add it. Going back to having a table of pointers is a step back, we used to do it this way, but every-time a new chip appeared or we found a delta in an existing chip(s) (like you are finding now) we would have to re-organize the pointer table and other associated tables, it is much cleaner and easier to review (more important than code size by orders of magnitude IMHO) to just add a new entry into the big master table of registers.
There were 8 mostly unique reg tables, and you'd need 8 dups to make all the IDs explicit.
Quoted 8 lines
Quoted 1 line
Why do all IDs need to be explicit, most have the same register set.
The DM registers are different. See:
bq27500_dm_regs[]
bq27545_dm_regs[]
bq27421_dm_regs[]
bq27425_dm_regs[]
bq27621_dm_regs[]
Another way to handle this is using a separate field for the dm_regs[] index, e.g. di->dmid.
That's a smaller patch, roughly +20 LoC.
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
You're already using a table of pointers for the property lists.
I don't see how adding an entry to a pointer table is worse than adding an entire reg table. Sure, now and then you'd need to add both.
Quoted 27 lines
Quoted 17 lines
Quoted 10 lines
Quoted 9 lines
drivers/power/supply/bq27xxx_battery.c | 94 +++++++++++++++++------------- drivers/power/supply/bq27xxx_battery_i2c.c | 14 ++--- include/linux/power/bq27xxx_battery.h | 15 +++-- 3 files changed, 71 insertions(+), 52 deletions(-)drivers/power/supply/bq27xxx_battery.c +0
-0Quoted 6 lines
drivers/power/supply/bq27xxx_battery.c
Quoted 3 lines
drivers/power/supply/bq27xxx_battery.c +3
-0+static u8 * bq27xxx_regs[] = { + [BQ27000 ] = bq27000_regs,/* really bq27200 */ + [BQ27010 ] = bq27010_regs,/* really bq27210 */ Not strictly true, the bq270x0 and bq272x0 are different chips, one has an HDQ bus and the other I2C, later chips have both ports on each chip.
Quoted 7 lines
Oh, I saw only the 200 & 210 in
_i2c.c, and forgot that the driver supports another interface. I'll remove those comments.I won't separate these IDs as none of them support DM update.
Think you could do some testing soon?
Yeah, I could probably fit some testing into my schedule, I'll see what v9 looks like before I unpack the boards.
Quoted 50 lines · Liam Breck
Quoted 40 lines · Liam Breck
Quoted 39 lines · Andrew F. Davis
Quoted 37 lines · Liam Breck
Quoted 25 lines · Andrew F. Davis
Quoted 14 lines · Liam Breck
Quoted 13 lines · Andrew F. Davis
Quoted 11 lines · Liam Breck
From: Liam Breck <[email protected]>
Assign every chip a unique ID, to enable
power_supply_battery_infoconfig for all supported chips. There are no functional changes to the driver.Depends-on: power:
bq27xxx_battery: Addpower_supply_battery_infosupportSigned-off-by Liam Breck <[email protected]>---
Andrew, let me know if you'd like me to include this in the other patchset.Quoted 9 lines
Quoted 2 lines
Why do we need this at all? It may be just bit too early for me, but I'm not seeing what this gets us, that couldn't be done before.
Sadly, the chips mostly have different
dm_regtables, so we need the real chip ID to give each a table.My last rev only supported IDs associated with a single chip: 500, 545, 421. In the 421 case, we had to split off that ID.
Quoted 7 lines
Okay, then if we need a new ID lets add it. Going back to having a table of pointers is a step back, we used to do it this way, but every-time a new chip appeared or we found a delta in an existing chip(s) (like you are finding now) we would have to re-organize the pointer table and other associated tables, it is much cleaner and easier to review (more important than code size by orders of magnitude IMHO) to just add a new entry into the big master table of registers.
There were 8 mostly unique reg tables, and you'd need 8 dups to make all the IDs explicit.
Quoted 8 lines
Quoted 1 line
Why do all IDs need to be explicit, most have the same register set.
The DM registers are different. See:
bq27500_dm_regs[]
bq27545_dm_regs[]
bq27421_dm_regs[]
bq27425_dm_regs[]
bq27621_dm_regs[]
Quoted 5 lines
Another way to handle this is using a separate field for the dm_regs[] index, e.g.
di->dmid.That's a smaller patch, roughly +20 LoC.
This might work better
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
You're already using a table of pointers for the property lists.
I don't see how adding an entry to a pointer table is worse than adding an entire reg table. Sure, now and then you'd need to add both.
Quoted 27 lines
Quoted 17 lines
Quoted 10 lines
Quoted 9 lines
drivers/power/supply/bq27xxx_battery.c | 94 +++++++++++++++++------------- drivers/power/supply/bq27xxx_battery_i2c.c | 14 ++--- include/linux/power/bq27xxx_battery.h | 15 +++-- 3 files changed, 71 insertions(+), 52 deletions(-)drivers/power/supply/bq27xxx_battery.c +0
-0Quoted 6 lines
drivers/power/supply/bq27xxx_battery.c
Quoted 3 lines
drivers/power/supply/bq27xxx_battery.c +3
-0+static u8 * bq27xxx_regs[] = { + [BQ27000 ] = bq27000_regs,/* really bq27200 */ + [BQ27010 ] = bq27010_regs,/* really bq27210 */ Not strictly true, the bq270x0 and bq272x0 are different chips, one has an HDQ bus and the other I2C, later chips have both ports on each chip.
Quoted 7 lines
Oh, I saw only the 200 & 210 in
_i2c.c, and forgot that the driver supports another interface. I'll remove those comments.I won't separate these IDs as none of them support DM update.
Think you could do some testing soon?
Yeah, I could probably fit some testing into my schedule, I'll see what v9 looks like before I unpack the boards.
Quoted 58 lines · Andrew F. Davis
Quoted 57 lines · Andrew F. Davis
Quoted 55 lines · Liam Breck
Quoted 40 lines · Liam Breck
Quoted 39 lines · Andrew F. Davis
Quoted 37 lines · Liam Breck
Quoted 25 lines · Andrew F. Davis
Quoted 14 lines · Liam Breck
Quoted 13 lines · Andrew F. Davis
Quoted 11 lines · Liam Breck
From: Liam Breck <[email protected]>
Assign every chip a unique ID, to enable
power_supply_battery_infoconfig for all supported chips. There are no functional changes to the driver.Depends-on: power:
bq27xxx_battery: Addpower_supply_battery_infosupportSigned-off-by Liam Breck <[email protected]>---
Andrew, let me know if you'd like me to include this in the other patchset.Quoted 9 lines
Quoted 2 lines
Why do we need this at all? It may be just bit too early for me, but I'm not seeing what this gets us, that couldn't be done before.
Sadly, the chips mostly have different
dm_regtables, so we need the real chip ID to give each a table.My last rev only supported IDs associated with a single chip: 500, 545, 421. In the 421 case, we had to split off that ID.
Quoted 7 lines
Okay, then if we need a new ID lets add it. Going back to having a table of pointers is a step back, we used to do it this way, but every-time a new chip appeared or we found a delta in an existing chip(s) (like you are finding now) we would have to re-organize the pointer table and other associated tables, it is much cleaner and easier to review (more important than code size by orders of magnitude IMHO) to just add a new entry into the big master table of registers.
There were 8 mostly unique reg tables, and you'd need 8 dups to make all the IDs explicit.
Quoted 8 lines
Quoted 1 line
Why do all IDs need to be explicit, most have the same register set.
The DM registers are different. See:
bq27500_dm_regs[]
bq27545_dm_regs[]
bq27421_dm_regs[]
bq27425_dm_regs[]
bq27621_dm_regs[]Another way to handle this is using a separate field for the dm_regs[] index, e.g.
di->dmid.That's a smaller patch, roughly +20 LoC.
Quoted 6 lines
Quoted 2 lines
This might work better
Hmmm, looking at the other patch, I think I'll take that back, I guess I'm not so apposed to this method seeing what would need to be done otherwise...
I'm strongly in favor of the newer, shorter patch, with .chip & .dmid. It's much less work to maintain than the .chip-only approach.
I can set .dmid instead of .chip in the probe functions if that makes it clearer.
BTW the enum values should be explicit in any case, since they appear in platform_data objects outside the driver.
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
You're already using a table of pointers for the property lists.
I don't see how adding an entry to a pointer table is worse than adding an entire reg table. Sure, now and then you'd need to add both.
Quoted 27 lines
Quoted 17 lines
Quoted 10 lines
Quoted 9 lines
drivers/power/supply/bq27xxx_battery.c | 94 +++++++++++++++++------------- drivers/power/supply/bq27xxx_battery_i2c.c | 14 ++--- include/linux/power/bq27xxx_battery.h | 15 +++-- 3 files changed, 71 insertions(+), 52 deletions(-)drivers/power/supply/bq27xxx_battery.c +0
-0Quoted 6 lines
drivers/power/supply/bq27xxx_battery.c
Quoted 3 lines
drivers/power/supply/bq27xxx_battery.c +3
-0+static u8 * bq27xxx_regs[] = { + [BQ27000 ] = bq27000_regs,/* really bq27200 */ + [BQ27010 ] = bq27010_regs,/* really bq27210 */ Not strictly true, the bq270x0 and bq272x0 are different chips, one has an HDQ bus and the other I2C, later chips have both ports on each chip.
Quoted 7 lines
Oh, I saw only the 200 & 210 in
_i2c.c, and forgot that the driver supports another interface. I'll remove those comments.I won't separate these IDs as none of them support DM update.
Think you could do some testing soon?
Yeah, I could probably fit some testing into my schedule, I'll see what v9 looks like before I unpack the boards.
Quoted 66 lines · Liam Breck
Quoted 58 lines · Andrew F. Davis
Quoted 57 lines · Andrew F. Davis
Quoted 55 lines · Liam Breck
Quoted 40 lines · Liam Breck
Quoted 39 lines · Andrew F. Davis
Quoted 37 lines · Liam Breck
Quoted 25 lines · Andrew F. Davis
Quoted 14 lines · Liam Breck
Quoted 13 lines · Andrew F. Davis
Quoted 11 lines · Liam Breck
From: Liam Breck <[email protected]>
Assign every chip a unique ID, to enable
power_supply_battery_infoconfig for all supported chips. There are no functional changes to the driver.Depends-on: power:
bq27xxx_battery: Addpower_supply_battery_infosupportSigned-off-by Liam Breck <[email protected]>---
Andrew, let me know if you'd like me to include this in the other patchset.Quoted 9 lines
Quoted 2 lines
Why do we need this at all? It may be just bit too early for me, but I'm not seeing what this gets us, that couldn't be done before.
Sadly, the chips mostly have different
dm_regtables, so we need the real chip ID to give each a table.My last rev only supported IDs associated with a single chip: 500, 545, 421. In the 421 case, we had to split off that ID.
Quoted 7 lines
Okay, then if we need a new ID lets add it. Going back to having a table of pointers is a step back, we used to do it this way, but every-time a new chip appeared or we found a delta in an existing chip(s) (like you are finding now) we would have to re-organize the pointer table and other associated tables, it is much cleaner and easier to review (more important than code size by orders of magnitude IMHO) to just add a new entry into the big master table of registers.
There were 8 mostly unique reg tables, and you'd need 8 dups to make all the IDs explicit.
Quoted 8 lines
Quoted 1 line
Why do all IDs need to be explicit, most have the same register set.
The DM registers are different. See:
bq27500_dm_regs[]
bq27545_dm_regs[]
bq27421_dm_regs[]
bq27425_dm_regs[]
bq27621_dm_regs[]Another way to handle this is using a separate field for the dm_regs[] index, e.g.
di->dmid.That's a smaller patch, roughly +20 LoC.
Quoted 6 lines
Quoted 2 lines
This might work better
Hmmm, looking at the other patch, I think I'll take that back, I guess I'm not so apposed to this method seeing what would need to be done otherwise...
Quoted 9 lines
I'm strongly in favor of the newer, shorter patch, with .chip & .dmid. It's much less work to maintain than the .chip-only approach.
I can set .dmid instead of .chip in the probe functions if that makes it clearer.
BTW the enum values should be explicit in any case, since they appear in
platform_dataobjects outside the driver.
The only part I didn't like was the duplicate enum values, each chip should have one unique ID, I think what ever way you prefer would work for the table structure, lets just keep the chip ID enums clean.
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
You're already using a table of pointers for the property lists.
I don't see how adding an entry to a pointer table is worse than adding an entire reg table. Sure, now and then you'd need to add both.
Quoted 27 lines
Quoted 17 lines
Quoted 10 lines
Quoted 9 lines
drivers/power/supply/bq27xxx_battery.c | 94 +++++++++++++++++------------- drivers/power/supply/bq27xxx_battery_i2c.c | 14 ++--- include/linux/power/bq27xxx_battery.h | 15 +++-- 3 files changed, 71 insertions(+), 52 deletions(-)drivers/power/supply/bq27xxx_battery.c +0
-0Quoted 6 lines
drivers/power/supply/bq27xxx_battery.c
Quoted 3 lines
drivers/power/supply/bq27xxx_battery.c +3
-0+static u8 * bq27xxx_regs[] = { + [BQ27000 ] = bq27000_regs,/* really bq27200 */ + [BQ27010 ] = bq27010_regs,/* really bq27210 */ Not strictly true, the bq270x0 and bq272x0 are different chips, one has an HDQ bus and the other I2C, later chips have both ports on each chip.
Quoted 7 lines
Oh, I saw only the 200 & 210 in
_i2c.c, and forgot that the driver supports another interface. I'll remove those comments.I won't separate these IDs as none of them support DM update.
Think you could do some testing soon?
Yeah, I could probably fit some testing into my schedule, I'll see what v9 looks like before I unpack the boards.
Quoted 73 lines · Andrew F. Davis
Quoted 72 lines · Liam Breck
Quoted 58 lines · Andrew F. Davis
Quoted 57 lines · Andrew F. Davis
Quoted 55 lines · Liam Breck
Quoted 40 lines · Liam Breck
Quoted 39 lines · Andrew F. Davis
Quoted 37 lines · Liam Breck
Quoted 25 lines · Andrew F. Davis
Quoted 14 lines · Liam Breck
Quoted 13 lines · Andrew F. Davis
Quoted 11 lines · Liam Breck
From: Liam Breck <[email protected]>
Assign every chip a unique ID, to enable
power_supply_battery_infoconfig for all supported chips. There are no functional changes to the driver.Depends-on: power:
bq27xxx_battery: Addpower_supply_battery_infosupportSigned-off-by Liam Breck <[email protected]>---
Andrew, let me know if you'd like me to include this in the other patchset.Quoted 9 lines
Quoted 2 lines
Why do we need this at all? It may be just bit too early for me, but I'm not seeing what this gets us, that couldn't be done before.
Sadly, the chips mostly have different
dm_regtables, so we need the real chip ID to give each a table.My last rev only supported IDs associated with a single chip: 500, 545, 421. In the 421 case, we had to split off that ID.
Quoted 7 lines
Okay, then if we need a new ID lets add it. Going back to having a table of pointers is a step back, we used to do it this way, but every-time a new chip appeared or we found a delta in an existing chip(s) (like you are finding now) we would have to re-organize the pointer table and other associated tables, it is much cleaner and easier to review (more important than code size by orders of magnitude IMHO) to just add a new entry into the big master table of registers.
There were 8 mostly unique reg tables, and you'd need 8 dups to make all the IDs explicit.
Quoted 8 lines
Quoted 1 line
Why do all IDs need to be explicit, most have the same register set.
The DM registers are different. See:
bq27500_dm_regs[]
bq27545_dm_regs[]
bq27421_dm_regs[]
bq27425_dm_regs[]
bq27621_dm_regs[]Another way to handle this is using a separate field for the dm_regs[] index, e.g.
di->dmid.That's a smaller patch, roughly +20 LoC.
Quoted 6 lines
Quoted 2 lines
This might work better
Hmmm, looking at the other patch, I think I'll take that back, I guess I'm not so apposed to this method seeing what would need to be done otherwise...
I'm strongly in favor of the newer, shorter patch, with .chip & .dmid. It's much less work to maintain than the .chip-only approach.
I can set .dmid instead of .chip in the probe functions if that makes it clearer.
Quoted 7 lines
Quoted 3 lines
BTW the enum values should be explicit in any case, since they appear in
platform_dataobjects outside the driver.The only part I didn't like was the duplicate enum values, each chip should have one unique ID, I think what ever way you prefer would work for the table structure, lets just keep the chip ID enums clean.
It has a group ID (.chip) and a part ID (.dmid). In some cases they are the same value but so what.
I didn't want to rename .chip to .group since it appears a lot.
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
You're already using a table of pointers for the property lists.
I don't see how adding an entry to a pointer table is worse than adding an entire reg table. Sure, now and then you'd need to add both.
Quoted 27 lines
Quoted 17 lines
Quoted 10 lines
Quoted 9 lines
drivers/power/supply/bq27xxx_battery.c | 94 +++++++++++++++++------------- drivers/power/supply/bq27xxx_battery_i2c.c | 14 ++--- include/linux/power/bq27xxx_battery.h | 15 +++-- 3 files changed, 71 insertions(+), 52 deletions(-)drivers/power/supply/bq27xxx_battery.c +0
-0Quoted 6 lines
drivers/power/supply/bq27xxx_battery.c
Quoted 3 lines
drivers/power/supply/bq27xxx_battery.c +3
-0+static u8 * bq27xxx_regs[] = { + [BQ27000 ] = bq27000_regs,/* really bq27200 */ + [BQ27010 ] = bq27010_regs,/* really bq27210 */ Not strictly true, the bq270x0 and bq272x0 are different chips, one has an HDQ bus and the other I2C, later chips have both ports on each chip.
Quoted 7 lines
Oh, I saw only the 200 & 210 in
_i2c.c, and forgot that the driver supports another interface. I'll remove those comments.I won't separate these IDs as none of them support DM update.
Think you could do some testing soon?
Yeah, I could probably fit some testing into my schedule, I'll see what v9 looks like before I unpack the boards.
Quoted 51 lines · Andrew F. Davis
Quoted 50 lines · Liam Breck
Quoted 48 lines · Liam Breck
Quoted 35 lines · Andrew F. Davis
Quoted 34 lines · Liam Breck
Quoted 32 lines · Andrew F. Davis
Quoted 14 lines · Liam Breck
Quoted 13 lines · Andrew F. Davis
Quoted 11 lines · Liam Breck
From: Liam Breck <[email protected]>
Assign every chip a unique ID, to enable
power_supply_battery_infoconfig for all supported chips. There are no functional changes to the driver.Depends-on: power:
bq27xxx_battery: Addpower_supply_battery_infosupportSigned-off-by Liam Breck <[email protected]>---
Andrew, let me know if you'd like me to include this in the other patchset.Quoted 9 lines
Quoted 2 lines
Why do we need this at all? It may be just bit too early for me, but I'm not seeing what this gets us, that couldn't be done before.
Sadly, the chips mostly have different
dm_regtables, so we need the real chip ID to give each a table.My last rev only supported IDs associated with a single chip: 500, 545, 421. In the 421 case, we had to split off that ID.
Okay, then if we need a new ID lets add it. Going back to having a table of pointers is a step back, we used to do it this way, but every-time a new chip appeared or we found a delta in an existing chip(s) (like you are finding now) we would have to re-organize the pointer table and other associated tables, it is much cleaner and easier to review (more important than code size by orders of magnitude IMHO) to just add a new entry into the big master table of registers.
Quoted 5 lines
Quoted 3 lines
There were 8 mostly unique reg tables, and you'd need 8 dups to make all the IDs explicit.
Why do all IDs need to be explicit, most have the same register set.
The DM registers are different. See:
bq27500_dm_regs[]
bq27545_dm_regs[]
bq27421_dm_regs[]
bq27425_dm_regs[]
bq27621_dm_regs[]
Quoted 8 lines
Quoted 5 lines
Another way to handle this is using a separate field for the dm_regs[] index, e.g.
di->dmid.That's a smaller patch, roughly +20 LoC.
This might work better
Hmmm, looking at the other patch, I think I'll take that back, I guess I'm not so apposed to this method seeing what would need to be done otherwise...
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
You're already using a table of pointers for the property lists.
I don't see how adding an entry to a pointer table is worse than adding an entire reg table. Sure, now and then you'd need to add both.
Quoted 27 lines
Quoted 17 lines
Quoted 10 lines
Quoted 9 lines
drivers/power/supply/bq27xxx_battery.c | 94 +++++++++++++++++------------- drivers/power/supply/bq27xxx_battery_i2c.c | 14 ++--- include/linux/power/bq27xxx_battery.h | 15 +++-- 3 files changed, 71 insertions(+), 52 deletions(-)drivers/power/supply/bq27xxx_battery.c +0
-0Quoted 6 lines
drivers/power/supply/bq27xxx_battery.c
Quoted 3 lines
drivers/power/supply/bq27xxx_battery.c +3
-0+static u8 * bq27xxx_regs[] = { + [BQ27000 ] = bq27000_regs,/* really bq27200 */ + [BQ27010 ] = bq27010_regs,/* really bq27210 */ Not strictly true, the bq270x0 and bq272x0 are different chips, one has an HDQ bus and the other I2C, later chips have both ports on each chip.
Quoted 7 lines
Oh, I saw only the 200 & 210 in
_i2c.c, and forgot that the driver supports another interface. I'll remove those comments.I won't separate these IDs as none of them support DM update.
Think you could do some testing soon?
Yeah, I could probably fit some testing into my schedule, I'll see what v9 looks like before I unpack the boards.