diff options
author | Vijay Hiremath <vijay.p.hiremath@intel.com> | 2020-01-27 17:25:45 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-01-28 23:51:32 +0000 |
commit | 786dedfb15f333ac5a70b83a110eb37805f3be7d (patch) | |
tree | daa30ee49f9e261eb23b0776ec207c2c86ad7da9 /common/usb_pd_host_cmd.c | |
parent | 9e06e793bb953817a6f6b56da19970f04f09c84e (diff) | |
download | chrome-ec-786dedfb15f333ac5a70b83a110eb37805f3be7d.tar.gz |
TCPMv1/v2: Move EC_CMD_USB_PD_DISCOVERY host command to common file
BUG=b:142911453
BRANCH=none
TEST=make buildall -j
Change-Id: Ia2ad22669a908e9b9c23c4b73e97872399049e75
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2024427
Reviewed-by: Keith Short <keithshort@chromium.org>
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'common/usb_pd_host_cmd.c')
-rw-r--r-- | common/usb_pd_host_cmd.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/common/usb_pd_host_cmd.c b/common/usb_pd_host_cmd.c index d93dad714d..0a4f756e58 100644 --- a/common/usb_pd_host_cmd.c +++ b/common/usb_pd_host_cmd.c @@ -136,6 +136,28 @@ static enum ec_status hc_remote_pd_set_amode(struct host_cmd_handler_args *args) DECLARE_HOST_COMMAND(EC_CMD_USB_PD_SET_AMODE, hc_remote_pd_set_amode, EC_VER_MASK(0)); + +static enum ec_status hc_remote_pd_discovery(struct host_cmd_handler_args *args) +{ + const uint8_t *port = args->params; + struct ec_params_usb_pd_discovery_entry *r = args->response; + + if (*port >= board_get_usb_pd_port_count()) + return EC_RES_INVALID_PARAM; + + r->vid = pd_get_identity_vid(*port); + r->ptype = pd_get_product_type(*port); + + /* pid only included if vid is assigned */ + if (r->vid) + r->pid = pd_get_identity_pid(*port); + + args->response_size = sizeof(*r); + return EC_RES_SUCCESS; +} +DECLARE_HOST_COMMAND(EC_CMD_USB_PD_DISCOVERY, + hc_remote_pd_discovery, + EC_VER_MASK(0)); #endif /* CONFIG_USB_PD_ALT_MODE_DFP */ #ifdef CONFIG_COMMON_RUNTIME |