From e6078290c5c3fd5a89f548abc5d67b5264745d73 Mon Sep 17 00:00:00 2001 From: Tim Wawrzynczak Date: Wed, 22 Jan 2020 15:22:18 -0700 Subject: ec/google/chromeec: Add new wrappers for host commands Add new functions to get (from the EC): 1) The number of USB-PD ports 2) The capabilities of each port (EC_CMD_GET_PD_PORT_CAPS) BUG=b:146506369 BRANCH=none TEST=Instrumented calls to these and verified the data Change-Id: I57edbe1592cd28b005f01679ef8a8b5de3e1f586 Signed-off-by: Tim Wawrzynczak Reviewed-on: https://review.coreboot.org/c/coreboot/+/38540 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/ec/google/chromeec/ec.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/ec/google/chromeec/ec.h') diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h index d90d24c767..5ce375e00b 100644 --- a/src/ec/google/chromeec/ec.h +++ b/src/ec/google/chromeec/ec.h @@ -299,4 +299,34 @@ int google_chromeec_get_protocol_info( */ int google_chromeec_get_cmd_versions(int command, uint32_t *pmask); +/** + * Get number of PD-capable USB ports from EC. + * + * @param *num_ports If successful, num_ports is the number + * of PD-capable USB ports according to the EC. + * @return 0 on success, -1 on error + */ +int google_chromeec_get_num_pd_ports(int *num_ports); + +/* Structure representing the capabilities of a USB-PD port */ +struct usb_pd_port_caps { + enum ec_pd_power_role_caps power_role_cap; + enum ec_pd_try_power_role_caps try_power_role_cap; + enum ec_pd_data_role_caps data_role_cap; + enum ec_pd_port_location port_location; +}; + +/** + * Get role-based capabilities for a USB-PD port + * + * @param port Which port to get information about + * @param *power_role_cap The power-role capabillity of the port + * @param *try_power_role_cap The Try-power-role capability of the port + * @param *data_role_cap The data role capability of the port + * @param *port_location Location of the port on the device + * @return 0 on success, -1 on error + */ +int google_chromeec_get_pd_port_caps(int port, + struct usb_pd_port_caps *port_caps); + #endif /* _EC_GOOGLE_CHROMEEC_EC_H */ -- cgit v1.2.3