Debian Codegraph @

src/soc/intel/pantherlake/retimer.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 #include <console/console.h>
4 #include <device/device.h>
5 #include <drivers/intel/usb4/retimer/retimer.h>
6 #include <intelblocks/tcss.h>
7 #include <static.h>
8
9 int retimer_get_index_for_typec(uint8_t typec_port)
10 {
11 const struct device *tcss_port_arr[] = {
12 DEV_PTR(tcss_usb3_port0),
13 DEV_PTR(tcss_usb3_port1),
14 #if CONFIG(SOC_INTEL_PANTHERLAKE)
15 DEV_PTR(tcss_usb3_port2),
16 DEV_PTR(tcss_usb3_port3),
17 #endif
18 };
19
20 for (int i = 0, ec_port = 0; i < MAX_TYPE_C_PORTS; i++) {
21 if (i == typec_port)
22 return ec_port;
23
24 if (is_dev_enabled(tcss_port_arr[i]))
25 ec_port++;
26 }
27
28 /* Code should not come here if typec_port input is correct */
29 return -1;
30 }