From 142a950aff428f87ca480e6a4695294ca21129aa Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Wed, 25 Mar 2015 12:39:42 -0700 Subject: Skip the battery device name reading on BQ27742 Contrary to the BQ2751 and BQ27741 it is sharing code with, BQ27742 does not have a "device name" register. So we need to skip the I2C reads else the battery_device_name() function returns an I2C error and the charge code retries until the end-of-time to read it hogging the CPU. Signed-off-by: Vincent Palatin BRANCH=none BUG=chrome-os-partner:38401 TEST=run on Ryu P4 and verify that we are no longer seeing 20ms of I2C transactions every 100ms on the battery I2C bus. Change-Id: I961af54017f661ee928058b346a42b7206ad8217 Reviewed-on: https://chromium-review.googlesource.com/262449 Reviewed-by: Alec Berg Commit-Queue: Vincent Palatin Tested-by: Vincent Palatin --- driver/battery/bq27541.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'driver/battery/bq27541.c') diff --git a/driver/battery/bq27541.c b/driver/battery/bq27541.c index 516d3330e6..2f7e1b2678 100644 --- a/driver/battery/bq27541.c +++ b/driver/battery/bq27541.c @@ -89,6 +89,12 @@ int battery_device_name(char *device_name, int buf_size) int rv, i, val; int len = MIN(7, buf_size - 1); + if (battery_type_id == BQ27742_TYPE_ID) { + /* No device name register available */ + strzcpy(device_name, "", len); + return 0; + } + rv = bq27541_read8(REG_DEVICE_NAME_LENGTH, &val); if (rv) return rv; -- cgit v1.2.1