1 // SPDX-License-Identifier: GPL-2.0
2 #define CREATE_TRACE_POINTS
6 static const char * const ucsi_cmd_strs[] = {
7 [0] = "Unknown command",
8 [UCSI_PPM_RESET] = "PPM_RESET",
9 [UCSI_CANCEL] = "CANCEL",
10 [UCSI_CONNECTOR_RESET] = "CONNECTOR_RESET",
11 [UCSI_ACK_CC_CI] = "ACK_CC_CI",
12 [UCSI_SET_NOTIFICATION_ENABLE] = "SET_NOTIFICATION_ENABLE",
13 [UCSI_GET_CAPABILITY] = "GET_CAPABILITY",
14 [UCSI_GET_CONNECTOR_CAPABILITY] = "GET_CONNECTOR_CAPABILITY",
15 [UCSI_SET_UOM] = "SET_UOM",
16 [UCSI_SET_UOR] = "SET_UOR",
17 [UCSI_SET_PDM] = "SET_PDM",
18 [UCSI_SET_PDR] = "SET_PDR",
19 [UCSI_GET_ALTERNATE_MODES] = "GET_ALTERNATE_MODES",
20 [UCSI_GET_CAM_SUPPORTED] = "GET_CAM_SUPPORTED",
21 [UCSI_GET_CURRENT_CAM] = "GET_CURRENT_CAM",
22 [UCSI_SET_NEW_CAM] = "SET_NEW_CAM",
23 [UCSI_GET_PDOS] = "GET_PDOS",
24 [UCSI_GET_CABLE_PROPERTY] = "GET_CABLE_PROPERTY",
25 [UCSI_GET_CONNECTOR_STATUS] = "GET_CONNECTOR_STATUS",
26 [UCSI_GET_ERROR_STATUS] = "GET_ERROR_STATUS",
29 const char *ucsi_cmd_str(u64 raw_cmd)
31 u8 cmd = raw_cmd & GENMASK(7, 0);
33 return ucsi_cmd_strs[(cmd >= ARRAY_SIZE(ucsi_cmd_strs)) ? 0 : cmd];
36 const char *ucsi_cci_str(u32 cci)
38 if (cci & GENMASK(7, 0)) {
40 return "Event pending (ACK completed)";
42 return "Event pending (command completed)";
43 return "Connector Change";
46 return "ACK completed";
48 return "Command completed";
53 static const char * const ucsi_recipient_strs[] = {
54 [UCSI_RECIPIENT_CON] = "port",
55 [UCSI_RECIPIENT_SOP] = "partner",
56 [UCSI_RECIPIENT_SOP_P] = "plug (prime)",
57 [UCSI_RECIPIENT_SOP_PP] = "plug (double prime)",
60 const char *ucsi_recipient_str(u8 recipient)
62 return ucsi_recipient_strs[recipient];