summaryrefslogtreecommitdiff
path: root/common/virtual_battery.c
diff options
context:
space:
mode:
authorMichael5 Chen1 <michael5_chen1@pegatron.corp-partner.google.com>2022-04-20 08:24:24 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-04-25 02:03:55 +0000
commit197da82322401ec38a181b28fb00ff37e647440b (patch)
treefe8d6190fb9b1d82a94bda6fa8ef0f79266e929c /common/virtual_battery.c
parent69373e79e1d5409d49e4bffef42e407749692999 (diff)
downloadchrome-ec-197da82322401ec38a181b28fb00ff37e647440b.tar.gz
virtual battery: Write manufacturer access command
Add battery command manufacturer data BUG=b:228360450 BRANCH=kukui TEST=make buildall Run command "ectool i2cwrite 16 2 0x16 0x00 0x0001" on damu. Signed-off-by: Michael5 Chen1 <michael5_chen1@pegatron.corp-partner.google.com> Change-Id: Ic560c76cf6ccffecf0f35f4d8d8d7abaa0a6bce2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3595399 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'common/virtual_battery.c')
-rw-r--r--common/virtual_battery.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/common/virtual_battery.c b/common/virtual_battery.c
index 33e014d68e..ae86f51d53 100644
--- a/common/virtual_battery.c
+++ b/common/virtual_battery.c
@@ -396,7 +396,14 @@ int virtual_battery_operation(const uint8_t *batt_cmd_head,
break;
#endif
case SB_MANUFACTURER_ACCESS:
- /* No manuf. access reg access allowed over VB interface */
+#ifdef CONFIG_BATTERY_SMART
+ if ((write_len >= 2) && (write_len <= 3)) {
+ val = batt_cmd_head[1] | batt_cmd_head[2] << 8;
+ /* This may cause an i2c transaction */
+ if (!battery_manufacturer_access(val))
+ return EC_SUCCESS;
+ }
+#endif
return EC_ERROR_INVAL;
case SB_SPECIFICATION_INFO:
/* v1.1 without PEC, no scale factor to voltage and current */