summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorEric Yilun Lin <yllin@chromium.org>2022-03-14 14:15:30 +0800
committerCommit Bot <commit-bot@chromium.org>2022-03-15 08:49:17 +0000
commit00b93c2d75ee4b52e2a7f07230be2142a5dd486f (patch)
treed7a4d1552690c02c2f507aca28c5228226202873 /common
parenta4a27f7238023dd0643029940f89d2273d8f0c17 (diff)
downloadchrome-ec-00b93c2d75ee4b52e2a7f07230be2142a5dd486f.tar.gz
ectool: support dps enable/disable command
Support dps host command for factory test. BUG=b:223937130 TEST=ectool usbpddps disable|enable BRANCH=cherry Change-Id: I050c724b5caab41644248a6f72704edbc76554a0 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3522247 Tested-by: Eric Yilun Lin <yllin@google.com> Auto-Submit: Eric Yilun Lin <yllin@google.com> Reviewed-by: Rong Chang <rongchang@chromium.org> Commit-Queue: Rong Chang <rongchang@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/dps.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/common/dps.c b/common/dps.c
index 9008984114..5becce7dc7 100644
--- a/common/dps.c
+++ b/common/dps.c
@@ -16,6 +16,7 @@
#include "charge_manager.h"
#include "charge_state.h"
#include "charge_state_v2.h"
+#include "ec_commands.h"
#include "math_util.h"
#include "task.h"
#include "timer.h"
@@ -647,3 +648,14 @@ DECLARE_CONSOLE_COMMAND(dps, command_dps,
"\t\t set(tstable|tcheck) <int>\n"
"\t\t fakepwr [dis|<mV> <mA>]",
"Print/set Dynamic PDO Selection state.");
+
+static enum ec_status hc_usb_pd_dps_control(struct host_cmd_handler_args *args)
+{
+ const struct ec_params_usb_pd_dps_control *p = args->params;
+
+ dps_enable(p->enable);
+ return EC_RES_SUCCESS;
+}
+DECLARE_HOST_COMMAND(EC_CMD_USB_PD_DPS_CONTROL,
+ hc_usb_pd_dps_control,
+ EC_VER_MASK(0));