summaryrefslogtreecommitdiff
path: root/common/charge_manager.c
diff options
context:
space:
mode:
authorFabien Parent <fparent@baylibre.com>2018-05-05 13:59:00 +0200
committerchrome-bot <chrome-bot@chromium.org>2018-05-11 02:58:45 -0700
commit7034d8b711398d5627fab5fe787fc33e24d76c48 (patch)
tree121e30fd90112443756ad8f8a5e366dbd0d9f98e /common/charge_manager.c
parentbf62593ebd4dead8553ca5615290fe372198e846 (diff)
downloadchrome-ec-7034d8b711398d5627fab5fe787fc33e24d76c48.tar.gz
charge_manager: add host cmd to get port count
The kernel is only able to know the number of USB PD port through EC_CMD_USB_PD_PORTS, but the kernel needs also to be able to know that there is a dedicated port. Add a host command that will return the total number of charge port (USB PD + BJ). BRANCH=None BUG=chromium:841944 TEST=Called command from kernel driver and checked that the port count was the expected value. Change-Id: I6ccd8a2dee35bbe8bb66dfbe09d1cc09c54b73a0 Signed-off-by: Fabien Parent <fparent@baylibre.com> Reviewed-on: https://chromium-review.googlesource.com/1046593 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'common/charge_manager.c')
-rw-r--r--common/charge_manager.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/common/charge_manager.c b/common/charge_manager.c
index b5fdfa7af9..63a257ab40 100644
--- a/common/charge_manager.c
+++ b/common/charge_manager.c
@@ -1089,6 +1089,19 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_PD_POWER_INFO,
EC_VER_MASK(0));
#endif /* TEST_BUILD */
+static int hc_charge_port_count(struct host_cmd_handler_args *args)
+{
+ struct ec_response_charge_port_count *resp = args->response;
+
+ args->response_size = sizeof(*resp);
+ resp->port_count = CHARGE_PORT_COUNT;
+
+ return EC_RES_SUCCESS;
+}
+DECLARE_HOST_COMMAND(EC_CMD_CHARGE_PORT_COUNT,
+ hc_charge_port_count,
+ EC_VER_MASK(0));
+
static int hc_charge_port_override(struct host_cmd_handler_args *args)
{
const struct ec_params_charge_port_override *p = args->params;