diff options
-rw-r--r-- | common/usb_pd_protocol.c | 6 | ||||
-rw-r--r-- | include/ec_commands.h | 3 | ||||
-rw-r--r-- | include/usb_pd.h | 8 | ||||
-rw-r--r-- | util/ectool.c | 21 |
4 files changed, 37 insertions, 1 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 730281c9b5..ff13a01b31 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -4886,6 +4886,11 @@ static const enum typec_mux typec_mux_map[USB_PD_CTRL_MUX_COUNT] = { }; #endif +__attribute__((weak)) uint8_t board_get_dp_pin_mode(int port) +{ + return 0; +} + static int hc_usb_pd_control(struct host_cmd_handler_args *args) { const struct ec_params_usb_pd_control *p = args->params; @@ -4967,6 +4972,7 @@ static int hc_usb_pd_control(struct host_cmd_handler_args *args) r_v2->state[0] = '\0'; r_v2->cc_state = pd[p->port].cc_state; + r_v2->dp_mode = board_get_dp_pin_mode(p->port); if (args->version == 1) args->response_size = sizeof(*r_v1); diff --git a/include/ec_commands.h b/include/ec_commands.h index eb0e05afd5..474ee428f4 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -4771,6 +4771,9 @@ struct ec_response_usb_pd_control_v2 { uint8_t polarity; char state[32]; uint8_t cc_state; /* USBC_PD_CC_*Encoded cc state */ + uint8_t dp_mode; /* Current DP pin mode (MODE_DP_PIN_[A-E]) */ + /* CL:1500994 Current cable type */ + uint8_t reserved_cable_type; } __ec_align1; #define EC_CMD_USB_PD_PORTS 0x0102 diff --git a/include/usb_pd.h b/include/usb_pd.h index d6b807791d..f5c43694be 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -1884,6 +1884,14 @@ int pd_get_partner_usb_comm_capable(int port); */ int pd_is_vbus_present(int port); +/** + * Get board specific current DisplayPort pin mode on the specified port. + * + * @param port USB-C port number + * @return MODE_DP_PIN_[A-E] if used else 0 + */ +uint8_t board_get_dp_pin_mode(int port); + /* ----- Logging ----- */ #ifdef CONFIG_USB_PD_LOGGING /** diff --git a/util/ectool.c b/util/ectool.c index 522daa572e..51bf39ca3a 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -5127,7 +5127,7 @@ int cmd_usb_pd(int argc, char *argv[]) r_v1->polarity + 1); if (cmdver == 2) { - printf("CC State: %d:", r_v2->cc_state); + printf("CC State:"); if (r_v2->cc_state == USBC_PD_CC_NONE) printf("None"); else if (r_v2->cc_state == USBC_PD_CC_NO_UFP) @@ -5143,6 +5143,25 @@ int cmd_usb_pd(int argc, char *argv[]) else printf("UNKNOWN"); printf("\n"); + + if (r_v2->dp_mode) { + printf("DP pin mode:"); + if (r_v2->dp_mode == MODE_DP_PIN_A) + printf("A"); + else if (r_v2->dp_mode == MODE_DP_PIN_B) + printf("B"); + else if (r_v2->dp_mode == MODE_DP_PIN_C) + printf("C"); + else if (r_v2->dp_mode == MODE_DP_PIN_D) + printf("D"); + else if (r_v2->dp_mode == MODE_DP_PIN_E) + printf("E"); + else if (r_v2->dp_mode == MODE_DP_PIN_F) + printf("F"); + else + printf("UNKNOWN"); + printf("\n"); + } } /* If connected to a PD device, then print port partner info */ |