History

mfd: cros_ec: Define commands as 4-digit UPPER CASE hex values

This change is required for compilation of embedded controller firmware to work properly (See CONFIG_HOSTCMD_SECTION_SORTED).

Gwendal Grignou committed 7 years ago

Commit ff834331 parent 6f72c3f1 file · +136 −99Browse files

Unified · Split

include/linux/mfd/cros_ec_commands.h+136−99
@@ -553,6 +553,9 @@ struct ec_host_response { · 552 unmodified lines
553553 * Parameter/response length is implicit in the structs. Some underlying
554554 * communication protocols (I2C, SPI) may add length or checksum headers, but
555555 * those are implementation-dependent and not defined here.
556+ *
557+ * All commands MUST be #defined to be 4-digit UPPER CASE hex values
558+ * (e.g., 0x00AB, not 0xab) for CONFIG_HOSTCMD_SECTION_SORTED to work.
556559 */
557560
558561 /*****************************************************************************/
@@ -562,7 +565,7 @@ struct ec_host_response { · 3 unmodified lines
562565 * Get protocol version, used to deal with non-backward compatible protocol
563566 * changes.
564567 */
565−#define EC_CMD_PROTO_VERSION 0x00
568+#define EC_CMD_PROTO_VERSION 0x0000
566569
567570 /**
568571 * struct ec_response_proto_version - Response to the proto version command.
@@ -576,7 +579,7 @@ struct ec_response_proto_version { · 7 unmodified lines
576579 * Hello. This is a simple command to test the EC is responsive to
577580 * commands.
578581 */
579−#define EC_CMD_HELLO 0x01
582+#define EC_CMD_HELLO 0x0001
580583
581584 /**
582585 * struct ec_params_hello - Parameters to the hello command.
@@ -595,7 +598,7 @@ struct ec_response_hello { · 12 unmodified lines
595598 } __ec_align4;
596599
597600 /* Get version number */
598−#define EC_CMD_GET_VERSION 0x02
601+#define EC_CMD_GET_VERSION 0x0002
599602
600603 enum ec_current_image {
601604 EC_IMAGE_UNKNOWN = 0,
@@ -618,7 +621,7 @@ struct ec_response_get_version { · 16 unmodified lines
618621 } __ec_align4;
619622
620623 /* Read test */
621−#define EC_CMD_READ_TEST 0x03
624+#define EC_CMD_READ_TEST 0x0003
622625
623626 /**
624627 * struct ec_params_read_test - Parameters for the read test command.
@@ -643,10 +646,10 @@ struct ec_response_read_test { · 18 unmodified lines
643646 *
644647 * Response is null-terminated string.
645648 */
646−#define EC_CMD_GET_BUILD_INFO 0x04
649+#define EC_CMD_GET_BUILD_INFO 0x0004
647650
648651 /* Get chip info */
649−#define EC_CMD_GET_CHIP_INFO 0x05
652+#define EC_CMD_GET_CHIP_INFO 0x0005
650653
651654 /**
652655 * struct ec_response_get_chip_info - Response to the get chip info command.
@@ -661,7 +664,7 @@ struct ec_response_get_chip_info { · 8 unmodified lines
661664 } __ec_align4;
662665
663666 /* Get board HW version */
664−#define EC_CMD_GET_BOARD_VERSION 0x06
667+#define EC_CMD_GET_BOARD_VERSION 0x0006
665668
666669 /**
667670 * struct ec_response_board_version - Response to the board version command.
@@ -679,7 +682,7 @@ struct ec_response_board_version { · 11 unmodified lines
679682 *
680683 * Response is params.size bytes of data.
681684 */
682−#define EC_CMD_READ_MEMMAP 0x07
685+#define EC_CMD_READ_MEMMAP 0x0007
683686
684687 /**
685688 * struct ec_params_read_memmap - Parameters for the read memory map command.
@@ -692,7 +695,7 @@ struct ec_params_read_memmap { · 6 unmodified lines
692695 } __ec_align1;
693696
694697 /* Read versions supported for a command */
695−#define EC_CMD_GET_CMD_VERSIONS 0x08
698+#define EC_CMD_GET_CMD_VERSIONS 0x0008
696699
697700 /**
698701 * struct ec_params_get_cmd_versions - Parameters for the get command versions.
@@ -727,7 +730,7 @@ struct ec_response_get_cmd_versions { · 28 unmodified lines
727730 * lpc must read the status from the command register. Attempting this on
728731 * lpc will overwrite the args/parameter space and corrupt its data.
729732 */
730−#define EC_CMD_GET_COMMS_STATUS 0x09
733+#define EC_CMD_GET_COMMS_STATUS 0x0009
731734
732735 /* Avoid using ec_status which is for return values */
733736 enum ec_comms_status {
@@ -744,7 +747,7 @@ struct ec_response_get_comms_status { · 10 unmodified lines
744747 } __ec_align4;
745748
746749 /* Fake a variety of responses, purely for testing purposes. */
747−#define EC_CMD_TEST_PROTOCOL 0x0a
750+#define EC_CMD_TEST_PROTOCOL 0x000A
748751
749752 /* Tell the EC what to send back to us. */
750753 struct ec_params_test_protocol {
@@ -759,7 +762,7 @@ struct ec_response_test_protocol { · 8 unmodified lines
759762 } __ec_align4;
760763
761764 /* Get protocol information */
762−#define EC_CMD_GET_PROTOCOL_INFO 0x0b
765+#define EC_CMD_GET_PROTOCOL_INFO 0x000B
763766
764767 /* Flags for ec_response_get_protocol_info.flags */
765768 /* EC_RES_IN_PROGRESS may be returned if a command is slow */
@@ -805,11 +808,11 @@ struct ec_response_get_set_value { · 39 unmodified lines
805808 } __ec_align4;
806809
807810 /* More than one command can use these structs to get/set parameters. */
808−#define EC_CMD_GSV_PAUSE_IN_S5 0x0c
811+#define EC_CMD_GSV_PAUSE_IN_S5 0x000C
809812
810813 /*****************************************************************************/
811814 /* List the features supported by the firmware */
812−#define EC_CMD_GET_FEATURES 0x0d
815+#define EC_CMD_GET_FEATURES 0x000D
813816
814817 /* Supported features */
815818 enum ec_feature_code {
@@ -933,7 +936,7 @@ struct ec_response_get_features { · 117 unmodified lines
933936 /* Flash commands */
934937
935938 /* Get flash info */
936−#define EC_CMD_FLASH_INFO 0x10
939+#define EC_CMD_FLASH_INFO 0x0010
937940
938941 /**
939942 * struct ec_response_flash_info - Response to the flash info command.
@@ -1000,7 +1003,7 @@ struct ec_response_flash_info_1 { · 60 unmodified lines
10001003 *
10011004 * Response is params.size bytes of data.
10021005 */
1003−#define EC_CMD_FLASH_READ 0x11
1006+#define EC_CMD_FLASH_READ 0x0011
10041007
10051008 /**
10061009 * struct ec_params_flash_read - Parameters for the flash read command.
@@ -1013,7 +1016,7 @@ struct ec_params_flash_read { · 6 unmodified lines
10131016 } __ec_align4;
10141017
10151018 /* Write flash */
1016−#define EC_CMD_FLASH_WRITE 0x12
1019+#define EC_CMD_FLASH_WRITE 0x0012
10171020 #define EC_VER_FLASH_WRITE 1
10181021
10191022 /* Version 0 of the flash command supported only 64 bytes of data */
@@ -1031,7 +1034,7 @@ struct ec_params_flash_write { · 11 unmodified lines
10311034 } __ec_align4;
10321035
10331036 /* Erase flash */
1034−#define EC_CMD_FLASH_ERASE 0x13
1037+#define EC_CMD_FLASH_ERASE 0x0013
10351038
10361039 /**
10371040 * struct ec_params_flash_erase - Parameters for the flash erase command.
@@ -1053,7 +1056,7 @@ struct ec_params_flash_erase { · 15 unmodified lines
10531056 *
10541057 * If mask=0, simply returns the current flags state.
10551058 */
1056−#define EC_CMD_FLASH_PROTECT 0x15
1059+#define EC_CMD_FLASH_PROTECT 0x0015
10571060 #define EC_VER_FLASH_PROTECT 1 /* Command version 1 */
10581061
10591062 /* Flags for flash protection */
@@ -1110,7 +1113,7 @@ struct ec_response_flash_protect { · 50 unmodified lines
11101113 */
11111114
11121115 /* Get the region offset/size */
1113−#define EC_CMD_FLASH_REGION_INFO 0x16
1116+#define EC_CMD_FLASH_REGION_INFO 0x0016
11141117 #define EC_VER_FLASH_REGION_INFO 1
11151118
11161119 enum ec_flash_region {
@@ -1142,7 +1145,7 @@ struct ec_response_flash_region_info { · 25 unmodified lines
11421145 } __ec_align4;
11431146
11441147 /* Read/write VbNvContext */
1145−#define EC_CMD_VBNV_CONTEXT 0x17
1148+#define EC_CMD_VBNV_CONTEXT 0x0017
11461149 #define EC_VER_VBNV_CONTEXT 1
11471150 #define EC_VBNV_BLOCK_SIZE 16
11481151
@@ -1164,7 +1167,7 @@ struct ec_response_vbnvcontext { · 15 unmodified lines
11641167 /* PWM commands */
11651168
11661169 /* Get fan target RPM */
1167−#define EC_CMD_PWM_GET_FAN_TARGET_RPM 0x20
1170+#define EC_CMD_PWM_GET_FAN_TARGET_RPM 0x0020
11681171
11691172 struct ec_response_pwm_get_fan_rpm {
11701173 uint32_t rpm;
@@ -1178,7 +1181,7 @@ struct ec_params_pwm_set_fan_target_rpm { · 7 unmodified lines
11781181 } __ec_align_size1;
11791182
11801183 /* Get keyboard backlight */
1181−#define EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT 0x22
1184+#define EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT 0x0022
11821185
11831186 struct ec_response_pwm_get_keyboard_backlight {
11841187 uint8_t percent;
@@ -1186,20 +1189,20 @@ struct ec_response_pwm_get_keyboard_backlight { · 1 unmodified line
11861189 } __ec_align1;
11871190
11881191 /* Set keyboard backlight */
1189−#define EC_CMD_PWM_SET_KEYBOARD_BACKLIGHT 0x23
1192+#define EC_CMD_PWM_SET_KEYBOARD_BACKLIGHT 0x0023
11901193
11911194 struct ec_params_pwm_set_keyboard_backlight {
11921195 uint8_t percent;
11931196 } __ec_align1;
11941197
11951198 /* Set target fan PWM duty cycle */
1196−#define EC_CMD_PWM_SET_FAN_DUTY 0x24
1199+#define EC_CMD_PWM_SET_FAN_DUTY 0x0024
11971200
11981201 struct ec_params_pwm_set_fan_duty {
11991202 uint32_t percent;
12001203 } __ec_align4;
12011204
1202−#define EC_CMD_PWM_SET_DUTY 0x25
1205+#define EC_CMD_PWM_SET_DUTY 0x0025
12031206 /* 16 bit duty cycle, 0xffff = 100% */
12041207 #define EC_PWM_MAX_DUTY 0xffff
12051208
@@ -1219,7 +1222,7 @@ struct ec_params_pwm_set_duty { · 13 unmodified lines
12191222 uint8_t index; /* Type-specific index, or 0 if unique */
12201223 } __ec_align4;
12211224
1222−#define EC_CMD_PWM_GET_DUTY 0x26
1225+#define EC_CMD_PWM_GET_DUTY 0x0026
12231226
12241227 struct ec_params_pwm_get_duty {
12251228 uint8_t pwm_type; /* ec_pwm_type */
@@ -1237,7 +1240,7 @@ struct ec_response_pwm_get_duty { · 11 unmodified lines
12371240 * into a subcommand. We'll make separate structs for subcommands with
12381241 * different input args, so that we know how much to expect.
12391242 */
1240−#define EC_CMD_LIGHTBAR_CMD 0x28
1243+#define EC_CMD_LIGHTBAR_CMD 0x0028
12411244
12421245 struct rgb_s {
12431246 uint8_t r, g, b;
@@ -1431,7 +1434,7 @@ enum lightbar_command { · 187 unmodified lines
14311434 /*****************************************************************************/
14321435 /* LED control commands */
14331436
1434−#define EC_CMD_LED_CONTROL 0x29
1437+#define EC_CMD_LED_CONTROL 0x0029
14351438
14361439 enum ec_led_id {
14371440 /* LED to indicate battery state of charge */
@@ -1488,7 +1491,7 @@ struct ec_response_led_control { · 50 unmodified lines
14881491 */
14891492
14901493 /* Verified boot hash command */
1491−#define EC_CMD_VBOOT_HASH 0x2A
1494+#define EC_CMD_VBOOT_HASH 0x002A
14921495
14931496 struct ec_params_vboot_hash {
14941497 uint8_t cmd; /* enum ec_vboot_hash_cmd */
@@ -1540,7 +1543,7 @@ enum ec_vboot_hash_status { · 45 unmodified lines
15401543 * Motion sense commands. We'll make separate structs for sub-commands with
15411544 * different input args, so that we know how much to expect.
15421545 */
1543−#define EC_CMD_MOTION_SENSE_CMD 0x2B
1546+#define EC_CMD_MOTION_SENSE_CMD 0x002B
15441547
15451548 /* Motion sense commands */
15461549 enum motionsense_command {
@@ -1804,7 +1807,7 @@ struct ec_response_motion_sense { · 257 unmodified lines
18041807 /* USB charging control commands */
18051808
18061809 /* Set USB port charging mode */
1807−#define EC_CMD_USB_CHARGE_SET_MODE 0x30
1810+#define EC_CMD_USB_CHARGE_SET_MODE 0x0030
18081811
18091812 struct ec_params_usb_charge_set_mode {
18101813 uint8_t usb_port_id;
@@ -1818,7 +1821,7 @@ struct ec_params_usb_charge_set_mode { · 7 unmodified lines
18181821 #define EC_PSTORE_SIZE_MAX 64
18191822
18201823 /* Get persistent storage info */
1821−#define EC_CMD_PSTORE_INFO 0x40
1824+#define EC_CMD_PSTORE_INFO 0x0040
18221825
18231826 struct ec_response_pstore_info {
18241827 /* Persistent storage size, in bytes */
@@ -1832,7 +1835,7 @@ struct ec_response_pstore_info { · 7 unmodified lines
18321835 *
18331836 * Response is params.size bytes of data.
18341837 */
1835−#define EC_CMD_PSTORE_READ 0x41
1838+#define EC_CMD_PSTORE_READ 0x0041
18361839
18371840 struct ec_params_pstore_read {
18381841 uint32_t offset; /* Byte offset to read */
@@ -1840,7 +1843,7 @@ struct ec_params_pstore_read { · 1 unmodified line
18401843 } __ec_align4;
18411844
18421845 /* Write persistent storage */
1843−#define EC_CMD_PSTORE_WRITE 0x42
1846+#define EC_CMD_PSTORE_WRITE 0x0042
18441847
18451848 struct ec_params_pstore_write {
18461849 uint32_t offset; /* Byte offset to write */
@@ -1861,12 +1864,12 @@ struct ec_response_rtc { · 14 unmodified lines
18611864 } __ec_align4;
18621865
18631866 /* These use ec_response_rtc */
1864−#define EC_CMD_RTC_GET_VALUE 0x44
1865−#define EC_CMD_RTC_GET_ALARM 0x45
1867+#define EC_CMD_RTC_GET_VALUE 0x0044
1868+#define EC_CMD_RTC_GET_ALARM 0x0045
18661869
18671870 /* These all use ec_params_rtc */
1868−#define EC_CMD_RTC_SET_VALUE 0x46
1869−#define EC_CMD_RTC_SET_ALARM 0x47
1871+#define EC_CMD_RTC_SET_VALUE 0x0046
1872+#define EC_CMD_RTC_SET_ALARM 0x0047
18701873
18711874 /* Pass as time param to SET_ALARM to clear the current alarm */
18721875 #define EC_RTC_ALARM_CLEAR 0
@@ -1878,8 +1881,8 @@ struct ec_response_rtc { · 5 unmodified lines
18781881 #define EC_PORT80_SIZE_MAX 32
18791882
18801883 /* Get last port80 code from previous boot */
1881−#define EC_CMD_PORT80_LAST_BOOT 0x48
1882−#define EC_CMD_PORT80_READ 0x48
1884+#define EC_CMD_PORT80_LAST_BOOT 0x0048
1885+#define EC_CMD_PORT80_READ 0x0048
18831886
18841887 enum ec_port80_subcmd {
18851888 EC_PORT80_GET_INFO = 0,
@@ -1920,8 +1923,8 @@ struct ec_response_port80_last_boot { · 34 unmodified lines
19201923 * Version 1 separates the CPU thermal limits from the fan control.
19211924 */
19221925
1923−#define EC_CMD_THERMAL_SET_THRESHOLD 0x50
1924−#define EC_CMD_THERMAL_GET_THRESHOLD 0x51
1926+#define EC_CMD_THERMAL_SET_THRESHOLD 0x0050
1927+#define EC_CMD_THERMAL_GET_THRESHOLD 0x0051
19251928
19261929 /* The version 0 structs are opaque. You have to know what they are for
19271930 * the get/set commands to make any sense.
@@ -1983,10 +1986,10 @@ struct ec_params_thermal_set_threshold_v1 { · 55 unmodified lines
19831986 /****************************************************************************/
19841987
19851988 /* Toggle automatic fan control */
1986−#define EC_CMD_THERMAL_AUTO_FAN_CTRL 0x52
1989+#define EC_CMD_THERMAL_AUTO_FAN_CTRL 0x0052
19871990
19881991 /* Get TMP006 calibration data */
1989−#define EC_CMD_TMP006_GET_CALIBRATION 0x53
1992+#define EC_CMD_TMP006_GET_CALIBRATION 0x0053
19901993
19911994 struct ec_params_tmp006_get_calibration {
19921995 uint8_t index;
@@ -2000,7 +2003,7 @@ struct ec_response_tmp006_get_calibration { · 7 unmodified lines
20002003 } __ec_align4;
20012004
20022005 /* Set TMP006 calibration data */
2003−#define EC_CMD_TMP006_SET_CALIBRATION 0x54
2006+#define EC_CMD_TMP006_SET_CALIBRATION 0x0054
20042007
20052008 struct ec_params_tmp006_set_calibration {
20062009 uint8_t index;
@@ -2012,7 +2015,7 @@ struct ec_params_tmp006_set_calibration { · 5 unmodified lines
20122015 } __ec_align4;
20132016
20142017 /* Read raw TMP006 data */
2015−#define EC_CMD_TMP006_GET_RAW 0x55
2018+#define EC_CMD_TMP006_GET_RAW 0x0055
20162019
20172020 struct ec_params_tmp006_get_raw {
20182021 uint8_t index;
@@ -2036,12 +2039,12 @@ struct ec_response_tmp006_get_raw { · 17 unmodified lines
20362039 * to obtain the instantaneous state, use EC_CMD_MKBP_INFO with the type
20372040 * EC_MKBP_INFO_CURRENT and event EC_MKBP_EVENT_KEY_MATRIX.
20382041 */
2039−#define EC_CMD_MKBP_STATE 0x60
2042+#define EC_CMD_MKBP_STATE 0x0060
20402043
20412044 /*
20422045 * Provide information about various MKBP things. See enum ec_mkbp_info_type.
20432046 */
2044−#define EC_CMD_MKBP_INFO 0x61
2047+#define EC_CMD_MKBP_INFO 0x0061
20452048
20462049 struct ec_response_mkbp_info {
20472050 uint32_t rows;
@@ -2095,7 +2098,7 @@ enum ec_mkbp_info_type { · 47 unmodified lines
20952098 };
20962099
20972100 /* Simulate key press */
2098−#define EC_CMD_MKBP_SIMULATE_KEY 0x62
2101+#define EC_CMD_MKBP_SIMULATE_KEY 0x0062
20992102
21002103 struct ec_params_mkbp_simulate_key {
21012104 uint8_t col;
@@ -2104,8 +2107,8 @@ struct ec_params_mkbp_simulate_key { · 2 unmodified lines
21042107 } __ec_align1;
21052108
21062109 /* Configure keyboard scanning */
2107−#define EC_CMD_MKBP_SET_CONFIG 0x64
2108−#define EC_CMD_MKBP_GET_CONFIG 0x65
2110+#define EC_CMD_MKBP_SET_CONFIG 0x0064
2111+#define EC_CMD_MKBP_GET_CONFIG 0x0065
21092112
21102113 /* flags */
21112114 enum mkbp_config_flags {
@@ -2158,7 +2161,7 @@ struct ec_response_mkbp_get_config { · 46 unmodified lines
21582161 } __ec_align_size1;
21592162
21602163 /* Run the key scan emulation */
2161−#define EC_CMD_KEYSCAN_SEQ_CTRL 0x66
2164+#define EC_CMD_KEYSCAN_SEQ_CTRL 0x0066
21622165
21632166 enum ec_keyscan_seq_cmd {
21642167 EC_KEYSCAN_SEQ_STATUS = 0, /* Get status information */
@@ -2219,7 +2222,7 @@ struct ec_result_keyscan_seq_ctrl { · 54 unmodified lines
22192222 *
22202223 * The device replies with UNAVAILABLE if there aren't any pending events.
22212224 */
2222−#define EC_CMD_GET_NEXT_EVENT 0x67
2225+#define EC_CMD_GET_NEXT_EVENT 0x0067
22232226
22242227 enum ec_mkbp_event {
22252228 /* Keyboard matrix changed. The event data is the new matrix state. */
@@ -2298,7 +2301,7 @@ struct ec_response_get_next_event_v1 { · 72 unmodified lines
22982301 /* Temperature sensor commands */
22992302
23002303 /* Read temperature sensor info */
2301−#define EC_CMD_TEMP_SENSOR_GET_INFO 0x70
2304+#define EC_CMD_TEMP_SENSOR_GET_INFO 0x0070
23022305
23032306 struct ec_params_temp_sensor_get_info {
23042307 uint8_t id;
@@ -2333,30 +2336,30 @@ struct ec_response_host_event_mask { · 28 unmodified lines
23332336 } __ec_align4;
23342337
23352338 /* These all use ec_response_host_event_mask */
2336−#define EC_CMD_HOST_EVENT_GET_B 0x87
2337−#define EC_CMD_HOST_EVENT_GET_SMI_MASK 0x88
2338−#define EC_CMD_HOST_EVENT_GET_SCI_MASK 0x89
2339−#define EC_CMD_HOST_EVENT_GET_WAKE_MASK 0x8d
2339+#define EC_CMD_HOST_EVENT_GET_B 0x0087
2340+#define EC_CMD_HOST_EVENT_GET_SMI_MASK 0x0088
2341+#define EC_CMD_HOST_EVENT_GET_SCI_MASK 0x0089
2342+#define EC_CMD_HOST_EVENT_GET_WAKE_MASK 0x008D
23402343
23412344 /* These all use ec_params_host_event_mask */
2342−#define EC_CMD_HOST_EVENT_SET_SMI_MASK 0x8a
2343−#define EC_CMD_HOST_EVENT_SET_SCI_MASK 0x8b
2344−#define EC_CMD_HOST_EVENT_CLEAR 0x8c
2345−#define EC_CMD_HOST_EVENT_SET_WAKE_MASK 0x8e
2346−#define EC_CMD_HOST_EVENT_CLEAR_B 0x8f
2345+#define EC_CMD_HOST_EVENT_SET_SMI_MASK 0x008A
2346+#define EC_CMD_HOST_EVENT_SET_SCI_MASK 0x008B
2347+#define EC_CMD_HOST_EVENT_CLEAR 0x008C
2348+#define EC_CMD_HOST_EVENT_SET_WAKE_MASK 0x008E
2349+#define EC_CMD_HOST_EVENT_CLEAR_B 0x008F
23472350
23482351 /*****************************************************************************/
23492352 /* Switch commands */
23502353
23512354 /* Enable/disable LCD backlight */
2352−#define EC_CMD_SWITCH_ENABLE_BKLIGHT 0x90
2355+#define EC_CMD_SWITCH_ENABLE_BKLIGHT 0x0090
23532356
23542357 struct ec_params_switch_enable_backlight {
23552358 uint8_t enabled;
23562359 } __ec_align1;
23572360
23582361 /* Enable/disable WLAN/Bluetooth */
2359−#define EC_CMD_SWITCH_ENABLE_WIRELESS 0x91
2362+#define EC_CMD_SWITCH_ENABLE_WIRELESS 0x0091
23602363 #define EC_VER_SWITCH_ENABLE_WIRELESS 1
23612364
23622365 /* Version 0 params; no response */
@@ -2396,7 +2399,7 @@ struct ec_response_switch_enable_wireless_v1 { · 33 unmodified lines
23962399 /* GPIO commands. Only available on EC if write protect has been disabled. */
23972400
23982401 /* Set GPIO output value */
2399−#define EC_CMD_GPIO_SET 0x92
2402+#define EC_CMD_GPIO_SET 0x0092
24002403
24012404 struct ec_params_gpio_set {
24022405 char name[32];
@@ -2404,7 +2407,7 @@ struct ec_params_gpio_set { · 1 unmodified line
24042407 } __ec_align1;
24052408
24062409 /* Get GPIO value */
2407−#define EC_CMD_GPIO_GET 0x93
2410+#define EC_CMD_GPIO_GET 0x0093
24082411
24092412 /* Version 0 of input params and response */
24102413 struct ec_params_gpio_get {
@@ -2458,7 +2461,7 @@ enum gpio_get_subcmd { · 47 unmodified lines
24582461 */
24592462
24602463 /* Read I2C bus */
2461−#define EC_CMD_I2C_READ 0x94
2464+#define EC_CMD_I2C_READ 0x0094
24622465
24632466 struct ec_params_i2c_read {
24642467 uint16_t addr; /* 8-bit address (7-bit shifted << 1) */
@@ -2472,7 +2475,7 @@ struct ec_response_i2c_read { · 7 unmodified lines
24722475 } __ec_align2;
24732476
24742477 /* Write I2C bus */
2475−#define EC_CMD_I2C_WRITE 0x95
2478+#define EC_CMD_I2C_WRITE 0x0095
24762479
24772480 struct ec_params_i2c_write {
24782481 uint16_t data;
@@ -2488,7 +2491,7 @@ struct ec_params_i2c_write { · 9 unmodified lines
24882491 /* Force charge state machine to stop charging the battery or force it to
24892492 * discharge the battery.
24902493 */
2491−#define EC_CMD_CHARGE_CONTROL 0x96
2494+#define EC_CMD_CHARGE_CONTROL 0x0096
24922495 #define EC_VER_CHARGE_CONTROL 1
24932496
24942497 enum ec_charge_control_mode {
@@ -2504,7 +2507,7 @@ struct ec_params_charge_control { · 9 unmodified lines
25042507 /*****************************************************************************/
25052508
25062509 /* Snapshot console output buffer for use by EC_CMD_CONSOLE_READ. */
2507−#define EC_CMD_CONSOLE_SNAPSHOT 0x97
2510+#define EC_CMD_CONSOLE_SNAPSHOT 0x0097
25082511
25092512 /*
25102513 * Read data from the saved snapshot. If the subcmd parameter is
@@ -2518,7 +2521,7 @@ struct ec_params_charge_control { · 7 unmodified lines
25182521 * Response is null-terminated string. Empty string, if there is no more
25192522 * remaining output.
25202523 */
2521−#define EC_CMD_CONSOLE_READ 0x98
2524+#define EC_CMD_CONSOLE_READ 0x0098
25222525
25232526 enum ec_console_read_subcmd {
25242527 CONSOLE_READ_NEXT = 0,
@@ -2538,8 +2541,7 @@ struct ec_params_console_read_v1 { · 13 unmodified lines
25382541 * EC_RES_SUCCESS if the command was successful.
25392542 * EC_RES_ERROR if the cut off command failed.
25402543 */
2541−
2542−#define EC_CMD_BATTERY_CUT_OFF 0x99
2544+#define EC_CMD_BATTERY_CUT_OFF 0x0099
25432545
25442546 #define EC_BATTERY_CUTOFF_FLAG_AT_SHUTDOWN (1 << 0)
25452547
@@ -2553,7 +2555,7 @@ struct ec_params_battery_cutoff { · 7 unmodified lines
25532555 /*
25542556 * Switch USB mux or return to automatic switching.
25552557 */
2556−#define EC_CMD_USB_MUX 0x9a
2558+#define EC_CMD_USB_MUX 0x009A
25572559
25582560 struct ec_params_usb_mux {
25592561 uint8_t mux;
@@ -2570,7 +2572,7 @@ enum ec_ldo_state { · 10 unmodified lines
25702572 /*
25712573 * Switch on/off a LDO.
25722574 */
2573−#define EC_CMD_LDO_SET 0x9b
2575+#define EC_CMD_LDO_SET 0x009B
25742576
25752577 struct ec_params_ldo_set {
25762578 uint8_t index;
@@ -2580,7 +2582,7 @@ struct ec_params_ldo_set { · 3 unmodified lines
25802582 /*
25812583 * Get LDO state.
25822584 */
2583−#define EC_CMD_LDO_GET 0x9c
2585+#define EC_CMD_LDO_GET 0x009C
25842586
25852587 struct ec_params_ldo_get {
25862588 uint8_t index;
@@ -2596,7 +2598,7 @@ struct ec_response_ldo_get { · 9 unmodified lines
25962598 /*
25972599 * Get power info.
25982600 */
2599−#define EC_CMD_POWER_INFO 0x9d
2601+#define EC_CMD_POWER_INFO 0x009D
26002602
26012603 struct ec_response_power_info {
26022604 uint32_t usb_dev_type;
@@ -2609,7 +2611,7 @@ struct ec_response_power_info { · 6 unmodified lines
26092611 /*****************************************************************************/
26102612 /* I2C passthru command */
26112613
2612−#define EC_CMD_I2C_PASSTHRU 0x9e
2614+#define EC_CMD_I2C_PASSTHRU 0x009E
26132615
26142616 /* Read data; if not present, message is a write */
26152617 #define EC_I2C_FLAG_READ (1 << 15)
@@ -2644,7 +2646,7 @@ struct ec_response_i2c_passthru { · 28 unmodified lines
26442646 /*****************************************************************************/
26452647 /* Power button hang detect */
26462648
2647−#define EC_CMD_HANG_DETECT 0x9f
2649+#define EC_CMD_HANG_DETECT 0x009F
26482650
26492651 /* Reasons to start hang detection timer */
26502652 /* Power button pressed */
@@ -2703,7 +2705,7 @@ struct ec_params_hang_detect { · 52 unmodified lines
27032705 * This is the single catch-all host command to exchange data regarding the
27042706 * charge state machine (v2 and up).
27052707 */
2706−#define EC_CMD_CHARGE_STATE 0xa0
2708+#define EC_CMD_CHARGE_STATE 0x00A0
27072709
27082710 /* Subcommands for this host command */
27092711 enum charge_state_command {
@@ -2774,7 +2776,7 @@ struct ec_response_charge_state { · 64 unmodified lines
27742776 /*
27752777 * Set maximum battery charging current.
27762778 */
2777−#define EC_CMD_CHARGE_CURRENT_LIMIT 0xa1
2779+#define EC_CMD_CHARGE_CURRENT_LIMIT 0x00A1
27782780
27792781 struct ec_params_current_limit {
27802782 uint32_t limit; /* in mA */
@@ -2794,7 +2796,7 @@ struct ec_params_external_power_limit_v1 { · 13 unmodified lines
27942796 #define EC_POWER_LIMIT_NONE 0xffff
27952797
27962798 /* Inform the EC when entering a sleep state */
2797−#define EC_CMD_HOST_SLEEP_EVENT 0xa9
2799+#define EC_CMD_HOST_SLEEP_EVENT 0x00A9
27982800
27992801 enum host_sleep_event {
28002802 HOST_SLEEP_EVENT_S3_SUSPEND = 1,
@@ -2868,14 +2870,14 @@ struct ec_response_host_sleep_event_v1 { · 67 unmodified lines
28682870 /* Smart battery pass-through */
28692871
28702872 /* Get / Set 16-bit smart battery registers */
2871−#define EC_CMD_SB_READ_WORD 0xb0
2872−#define EC_CMD_SB_WRITE_WORD 0xb1
2873+#define EC_CMD_SB_READ_WORD 0x00B0
2874+#define EC_CMD_SB_WRITE_WORD 0x00B1
28732875
28742876 /* Get / Set string smart battery parameters
28752877 * formatted as SMBUS "block".
28762878 */
2877−#define EC_CMD_SB_READ_BLOCK 0xb2
2878−#define EC_CMD_SB_WRITE_BLOCK 0xb3
2879+#define EC_CMD_SB_READ_BLOCK 0x00B2
2880+#define EC_CMD_SB_WRITE_BLOCK 0x00B3
28792881
28802882 struct ec_params_sb_rd {
28812883 uint8_t reg;
@@ -2908,7 +2910,7 @@ struct ec_params_sb_wr_block { · 26 unmodified lines
29082910 * requested value.
29092911 */
29102912
2911−#define EC_CMD_BATTERY_VENDOR_PARAM 0xb4
2913+#define EC_CMD_BATTERY_VENDOR_PARAM 0x00B4
29122914
29132915 enum ec_battery_vendor_param_mode {
29142916 BATTERY_VENDOR_PARAM_MODE_GET = 0,
@@ -3024,7 +3026,7 @@ struct ec_response_codec_gain { · 109 unmodified lines
30243026 * TODO(crosbug.com/p/23747): This is a confusing name, since it doesn't
30253027 * necessarily reboot the EC. Rename to "image" or something similar?
30263028 */
3027−#define EC_CMD_REBOOT_EC 0xd2
3029+#define EC_CMD_REBOOT_EC 0x00D2
30283030
30293031 /* Command */
30303032 enum ec_reboot_cmd {
@@ -3052,7 +3054,7 @@ struct ec_params_reboot_ec { · 21 unmodified lines
30523054 * Returns variable-length platform-dependent panic information. See panic.h
30533055 * for details.
30543056 */
3055−#define EC_CMD_GET_PANIC_INFO 0xd3
3057+#define EC_CMD_GET_PANIC_INFO 0x00D3
30563058
30573059 /*****************************************************************************/
30583060 /*
@@ -3260,7 +3262,7 @@ enum mkbp_cec_event { · 201 unmodified lines
32603262 *
32613263 * Use EC_CMD_REBOOT_EC to reboot the EC more politely.
32623264 */
3263−#define EC_CMD_REBOOT 0xd1 /* Think "die" */
3265+#define EC_CMD_REBOOT 0x00D1 /* Think "die" */
32643266
32653267 /*
32663268 * Resend last response (not supported on LPC).
@@ -3269,7 +3271,7 @@ enum mkbp_cec_event { · 2 unmodified lines
32693271 * there was no previous command, or the previous command's response was too
32703272 * big to save.
32713273 */
3272−#define EC_CMD_RESEND_RESPONSE 0xdb
3274+#define EC_CMD_RESEND_RESPONSE 0x00DB
32733275
32743276 /*
32753277 * This header byte on a command indicate version 0. Any header byte less
@@ -3281,7 +3283,7 @@ enum mkbp_cec_event { · 5 unmodified lines
32813283 *
32823284 * The old EC interface must not use commands 0xdc or higher.
32833285 */
3284−#define EC_CMD_VERSION0 0xdc
3286+#define EC_CMD_VERSION0 0x00DC
32853287
32863288 #endif /* !__ACPI__ */
32873289
@@ -3293,7 +3295,7 @@ enum mkbp_cec_event { · 5 unmodified lines
32933295 */
32943296
32953297 /* EC to PD MCU exchange status command */
3296−#define EC_CMD_PD_EXCHANGE_STATUS 0x100
3298+#define EC_CMD_PD_EXCHANGE_STATUS 0x0100
32973299
32983300 /* Status of EC being sent to PD */
32993301 struct ec_params_pd_status {
@@ -3307,7 +3309,7 @@ struct ec_response_pd_status { · 7 unmodified lines
33073309 } __ec_align_size1;
33083310
33093311 /* Set USB type-C port role and muxes */
3310−#define EC_CMD_USB_PD_CONTROL 0x101
3312+#define EC_CMD_USB_PD_CONTROL 0x0101
33113313
33123314 enum usb_pd_control_role {
33133315 USB_PD_CTRL_ROLE_NO_CHANGE = 0,
@@ -3360,7 +3362,7 @@ struct ec_response_usb_pd_control_v1 { · 46 unmodified lines
33603362 char state[32];
33613363 } __ec_align1;
33623364
3363−#define EC_CMD_USB_PD_PORTS 0x102
3365+#define EC_CMD_USB_PD_PORTS 0x0102
33643366
33653367 /* Maximum number of PD ports on a device, num_ports will be <= this */
33663368 #define EC_USB_PD_MAX_PORTS 8
@@ -3369,7 +3371,7 @@ struct ec_response_usb_pd_ports { · 2 unmodified lines
33693371 uint8_t num_ports;
33703372 } __ec_align1;
33713373
3372−#define EC_CMD_USB_PD_POWER_INFO 0x103
3374+#define EC_CMD_USB_PD_POWER_INFO 0x0103
33733375
33743376 #define PD_POWER_CHARGING_PORT 0xff
33753377 struct ec_params_usb_pd_power_info {
@@ -3536,7 +3538,7 @@ struct mcdp_info { · 160 unmodified lines
35363538 #define MCDP_FAMILY(family) ((family[0] << 8) | family[1])
35373539
35383540 /* Get info about USB-C SS muxes */
3539−#define EC_CMD_USB_PD_MUX_INFO 0x11a
3541+#define EC_CMD_USB_PD_MUX_INFO 0x011A
35403542
35413543 struct ec_params_usb_pd_mux_info {
35423544 uint8_t port; /* USB-C port number */
@@ -3551,6 +3553,41 @@ struct ec_params_usb_pd_mux_info { · 8 unmodified lines
35513553 struct ec_response_usb_pd_mux_info {
35523554 uint8_t flags; /* USB_PD_MUX_*-encoded USB mux state */
35533555 } __ec_align1;
3556+/*****************************************************************************/
3557+/*
3558+ * Reserve a range of host commands for board-specific, experimental, or
3559+ * special purpose features. These can be (re)used without updating this file.
3560+ *
3561+ * CAUTION: Don't go nuts with this. Shipping products should document ALL
3562+ * their EC commands for easier development, testing, debugging, and support.
3563+ *
3564+ * All commands MUST be #defined to be 4-digit UPPER CASE hex values
3565+ * (e.g., 0x00AB, not 0xab) for CONFIG_HOSTCMD_SECTION_SORTED to work.
3566+ *
3567+ * In your experimental code, you may want to do something like this:
3568+ *
3569+ * #define EC_CMD_MAGIC_FOO 0x0000
3570+ * #define EC_CMD_MAGIC_BAR 0x0001
3571+ * #define EC_CMD_MAGIC_HEY 0x0002
3572+ *
3573+ * DECLARE_PRIVATE_HOST_COMMAND(EC_CMD_MAGIC_FOO, magic_foo_handler,
3574+ * EC_VER_MASK(0);
3575+ *
3576+ * DECLARE_PRIVATE_HOST_COMMAND(EC_CMD_MAGIC_BAR, magic_bar_handler,
3577+ * EC_VER_MASK(0);
3578+ *
3579+ * DECLARE_PRIVATE_HOST_COMMAND(EC_CMD_MAGIC_HEY, magic_hey_handler,
3580+ * EC_VER_MASK(0);
3581+ */
3582+#define EC_CMD_BOARD_SPECIFIC_BASE 0x3E00
3583+#define EC_CMD_BOARD_SPECIFIC_LAST 0x3FFF
3584+
3585+/*
3586+ * Given the private host command offset, calculate the true private host
3587+ * command value.
3588+ */
3589+#define EC_PRIVATE_HOST_COMMAND_VALUE(command) \
3590+ (EC_CMD_BOARD_SPECIFIC_BASE + (command))
35543591
35553592 /*****************************************************************************/
35563593 /*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t