Caveh Jalali | 839ada1 | 2022-10-31 23:16:48 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: BSD-3-Clause */ |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | #ifndef __CROS_EC_EC_CMD_API_H |
| 7 | #define __CROS_EC_EC_CMD_API_H |
| 8 | |
| 9 | #ifdef __cplusplus |
| 10 | extern "C" { |
| 11 | #endif |
| 12 | |
| 13 | /* |
| 14 | * This file consists of 3 sections corresponding to the different |
| 15 | * methods used to determine the host command API function signature: |
| 16 | * |
| 17 | * 1. This section consists of functions that do not follow a simple |
| 18 | * pattern and need to be specified explicitly. |
| 19 | * |
| 20 | * 2. This section consists of functions that can be generated with the |
| 21 | * help of template macros. |
| 22 | * |
| 23 | * Note: |
| 24 | * |
| 25 | * A CROS_EC_COMMAND_INFO macro must be defined before including this |
| 26 | * file. This is the data type holding the context info identifying the |
| 27 | * EC performing the command. |
| 28 | * |
| 29 | * A CROS_EC_COMMAND macro must be defined before including this file |
| 30 | * with the following signature: |
| 31 | * |
| 32 | * int CROS_EC_COMMAND(CROS_EC_COMMAND_INFO *h, |
| 33 | * int command, int version, |
| 34 | * const void *outdata, int outsize, |
| 35 | * void *indata, int insize) |
| 36 | * |
| 37 | * This is the function implementing host command messaging with the EC. |
| 38 | */ |
| 39 | |
| 40 | /* |
| 41 | * Section 1: Functions that need to be implemented explicitly because |
| 42 | * they do not adhere to simple naming that would permit |
| 43 | * auto-generation. |
| 44 | * |
| 45 | * Please keep this list sorted by function name. |
| 46 | */ |
| 47 | |
Simon Glass | d3870a2 | 2023-11-09 08:43:30 -0700 | [diff] [blame] | 48 | static inline int ec_cmd_battery_config(CROS_EC_COMMAND_INFO *h, uint8_t *r) |
| 49 | { |
| 50 | return CROS_EC_COMMAND(h, EC_CMD_BATTERY_CONFIG, 0, NULL, 0, r, |
| 51 | BATT_CONF_MAX_SIZE); |
| 52 | } |
| 53 | |
Caveh Jalali | 839ada1 | 2022-10-31 23:16:48 -0700 | [diff] [blame] | 54 | static inline int ec_cmd_get_sku_id(CROS_EC_COMMAND_INFO *h, |
| 55 | struct ec_sku_id_info *r) |
| 56 | { |
| 57 | return CROS_EC_COMMAND(h, EC_CMD_GET_SKU_ID, 0, NULL, 0, r, sizeof(*r)); |
| 58 | } |
| 59 | |
| 60 | static inline int |
| 61 | ec_cmd_mkbp_info_get_next_data(CROS_EC_COMMAND_INFO *h, |
| 62 | const struct ec_params_mkbp_info *p, |
| 63 | union ec_response_get_next_data *r) |
| 64 | { |
| 65 | return CROS_EC_COMMAND(h, EC_CMD_MKBP_INFO, 0, p, sizeof(*p), r, |
| 66 | sizeof(*r)); |
| 67 | } |
| 68 | |
| 69 | static inline int ec_cmd_set_sku_id(CROS_EC_COMMAND_INFO *h, |
| 70 | const struct ec_sku_id_info *p) |
| 71 | { |
| 72 | return CROS_EC_COMMAND(h, EC_CMD_SET_SKU_ID, 0, p, sizeof(*p), NULL, 0); |
| 73 | } |
| 74 | |
| 75 | static inline int ec_cmd_thermal_get_threshold_v1( |
| 76 | CROS_EC_COMMAND_INFO *h, |
| 77 | const struct ec_params_thermal_get_threshold_v1 *p, |
| 78 | struct ec_thermal_config *r) |
| 79 | { |
| 80 | return CROS_EC_COMMAND(h, EC_CMD_THERMAL_GET_THRESHOLD, 1, p, |
| 81 | sizeof(*p), r, sizeof(*r)); |
| 82 | } |
| 83 | |
| 84 | static inline int |
| 85 | ec_cmd_usb_pd_dev_info(CROS_EC_COMMAND_INFO *h, |
| 86 | const struct ec_params_usb_pd_info_request *p, |
| 87 | struct ec_params_usb_pd_rw_hash_entry *r) |
| 88 | { |
| 89 | return CROS_EC_COMMAND(h, EC_CMD_USB_PD_DEV_INFO, 0, p, sizeof(*p), r, |
| 90 | sizeof(*r)); |
| 91 | } |
| 92 | |
| 93 | static inline int |
| 94 | ec_cmd_usb_pd_discovery(CROS_EC_COMMAND_INFO *h, |
| 95 | const struct ec_params_usb_pd_info_request *p, |
| 96 | struct ec_params_usb_pd_discovery_entry *r) |
| 97 | { |
| 98 | return CROS_EC_COMMAND(h, EC_CMD_USB_PD_DISCOVERY, 0, p, sizeof(*p), r, |
| 99 | sizeof(*r)); |
| 100 | } |
| 101 | |
| 102 | static inline int |
| 103 | ec_cmd_usb_pd_set_amode(CROS_EC_COMMAND_INFO *h, |
| 104 | const struct ec_params_usb_pd_set_mode_request *p) |
| 105 | { |
| 106 | return CROS_EC_COMMAND(h, EC_CMD_USB_PD_SET_AMODE, 0, p, sizeof(*p), |
| 107 | NULL, 0); |
| 108 | } |
| 109 | |
Aseda Aboagye | abc3812 | 2024-04-15 15:39:55 -0500 | [diff] [blame] | 110 | static inline int ec_cmd_fp_frame(CROS_EC_COMMAND_INFO *h, |
| 111 | const struct ec_params_fp_frame *p, |
| 112 | uint8_t *r) |
| 113 | { |
| 114 | return CROS_EC_COMMAND(h, EC_CMD_FP_FRAME, 0, p, sizeof(*p), r, |
| 115 | p->size); |
| 116 | } |
| 117 | |
| 118 | static inline int ec_cmd_fp_template(CROS_EC_COMMAND_INFO *h, |
| 119 | const struct ec_params_fp_template *p, |
| 120 | int size) |
| 121 | { |
| 122 | return CROS_EC_COMMAND(h, EC_CMD_FP_TEMPLATE, 0, p, size, NULL, 0); |
| 123 | } |
Caveh Jalali | 839ada1 | 2022-10-31 23:16:48 -0700 | [diff] [blame] | 124 | /* |
| 125 | * Section 2: EC interface functions that can be generated with the help |
| 126 | * of template macros. |
| 127 | * |
| 128 | * _cmd host command name |
| 129 | * _v host command version number |
| 130 | * _fn host command function name (will be prefixed with ec_cmd_) |
| 131 | * _in host command input (param) data type (will be prefixed with |
| 132 | * ec_params_) |
| 133 | * _out host command output (response) data type (will be prefixed with |
| 134 | * ec_response_) |
| 135 | * |
| 136 | * Template macros follow a naming scheme based on the arguments they |
| 137 | * require: |
| 138 | * |
| 139 | * C0 host command version 0, does not need to be specified (most |
| 140 | * common/default case) |
| 141 | * CV host command with specified version |
| 142 | * one of C0, CV is required |
| 143 | * F function name generated (the lower case version of the _cmd arg) |
| 144 | * (required) |
| 145 | * PF parameter type derived from function name (_fn arg) |
| 146 | * P parameter type specified explicitly (i.e. can not be derived from |
| 147 | * _fn arg) |
| 148 | * PF, P are mutually exclusive and optional |
| 149 | * RF response type derived from function name (_fn arg) |
| 150 | * R response type specified explicitly (i.e. can not be derived from |
| 151 | * _fn arg) |
| 152 | * RF, R are mutually exclusive and optional |
| 153 | */ |
| 154 | |
| 155 | /* |
| 156 | * Template for EC interface functions that take a param and returns a |
| 157 | * response. |
| 158 | */ |
| 159 | #define _CROS_EC_CV_F_P_R(_cmd, _v, _fn, _in, _out) \ |
| 160 | static inline int ec_cmd_##_fn(CROS_EC_COMMAND_INFO *h, \ |
| 161 | const struct ec_params_##_in *p, \ |
| 162 | struct ec_response_##_out *r) \ |
| 163 | { \ |
| 164 | return CROS_EC_COMMAND(h, (_cmd), (_v), p, sizeof(*p), r, \ |
| 165 | sizeof(*r)); \ |
| 166 | } |
| 167 | |
| 168 | /* |
| 169 | * Template for EC interface functions that take a param but do not |
| 170 | * return a response. |
| 171 | */ |
| 172 | #define _CROS_EC_CV_F_P(_cmd, _v, _fn, _in) \ |
| 173 | static inline int ec_cmd_##_fn(CROS_EC_COMMAND_INFO *h, \ |
| 174 | const struct ec_params_##_in *p) \ |
| 175 | { \ |
| 176 | return CROS_EC_COMMAND(h, (_cmd), (_v), p, sizeof(*p), NULL, \ |
| 177 | 0); \ |
| 178 | } |
| 179 | |
| 180 | /* |
| 181 | * Template for EC interface functions that do not take a param but do |
| 182 | * return a response. |
| 183 | */ |
| 184 | #define _CROS_EC_CV_F_R(_cmd, _v, _fn, _out) \ |
| 185 | static inline int ec_cmd_##_fn(CROS_EC_COMMAND_INFO *h, \ |
| 186 | struct ec_response_##_out *r) \ |
| 187 | { \ |
| 188 | return CROS_EC_COMMAND(h, (_cmd), (_v), NULL, 0, r, \ |
| 189 | sizeof(*r)); \ |
| 190 | } |
| 191 | |
| 192 | /* |
| 193 | * Template for EC interface functions that do not take a param and do |
| 194 | * not return a response. |
| 195 | */ |
| 196 | #define _CROS_EC_CV_F(_cmd, _v, _fn) \ |
| 197 | static inline int ec_cmd_##_fn(CROS_EC_COMMAND_INFO *h) \ |
| 198 | { \ |
| 199 | return CROS_EC_COMMAND(h, (_cmd), (_v), NULL, 0, NULL, 0); \ |
| 200 | } |
| 201 | |
| 202 | /* |
| 203 | * Shorthand for host command version 0 where param and response name is |
| 204 | * derived from the function name. |
| 205 | */ |
| 206 | #define _CROS_EC_C0_F_PF_RF(_cmd, _fn) _CROS_EC_CV_F_P_R(_cmd, 0, _fn, _fn, _fn) |
| 207 | |
| 208 | /* |
| 209 | * Shorthand for host command version 1 where param and response name is |
| 210 | * derived from the function name. |
| 211 | */ |
| 212 | #define _CROS_EC_C1_F_PF_RF(_cmd, _fn) \ |
| 213 | _CROS_EC_CV_F_P_R(_cmd, 1, _fn##_v1, _fn##_v1, _fn##_v1) |
| 214 | |
| 215 | /* |
| 216 | * Shorthand for host command version 0 where param name is |
| 217 | * derived from the function name and there is no response. |
| 218 | */ |
| 219 | #define _CROS_EC_C0_F_PF(_cmd, _fn) _CROS_EC_CV_F_P(_cmd, 0, _fn, _fn) |
| 220 | |
| 221 | /* |
| 222 | * Shorthand for host command version 1 where param name is |
| 223 | * derived from the function name and there is no response. |
| 224 | */ |
| 225 | #define _CROS_EC_C1_F_PF(_cmd, _fn) _CROS_EC_CV_F_P(_cmd, 1, _fn##_v1, _fn##_v1) |
| 226 | |
| 227 | /* |
| 228 | * Shorthand for host command version 0 where response name is derived |
| 229 | * from the function name and there is no param. |
| 230 | */ |
| 231 | #define _CROS_EC_C0_F_RF(_cmd, _fn) _CROS_EC_CV_F_R(_cmd, 0, _fn, _fn) |
| 232 | |
| 233 | /* |
| 234 | * Shorthand for host command version 1 where response name is derived |
| 235 | * from the function name and there is no param. |
| 236 | */ |
| 237 | #define _CROS_EC_C1_F_RF(_cmd, _fn) _CROS_EC_CV_F_R(_cmd, 1, _fn##_v1, _fn##_v1) |
| 238 | |
| 239 | /* |
| 240 | * Shorthand for host command version 0 where response and there are no |
| 241 | * params or response. |
| 242 | */ |
| 243 | #define _CROS_EC_C0_F(_cmd, _fn) _CROS_EC_CV_F(_cmd, 0, _fn) |
| 244 | |
| 245 | /* |
| 246 | * Please keep this list sorted by host command. Sort with: |
| 247 | * |
| 248 | * clang-format '--style={BasedOnStyle: InheritParentConfig, |
| 249 | * ColumnLimit: 888 }' include/ec_cmd_api.h | grep '^_CROS' | |
| 250 | * LC_COLLATE=C sort -t '(' -k 2,2 | clang-format |
| 251 | */ |
| 252 | |
| 253 | _CROS_EC_C0_F_PF_RF(EC_CMD_ADC_READ, adc_read); |
| 254 | _CROS_EC_CV_F_P(EC_CMD_ADD_ENTROPY, 0, add_entropy, rollback_add_entropy); |
Simon Glass | d3870a2 | 2023-11-09 08:43:30 -0700 | [diff] [blame] | 255 | _CROS_EC_C0_F_PF(EC_CMD_AP_FW_STATE, ap_fw_state); |
Caveh Jalali | 839ada1 | 2022-10-31 23:16:48 -0700 | [diff] [blame] | 256 | _CROS_EC_C0_F(EC_CMD_AP_RESET, ap_reset); |
| 257 | _CROS_EC_CV_F_P(EC_CMD_BATTERY_CUT_OFF, 1, battery_cut_off_v1, battery_cutoff); |
| 258 | _CROS_EC_C0_F(EC_CMD_BATTERY_CUT_OFF, battery_cut_off); |
| 259 | _CROS_EC_CV_F_P_R(EC_CMD_BATTERY_GET_DYNAMIC, 0, battery_get_dynamic, |
| 260 | battery_dynamic_info, battery_dynamic_info); |
| 261 | _CROS_EC_CV_F_P_R(EC_CMD_BATTERY_GET_STATIC, 0, battery_get_static, |
| 262 | battery_static_info, battery_static_info); |
| 263 | _CROS_EC_CV_F_P_R(EC_CMD_BATTERY_GET_STATIC, 1, battery_get_static_v1, |
| 264 | battery_static_info, battery_static_info_v1); |
| 265 | _CROS_EC_CV_F_P_R(EC_CMD_BATTERY_GET_STATIC, 2, battery_get_static_v2, |
| 266 | battery_static_info, battery_static_info_v2); |
| 267 | _CROS_EC_C0_F_PF_RF(EC_CMD_BATTERY_VENDOR_PARAM, battery_vendor_param); |
| 268 | _CROS_EC_C0_F_PF(EC_CMD_BUTTON, button); |
| 269 | _CROS_EC_C0_F_PF_RF(EC_CMD_CEC_GET, cec_get); |
| 270 | _CROS_EC_C0_F_PF(EC_CMD_CEC_SET, cec_set); |
Simon Glass | d3870a2 | 2023-11-09 08:43:30 -0700 | [diff] [blame] | 271 | _CROS_EC_C1_F_PF(EC_CMD_CEC_WRITE_MSG, cec_write); |
| 272 | _CROS_EC_C0_F_PF_RF(EC_CMD_CEC_READ_MSG, cec_read); |
| 273 | _CROS_EC_C0_F_RF(EC_CMD_CEC_PORT_COUNT, cec_port_count); |
Caveh Jalali | 839ada1 | 2022-10-31 23:16:48 -0700 | [diff] [blame] | 274 | _CROS_EC_C0_F_PF_RF(EC_CMD_CHARGESPLASH, chargesplash); |
| 275 | _CROS_EC_CV_F_P_R(EC_CMD_CHARGE_CONTROL, 2, charge_control_v2, charge_control, |
| 276 | charge_control); |
| 277 | _CROS_EC_CV_F_P(EC_CMD_CHARGE_CURRENT_LIMIT, 0, charge_current_limit, |
| 278 | current_limit); |
| 279 | _CROS_EC_C0_F_RF(EC_CMD_CHARGE_PORT_COUNT, charge_port_count); |
| 280 | _CROS_EC_C0_F_PF_RF(EC_CMD_CHARGE_STATE, charge_state); |
| 281 | _CROS_EC_C0_F_PF(EC_CMD_CONFIG_POWER_BUTTON, config_power_button); |
| 282 | _CROS_EC_C0_F(EC_CMD_CONSOLE_SNAPSHOT, console_snapshot); |
| 283 | _CROS_EC_C0_F_PF_RF(EC_CMD_DEVICE_EVENT, device_event); |
| 284 | _CROS_EC_C0_F_RF(EC_CMD_DISPLAY_SOC, display_soc); |
| 285 | _CROS_EC_C0_F_PF(EC_CMD_EFS_VERIFY, efs_verify); |
| 286 | _CROS_EC_C1_F_PF(EC_CMD_EXTERNAL_POWER_LIMIT, external_power_limit); |
| 287 | _CROS_EC_C0_F_PF(EC_CMD_FLASH_ERASE, flash_erase); |
| 288 | _CROS_EC_CV_F_R(EC_CMD_FLASH_INFO, 1, flash_info_v1, flash_info_1); |
| 289 | _CROS_EC_C0_F_RF(EC_CMD_FLASH_INFO, flash_info); |
| 290 | _CROS_EC_CV_F_P_R(EC_CMD_FLASH_PROTECT, 1, flash_protect_v1, flash_protect, |
| 291 | flash_protect); |
| 292 | _CROS_EC_C0_F_PF_RF(EC_CMD_FLASH_PROTECT, flash_protect); |
| 293 | _CROS_EC_CV_F_P_R(EC_CMD_FLASH_REGION_INFO, 1, flash_region_info_v1, |
| 294 | flash_region_info, flash_region_info); |
| 295 | _CROS_EC_C0_F_RF(EC_CMD_FLASH_SPI_INFO, flash_spi_info); |
| 296 | _CROS_EC_C0_F_PF(EC_CMD_FORCE_LID_OPEN, force_lid_open); |
Caveh Jalali | 839ada1 | 2022-10-31 23:16:48 -0700 | [diff] [blame] | 297 | _CROS_EC_C0_F_PF(EC_CMD_FP_SEED, fp_seed); |
Aseda Aboagye | abc3812 | 2024-04-15 15:39:55 -0500 | [diff] [blame] | 298 | _CROS_EC_C0_F_PF_RF(EC_CMD_FP_MODE, fp_mode); |
| 299 | _CROS_EC_C0_F_PF_RF(EC_CMD_FP_READ_MATCH_SECRET, fp_read_match_secret); |
| 300 | _CROS_EC_C0_F_RF(EC_CMD_FP_ENC_STATUS, fp_encryption_status); |
Caveh Jalali | 839ada1 | 2022-10-31 23:16:48 -0700 | [diff] [blame] | 301 | _CROS_EC_C0_F_RF(EC_CMD_FP_STATS, fp_stats); |
Aseda Aboagye | abc3812 | 2024-04-15 15:39:55 -0500 | [diff] [blame] | 302 | _CROS_EC_C1_F_PF(EC_CMD_FP_CONTEXT, fp_context); |
| 303 | _CROS_EC_CV_F_R(EC_CMD_FP_INFO, 1, fp_info, fp_info); |
Caveh Jalali | 839ada1 | 2022-10-31 23:16:48 -0700 | [diff] [blame] | 304 | _CROS_EC_CV_F_R(EC_CMD_GET_BOARD_VERSION, 0, get_board_version, board_version); |
| 305 | _CROS_EC_C0_F_RF(EC_CMD_GET_BOOT_TIME, get_boot_time); |
| 306 | _CROS_EC_C0_F_RF(EC_CMD_GET_CHIP_INFO, get_chip_info); |
| 307 | _CROS_EC_CV_F_P_R(EC_CMD_GET_CMD_VERSIONS, 1, get_cmd_versions_v1, |
| 308 | get_cmd_versions_v1, get_cmd_versions); |
| 309 | _CROS_EC_C0_F_PF_RF(EC_CMD_GET_CMD_VERSIONS, get_cmd_versions); |
| 310 | _CROS_EC_C0_F_RF(EC_CMD_GET_COMMS_STATUS, get_comms_status); |
| 311 | _CROS_EC_C0_F_RF(EC_CMD_GET_FEATURES, get_features); |
| 312 | _CROS_EC_CV_F_R(EC_CMD_GET_KEYBD_CONFIG, 0, get_keybd_config, keybd_config); |
Caveh Jalali | 839ada1 | 2022-10-31 23:16:48 -0700 | [diff] [blame] | 313 | _CROS_EC_C0_F_RF(EC_CMD_GET_NEXT_EVENT, get_next_event); |
Aseda Aboagye | abc3812 | 2024-04-15 15:39:55 -0500 | [diff] [blame] | 314 | _CROS_EC_C1_F_RF(EC_CMD_GET_NEXT_EVENT, get_next_event); |
| 315 | _CROS_EC_CV_F_R(EC_CMD_GET_NEXT_EVENT, 2, get_next_event_v2, get_next_event_v1); |
Caveh Jalali | 839ada1 | 2022-10-31 23:16:48 -0700 | [diff] [blame] | 316 | _CROS_EC_C0_F_PF_RF(EC_CMD_GET_PD_PORT_CAPS, get_pd_port_caps); |
| 317 | _CROS_EC_C0_F_RF(EC_CMD_GET_PROTOCOL_INFO, get_protocol_info); |
| 318 | _CROS_EC_CV_F_R(EC_CMD_GET_UPTIME_INFO, 0, get_uptime_info, uptime_info); |
| 319 | _CROS_EC_C0_F_RF(EC_CMD_GET_VERSION, get_version); |
| 320 | _CROS_EC_C1_F_RF(EC_CMD_GET_VERSION, get_version); |
| 321 | _CROS_EC_C0_F_PF_RF(EC_CMD_GPIO_GET, gpio_get); |
| 322 | _CROS_EC_C1_F_PF_RF(EC_CMD_GPIO_GET, gpio_get); |
| 323 | _CROS_EC_C0_F_PF(EC_CMD_GPIO_SET, gpio_set); |
| 324 | _CROS_EC_CV_F_P_R(EC_CMD_GSV_PAUSE_IN_S5, 0, gsv_pause_in_s5, get_set_value, |
| 325 | get_set_value); |
Aseda Aboagye | abc3812 | 2024-04-15 15:39:55 -0500 | [diff] [blame] | 326 | _CROS_EC_C0_F_PF_RF(EC_CMD_HANG_DETECT, hang_detect); |
Caveh Jalali | 839ada1 | 2022-10-31 23:16:48 -0700 | [diff] [blame] | 327 | _CROS_EC_C0_F_PF_RF(EC_CMD_HELLO, hello); |
| 328 | _CROS_EC_C0_F_PF_RF(EC_CMD_HIBERNATION_DELAY, hibernation_delay); |
| 329 | _CROS_EC_C0_F_PF_RF(EC_CMD_HOST_EVENT, host_event); |
| 330 | _CROS_EC_CV_F_P(EC_CMD_HOST_EVENT_CLEAR, 0, host_event_clear, host_event_mask); |
| 331 | _CROS_EC_CV_F_P(EC_CMD_HOST_EVENT_CLEAR_B, 0, host_event_clear_b, |
| 332 | host_event_mask); |
| 333 | _CROS_EC_CV_F_R(EC_CMD_HOST_EVENT_GET_B, 0, host_event_get_b, host_event_mask); |
| 334 | _CROS_EC_CV_F_R(EC_CMD_HOST_EVENT_GET_SCI_MASK, 0, host_event_get_sci_mask, |
| 335 | host_event_mask); |
| 336 | _CROS_EC_CV_F_R(EC_CMD_HOST_EVENT_GET_SMI_MASK, 0, host_event_get_smi_mask, |
| 337 | host_event_mask); |
| 338 | _CROS_EC_CV_F_R(EC_CMD_HOST_EVENT_GET_WAKE_MASK, 0, host_event_get_wake_mask, |
| 339 | host_event_mask); |
| 340 | _CROS_EC_CV_F_P(EC_CMD_HOST_EVENT_SET_SCI_MASK, 0, host_event_set_sci_mask, |
| 341 | host_event_mask); |
| 342 | _CROS_EC_CV_F_P(EC_CMD_HOST_EVENT_SET_SMI_MASK, 0, host_event_set_smi_mask, |
| 343 | host_event_mask); |
| 344 | _CROS_EC_CV_F_P(EC_CMD_HOST_EVENT_SET_WAKE_MASK, 0, host_event_set_wake_mask, |
| 345 | host_event_mask); |
| 346 | _CROS_EC_C0_F_PF(EC_CMD_HOST_SLEEP_EVENT, host_sleep_event); |
| 347 | _CROS_EC_C1_F_PF_RF(EC_CMD_HOST_SLEEP_EVENT, host_sleep_event); |
| 348 | _CROS_EC_C0_F_PF_RF(EC_CMD_I2C_CONTROL, i2c_control); |
| 349 | _CROS_EC_C0_F_PF_RF(EC_CMD_I2C_PASSTHRU_PROTECT, i2c_passthru_protect); |
| 350 | _CROS_EC_C0_F_RF(EC_CMD_KEYBOARD_FACTORY_TEST, keyboard_factory_test); |
| 351 | _CROS_EC_CV_F_P_R(EC_CMD_LED_CONTROL, 1, led_control_v1, led_control, |
| 352 | led_control); |
| 353 | _CROS_EC_C0_F_PF_RF(EC_CMD_LOCATE_CHIP, locate_chip); |
| 354 | _CROS_EC_C0_F_RF(EC_CMD_MKBP_GET_CONFIG, mkbp_get_config); |
| 355 | _CROS_EC_C0_F_PF_RF(EC_CMD_MKBP_INFO, mkbp_info); |
| 356 | _CROS_EC_C0_F_PF(EC_CMD_MKBP_SET_CONFIG, mkbp_set_config); |
| 357 | _CROS_EC_C0_F_PF(EC_CMD_MKBP_SIMULATE_KEY, mkbp_simulate_key); |
| 358 | _CROS_EC_CV_F_P_R(EC_CMD_MKBP_WAKE_MASK, 0, mkbp_wake_mask, |
| 359 | mkbp_event_wake_mask, mkbp_event_wake_mask); |
| 360 | _CROS_EC_CV_F_P_R(EC_CMD_MOTION_SENSE_CMD, 1, motion_sense_cmd_v1, motion_sense, |
| 361 | motion_sense); |
| 362 | _CROS_EC_CV_F_P_R(EC_CMD_MOTION_SENSE_CMD, 2, motion_sense_cmd_v2, motion_sense, |
| 363 | motion_sense); |
| 364 | _CROS_EC_CV_F_P_R(EC_CMD_MOTION_SENSE_CMD, 4, motion_sense_cmd_v4, motion_sense, |
| 365 | motion_sense); |
| 366 | _CROS_EC_CV_F_P(EC_CMD_OVERRIDE_DEDICATED_CHARGER_LIMIT, 0, |
| 367 | override_dedicated_charger_limit, dedicated_charger_limit); |
| 368 | _CROS_EC_C0_F_RF(EC_CMD_PCHG_COUNT, pchg_count); |
| 369 | _CROS_EC_CV_F_P(EC_CMD_PD_CHARGE_PORT_OVERRIDE, 0, pd_charge_port_override, |
| 370 | charge_port_override); |
| 371 | _CROS_EC_CV_F_P_R(EC_CMD_PD_CHIP_INFO, 1, pd_chip_info_v1, pd_chip_info, |
| 372 | pd_chip_info_v1); |
| 373 | _CROS_EC_C0_F_PF_RF(EC_CMD_PD_CHIP_INFO, pd_chip_info); |
| 374 | _CROS_EC_C0_F_PF(EC_CMD_PD_CONTROL, pd_control); |
| 375 | _CROS_EC_CV_F_R(EC_CMD_PD_HOST_EVENT_STATUS, 0, pd_host_event_status, |
| 376 | host_event_status); |
| 377 | _CROS_EC_C0_F_PF(EC_CMD_PD_WRITE_LOG_ENTRY, pd_write_log_entry); |
| 378 | _CROS_EC_C0_F_RF(EC_CMD_PORT80_LAST_BOOT, port80_last_boot); |
| 379 | _CROS_EC_C1_F_RF(EC_CMD_POWER_INFO, power_info); |
| 380 | _CROS_EC_CV_F_P_R(EC_CMD_PSE, 0, pse, pse, pse_status); |
| 381 | _CROS_EC_C0_F_RF(EC_CMD_PSTORE_INFO, pstore_info); |
| 382 | _CROS_EC_C0_F_PF(EC_CMD_PSTORE_WRITE, pstore_write); |
| 383 | _CROS_EC_C0_F_PF_RF(EC_CMD_PWM_GET_DUTY, pwm_get_duty); |
| 384 | _CROS_EC_C0_F_RF(EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT, pwm_get_keyboard_backlight); |
| 385 | _CROS_EC_C0_F_PF(EC_CMD_PWM_SET_DUTY, pwm_set_duty); |
| 386 | _CROS_EC_C0_F_PF(EC_CMD_PWM_SET_FAN_DUTY, pwm_set_fan_duty_v0); |
| 387 | _CROS_EC_C0_F_PF(EC_CMD_PWM_SET_KEYBOARD_BACKLIGHT, pwm_set_keyboard_backlight); |
| 388 | _CROS_EC_C0_F_PF_RF(EC_CMD_RAND_NUM, rand_num); |
| 389 | _CROS_EC_C0_F(EC_CMD_REBOOT, reboot); |
| 390 | _CROS_EC_C0_F(EC_CMD_REBOOT_AP_ON_G3, reboot_ap_on_g3); |
| 391 | _CROS_EC_C1_F_PF(EC_CMD_REBOOT_AP_ON_G3, reboot_ap_on_g3); |
| 392 | _CROS_EC_C0_F_PF(EC_CMD_REBOOT_EC, reboot_ec); |
| 393 | _CROS_EC_C0_F_PF(EC_CMD_REGULATOR_ENABLE, regulator_enable); |
| 394 | _CROS_EC_C0_F_PF_RF(EC_CMD_REGULATOR_GET_VOLTAGE, regulator_get_voltage); |
| 395 | _CROS_EC_C0_F_PF_RF(EC_CMD_REGULATOR_IS_ENABLED, regulator_is_enabled); |
| 396 | _CROS_EC_C0_F_PF(EC_CMD_REGULATOR_SET_VOLTAGE, regulator_set_voltage); |
| 397 | _CROS_EC_C0_F_PF_RF(EC_CMD_RGBKBD, rgbkbd); |
| 398 | _CROS_EC_C0_F_RF(EC_CMD_ROLLBACK_INFO, rollback_info); |
| 399 | _CROS_EC_CV_F_R(EC_CMD_RTC_GET_ALARM, 0, rtc_get_alarm, rtc); |
| 400 | _CROS_EC_CV_F_R(EC_CMD_RTC_GET_VALUE, 0, rtc_get_value, rtc); |
| 401 | _CROS_EC_CV_F_P(EC_CMD_RTC_SET_ALARM, 0, rtc_set_alarm, rtc); |
| 402 | _CROS_EC_CV_F_P(EC_CMD_RTC_SET_VALUE, 0, rtc_set_value, rtc); |
| 403 | _CROS_EC_C0_F_PF(EC_CMD_RWSIG_ACTION, rwsig_action); |
| 404 | _CROS_EC_C0_F_RF(EC_CMD_RWSIG_CHECK_STATUS, rwsig_check_status); |
| 405 | _CROS_EC_C0_F_RF(EC_CMD_RWSIG_INFO, rwsig_info); |
| 406 | _CROS_EC_C0_F_PF(EC_CMD_SET_BASE_STATE, set_base_state); |
| 407 | _CROS_EC_C0_F_PF(EC_CMD_SET_TABLET_MODE, set_tablet_mode); |
| 408 | _CROS_EC_C0_F_PF_RF(EC_CMD_SMART_DISCHARGE, smart_discharge); |
| 409 | _CROS_EC_CV_F_P(EC_CMD_SWITCH_ENABLE_BKLIGHT, 0, switch_enable_bklight, |
| 410 | switch_enable_backlight); |
| 411 | _CROS_EC_CV_F_P(EC_CMD_SWITCH_ENABLE_WIRELESS, 0, switch_enable_wireless, |
| 412 | switch_enable_wireless_v0); |
| 413 | _CROS_EC_C1_F_PF_RF(EC_CMD_SWITCH_ENABLE_WIRELESS, switch_enable_wireless); |
| 414 | _CROS_EC_C0_F_RF(EC_CMD_SYSINFO, sysinfo); |
| 415 | _CROS_EC_C0_F_PF_RF(EC_CMD_TEMP_SENSOR_GET_INFO, temp_sensor_get_info); |
| 416 | _CROS_EC_C0_F_PF_RF(EC_CMD_TEST_PROTOCOL, test_protocol); |
| 417 | _CROS_EC_C0_F(EC_CMD_THERMAL_AUTO_FAN_CTRL, thermal_auto_fan_ctrl); |
| 418 | _CROS_EC_C0_F_PF_RF(EC_CMD_THERMAL_GET_THRESHOLD, thermal_get_threshold); |
| 419 | _CROS_EC_C0_F_PF(EC_CMD_THERMAL_SET_THRESHOLD, thermal_set_threshold); |
| 420 | _CROS_EC_C1_F_PF(EC_CMD_THERMAL_SET_THRESHOLD, thermal_set_threshold); |
| 421 | _CROS_EC_C0_F_PF_RF(EC_CMD_TMP006_GET_RAW, tmp006_get_raw); |
| 422 | _CROS_EC_C0_F_PF(EC_CMD_TYPEC_CONTROL, typec_control); |
| 423 | _CROS_EC_C0_F_PF_RF(EC_CMD_TYPEC_STATUS, typec_status); |
| 424 | _CROS_EC_C0_F_PF_RF(EC_CMD_TYPEC_VDM_RESPONSE, typec_vdm_response); |
| 425 | _CROS_EC_C0_F_PF(EC_CMD_USB_CHARGE_SET_MODE, usb_charge_set_mode); |
| 426 | _CROS_EC_C0_F_PF(EC_CMD_USB_MUX, usb_mux); |
| 427 | _CROS_EC_CV_F_P_R(EC_CMD_USB_PD_CONTROL, 2, usb_pd_control_v2, usb_pd_control, |
| 428 | usb_pd_control_v2); |
| 429 | _CROS_EC_C0_F_PF_RF(EC_CMD_USB_PD_CONTROL, usb_pd_control); |
| 430 | _CROS_EC_C0_F_PF(EC_CMD_USB_PD_DPS_CONTROL, usb_pd_dps_control); |
| 431 | _CROS_EC_C0_F_PF(EC_CMD_USB_PD_MUX_ACK, usb_pd_mux_ack); |
| 432 | _CROS_EC_C0_F_PF_RF(EC_CMD_USB_PD_MUX_INFO, usb_pd_mux_info); |
| 433 | _CROS_EC_C0_F_RF(EC_CMD_USB_PD_PORTS, usb_pd_ports); |
| 434 | _CROS_EC_C0_F_PF_RF(EC_CMD_USB_PD_POWER_INFO, usb_pd_power_info); |
| 435 | _CROS_EC_C0_F_PF(EC_CMD_USB_PD_RW_HASH_ENTRY, usb_pd_rw_hash_entry); |
| 436 | _CROS_EC_C0_F_PF_RF(EC_CMD_VBOOT_HASH, vboot_hash); |
| 437 | _CROS_EC_C0_F_PF_RF(EC_CMD_VSTORE_READ, vstore_read); |
| 438 | _CROS_EC_C0_F_PF(EC_CMD_VSTORE_WRITE, vstore_write); |
| 439 | |
| 440 | #ifdef __cplusplus |
| 441 | } |
| 442 | #endif |
| 443 | |
| 444 | #endif /* __CROS_EC_EC_CMD_API_H */ |