summaryrefslogtreecommitdiff
path: root/driver/battery
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2019-03-13 15:53:38 +0800
committerchrome-bot <chrome-bot@chromium.org>2019-03-13 21:05:09 -0700
commita938057c4e643015cf1d97ff1b01dbd20bf929bc (patch)
tree6a82f3fe6312383509295265af6bcdee8e48d7af /driver/battery
parenta898b6cc70e1a32494d474620e40076fa5741125 (diff)
downloadchrome-ec-a938057c4e643015cf1d97ff1b01dbd20bf929bc.tar.gz
battery/max17055: Use DevName Register as device name
As requested in b:128393179, set the device name to '0x4010' for HWID probing. BUG=b:128393179 TEST=Verify 'Device: 0x4010' appears in 'battery' console command. BRANCH=None Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: Icf4dad3296a5e14d77cc8254146f8d149fade90c Reviewed-on: https://chromium-review.googlesource.com/1520566 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-by: Yilun Lin <yllin@chromium.org>
Diffstat (limited to 'driver/battery')
-rw-r--r--driver/battery/max17055.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/driver/battery/max17055.c b/driver/battery/max17055.c
index 3e08f52514..e549dcec3c 100644
--- a/driver/battery/max17055.c
+++ b/driver/battery/max17055.c
@@ -11,6 +11,7 @@
#include "hooks.h"
#include "i2c.h"
#include "max17055.h"
+#include "printf.h"
#include "timer.h"
#include "util.h"
@@ -87,9 +88,14 @@ static int max17055_probe(void)
int battery_device_name(char *device_name, int buf_size)
{
- strzcpy(device_name, "<BATT>", buf_size);
+ int dev_id;
+ int rv;
- return EC_SUCCESS;
+ rv = max17055_read(REG_DEVICE_NAME, &dev_id);
+ if (!rv)
+ snprintf(device_name, buf_size, "0x%04x", dev_id);
+
+ return rv;
}
int battery_state_of_charge_abs(int *percent)