1 /* SPDX-License-Identifier: GPL-2.0 */
7 static const char * const ucsi_cmd_strs[] = {
8 [0] = "Unknown command",
9 [UCSI_PPM_RESET] = "PPM_RESET",
10 [UCSI_CANCEL] = "CANCEL",
11 [UCSI_CONNECTOR_RESET] = "CONNECTOR_RESET",
12 [UCSI_ACK_CC_CI] = "ACK_CC_CI",
13 [UCSI_SET_NOTIFICATION_ENABLE] = "SET_NOTIFICATION_ENABLE",
14 [UCSI_GET_CAPABILITY] = "GET_CAPABILITY",
15 [UCSI_GET_CONNECTOR_CAPABILITY] = "GET_CONNECTOR_CAPABILITY",
16 [UCSI_SET_UOM] = "SET_UOM",
17 [UCSI_SET_UOR] = "SET_UOR",
18 [UCSI_SET_PDM] = "SET_PDM",
19 [UCSI_SET_PDR] = "SET_PDR",
20 [UCSI_GET_ALTERNATE_MODES] = "GET_ALTERNATE_MODES",
21 [UCSI_GET_CAM_SUPPORTED] = "GET_CAM_SUPPORTED",
22 [UCSI_GET_CURRENT_CAM] = "GET_CURRENT_CAM",
23 [UCSI_SET_NEW_CAM] = "SET_NEW_CAM",
24 [UCSI_GET_PDOS] = "GET_PDOS",
25 [UCSI_GET_CABLE_PROPERTY] = "GET_CABLE_PROPERTY",
26 [UCSI_GET_CONNECTOR_STATUS] = "GET_CONNECTOR_STATUS",
27 [UCSI_GET_ERROR_STATUS] = "GET_ERROR_STATUS",
30 static inline const char *ucsi_cmd_str(u64 raw_cmd)
32 u8 cmd = raw_cmd & GENMASK(7, 0);
34 return ucsi_cmd_strs[(cmd >= ARRAY_SIZE(ucsi_cmd_strs)) ? 0 : cmd];
37 static const char * const ucsi_ack_strs[] = {
39 [UCSI_ACK_EVENT] = "event",
40 [UCSI_ACK_CMD] = "command",
43 static inline const char *ucsi_ack_str(u8 ack)
45 return ucsi_ack_strs[(ack >= ARRAY_SIZE(ucsi_ack_strs)) ? 0 : ack];
48 static inline const char *ucsi_cci_str(u32 cci)
50 if (cci & GENMASK(7, 0)) {
52 return "Event pending (ACK completed)";
54 return "Event pending (command completed)";
55 return "Connector Change";
58 return "ACK completed";
60 return "Command completed";
65 #endif /* __UCSI_DEBUG_H */