File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88
99#include <drivers/emul.h>
1010#include <drivers/gpio/gpio_emul.h>
11+ #include <string.h>
1112
1213#include "charger.h"
1314#include "emul/tcpc/emul_tcpci_partner_src.h"
@@ -208,6 +209,7 @@ host_cmd_get_charge_control(void)
208209
209210 zassume_ok (host_command_process (& args ),
210211 "Failed to get charge control values" );
212+
211213 return response ;
212214}
213215
@@ -224,6 +226,19 @@ host_cmd_get_charge_control(void)
224226void host_cmd_motion_sense_dump (int max_sensor_count ,
225227 struct ec_response_motion_sense * response );
226228
229+ /**
230+ * Run the host command to get the PD discovery responses.
231+ *
232+ * @param port The USB-C port number
233+ * @param partner_type SOP, SOP', or SOP''
234+ * @param response Destination buffer for command response;
235+ * should hold struct ec_response_typec_discovery and
236+ * enough struct svid_mode_info for expected response.
237+ * @param response_size Number of bytes in response
238+ */
239+ void host_cmd_typec_discovery (int port , enum typec_partner_type partner_type ,
240+ void * response , size_t response_size );
241+
227242#define GPIO_ACOK_OD_NODE DT_NODELABEL(gpio_acok_od)
228243#define GPIO_ACOK_OD_PIN DT_GPIO_PIN(GPIO_ACOK_OD_NODE, gpios)
229244
Original file line number Diff line number Diff line change @@ -111,3 +111,21 @@ void host_cmd_motion_sense_dump(int max_sensor_count,
111111 zassume_ok (host_command_process (& args ),
112112 "Failed to get motion_sense dump" );
113113}
114+
115+ void host_cmd_typec_discovery (int port , enum typec_partner_type partner_type ,
116+ void * response , size_t response_size )
117+ {
118+ struct ec_params_typec_discovery params = {
119+ .port = port , .partner_type = partner_type
120+ };
121+ struct host_cmd_handler_args args = BUILD_HOST_COMMAND_PARAMS (
122+ EC_CMD_TYPEC_DISCOVERY , 0 , params );
123+ /* The expected response to EC_CMD_TYPEC_DISCOVERY extends beyond the
124+ * bounds of struct ec_response_typec_discovery.
125+ */
126+ args .response = response ;
127+ args .response_max = response_size ;
128+
129+ zassume_ok (host_command_process (& args ),
130+ "Failed to get Type-C state for port %d" , port );
131+ }
You can’t perform that action at this time.
0 commit comments