Debian Codegraph @

src/soc/intel/tigerlake/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 #include <stdint.h>
9
10 int retimer_get_index_for_typec(uint8_t typec_port)
11 {
12 int ec_port = 0;
13
14 const struct device *tcss_port_arr[] = {
15 DEV_PTR(tcss_usb3_port1),
16 DEV_PTR(tcss_usb3_port2),
17 DEV_PTR(tcss_usb3_port3),
18 DEV_PTR(tcss_usb3_port4),
19 };
20
21 for (uint8_t i = 0; i < MAX_TYPE_C_PORTS; i++) {
22 if (i == typec_port)
23 return ec_port;
24
25 if (is_dev_enabled(tcss_port_arr[i]))
26 ec_port++;
27 }
28
29 // Code should not come here if typec_port input is correct
30 return -1;
31 }