Skip to content

Commit

Permalink
bq27x00_battery: Fix bugs introduced with BQ27425 support
Browse files Browse the repository at this point in the history
commit a66f59b

    bq27x00_battery: Add support for BQ27425 chip

introduced 2 bugs.

1/ 'chip' was set to BQ27425 unconditionally - breaking support for
   other devices;

2/ BQ27425 does not support cycle count, how the code still tries to
   get the cycle count for BQ27425, and now does it twice for other chips.

Signed-off-by: NeilBrown <[email protected]>
Cc: Saranya Gopal <[email protected]>
Cc: [email protected]
Signed-off-by: Anton Vorontsov <[email protected]>
  • Loading branch information
neilbrown authored and enomsg committed Jan 6, 2013
1 parent a05be99 commit bde83b9
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions drivers/power/bq27x00_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@ static void bq27x00_update(struct bq27x00_device_info *di)
cache.temperature = bq27x00_battery_read_temperature(di);
if (!is_bq27425)
cache.cycle_count = bq27x00_battery_read_cyct(di);
cache.cycle_count = bq27x00_battery_read_cyct(di);
cache.power_avg =
bq27x00_battery_read_pwr_avg(di, BQ27x00_POWER_AVG);

Expand Down Expand Up @@ -696,7 +695,6 @@ static int bq27x00_powersupply_init(struct bq27x00_device_info *di)
int ret;

di->bat.type = POWER_SUPPLY_TYPE_BATTERY;
di->chip = BQ27425;
if (di->chip == BQ27425) {
di->bat.properties = bq27425_battery_props;
di->bat.num_properties = ARRAY_SIZE(bq27425_battery_props);
Expand Down

0 comments on commit bde83b9

Please sign in to comment.