summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ec/google/chromeec/ec.c22
-rw-r--r--src/ec/google/chromeec/ec.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c
index 1308c3d13b..d0648f7d1d 100644
--- a/src/ec/google/chromeec/ec.c
+++ b/src/ec/google/chromeec/ec.c
@@ -497,6 +497,28 @@ int google_chromeec_set_usb_charge_mode(u8 port_id, enum usb_charge_mode mode)
return google_chromeec_command(&cmd);
}
+int google_chromeec_set_usb_pd_role(u8 port, enum usb_pd_control_role role)
+{
+ struct ec_params_usb_pd_control req = {
+ .port = port,
+ .role = role,
+ .mux = USB_PD_CTRL_MUX_NO_CHANGE,
+ .swap = USB_PD_CTRL_SWAP_NONE,
+ };
+ struct ec_response_usb_pd_control rsp;
+ struct chromeec_command cmd = {
+ .cmd_code = EC_CMD_USB_PD_CONTROL,
+ .cmd_version = 0,
+ .cmd_data_in = &req,
+ .cmd_size_in = sizeof(req),
+ .cmd_data_out = &rsp,
+ .cmd_size_out = sizeof(rsp),
+ .cmd_dev_index = 0,
+ };
+
+ return google_chromeec_command(&cmd);
+}
+
#ifndef __SMM__
static
diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h
index f765fe46ba..71cea7ea8a 100644
--- a/src/ec/google/chromeec/ec.h
+++ b/src/ec/google/chromeec/ec.h
@@ -76,6 +76,7 @@ enum usb_charge_mode {
USB_CHARGE_MODE_DOWNSTREAM_1500MA,
};
int google_chromeec_set_usb_charge_mode(u8 port_id, enum usb_charge_mode mode);
+int google_chromeec_set_usb_pd_role(u8 port, enum usb_pd_control_role role);
/* internal structure to send a command to the EC and wait for response. */
struct chromeec_command {