summaryrefslogtreecommitdiff
path: root/zephyr/test/drivers/src/tcpci.c
blob: 167744f3a98ff82142d35022c6fc7db12e53d1e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
/* Copyright 2021 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include <zephyr/zephyr.h>
#include <ztest.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/gpio/gpio_emul.h>

#include "common.h"
#include "ec_tasks.h"
#include "emul/emul_common_i2c.h"
#include "emul/tcpc/emul_tcpci.h"
#include "hooks.h"
#include "i2c.h"
#include "test/drivers/stubs.h"
#include "test/drivers/tcpci_test_common.h"

#include "tcpm/tcpci.h"
#include "test/drivers/test_state.h"

#define EMUL_LABEL DT_NODELABEL(tcpci_emul)

/** Test TCPCI init and vbus level */
ZTEST(tcpci, test_generic_tcpci_init)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));

	test_tcpci_init(emul, USBC_PORT_C0);
}

/** Test TCPCI release */
ZTEST(tcpci, test_generic_tcpci_release)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));

	test_tcpci_release(emul, USBC_PORT_C0);
}

/** Test TCPCI get cc */
ZTEST(tcpci, test_generic_tcpci_get_cc)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));

	test_tcpci_get_cc(emul, USBC_PORT_C0);
}

/** Test TCPCI set cc */
ZTEST(tcpci, test_generic_tcpci_set_cc)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));

	test_tcpci_set_cc(emul, USBC_PORT_C0);
}

/** Test TCPCI set polarity */
ZTEST(tcpci, test_generic_tcpci_set_polarity)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));

	test_tcpci_set_polarity(emul, USBC_PORT_C0);
}

/** Test TCPCI set vconn */
ZTEST(tcpci, test_generic_tcpci_set_vconn)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));

	test_tcpci_set_vconn(emul, USBC_PORT_C0);
}

/** Test TCPCI set msg header */
ZTEST(tcpci, test_generic_tcpci_set_msg_header)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));

	test_tcpci_set_msg_header(emul, USBC_PORT_C0);
}

/** Test TCPCI rx and sop prime enable */
ZTEST(tcpci, test_generic_tcpci_set_rx_detect)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));

	test_tcpci_set_rx_detect(emul, USBC_PORT_C0);
}

/** Test TCPCI get raw message from TCPC revision 2.0 */
ZTEST(tcpci, test_generic_tcpci_get_rx_message_raw_rev2)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));

	tcpc_config[USBC_PORT_C0].flags = TCPC_FLAGS_TCPCI_REV2_0;
	tcpci_emul_set_rev(emul, TCPCI_EMUL_REV2_0_VER1_1);

	test_tcpci_get_rx_message_raw(emul, USBC_PORT_C0);
}

/** Test TCPCI get raw message from TCPC revision 1.0 */
ZTEST(tcpci, test_generic_tcpci_get_rx_message_raw_rev1)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));

	tcpc_config[USBC_PORT_C0].flags = 0;
	tcpci_emul_set_rev(emul, TCPCI_EMUL_REV1_0_VER1_0);

	test_tcpci_get_rx_message_raw(emul, USBC_PORT_C0);
}

/** Test TCPCI transmitting message from TCPC revision 2.0 */
ZTEST(tcpci, test_generic_tcpci_transmit_rev2)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));

	tcpc_config[USBC_PORT_C0].flags = TCPC_FLAGS_TCPCI_REV2_0;
	tcpci_emul_set_rev(emul, TCPCI_EMUL_REV2_0_VER1_1);

	test_tcpci_transmit(emul, USBC_PORT_C0);
}

/** Test TCPCI transmitting message from TCPC revision 1.0 */
ZTEST(tcpci, test_generic_tcpci_transmit_rev1)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));

	tcpc_config[USBC_PORT_C0].flags = 0;
	tcpci_emul_set_rev(emul, TCPCI_EMUL_REV1_0_VER1_0);

	test_tcpci_transmit(emul, USBC_PORT_C0);
}

/** Test TCPCI alert */
ZTEST(tcpci, test_generic_tcpci_alert)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));

	test_tcpci_alert(emul, USBC_PORT_C0);
}


/** Test TCPCI alert RX message */
ZTEST(tcpci, test_generic_tcpci_alert_rx_message)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));

	test_tcpci_alert_rx_message(emul, USBC_PORT_C0);
}

/** Test TCPCI auto discharge on disconnect */
ZTEST(tcpci, test_generic_tcpci_auto_discharge)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));

	test_tcpci_auto_discharge(emul, USBC_PORT_C0);
}

/** Test TCPCI drp toggle */
ZTEST(tcpci, test_generic_tcpci_drp_toggle)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));

	test_tcpci_drp_toggle(emul, USBC_PORT_C0);
}

/** Test TCPCI get chip info */
ZTEST(tcpci, test_generic_tcpci_get_chip_info)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));

	test_tcpci_get_chip_info(emul, USBC_PORT_C0);
}

/** Test TCPCI enter low power mode */
ZTEST(tcpci, test_generic_tcpci_low_power_mode)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));

	test_tcpci_low_power_mode(emul, USBC_PORT_C0);
}

/** Test TCPCI set bist test mode */
ZTEST(tcpci, test_generic_tcpci_set_bist_mode)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));

	test_tcpci_set_bist_mode(emul, USBC_PORT_C0);
}

/** Test TCPCI discharge vbus */
ZTEST(tcpci, test_generic_tcpci_discharge_vbus)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));
	uint8_t exp_ctrl, initial_ctrl;

	/* Set initial value for POWER ctrl register. Chosen arbitrary. */
	initial_ctrl = TCPC_REG_POWER_CTRL_VBUS_VOL_MONITOR_DIS |
		       TCPC_REG_POWER_CTRL_VOLT_ALARM_DIS;
	tcpci_emul_set_reg(emul, TCPC_REG_POWER_CTRL, initial_ctrl);

	/* Test discharge enable */
	exp_ctrl = initial_ctrl | TCPC_REG_POWER_CTRL_FORCE_DISCHARGE;
	tcpci_tcpc_discharge_vbus(USBC_PORT_C0, 1);
	check_tcpci_reg(emul, TCPC_REG_POWER_CTRL, exp_ctrl);

	/* Test discharge disable */
	exp_ctrl = initial_ctrl & ~TCPC_REG_POWER_CTRL_FORCE_DISCHARGE;
	tcpci_tcpc_discharge_vbus(USBC_PORT_C0, 0);
	check_tcpci_reg(emul, TCPC_REG_POWER_CTRL, exp_ctrl);
}

/** Test TCPC xfer */
ZTEST(tcpci, test_tcpc_xfer)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));
	uint16_t val, exp_val;
	uint8_t reg;

	/* Set value to register (value and register chosen arbitrary) */
	exp_val = 0x7fff;
	reg = TCPC_REG_ALERT_MASK;
	tcpci_emul_set_reg(emul, reg, exp_val);

	/* Test reading value using tcpc_xfer() function */
	zassert_equal(EC_SUCCESS,
		      tcpc_xfer(USBC_PORT_C0, &reg, 1, (uint8_t *)&val, 2),
		      NULL);
	zassert_equal(exp_val, val, "0x%x != 0x%x", exp_val, val);
}

/** Test TCPCI debug accessory enable/disable */
ZTEST(tcpci, test_generic_tcpci_debug_accessory)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));
	uint8_t exp_val, initial_val;

	/* Set initial value for STD output register. Chosen arbitrary. */
	initial_val = TCPC_REG_CONFIG_STD_OUTPUT_AUDIO_CONN_N |
		      TCPC_REG_CONFIG_STD_OUTPUT_MUX_USB |
		      TCPC_REG_CONFIG_STD_OUTPUT_CONNECTOR_FLIPPED |
		      TCPC_REG_CONFIG_STD_OUTPUT_DBG_ACC_CONN_N;
	tcpci_emul_set_reg(emul, TCPC_REG_CONFIG_STD_OUTPUT, initial_val);

	/* Test debug accessory connect */
	exp_val = initial_val & ~TCPC_REG_CONFIG_STD_OUTPUT_DBG_ACC_CONN_N;
	tcpci_tcpc_debug_accessory(USBC_PORT_C0, 1);
	check_tcpci_reg(emul, TCPC_REG_CONFIG_STD_OUTPUT, exp_val);

	/* Test debug accessory disconnect */
	exp_val = initial_val | TCPC_REG_CONFIG_STD_OUTPUT_DBG_ACC_CONN_N;
	tcpci_tcpc_debug_accessory(USBC_PORT_C0, 0);
	check_tcpci_reg(emul, TCPC_REG_CONFIG_STD_OUTPUT, exp_val);
}

/* Setup TCPCI usb mux to behave as it is used only for usb mux */
static void set_usb_mux_not_tcpc(void)
{
	usb_muxes[USBC_PORT_C0].flags = USB_MUX_FLAG_NOT_TCPC;
}

/* Setup TCPCI usb mux to behave as it is used for usb mux and TCPC */
static void set_usb_mux_tcpc(void)
{
	usb_muxes[USBC_PORT_C0].flags = 0;
}

/** Test TCPCI mux init */
ZTEST(tcpci, test_generic_tcpci_mux_init)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));
	struct i2c_emul *i2c_emul = tcpci_emul_get_i2c_emul(emul);
	struct usb_mux *tcpci_usb_mux = &usb_muxes[USBC_PORT_C0];

	/* Set as usb mux with TCPC for first init call */
	set_usb_mux_tcpc();

	/* Make sure that TCPC is not accessed */
	i2c_common_emul_set_read_fail_reg(i2c_emul,
					  I2C_COMMON_EMUL_FAIL_ALL_REG);
	zassert_equal(EC_SUCCESS, tcpci_tcpm_mux_init(tcpci_usb_mux),
		      NULL);

	/* Set as only usb mux without TCPC for rest of the test */
	set_usb_mux_not_tcpc();

	/* Test fail on power status read */
	i2c_common_emul_set_read_fail_reg(i2c_emul, TCPC_REG_POWER_STATUS);
	zassert_equal(EC_ERROR_INVAL, tcpci_tcpm_mux_init(tcpci_usb_mux),
		      NULL);
	i2c_common_emul_set_read_fail_reg(i2c_emul,
					  I2C_COMMON_EMUL_NO_FAIL_REG);

	/* Test fail on uninitialised bit set */
	tcpci_emul_set_reg(emul, TCPC_REG_POWER_STATUS,
			   TCPC_REG_POWER_STATUS_UNINIT);
	zassert_equal(EC_ERROR_TIMEOUT,
		      tcpci_tcpm_mux_init(tcpci_usb_mux), NULL);

	/* Set default power status for rest of the test */
	tcpci_emul_set_reg(emul, TCPC_REG_POWER_STATUS,
			   TCPC_REG_POWER_STATUS_VBUS_DET);

	/* Test fail on alert mask write fail */
	i2c_common_emul_set_write_fail_reg(i2c_emul, TCPC_REG_ALERT_MASK);
	zassert_equal(EC_ERROR_UNKNOWN,
		      tcpci_tcpm_mux_init(tcpci_usb_mux), NULL);

	/* Test fail on alert write fail */
	i2c_common_emul_set_write_fail_reg(i2c_emul, TCPC_REG_ALERT);
	zassert_equal(EC_ERROR_UNKNOWN,
		      tcpci_tcpm_mux_init(tcpci_usb_mux), NULL);
	i2c_common_emul_set_write_fail_reg(i2c_emul,
					   I2C_COMMON_EMUL_NO_FAIL_REG);

	/* Set arbitrary value to alert and alert mask registers */
	tcpci_emul_set_reg(emul, TCPC_REG_ALERT, 0xffff);
	tcpci_emul_set_reg(emul, TCPC_REG_ALERT_MASK, 0xffff);

	/* Test success init */
	zassert_equal(EC_SUCCESS, tcpci_tcpm_mux_init(tcpci_usb_mux),
		      NULL);
	check_tcpci_reg(emul, TCPC_REG_ALERT_MASK, 0);
	check_tcpci_reg(emul, TCPC_REG_ALERT, 0);
}

/** Test TCPCI mux enter low power mode */
ZTEST(tcpci, test_generic_tcpci_mux_enter_low_power)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));
	struct i2c_emul *i2c_emul = tcpci_emul_get_i2c_emul(emul);
	struct usb_mux *tcpci_usb_mux = &usb_muxes[USBC_PORT_C0];

	/* Set as usb mux with TCPC for first enter_low_power call */
	set_usb_mux_tcpc();

	/* Make sure that TCPC is not accessed */
	i2c_common_emul_set_write_fail_reg(i2c_emul,
					   I2C_COMMON_EMUL_FAIL_ALL_REG);
	zassert_equal(EC_SUCCESS,
		      tcpci_tcpm_mux_enter_low_power(tcpci_usb_mux),
		      NULL);

	/* Set as only usb mux without TCPC for rest of the test */
	set_usb_mux_not_tcpc();

	/* Test error on failed command set */
	i2c_common_emul_set_write_fail_reg(i2c_emul, TCPC_REG_COMMAND);
	zassert_equal(EC_ERROR_INVAL,
		      tcpci_tcpm_mux_enter_low_power(tcpci_usb_mux),
		      NULL);
	i2c_common_emul_set_write_fail_reg(i2c_emul,
					   I2C_COMMON_EMUL_NO_FAIL_REG);

	/* Test correct command is issued */
	zassert_equal(EC_SUCCESS,
		      tcpci_tcpm_mux_enter_low_power(tcpci_usb_mux),
		      NULL);
	check_tcpci_reg(emul, TCPC_REG_COMMAND, TCPC_REG_COMMAND_I2CIDLE);
}

/** Test TCPCI mux set and get */
static void test_generic_tcpci_mux_set_get(void)
{
	const struct emul *emul = emul_get_binding(DT_LABEL(EMUL_LABEL));
	struct i2c_emul *i2c_emul = tcpci_emul_get_i2c_emul(emul);
	struct usb_mux *tcpci_usb_mux = &usb_muxes[USBC_PORT_C0];
	mux_state_t mux_state, mux_state_get;
	uint16_t exp_val, initial_val;
	bool ack;

	mux_state = USB_PD_MUX_NONE;

	/* Test fail on standard output config register read */
	i2c_common_emul_set_read_fail_reg(i2c_emul, TCPC_REG_CONFIG_STD_OUTPUT);
	zassert_equal(EC_ERROR_INVAL,
		      tcpci_tcpm_mux_set(tcpci_usb_mux, mux_state, &ack),
		      NULL);
	zassert_equal(EC_ERROR_INVAL,
		      tcpci_tcpm_mux_get(tcpci_usb_mux, &mux_state_get),
		      NULL);
	i2c_common_emul_set_read_fail_reg(i2c_emul,
					  I2C_COMMON_EMUL_NO_FAIL_REG);

	/* Test fail on standard output config register write */
	i2c_common_emul_set_write_fail_reg(i2c_emul,
					   TCPC_REG_CONFIG_STD_OUTPUT);
	zassert_equal(EC_ERROR_INVAL,
		      tcpci_tcpm_mux_set(tcpci_usb_mux, mux_state, &ack),
		      NULL);
	i2c_common_emul_set_write_fail_reg(i2c_emul,
					   I2C_COMMON_EMUL_NO_FAIL_REG);

	/* Set initial value for STD output register. Chosen arbitrary. */
	initial_val = TCPC_REG_CONFIG_STD_OUTPUT_AUDIO_CONN_N |
		      TCPC_REG_CONFIG_STD_OUTPUT_MUX_USB |
		      TCPC_REG_CONFIG_STD_OUTPUT_CONNECTOR_FLIPPED |
		      TCPC_REG_CONFIG_STD_OUTPUT_DBG_ACC_CONN_N;
	tcpci_emul_set_reg(emul, TCPC_REG_CONFIG_STD_OUTPUT, initial_val);

	/* Test setting/getting no MUX connection without polarity inverted */
	exp_val = (initial_val & ~TCPC_REG_CONFIG_STD_OUTPUT_MUX_MASK) |
		  TCPC_REG_CONFIG_STD_OUTPUT_MUX_NONE;
	exp_val &= ~TCPC_REG_CONFIG_STD_OUTPUT_CONNECTOR_FLIPPED;
	mux_state = USB_PD_MUX_NONE;
	zassert_equal(EC_SUCCESS,
		      tcpci_tcpm_mux_set(tcpci_usb_mux, mux_state, &ack),
		      NULL);
	check_tcpci_reg(emul, TCPC_REG_CONFIG_STD_OUTPUT, exp_val);
	zassert_false(ack, "Ack from host shouldn't be required");
	zassert_equal(EC_SUCCESS,
		      tcpci_tcpm_mux_get(tcpci_usb_mux, &mux_state_get),
		      NULL);
	zassert_equal(mux_state, mux_state_get, "Expected state 0x%x, got 0x%x",
		      mux_state, mux_state_get);

	/* Test setting/getting MUX DP with polarity inverted */
	exp_val = (initial_val & ~TCPC_REG_CONFIG_STD_OUTPUT_MUX_MASK) |
		  TCPC_REG_CONFIG_STD_OUTPUT_MUX_DP |
		  TCPC_REG_CONFIG_STD_OUTPUT_CONNECTOR_FLIPPED;
	mux_state = USB_PD_MUX_DP_ENABLED | USB_PD_MUX_POLARITY_INVERTED;
	zassert_equal(EC_SUCCESS,
		      tcpci_tcpm_mux_set(tcpci_usb_mux, mux_state, &ack),
		      NULL);
	check_tcpci_reg(emul, TCPC_REG_CONFIG_STD_OUTPUT, exp_val);
	zassert_false(ack, "Ack from host shouldn't be required");
	zassert_equal(EC_SUCCESS,
		      tcpci_tcpm_mux_get(tcpci_usb_mux, &mux_state_get),
		      NULL);
	zassert_equal(mux_state, mux_state_get, "Expected state 0x%x, got 0x%x",
		      mux_state, mux_state_get);

	/* Test setting/getting MUX USB without polarity inverted */
	exp_val = (initial_val & ~TCPC_REG_CONFIG_STD_OUTPUT_MUX_MASK) |
		  TCPC_REG_CONFIG_STD_OUTPUT_MUX_USB;
	exp_val &= ~TCPC_REG_CONFIG_STD_OUTPUT_CONNECTOR_FLIPPED;
	mux_state = USB_PD_MUX_USB_ENABLED;
	zassert_equal(EC_SUCCESS,
		      tcpci_tcpm_mux_set(tcpci_usb_mux, mux_state, &ack),
		      NULL);
	check_tcpci_reg(emul, TCPC_REG_CONFIG_STD_OUTPUT, exp_val);
	zassert_false(ack, "Ack from host shouldn't be required");
	zassert_equal(EC_SUCCESS,
		      tcpci_tcpm_mux_get(tcpci_usb_mux, &mux_state_get),
		      NULL);
	zassert_equal(mux_state, mux_state_get, "Expected state 0x%x, got 0x%x",
		      mux_state, mux_state_get);

	/* Test setting/getting MUX USB and DP with polarity inverted */
	exp_val = (initial_val & ~TCPC_REG_CONFIG_STD_OUTPUT_MUX_MASK) |
		  TCPC_REG_CONFIG_STD_OUTPUT_MUX_DP |
		  TCPC_REG_CONFIG_STD_OUTPUT_MUX_USB |
		  TCPC_REG_CONFIG_STD_OUTPUT_CONNECTOR_FLIPPED;
	mux_state = USB_PD_MUX_USB_ENABLED | USB_PD_MUX_DP_ENABLED |
		    USB_PD_MUX_POLARITY_INVERTED;
	zassert_equal(EC_SUCCESS,
		      tcpci_tcpm_mux_set(tcpci_usb_mux, mux_state, &ack),
		      NULL);
	check_tcpci_reg(emul, TCPC_REG_CONFIG_STD_OUTPUT, exp_val);
	zassert_false(ack, "Ack from host shouldn't be required");
	zassert_equal(EC_SUCCESS,
		      tcpci_tcpm_mux_get(tcpci_usb_mux, &mux_state_get),
		      NULL);
	zassert_equal(mux_state, mux_state_get, "Expected state 0x%x, got 0x%x",
		      mux_state, mux_state_get);
}

ZTEST(tcpci, test_generic_tcpci_mux_set_get)
{
	test_generic_tcpci_mux_set_get();
}

ZTEST(tcpci, test_generic_tcpci_mux_set_get__not_tcpc)
{
	set_usb_mux_not_tcpc();
	test_generic_tcpci_mux_set_get();
	set_usb_mux_tcpc();
}

static void *tcpci_setup(void)
{
	/* This test suite assumes that first usb mux for port C0 is TCPCI */
	__ASSERT(usb_muxes[USBC_PORT_C0].driver == &tcpci_tcpm_usb_mux_driver,
		 "Invalid config of usb_muxes in test/drivers/src/stubs.c");

	return NULL;
}

ZTEST_SUITE(tcpci, drivers_predicate_post_main, tcpci_setup, NULL, NULL, NULL);