To reduce code and improve performance of the embedded controller firmware, pragma __aligned(2) or __aligned(4) are used when alignment to 16 or 32 bit boundary is expected. Define all ec_align to packed when compiling kernel.
Showing the changes to include/linux (1 of 1 file). Show all
Unified · Split
| @@ -188,12 +188,46 @@ · 187 unmodified lines | |||
| 188 | #ifndef __ACPI__ | 188 | #ifndef __ACPI__ |
| 189 | 189 | ||
| 190 | /* | 190 | /* |
| 191 | * Define __packed if someone hasn't beat us to it. Linux kernel style | 191 | * Attributes for EC request and response packets. Just defining __packed |
| 192 | * checking prefers __packed over __attribute__((packed)). | 192 | * results in inefficient assembly code on ARM, if the structure is actually |
| 193 | * 32-bit aligned, as it should be for all buffers. | ||
| 194 | * | ||
| 195 | * Be very careful when adding these to existing structures. They will round | ||
| 196 | * up the structure size to the specified boundary. | ||
| 197 | * | ||
| 198 | * Also be very careful to make that if a structure is included in some other | ||
| 199 | * parent structure that the alignment will still be true given the packing of | ||
| 200 | * the parent structure. This is particularly important if the sub-structure | ||
| 201 | * will be passed as a pointer to another function, since that function will | ||
| 202 | * not know about the misaligment caused by the parent structure's packing. | ||
| 203 | * | ||
| 204 | * Also be very careful using __packed - particularly when nesting non-packed | ||
| 205 | * structures inside packed ones. In fact, DO NOT use __packed directly; | ||
| 206 | * always use one of these attributes. | ||
| 207 | * | ||
| 208 | * Once everything is annotated properly, the following search strings should | ||
| 209 | * not return ANY matches in this file other than right here: | ||
| 210 | * | ||
| 211 | * "__packed" - generates inefficient code; all sub-structs must also be packed | ||
| 212 | * | ||
| 213 | * "struct [^_]" - all structs should be annotated, except for structs that are | ||
| 214 | * members of other structs/unions (and their original declarations should be | ||
| 215 | * annotated). | ||
| 193 | */ | 216 | */ |
| 194 | #ifndef __packed | 217 | |
| 195 | #define __packed __attribute__((packed)) | 218 | /* |
| 196 | #endif | 219 | * Packed structures make no assumption about alignment, so they do inefficient |
| 220 | * byte-wise reads. | ||
| 221 | */ | ||
| 222 | #define __ec_align1 __packed | ||
| 223 | #define __ec_align2 __packed | ||
| 224 | #define __ec_align4 __packed | ||
| 225 | #define __ec_align_size1 __packed | ||
| 226 | #define __ec_align_offset1 __packed | ||
| 227 | #define __ec_align_offset2 __packed | ||
| 228 | #define __ec_todo_packed __packed | ||
| 229 | #define __ec_todo_unpacked | ||
| 230 | |||
| 197 | 231 | ||
| 198 | /* LPC command status byte masks */ | 232 | /* LPC command status byte masks */ |
| 199 | /* EC has written a byte in the data register and host hasn't read it yet */ | 233 | /* EC has written a byte in the data register and host hasn't read it yet */ |
| @@ -317,7 +351,7 @@ struct ec_lpc_host_args { · 117 unmodified lines | |||
| 317 | uint8_t command_version; | 351 | uint8_t command_version; |
| 318 | uint8_t data_size; | 352 | uint8_t data_size; |
| 319 | uint8_t checksum; | 353 | uint8_t checksum; |
| 320 | } __packed; | 354 | } __ec_align4; |
| 321 | 355 | ||
| 322 | /* Flags for ec_lpc_host_args.flags */ | 356 | /* Flags for ec_lpc_host_args.flags */ |
| 323 | /* | 357 | /* |
| @@ -488,7 +522,7 @@ struct ec_host_request { · 164 unmodified lines | |||
| 488 | uint8_t command_version; | 522 | uint8_t command_version; |
| 489 | uint8_t reserved; | 523 | uint8_t reserved; |
| 490 | uint16_t data_len; | 524 | uint16_t data_len; |
| 491 | } __packed; | 525 | } __ec_align4; |
| 492 | 526 | ||
| 493 | #define EC_HOST_RESPONSE_VERSION 3 | 527 | #define EC_HOST_RESPONSE_VERSION 3 |
| 494 | 528 | ||
| @@ -507,7 +541,7 @@ struct ec_host_response { · 12 unmodified lines | |||
| 507 | uint16_t result; | 541 | uint16_t result; |
| 508 | uint16_t data_len; | 542 | uint16_t data_len; |
| 509 | uint16_t reserved; | 543 | uint16_t reserved; |
| 510 | } __packed; | 544 | } __ec_align4; |
| 511 | 545 | ||
| 512 | /*****************************************************************************/ | 546 | /*****************************************************************************/ |
| 513 | /* | 547 | /* |
| @@ -536,7 +570,7 @@ struct ec_host_response { · 22 unmodified lines | |||
| 536 | */ | 570 | */ |
| 537 | struct ec_response_proto_version { | 571 | struct ec_response_proto_version { |
| 538 | uint32_t version; | 572 | uint32_t version; |
| 539 | } __packed; | 573 | } __ec_align4; |
| 540 | 574 | ||
| 541 | /* | 575 | /* |
| 542 | * Hello. This is a simple command to test the EC is responsive to | 576 | * Hello. This is a simple command to test the EC is responsive to |
| @@ -550,7 +584,7 @@ struct ec_response_proto_version { · 7 unmodified lines | |||
| 550 | */ | 584 | */ |
| 551 | struct ec_params_hello { | 585 | struct ec_params_hello { |
| 552 | uint32_t in_data; | 586 | uint32_t in_data; |
| 553 | } __packed; | 587 | } __ec_align4; |
| 554 | 588 | ||
| 555 | /** | 589 | /** |
| 556 | * struct ec_response_hello - Response to the hello command. | 590 | * struct ec_response_hello - Response to the hello command. |
| @@ -558,7 +592,7 @@ struct ec_params_hello { · 1 unmodified line | |||
| 558 | */ | 592 | */ |
| 559 | struct ec_response_hello { | 593 | struct ec_response_hello { |
| 560 | uint32_t out_data; | 594 | uint32_t out_data; |
| 561 | } __packed; | 595 | } __ec_align4; |
| 562 | 596 | ||
| 563 | /* Get version number */ | 597 | /* Get version number */ |
| 564 | #define EC_CMD_GET_VERSION 0x02 | 598 | #define EC_CMD_GET_VERSION 0x02 |
| @@ -581,7 +615,7 @@ struct ec_response_get_version { · 16 unmodified lines | |||
| 581 | char version_string_rw[32]; | 615 | char version_string_rw[32]; |
| 582 | char reserved[32]; | 616 | char reserved[32]; |
| 583 | uint32_t current_image; | 617 | uint32_t current_image; |
| 584 | } __packed; | 618 | } __ec_align4; |
| 585 | 619 | ||
| 586 | /* Read test */ | 620 | /* Read test */ |
| 587 | #define EC_CMD_READ_TEST 0x03 | 621 | #define EC_CMD_READ_TEST 0x03 |
| @@ -594,7 +628,7 @@ struct ec_response_get_version { · 6 unmodified lines | |||
| 594 | struct ec_params_read_test { | 628 | struct ec_params_read_test { |
| 595 | uint32_t offset; | 629 | uint32_t offset; |
| 596 | uint32_t size; | 630 | uint32_t size; |
| 597 | } __packed; | 631 | } __ec_align4; |
| 598 | 632 | ||
| 599 | /** | 633 | /** |
| 600 | * struct ec_response_read_test - Response to the read test command. | 634 | * struct ec_response_read_test - Response to the read test command. |
| @@ -602,7 +636,7 @@ struct ec_params_read_test { · 1 unmodified line | |||
| 602 | */ | 636 | */ |
| 603 | struct ec_response_read_test { | 637 | struct ec_response_read_test { |
| 604 | uint32_t data[32]; | 638 | uint32_t data[32]; |
| 605 | } __packed; | 639 | } __ec_align4; |
| 606 | 640 | ||
| 607 | /* | 641 | /* |
| 608 | * Get build information | 642 | * Get build information |
| @@ -624,7 +658,7 @@ struct ec_response_get_chip_info { · 15 unmodified lines | |||
| 624 | char vendor[32]; | 658 | char vendor[32]; |
| 625 | char name[32]; | 659 | char name[32]; |
| 626 | char revision[32]; | 660 | char revision[32]; |
| 627 | } __packed; | 661 | } __ec_align4; |
| 628 | 662 | ||
| 629 | /* Get board HW version */ | 663 | /* Get board HW version */ |
| 630 | #define EC_CMD_GET_BOARD_VERSION 0x06 | 664 | #define EC_CMD_GET_BOARD_VERSION 0x06 |
| @@ -635,7 +669,7 @@ struct ec_response_get_chip_info { · 4 unmodified lines | |||
| 635 | */ | 669 | */ |
| 636 | struct ec_response_board_version { | 670 | struct ec_response_board_version { |
| 637 | uint16_t board_version; | 671 | uint16_t board_version; |
| 638 | } __packed; | 672 | } __ec_align2; |
| 639 | 673 | ||
| 640 | /* | 674 | /* |
| 641 | * Read memory-mapped data. | 675 | * Read memory-mapped data. |
| @@ -655,7 +689,7 @@ struct ec_response_board_version { · 13 unmodified lines | |||
| 655 | struct ec_params_read_memmap { | 689 | struct ec_params_read_memmap { |
| 656 | uint8_t offset; | 690 | uint8_t offset; |
| 657 | uint8_t size; | 691 | uint8_t size; |
| 658 | } __packed; | 692 | } __ec_align1; |
| 659 | 693 | ||
| 660 | /* Read versions supported for a command */ | 694 | /* Read versions supported for a command */ |
| 661 | #define EC_CMD_GET_CMD_VERSIONS 0x08 | 695 | #define EC_CMD_GET_CMD_VERSIONS 0x08 |
| @@ -666,7 +700,7 @@ struct ec_params_read_memmap { · 4 unmodified lines | |||
| 666 | */ | 700 | */ |
| 667 | struct ec_params_get_cmd_versions { | 701 | struct ec_params_get_cmd_versions { |
| 668 | uint8_t cmd; | 702 | uint8_t cmd; |
| 669 | } __packed; | 703 | } __ec_align1; |
| 670 | 704 | ||
| 671 | /** | 705 | /** |
| 672 | * struct ec_params_get_cmd_versions_v1 - Parameters for the get command | 706 | * struct ec_params_get_cmd_versions_v1 - Parameters for the get command |
| @@ -675,7 +709,7 @@ struct ec_params_get_cmd_versions { · 2 unmodified lines | |||
| 675 | */ | 709 | */ |
| 676 | struct ec_params_get_cmd_versions_v1 { | 710 | struct ec_params_get_cmd_versions_v1 { |
| 677 | uint16_t cmd; | 711 | uint16_t cmd; |
| 678 | } __packed; | 712 | } __ec_align2; |
| 679 | 713 | ||
| 680 | /** | 714 | /** |
| 681 | * struct ec_response_get_cmd_version - Response to the get command versions. | 715 | * struct ec_response_get_cmd_version - Response to the get command versions. |
| @@ -684,7 +718,7 @@ struct ec_params_get_cmd_versions_v1 { · 2 unmodified lines | |||
| 684 | */ | 718 | */ |
| 685 | struct ec_response_get_cmd_versions { | 719 | struct ec_response_get_cmd_versions { |
| 686 | uint32_t version_mask; | 720 | uint32_t version_mask; |
| 687 | } __packed; | 721 | } __ec_align4; |
| 688 | 722 | ||
| 689 | /* | 723 | /* |
| 690 | * Check EC communications status (busy). This is needed on i2c/spi but not | 724 | * Check EC communications status (busy). This is needed on i2c/spi but not |
| @@ -707,7 +741,7 @@ enum ec_comms_status { · 16 unmodified lines | |||
| 707 | */ | 741 | */ |
| 708 | struct ec_response_get_comms_status { | 742 | struct ec_response_get_comms_status { |
| 709 | uint32_t flags; /* Mask of enum ec_comms_status */ | 743 | uint32_t flags; /* Mask of enum ec_comms_status */ |
| 710 | } __packed; | 744 | } __ec_align4; |
| 711 | 745 | ||
| 712 | /* Fake a variety of responses, purely for testing purposes. */ | 746 | /* Fake a variety of responses, purely for testing purposes. */ |
| 713 | #define EC_CMD_TEST_PROTOCOL 0x0a | 747 | #define EC_CMD_TEST_PROTOCOL 0x0a |
| @@ -717,12 +751,12 @@ struct ec_params_test_protocol { · 3 unmodified lines | |||
| 717 | uint32_t ec_result; | 751 | uint32_t ec_result; |
| 718 | uint32_t ret_len; | 752 | uint32_t ret_len; |
| 719 | uint8_t buf[32]; | 753 | uint8_t buf[32]; |
| 720 | } __packed; | 754 | } __ec_align4; |
| 721 | 755 | ||
| 722 | /* Here it comes... */ | 756 | /* Here it comes... */ |
| 723 | struct ec_response_test_protocol { | 757 | struct ec_response_test_protocol { |
| 724 | uint8_t buf[32]; | 758 | uint8_t buf[32]; |
| 725 | } __packed; | 759 | } __ec_align4; |
| 726 | 760 | ||
| 727 | /* Get protocol information */ | 761 | /* Get protocol information */ |
| 728 | #define EC_CMD_GET_PROTOCOL_INFO 0x0b | 762 | #define EC_CMD_GET_PROTOCOL_INFO 0x0b |
| @@ -745,7 +779,7 @@ struct ec_response_get_protocol_info { · 16 unmodified lines | |||
| 745 | uint16_t max_request_packet_size; | 779 | uint16_t max_request_packet_size; |
| 746 | uint16_t max_response_packet_size; | 780 | uint16_t max_response_packet_size; |
| 747 | uint32_t flags; | 781 | uint32_t flags; |
| 748 | } __packed; | 782 | } __ec_align4; |
| 749 | 783 | ||
| 750 | 784 | ||
| 751 | /*****************************************************************************/ | 785 | /*****************************************************************************/ |
| @@ -763,12 +797,12 @@ struct ec_response_get_protocol_info { · 11 unmodified lines | |||
| 763 | struct ec_params_get_set_value { | 797 | struct ec_params_get_set_value { |
| 764 | uint32_t flags; | 798 | uint32_t flags; |
| 765 | uint32_t value; | 799 | uint32_t value; |
| 766 | } __packed; | 800 | } __ec_align4; |
| 767 | 801 | ||
| 768 | struct ec_response_get_set_value { | 802 | struct ec_response_get_set_value { |
| 769 | uint32_t flags; | 803 | uint32_t flags; |
| 770 | uint32_t value; | 804 | uint32_t value; |
| 771 | } __packed; | 805 | } __ec_align4; |
| 772 | 806 | ||
| 773 | /* More than one command can use these structs to get/set parameters. */ | 807 | /* More than one command can use these structs to get/set parameters. */ |
| 774 | #define EC_CMD_GSV_PAUSE_IN_S5 0x0c | 808 | #define EC_CMD_GSV_PAUSE_IN_S5 0x0c |
| @@ -893,7 +927,7 @@ enum ec_feature_code { · 118 unmodified lines | |||
| 893 | 927 | ||
| 894 | struct ec_response_get_features { | 928 | struct ec_response_get_features { |
| 895 | uint32_t flags[2]; | 929 | uint32_t flags[2]; |
| 896 | } __packed; | 930 | } __ec_align4; |
| 897 | 931 | ||
| 898 | /*****************************************************************************/ | 932 | /*****************************************************************************/ |
| 899 | /* Flash commands */ | 933 | /* Flash commands */ |
| @@ -918,7 +952,7 @@ struct ec_response_flash_info { · 18 unmodified lines | |||
| 918 | uint32_t write_block_size; | 952 | uint32_t write_block_size; |
| 919 | uint32_t erase_block_size; | 953 | uint32_t erase_block_size; |
| 920 | uint32_t protect_block_size; | 954 | uint32_t protect_block_size; |
| 921 | } __packed; | 955 | } __ec_align4; |
| 922 | 956 | ||
| 923 | /* | 957 | /* |
| 924 | * Flags for version 1+ flash info command | 958 | * Flags for version 1+ flash info command |
| @@ -959,7 +993,7 @@ struct ec_response_flash_info_1 { · 34 unmodified lines | |||
| 959 | /* Version 1 adds these fields: */ | 993 | /* Version 1 adds these fields: */ |
| 960 | uint32_t write_ideal_size; | 994 | uint32_t write_ideal_size; |
| 961 | uint32_t flags; | 995 | uint32_t flags; |
| 962 | } __packed; | 996 | } __ec_align4; |
| 963 | 997 | ||
| 964 | /* | 998 | /* |
| 965 | * Read flash | 999 | * Read flash |
| @@ -976,7 +1010,7 @@ struct ec_response_flash_info_1 { · 10 unmodified lines | |||
| 976 | struct ec_params_flash_read { | 1010 | struct ec_params_flash_read { |
| 977 | uint32_t offset; | 1011 | uint32_t offset; |
| 978 | uint32_t size; | 1012 | uint32_t size; |
| 979 | } __packed; | 1013 | } __ec_align4; |
| 980 | 1014 | ||
| 981 | /* Write flash */ | 1015 | /* Write flash */ |
| 982 | #define EC_CMD_FLASH_WRITE 0x12 | 1016 | #define EC_CMD_FLASH_WRITE 0x12 |
| @@ -994,7 +1028,7 @@ struct ec_params_flash_write { · 11 unmodified lines | |||
| 994 | uint32_t offset; | 1028 | uint32_t offset; |
| 995 | uint32_t size; | 1029 | uint32_t size; |
| 996 | /* Followed by data to write */ | 1030 | /* Followed by data to write */ |
| 997 | } __packed; | 1031 | } __ec_align4; |
| 998 | 1032 | ||
| 999 | /* Erase flash */ | 1033 | /* Erase flash */ |
| 1000 | #define EC_CMD_FLASH_ERASE 0x13 | 1034 | #define EC_CMD_FLASH_ERASE 0x13 |
| @@ -1007,7 +1041,7 @@ struct ec_params_flash_write { · 6 unmodified lines | |||
| 1007 | struct ec_params_flash_erase { | 1041 | struct ec_params_flash_erase { |
| 1008 | uint32_t offset; | 1042 | uint32_t offset; |
| 1009 | uint32_t size; | 1043 | uint32_t size; |
| 1010 | } __packed; | 1044 | } __ec_align4; |
| 1011 | 1045 | ||
| 1012 | /* | 1046 | /* |
| 1013 | * Get/set flash protection. | 1047 | * Get/set flash protection. |
| @@ -1053,7 +1087,7 @@ struct ec_params_flash_erase { · 39 unmodified lines | |||
| 1053 | struct ec_params_flash_protect { | 1087 | struct ec_params_flash_protect { |
| 1054 | uint32_t mask; | 1088 | uint32_t mask; |
| 1055 | uint32_t flags; | 1089 | uint32_t flags; |
| 1056 | } __packed; | 1090 | } __ec_align4; |
| 1057 | 1091 | ||
| 1058 | /** | 1092 | /** |
| 1059 | * struct ec_response_flash_protect - Response to the flash protect command. | 1093 | * struct ec_response_flash_protect - Response to the flash protect command. |
| @@ -1068,7 +1102,7 @@ struct ec_response_flash_protect { · 8 unmodified lines | |||
| 1068 | uint32_t flags; | 1102 | uint32_t flags; |
| 1069 | uint32_t valid_flags; | 1103 | uint32_t valid_flags; |
| 1070 | uint32_t writable_flags; | 1104 | uint32_t writable_flags; |
| 1071 | } __packed; | 1105 | } __ec_align4; |
| 1072 | 1106 | ||
| 1073 | /* | 1107 | /* |
| 1074 | * Note: commands 0x14 - 0x19 version 0 were old commands to get/set flash | 1108 | * Note: commands 0x14 - 0x19 version 0 were old commands to get/set flash |
| @@ -1100,12 +1134,12 @@ enum ec_flash_region { · 25 unmodified lines | |||
| 1100 | */ | 1134 | */ |
| 1101 | struct ec_params_flash_region_info { | 1135 | struct ec_params_flash_region_info { |
| 1102 | uint32_t region; | 1136 | uint32_t region; |
| 1103 | } __packed; | 1137 | } __ec_align4; |
| 1104 | 1138 | ||
| 1105 | struct ec_response_flash_region_info { | 1139 | struct ec_response_flash_region_info { |
| 1106 | uint32_t offset; | 1140 | uint32_t offset; |
| 1107 | uint32_t size; | 1141 | uint32_t size; |
| 1108 | } __packed; | 1142 | } __ec_align4; |
| 1109 | 1143 | ||
| 1110 | /* Read/write VbNvContext */ | 1144 | /* Read/write VbNvContext */ |
| 1111 | #define EC_CMD_VBNV_CONTEXT 0x17 | 1145 | #define EC_CMD_VBNV_CONTEXT 0x17 |
| @@ -1120,11 +1154,11 @@ enum ec_vbnvcontext_op { · 8 unmodified lines | |||
| 1120 | struct ec_params_vbnvcontext { | 1154 | struct ec_params_vbnvcontext { |
| 1121 | uint32_t op; | 1155 | uint32_t op; |
| 1122 | uint8_t block[EC_VBNV_BLOCK_SIZE]; | 1156 | uint8_t block[EC_VBNV_BLOCK_SIZE]; |
| 1123 | } __packed; | 1157 | } __ec_align4; |
| 1124 | 1158 | ||
| 1125 | struct ec_response_vbnvcontext { | 1159 | struct ec_response_vbnvcontext { |
| 1126 | uint8_t block[EC_VBNV_BLOCK_SIZE]; | 1160 | uint8_t block[EC_VBNV_BLOCK_SIZE]; |
| 1127 | } __packed; | 1161 | } __ec_align4; |
| 1128 | 1162 | ||
| 1129 | /*****************************************************************************/ | 1163 | /*****************************************************************************/ |
| 1130 | /* PWM commands */ | 1164 | /* PWM commands */ |
| @@ -1134,14 +1168,14 @@ struct ec_response_vbnvcontext { · 3 unmodified lines | |||
| 1134 | 1168 | ||
| 1135 | struct ec_response_pwm_get_fan_rpm { | 1169 | struct ec_response_pwm_get_fan_rpm { |
| 1136 | uint32_t rpm; | 1170 | uint32_t rpm; |
| 1137 | } __packed; | 1171 | } __ec_align4; |
| 1138 | 1172 | ||
| 1139 | /* Set target fan RPM */ | 1173 | /* Set target fan RPM */ |
| 1140 | #define EC_CMD_PWM_SET_FAN_TARGET_RPM 0x21 | 1174 | #define EC_CMD_PWM_SET_FAN_TARGET_RPM 0x0021 |
| 1141 | 1175 | ||
| 1142 | struct ec_params_pwm_set_fan_target_rpm { | 1176 | struct ec_params_pwm_set_fan_target_rpm { |
| 1143 | uint32_t rpm; | 1177 | uint32_t rpm; |
| 1144 | } __packed; | 1178 | } __ec_align_size1; |
| 1145 | 1179 | ||
| 1146 | /* Get keyboard backlight */ | 1180 | /* Get keyboard backlight */ |
| 1147 | #define EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT 0x22 | 1181 | #define EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT 0x22 |
| @@ -1149,21 +1183,21 @@ struct ec_params_pwm_set_fan_target_rpm { · 1 unmodified line | |||
| 1149 | struct ec_response_pwm_get_keyboard_backlight { | 1183 | struct ec_response_pwm_get_keyboard_backlight { |
| 1150 | uint8_t percent; | 1184 | uint8_t percent; |
| 1151 | uint8_t enabled; | 1185 | uint8_t enabled; |
| 1152 | } __packed; | 1186 | } __ec_align1; |
| 1153 | 1187 | ||
| 1154 | /* Set keyboard backlight */ | 1188 | /* Set keyboard backlight */ |
| 1155 | #define EC_CMD_PWM_SET_KEYBOARD_BACKLIGHT 0x23 | 1189 | #define EC_CMD_PWM_SET_KEYBOARD_BACKLIGHT 0x23 |
| 1156 | 1190 | ||
| 1157 | struct ec_params_pwm_set_keyboard_backlight { | 1191 | struct ec_params_pwm_set_keyboard_backlight { |
| 1158 | uint8_t percent; | 1192 | uint8_t percent; |
| 1159 | } __packed; | 1193 | } __ec_align1; |
| 1160 | 1194 | ||
| 1161 | /* Set target fan PWM duty cycle */ | 1195 | /* Set target fan PWM duty cycle */ |
| 1162 | #define EC_CMD_PWM_SET_FAN_DUTY 0x24 | 1196 | #define EC_CMD_PWM_SET_FAN_DUTY 0x24 |
| 1163 | 1197 | ||
| 1164 | struct ec_params_pwm_set_fan_duty { | 1198 | struct ec_params_pwm_set_fan_duty { |
| 1165 | uint32_t percent; | 1199 | uint32_t percent; |
| 1166 | } __packed; | 1200 | } __ec_align4; |
| 1167 | 1201 | ||
| 1168 | #define EC_CMD_PWM_SET_DUTY 0x25 | 1202 | #define EC_CMD_PWM_SET_DUTY 0x25 |
| 1169 | /* 16 bit duty cycle, 0xffff = 100% */ | 1203 | /* 16 bit duty cycle, 0xffff = 100% */ |
| @@ -1183,18 +1217,18 @@ struct ec_params_pwm_set_duty { · 13 unmodified lines | |||
| 1183 | uint16_t duty; /* Duty cycle, EC_PWM_MAX_DUTY = 100% */ | 1217 | uint16_t duty; /* Duty cycle, EC_PWM_MAX_DUTY = 100% */ |
| 1184 | uint8_t pwm_type; /* ec_pwm_type */ | 1218 | uint8_t pwm_type; /* ec_pwm_type */ |
| 1185 | uint8_t index; /* Type-specific index, or 0 if unique */ | 1219 | uint8_t index; /* Type-specific index, or 0 if unique */ |
| 1186 | } __packed; | 1220 | } __ec_align4; |
| 1187 | 1221 | ||
| 1188 | #define EC_CMD_PWM_GET_DUTY 0x26 | 1222 | #define EC_CMD_PWM_GET_DUTY 0x26 |
| 1189 | 1223 | ||
| 1190 | struct ec_params_pwm_get_duty { | 1224 | struct ec_params_pwm_get_duty { |
| 1191 | uint8_t pwm_type; /* ec_pwm_type */ | 1225 | uint8_t pwm_type; /* ec_pwm_type */ |
| 1192 | uint8_t index; /* Type-specific index, or 0 if unique */ | 1226 | uint8_t index; /* Type-specific index, or 0 if unique */ |
| 1193 | } __packed; | 1227 | } __ec_align1; |
| 1194 | 1228 | ||
| 1195 | struct ec_response_pwm_get_duty { | 1229 | struct ec_response_pwm_get_duty { |
| 1196 | uint16_t duty; /* Duty cycle, EC_PWM_MAX_DUTY = 100% */ | 1230 | uint16_t duty; /* Duty cycle, EC_PWM_MAX_DUTY = 100% */ |
| 1197 | } __packed; | 1231 | } __ec_align2; |
| 1198 | 1232 | ||
| 1199 | /*****************************************************************************/ | 1233 | /*****************************************************************************/ |
| 1200 | /* | 1234 | /* |
| @@ -1207,7 +1241,7 @@ struct ec_response_pwm_get_duty { · 6 unmodified lines | |||
| 1207 | 1241 | ||
| 1208 | struct rgb_s { | 1242 | struct rgb_s { |
| 1209 | uint8_t r, g, b; | 1243 | uint8_t r, g, b; |
| 1210 | }; | 1244 | } __ec_todo_unpacked; |
| 1211 | 1245 | ||
| 1212 | #define LB_BATTERY_LEVELS 4 | 1246 | #define LB_BATTERY_LEVELS 4 |
| 1213 | 1247 | ||
| @@ -1247,7 +1281,7 @@ struct lightbar_params_v0 { · 33 unmodified lines | |||
| 1247 | 1281 | ||
| 1248 | /* Color palette */ | 1282 | /* Color palette */ |
| 1249 | struct rgb_s color[8]; /* 0-3 are Google colors */ | 1283 | struct rgb_s color[8]; /* 0-3 are Google colors */ |
| 1250 | } __packed; | 1284 | } __ec_todo_packed; |
| 1251 | 1285 | ||
| 1252 | struct lightbar_params_v1 { | 1286 | struct lightbar_params_v1 { |
| 1253 | /* Timing */ | 1287 | /* Timing */ |
| @@ -1290,14 +1324,14 @@ struct lightbar_params_v1 { · 36 unmodified lines | |||
| 1290 | 1324 | ||
| 1291 | /* Color palette */ | 1325 | /* Color palette */ |
| 1292 | struct rgb_s color[8]; /* 0-3 are Google colors */ | 1326 | struct rgb_s color[8]; /* 0-3 are Google colors */ |
| 1293 | } __packed; | 1327 | } __ec_todo_packed; |
| 1294 | 1328 | ||
| 1295 | /* Lightbar program */ | 1329 | /* Lightbar program */ |
| 1296 | #define EC_LB_PROG_LEN 192 | 1330 | #define EC_LB_PROG_LEN 192 |
| 1297 | struct lightbar_program { | 1331 | struct lightbar_program { |
| 1298 | uint8_t size; | 1332 | uint8_t size; |
| 1299 | uint8_t data[EC_LB_PROG_LEN]; | 1333 | uint8_t data[EC_LB_PROG_LEN]; |
| 1300 | }; | 1334 | } __ec_todo_unpacked; |
| 1301 | 1335 | ||
| 1302 | struct ec_params_lightbar { | 1336 | struct ec_params_lightbar { |
| 1303 | uint8_t cmd; /* Command (see enum lightbar_command) */ | 1337 | uint8_t cmd; /* Command (see enum lightbar_command) */ |
| @@ -1307,23 +1341,23 @@ struct ec_params_lightbar { · 3 unmodified lines | |||
| 1307 | } dump, off, on, init, get_seq, get_params_v0, get_params_v1, | 1341 | } dump, off, on, init, get_seq, get_params_v0, get_params_v1, |
| 1308 | version, get_brightness, get_demo, suspend, resume; | 1342 | version, get_brightness, get_demo, suspend, resume; |
| 1309 | 1343 | ||
| 1310 | struct { | 1344 | struct __ec_todo_unpacked { |
| 1311 | uint8_t num; | 1345 | uint8_t num; |
| 1312 | } set_brightness, seq, demo; | 1346 | } set_brightness, seq, demo; |
| 1313 | 1347 | ||
| 1314 | struct { | 1348 | struct __ec_todo_unpacked { |
| 1315 | uint8_t ctrl, reg, value; | 1349 | uint8_t ctrl, reg, value; |
| 1316 | } reg; | 1350 | } reg; |
| 1317 | 1351 | ||
| 1318 | struct { | 1352 | struct __ec_todo_unpacked { |
| 1319 | uint8_t led, red, green, blue; | 1353 | uint8_t led, red, green, blue; |
| 1320 | } set_rgb; | 1354 | } set_rgb; |
| 1321 | 1355 | ||
| 1322 | struct { | 1356 | struct __ec_todo_unpacked { |
| 1323 | uint8_t led; | 1357 | uint8_t led; |
| 1324 | } get_rgb; | 1358 | } get_rgb; |
| 1325 | 1359 | ||
| 1326 | struct { | 1360 | struct __ec_todo_unpacked { |
| 1327 | uint8_t enable; | 1361 | uint8_t enable; |
| 1328 | } manual_suspend_ctrl; | 1362 | } manual_suspend_ctrl; |
| 1329 | 1363 | ||
| @@ -1331,31 +1365,31 @@ struct ec_params_lightbar { · 1 unmodified line | |||
| 1331 | struct lightbar_params_v1 set_params_v1; | 1365 | struct lightbar_params_v1 set_params_v1; |
| 1332 | struct lightbar_program set_program; | 1366 | struct lightbar_program set_program; |
| 1333 | }; | 1367 | }; |
| 1334 | } __packed; | 1368 | } __ec_todo_packed; |
| 1335 | 1369 | ||
| 1336 | struct ec_response_lightbar { | 1370 | struct ec_response_lightbar { |
| 1337 | union { | 1371 | union { |
| 1338 | struct { | 1372 | struct __ec_todo_unpacked { |
| 1339 | struct { | 1373 | struct __ec_todo_unpacked { |
| 1340 | uint8_t reg; | 1374 | uint8_t reg; |
| 1341 | uint8_t ic0; | 1375 | uint8_t ic0; |
| 1342 | uint8_t ic1; | 1376 | uint8_t ic1; |
| 1343 | } vals[23]; | 1377 | } vals[23]; |
| 1344 | } dump; | 1378 | } dump; |
| 1345 | 1379 | ||
| 1346 | struct { | 1380 | struct __ec_todo_unpacked { |
| 1347 | uint8_t num; | 1381 | uint8_t num; |
| 1348 | } get_seq, get_brightness, get_demo; | 1382 | } get_seq, get_brightness, get_demo; |
| 1349 | 1383 | ||
| 1350 | struct lightbar_params_v0 get_params_v0; | 1384 | struct lightbar_params_v0 get_params_v0; |
| 1351 | struct lightbar_params_v1 get_params_v1; | 1385 | struct lightbar_params_v1 get_params_v1; |
| 1352 | 1386 | ||
| 1353 | struct { | 1387 | struct __ec_todo_unpacked { |
| 1354 | uint32_t num; | 1388 | uint32_t num; |
| 1355 | uint32_t flags; | 1389 | uint32_t flags; |
| 1356 | } version; | 1390 | } version; |
| 1357 | 1391 | ||
| 1358 | struct { | 1392 | struct __ec_todo_unpacked { |
| 1359 | uint8_t red, green, blue; | 1393 | uint8_t red, green, blue; |
| 1360 | } get_rgb; | 1394 | } get_rgb; |
| 1361 | 1395 | ||
| @@ -1365,7 +1399,7 @@ struct ec_response_lightbar { · 3 unmodified lines | |||
| 1365 | demo, set_params_v0, set_params_v1, | 1399 | demo, set_params_v0, set_params_v1, |
| 1366 | set_program, manual_suspend_ctrl, suspend, resume; | 1400 | set_program, manual_suspend_ctrl, suspend, resume; |
| 1367 | }; | 1401 | }; |
| 1368 | } __packed; | 1402 | } __ec_todo_packed; |
| 1369 | 1403 | ||
| 1370 | /* Lightbar commands */ | 1404 | /* Lightbar commands */ |
| 1371 | enum lightbar_command { | 1405 | enum lightbar_command { |
| @@ -1432,7 +1466,7 @@ struct ec_params_led_control { · 60 unmodified lines | |||
| 1432 | uint8_t flags; /* Control flags */ | 1466 | uint8_t flags; /* Control flags */ |
| 1433 | 1467 | ||
| 1434 | uint8_t brightness[EC_LED_COLOR_COUNT]; | 1468 | uint8_t brightness[EC_LED_COLOR_COUNT]; |
| 1435 | } __packed; | 1469 | } __ec_align1; |
| 1436 | 1470 | ||
| 1437 | struct ec_response_led_control { | 1471 | struct ec_response_led_control { |
| 1438 | /* | 1472 | /* |
| @@ -1443,7 +1477,7 @@ struct ec_response_led_control { · 4 unmodified lines | |||
| 1443 | * Other values means the LED is control by PWM. | 1477 | * Other values means the LED is control by PWM. |
| 1444 | */ | 1478 | */ |
| 1445 | uint8_t brightness_range[EC_LED_COLOR_COUNT]; | 1479 | uint8_t brightness_range[EC_LED_COLOR_COUNT]; |
| 1446 | } __packed; | 1480 | } __ec_align1; |
| 1447 | 1481 | ||
| 1448 | /*****************************************************************************/ | 1482 | /*****************************************************************************/ |
| 1449 | /* Verified boot commands */ | 1483 | /* Verified boot commands */ |
| @@ -1464,7 +1498,7 @@ struct ec_params_vboot_hash { · 14 unmodified lines | |||
| 1464 | uint32_t offset; /* Offset in flash to hash */ | 1498 | uint32_t offset; /* Offset in flash to hash */ |
| 1465 | uint32_t size; /* Number of bytes to hash */ | 1499 | uint32_t size; /* Number of bytes to hash */ |
| 1466 | uint8_t nonce_data[64]; /* Nonce data; ignored if nonce_size=0 */ | 1500 | uint8_t nonce_data[64]; /* Nonce data; ignored if nonce_size=0 */ |
| 1467 | } __packed; | 1501 | } __ec_align4; |
| 1468 | 1502 | ||
| 1469 | struct ec_response_vboot_hash { | 1503 | struct ec_response_vboot_hash { |
| 1470 | uint8_t status; /* enum ec_vboot_hash_status */ | 1504 | uint8_t status; /* enum ec_vboot_hash_status */ |
| @@ -1474,7 +1508,7 @@ struct ec_response_vboot_hash { · 3 unmodified lines | |||
| 1474 | uint32_t offset; /* Offset in flash which was hashed */ | 1508 | uint32_t offset; /* Offset in flash which was hashed */ |
| 1475 | uint32_t size; /* Number of bytes hashed */ | 1509 | uint32_t size; /* Number of bytes hashed */ |
| 1476 | uint8_t hash_digest[64]; /* Hash digest data */ | 1510 | uint8_t hash_digest[64]; /* Hash digest data */ |
| 1477 | } __packed; | 1511 | } __ec_align4; |
| 1478 | 1512 | ||
| 1479 | enum ec_vboot_hash_cmd { | 1513 | enum ec_vboot_hash_cmd { |
| 1480 | EC_VBOOT_HASH_GET = 0, /* Get current hash status */ | 1514 | EC_VBOOT_HASH_GET = 0, /* Get current hash status */ |
| @@ -1634,23 +1668,23 @@ struct ec_response_motion_sensor_data { · 153 unmodified lines | |||
| 1634 | /* Each sensor is up to 3-axis. */ | 1668 | /* Each sensor is up to 3-axis. */ |
| 1635 | union { | 1669 | union { |
| 1636 | int16_t data[3]; | 1670 | int16_t data[3]; |
| 1637 | struct { | 1671 | struct __ec_todo_packed { |
| 1638 | uint16_t reserved; | 1672 | uint16_t reserved; |
| 1639 | uint32_t timestamp; | 1673 | uint32_t timestamp; |
| 1640 | } __packed; | 1674 | }; |
| 1641 | struct { | 1675 | struct __ec_todo_unpacked { |
| 1642 | uint8_t activity; /* motionsensor_activity */ | 1676 | uint8_t activity; /* motionsensor_activity */ |
| 1643 | uint8_t state; | 1677 | uint8_t state; |
| 1644 | int16_t add_info[2]; | 1678 | int16_t add_info[2]; |
| 1645 | }; | 1679 | }; |
| 1646 | }; | 1680 | }; |
| 1647 | } __packed; | 1681 | } __ec_todo_packed; |
| 1648 | 1682 | ||
| 1649 | struct ec_params_motion_sense { | 1683 | struct ec_params_motion_sense { |
| 1650 | uint8_t cmd; | 1684 | uint8_t cmd; |
| 1651 | union { | 1685 | union { |
| 1652 | /* Used for MOTIONSENSE_CMD_DUMP. */ | 1686 | /* Used for MOTIONSENSE_CMD_DUMP. */ |
| 1653 | struct { | 1687 | struct __ec_todo_unpacked { |
| 1654 | /* no args */ | 1688 | /* no args */ |
| 1655 | } dump; | 1689 | } dump; |
| 1656 | 1690 | ||
| @@ -1658,13 +1692,13 @@ struct ec_params_motion_sense { · 1 unmodified line | |||
| 1658 | * Used for MOTIONSENSE_CMD_EC_RATE and | 1692 | * Used for MOTIONSENSE_CMD_EC_RATE and |
| 1659 | * MOTIONSENSE_CMD_KB_WAKE_ANGLE. | 1693 | * MOTIONSENSE_CMD_KB_WAKE_ANGLE. |
| 1660 | */ | 1694 | */ |
| 1661 | struct { | 1695 | struct __ec_todo_unpacked { |
| 1662 | /* Data to set or EC_MOTION_SENSE_NO_VALUE to read. */ | 1696 | /* Data to set or EC_MOTION_SENSE_NO_VALUE to read. */ |
| 1663 | int16_t data; | 1697 | int16_t data; |
| 1664 | } ec_rate, kb_wake_angle; | 1698 | } ec_rate, kb_wake_angle; |
| 1665 | 1699 | ||
| 1666 | /* Used for MOTIONSENSE_CMD_SENSOR_OFFSET */ | 1700 | /* Used for MOTIONSENSE_CMD_SENSOR_OFFSET */ |
| 1667 | struct { | 1701 | struct __ec_todo_packed { |
| 1668 | uint8_t sensor_num; | 1702 | uint8_t sensor_num; |
| 1669 | 1703 | ||
| 1670 | /* | 1704 | /* |
| @@ -1690,10 +1724,10 @@ struct ec_params_motion_sense { · 19 unmodified lines | |||
| 1690 | * Compass: 1/16 uT | 1724 | * Compass: 1/16 uT |
| 1691 | */ | 1725 | */ |
| 1692 | int16_t offset[3]; | 1726 | int16_t offset[3]; |
| 1693 | } __packed sensor_offset; | 1727 | } sensor_offset; |
| 1694 | 1728 | ||
| 1695 | /* Used for MOTIONSENSE_CMD_INFO. */ | 1729 | /* Used for MOTIONSENSE_CMD_INFO. */ |
| 1696 | struct { | 1730 | struct __ec_todo_packed { |
| 1697 | uint8_t sensor_num; | 1731 | uint8_t sensor_num; |
| 1698 | } info; | 1732 | } info; |
| 1699 | 1733 | ||
| @@ -1714,12 +1748,12 @@ struct ec_params_motion_sense { · 14 unmodified lines | |||
| 1714 | int32_t data; | 1748 | int32_t data; |
| 1715 | } sensor_odr, sensor_range; | 1749 | } sensor_odr, sensor_range; |
| 1716 | }; | 1750 | }; |
| 1717 | } __packed; | 1751 | } __ec_todo_packed; |
| 1718 | 1752 | ||
| 1719 | struct ec_response_motion_sense { | 1753 | struct ec_response_motion_sense { |
| 1720 | union { | 1754 | union { |
| 1721 | /* Used for MOTIONSENSE_CMD_DUMP. */ | 1755 | /* Used for MOTIONSENSE_CMD_DUMP. */ |
| 1722 | struct { | 1756 | struct __ec_todo_unpacked { |
| 1723 | /* Flags representing the motion sensor module. */ | 1757 | /* Flags representing the motion sensor module. */ |
| 1724 | uint8_t module_flags; | 1758 | uint8_t module_flags; |
| 1725 | 1759 | ||
| @@ -1734,7 +1768,7 @@ struct ec_response_motion_sense { · 8 unmodified lines | |||
| 1734 | } dump; | 1768 | } dump; |
| 1735 | 1769 | ||
| 1736 | /* Used for MOTIONSENSE_CMD_INFO. */ | 1770 | /* Used for MOTIONSENSE_CMD_INFO. */ |
| 1737 | struct { | 1771 | struct __ec_todo_unpacked { |
| 1738 | /* Should be element of enum motionsensor_type. */ | 1772 | /* Should be element of enum motionsensor_type. */ |
| 1739 | uint8_t type; | 1773 | uint8_t type; |
| 1740 | 1774 | ||
| @@ -1753,18 +1787,18 @@ struct ec_response_motion_sense { · 12 unmodified lines | |||
| 1753 | * MOTIONSENSE_CMD_SENSOR_RANGE, and | 1787 | * MOTIONSENSE_CMD_SENSOR_RANGE, and |
| 1754 | * MOTIONSENSE_CMD_KB_WAKE_ANGLE. | 1788 | * MOTIONSENSE_CMD_KB_WAKE_ANGLE. |
| 1755 | */ | 1789 | */ |
| 1756 | struct { | 1790 | struct __ec_todo_unpacked { |
| 1757 | /* Current value of the parameter queried. */ | 1791 | /* Current value of the parameter queried. */ |
| 1758 | int32_t ret; | 1792 | int32_t ret; |
| 1759 | } ec_rate, sensor_odr, sensor_range, kb_wake_angle; | 1793 | } ec_rate, sensor_odr, sensor_range, kb_wake_angle; |
| 1760 | 1794 | ||
| 1761 | /* Used for MOTIONSENSE_CMD_SENSOR_OFFSET */ | 1795 | /* Used for MOTIONSENSE_CMD_SENSOR_OFFSET */ |
| 1762 | struct { | 1796 | struct __ec_todo_unpacked { |
| 1763 | int16_t temp; | 1797 | int16_t temp; |
| 1764 | int16_t offset[3]; | 1798 | int16_t offset[3]; |
| 1765 | } sensor_offset, perform_calib; | 1799 | } sensor_offset, perform_calib; |
| 1766 | }; | 1800 | }; |
| 1767 | } __packed; | 1801 | } __ec_todo_packed; |
| 1768 | 1802 | ||
| 1769 | /*****************************************************************************/ | 1803 | /*****************************************************************************/ |
| 1770 | /* USB charging control commands */ | 1804 | /* USB charging control commands */ |
| @@ -1775,7 +1809,7 @@ struct ec_response_motion_sense { · 4 unmodified lines | |||
| 1775 | struct ec_params_usb_charge_set_mode { | 1809 | struct ec_params_usb_charge_set_mode { |
| 1776 | uint8_t usb_port_id; | 1810 | uint8_t usb_port_id; |
| 1777 | uint8_t mode; | 1811 | uint8_t mode; |
| 1778 | } __packed; | 1812 | } __ec_align1; |
| 1779 | 1813 | ||
| 1780 | /*****************************************************************************/ | 1814 | /*****************************************************************************/ |
| 1781 | /* Persistent storage for host */ | 1815 | /* Persistent storage for host */ |
| @@ -1791,7 +1825,7 @@ struct ec_response_pstore_info { · 9 unmodified lines | |||
| 1791 | uint32_t pstore_size; | 1825 | uint32_t pstore_size; |
| 1792 | /* Access size; read/write offset and size must be a multiple of this */ | 1826 | /* Access size; read/write offset and size must be a multiple of this */ |
| 1793 | uint32_t access_size; | 1827 | uint32_t access_size; |
| 1794 | } __packed; | 1828 | } __ec_align4; |
| 1795 | 1829 | ||
| 1796 | /* | 1830 | /* |
| 1797 | * Read persistent storage | 1831 | * Read persistent storage |
| @@ -1803,7 +1837,7 @@ struct ec_response_pstore_info { · 5 unmodified lines | |||
| 1803 | struct ec_params_pstore_read { | 1837 | struct ec_params_pstore_read { |
| 1804 | uint32_t offset; /* Byte offset to read */ | 1838 | uint32_t offset; /* Byte offset to read */ |
| 1805 | uint32_t size; /* Size to read in bytes */ | 1839 | uint32_t size; /* Size to read in bytes */ |
| 1806 | } __packed; | 1840 | } __ec_align4; |
| 1807 | 1841 | ||
| 1808 | /* Write persistent storage */ | 1842 | /* Write persistent storage */ |
| 1809 | #define EC_CMD_PSTORE_WRITE 0x42 | 1843 | #define EC_CMD_PSTORE_WRITE 0x42 |
| @@ -1812,7 +1846,7 @@ struct ec_params_pstore_write { · 2 unmodified lines | |||
| 1812 | uint32_t offset; /* Byte offset to write */ | 1846 | uint32_t offset; /* Byte offset to write */ |
| 1813 | uint32_t size; /* Size to write in bytes */ | 1847 | uint32_t size; /* Size to write in bytes */ |
| 1814 | uint8_t data[EC_PSTORE_SIZE_MAX]; | 1848 | uint8_t data[EC_PSTORE_SIZE_MAX]; |
| 1815 | } __packed; | 1849 | } __ec_align4; |
| 1816 | 1850 | ||
| 1817 | /*****************************************************************************/ | 1851 | /*****************************************************************************/ |
| 1818 | /* Real-time clock */ | 1852 | /* Real-time clock */ |
| @@ -1820,11 +1854,11 @@ struct ec_params_pstore_write { · 1 unmodified line | |||
| 1820 | /* RTC params and response structures */ | 1854 | /* RTC params and response structures */ |
| 1821 | struct ec_params_rtc { | 1855 | struct ec_params_rtc { |
| 1822 | uint32_t time; | 1856 | uint32_t time; |
| 1823 | } __packed; | 1857 | } __ec_align4; |
| 1824 | 1858 | ||
| 1825 | struct ec_response_rtc { | 1859 | struct ec_response_rtc { |
| 1826 | uint32_t time; | 1860 | uint32_t time; |
| 1827 | } __packed; | 1861 | } __ec_align4; |
| 1828 | 1862 | ||
| 1829 | /* These use ec_response_rtc */ | 1863 | /* These use ec_response_rtc */ |
| 1830 | #define EC_CMD_RTC_GET_VALUE 0x44 | 1864 | #define EC_CMD_RTC_GET_VALUE 0x44 |
| @@ -1855,29 +1889,29 @@ enum ec_port80_subcmd { · 24 unmodified lines | |||
| 1855 | struct ec_params_port80_read { | 1889 | struct ec_params_port80_read { |
| 1856 | uint16_t subcmd; | 1890 | uint16_t subcmd; |
| 1857 | union { | 1891 | union { |
| 1858 | struct { | 1892 | struct __ec_todo_unpacked { |
| 1859 | uint32_t offset; | 1893 | uint32_t offset; |
| 1860 | uint32_t num_entries; | 1894 | uint32_t num_entries; |
| 1861 | } read_buffer; | 1895 | } read_buffer; |
| 1862 | }; | 1896 | }; |
| 1863 | } __packed; | 1897 | } __ec_todo_packed; |
| 1864 | 1898 | ||
| 1865 | struct ec_response_port80_read { | 1899 | struct ec_response_port80_read { |
| 1866 | union { | 1900 | union { |
| 1867 | struct { | 1901 | struct __ec_todo_unpacked { |
| 1868 | uint32_t writes; | 1902 | uint32_t writes; |
| 1869 | uint32_t history_size; | 1903 | uint32_t history_size; |
| 1870 | uint32_t last_boot; | 1904 | uint32_t last_boot; |
| 1871 | } get_info; | 1905 | } get_info; |
| 1872 | struct { | 1906 | struct __ec_todo_unpacked { |
| 1873 | uint16_t codes[EC_PORT80_SIZE_MAX]; | 1907 | uint16_t codes[EC_PORT80_SIZE_MAX]; |
| 1874 | } data; | 1908 | } data; |
| 1875 | }; | 1909 | }; |
| 1876 | } __packed; | 1910 | } __ec_todo_packed; |
| 1877 | 1911 | ||
| 1878 | struct ec_response_port80_last_boot { | 1912 | struct ec_response_port80_last_boot { |
| 1879 | uint16_t code; | 1913 | uint16_t code; |
| 1880 | } __packed; | 1914 | } __ec_align2; |
| 1881 | 1915 | ||
| 1882 | /*****************************************************************************/ | 1916 | /*****************************************************************************/ |
| 1883 | /* Thermal engine commands. Note that there are two implementations. We'll | 1917 | /* Thermal engine commands. Note that there are two implementations. We'll |
| @@ -1898,17 +1932,17 @@ struct ec_params_thermal_set_threshold { · 14 unmodified lines | |||
| 1898 | uint8_t sensor_type; | 1932 | uint8_t sensor_type; |
| 1899 | uint8_t threshold_id; | 1933 | uint8_t threshold_id; |
| 1900 | uint16_t value; | 1934 | uint16_t value; |
| 1901 | } __packed; | 1935 | } __ec_align2; |
| 1902 | 1936 | ||
| 1903 | /* Version 0 - get */ | 1937 | /* Version 0 - get */ |
| 1904 | struct ec_params_thermal_get_threshold { | 1938 | struct ec_params_thermal_get_threshold { |
| 1905 | uint8_t sensor_type; | 1939 | uint8_t sensor_type; |
| 1906 | uint8_t threshold_id; | 1940 | uint8_t threshold_id; |
| 1907 | } __packed; | 1941 | } __ec_align1; |
| 1908 | 1942 | ||
| 1909 | struct ec_response_thermal_get_threshold { | 1943 | struct ec_response_thermal_get_threshold { |
| 1910 | uint16_t value; | 1944 | uint16_t value; |
| 1911 | } __packed; | 1945 | } __ec_align2; |
| 1912 | 1946 | ||
| 1913 | 1947 | ||
| 1914 | /* The version 1 structs are visible. */ | 1948 | /* The version 1 structs are visible. */ |
| @@ -1928,12 +1962,12 @@ struct ec_thermal_config { · 13 unmodified lines | |||
| 1928 | uint32_t temp_host[EC_TEMP_THRESH_COUNT]; /* levels of hotness */ | 1962 | uint32_t temp_host[EC_TEMP_THRESH_COUNT]; /* levels of hotness */ |
| 1929 | uint32_t temp_fan_off; /* no active cooling needed */ | 1963 | uint32_t temp_fan_off; /* no active cooling needed */ |
| 1930 | uint32_t temp_fan_max; /* max active cooling needed */ | 1964 | uint32_t temp_fan_max; /* max active cooling needed */ |
| 1931 | } __packed; | 1965 | } __ec_align4; |
| 1932 | 1966 | ||
| 1933 | /* Version 1 - get config for one sensor. */ | 1967 | /* Version 1 - get config for one sensor. */ |
| 1934 | struct ec_params_thermal_get_threshold_v1 { | 1968 | struct ec_params_thermal_get_threshold_v1 { |
| 1935 | uint32_t sensor_num; | 1969 | uint32_t sensor_num; |
| 1936 | } __packed; | 1970 | } __ec_align4; |
| 1937 | /* This returns a struct ec_thermal_config */ | 1971 | /* This returns a struct ec_thermal_config */ |
| 1938 | 1972 | ||
| 1939 | /* | 1973 | /* |
| @@ -1943,7 +1977,7 @@ struct ec_params_thermal_get_threshold_v1 { · 3 unmodified lines | |||
| 1943 | struct ec_params_thermal_set_threshold_v1 { | 1977 | struct ec_params_thermal_set_threshold_v1 { |
| 1944 | uint32_t sensor_num; | 1978 | uint32_t sensor_num; |
| 1945 | struct ec_thermal_config cfg; | 1979 | struct ec_thermal_config cfg; |
| 1946 | } __packed; | 1980 | } __ec_align4; |
| 1947 | /* This returns no data */ | 1981 | /* This returns no data */ |
| 1948 | 1982 | ||
| 1949 | /****************************************************************************/ | 1983 | /****************************************************************************/ |
| @@ -1956,14 +1990,14 @@ struct ec_params_thermal_set_threshold_v1 { · 6 unmodified lines | |||
| 1956 | 1990 | ||
| 1957 | struct ec_params_tmp006_get_calibration { | 1991 | struct ec_params_tmp006_get_calibration { |
| 1958 | uint8_t index; | 1992 | uint8_t index; |
| 1959 | } __packed; | 1993 | } __ec_align1; |
| 1960 | 1994 | ||
| 1961 | struct ec_response_tmp006_get_calibration { | 1995 | struct ec_response_tmp006_get_calibration { |
| 1962 | float s0; | 1996 | float s0; |
| 1963 | float b0; | 1997 | float b0; |
| 1964 | float b1; | 1998 | float b1; |
| 1965 | float b2; | 1999 | float b2; |
| 1966 | } __packed; | 2000 | } __ec_align4; |
| 1967 | 2001 | ||
| 1968 | /* Set TMP006 calibration data */ | 2002 | /* Set TMP006 calibration data */ |
| 1969 | #define EC_CMD_TMP006_SET_CALIBRATION 0x54 | 2003 | #define EC_CMD_TMP006_SET_CALIBRATION 0x54 |
| @@ -1975,19 +2009,19 @@ struct ec_params_tmp006_set_calibration { · 5 unmodified lines | |||
| 1975 | float b0; | 2009 | float b0; |
| 1976 | float b1; | 2010 | float b1; |
| 1977 | float b2; | 2011 | float b2; |
| 1978 | } __packed; | 2012 | } __ec_align4; |
| 1979 | 2013 | ||
| 1980 | /* Read raw TMP006 data */ | 2014 | /* Read raw TMP006 data */ |
| 1981 | #define EC_CMD_TMP006_GET_RAW 0x55 | 2015 | #define EC_CMD_TMP006_GET_RAW 0x55 |
| 1982 | 2016 | ||
| 1983 | struct ec_params_tmp006_get_raw { | 2017 | struct ec_params_tmp006_get_raw { |
| 1984 | uint8_t index; | 2018 | uint8_t index; |
| 1985 | } __packed; | 2019 | } __ec_align1; |
| 1986 | 2020 | ||
| 1987 | struct ec_response_tmp006_get_raw { | 2021 | struct ec_response_tmp006_get_raw { |
| 1988 | int32_t t; /* In 1/100 K */ | 2022 | int32_t t; /* In 1/100 K */ |
| 1989 | int32_t v; /* In nV */ | 2023 | int32_t v; /* In nV */ |
| 1990 | }; | 2024 | } __ec_align4; |
| 1991 | 2025 | ||
| 1992 | /*****************************************************************************/ | 2026 | /*****************************************************************************/ |
| 1993 | /* MKBP - Matrix KeyBoard Protocol */ | 2027 | /* MKBP - Matrix KeyBoard Protocol */ |
| @@ -2014,12 +2048,12 @@ struct ec_response_mkbp_info { · 20 unmodified lines | |||
| 2014 | uint32_t cols; | 2048 | uint32_t cols; |
| 2015 | /* Formerly "switches", which was 0. */ | 2049 | /* Formerly "switches", which was 0. */ |
| 2016 | uint8_t reserved; | 2050 | uint8_t reserved; |
| 2017 | } __packed; | 2051 | } __ec_align_size1; |
| 2018 | 2052 | ||
| 2019 | struct ec_params_mkbp_info { | 2053 | struct ec_params_mkbp_info { |
| 2020 | uint8_t info_type; | 2054 | uint8_t info_type; |
| 2021 | uint8_t event_type; | 2055 | uint8_t event_type; |
| 2022 | } __packed; | 2056 | } __ec_align1; |
| 2023 | 2057 | ||
| 2024 | enum ec_mkbp_info_type { | 2058 | enum ec_mkbp_info_type { |
| 2025 | /* | 2059 | /* |
| @@ -2067,7 +2101,7 @@ struct ec_params_mkbp_simulate_key { · 41 unmodified lines | |||
| 2067 | uint8_t col; | 2101 | uint8_t col; |
| 2068 | uint8_t row; | 2102 | uint8_t row; |
| 2069 | uint8_t pressed; | 2103 | uint8_t pressed; |
| 2070 | } __packed; | 2104 | } __ec_align1; |
| 2071 | 2105 | ||
| 2072 | /* Configure keyboard scanning */ | 2106 | /* Configure keyboard scanning */ |
| 2073 | #define EC_CMD_MKBP_SET_CONFIG 0x64 | 2107 | #define EC_CMD_MKBP_SET_CONFIG 0x64 |
| @@ -2113,15 +2147,15 @@ struct ec_mkbp_config { · 39 unmodified lines | |||
| 2113 | uint16_t debounce_up_us; /* time for debounce on key up */ | 2147 | uint16_t debounce_up_us; /* time for debounce on key up */ |
| 2114 | /* maximum depth to allow for fifo (0 = no keyscan output) */ | 2148 | /* maximum depth to allow for fifo (0 = no keyscan output) */ |
| 2115 | uint8_t fifo_max_depth; | 2149 | uint8_t fifo_max_depth; |
| 2116 | } __packed; | 2150 | } __ec_align_size1; |
| 2117 | 2151 | ||
| 2118 | struct ec_params_mkbp_set_config { | 2152 | struct ec_params_mkbp_set_config { |
| 2119 | struct ec_mkbp_config config; | 2153 | struct ec_mkbp_config config; |
| 2120 | } __packed; | 2154 | } __ec_align_size1; |
| 2121 | 2155 | ||
| 2122 | struct ec_response_mkbp_get_config { | 2156 | struct ec_response_mkbp_get_config { |
| 2123 | struct ec_mkbp_config config; | 2157 | struct ec_mkbp_config config; |
| 2124 | } __packed; | 2158 | } __ec_align_size1; |
| 2125 | 2159 | ||
| 2126 | /* Run the key scan emulation */ | 2160 | /* Run the key scan emulation */ |
| 2127 | #define EC_CMD_KEYSCAN_SEQ_CTRL 0x66 | 2161 | #define EC_CMD_KEYSCAN_SEQ_CTRL 0x66 |
| @@ -2144,18 +2178,18 @@ enum ec_collect_flags { · 16 unmodified lines | |||
| 2144 | 2178 | ||
| 2145 | struct ec_collect_item { | 2179 | struct ec_collect_item { |
| 2146 | uint8_t flags; /* some flags (enum ec_collect_flags) */ | 2180 | uint8_t flags; /* some flags (enum ec_collect_flags) */ |
| 2147 | }; | 2181 | } __ec_align1; |
| 2148 | 2182 | ||
| 2149 | struct ec_params_keyscan_seq_ctrl { | 2183 | struct ec_params_keyscan_seq_ctrl { |
| 2150 | uint8_t cmd; /* Command to send (enum ec_keyscan_seq_cmd) */ | 2184 | uint8_t cmd; /* Command to send (enum ec_keyscan_seq_cmd) */ |
| 2151 | union { | 2185 | union { |
| 2152 | struct { | 2186 | struct __ec_align1 { |
| 2153 | uint8_t active; /* still active */ | 2187 | uint8_t active; /* still active */ |
| 2154 | uint8_t num_items; /* number of items */ | 2188 | uint8_t num_items; /* number of items */ |
| 2155 | /* Current item being presented */ | 2189 | /* Current item being presented */ |
| 2156 | uint8_t cur_item; | 2190 | uint8_t cur_item; |
| 2157 | } status; | 2191 | } status; |
| 2158 | struct { | 2192 | struct __ec_todo_unpacked { |
| 2159 | /* | 2193 | /* |
| 2160 | * Absolute time for this scan, measured from the | 2194 | * Absolute time for this scan, measured from the |
| 2161 | * start of the sequence. | 2195 | * start of the sequence. |
| @@ -2163,22 +2197,22 @@ struct ec_params_keyscan_seq_ctrl { · 1 unmodified line | |||
| 2163 | uint32_t time_us; | 2197 | uint32_t time_us; |
| 2164 | uint8_t scan[0]; /* keyscan data */ | 2198 | uint8_t scan[0]; /* keyscan data */ |
| 2165 | } add; | 2199 | } add; |
| 2166 | struct { | 2200 | struct __ec_align1 { |
| 2167 | uint8_t start_item; /* First item to return */ | 2201 | uint8_t start_item; /* First item to return */ |
| 2168 | uint8_t num_items; /* Number of items to return */ | 2202 | uint8_t num_items; /* Number of items to return */ |
| 2169 | } collect; | 2203 | } collect; |
| 2170 | }; | 2204 | }; |
| 2171 | } __packed; | 2205 | } __ec_todo_packed; |
| 2172 | 2206 | ||
| 2173 | struct ec_result_keyscan_seq_ctrl { | 2207 | struct ec_result_keyscan_seq_ctrl { |
| 2174 | union { | 2208 | union { |
| 2175 | struct { | 2209 | struct __ec_todo_unpacked { |
| 2176 | uint8_t num_items; /* Number of items */ | 2210 | uint8_t num_items; /* Number of items */ |
| 2177 | /* Data for each item */ | 2211 | /* Data for each item */ |
| 2178 | struct ec_collect_item item[0]; | 2212 | struct ec_collect_item item[0]; |
| 2179 | } collect; | 2213 | } collect; |
| 2180 | }; | 2214 | }; |
| 2181 | } __packed; | 2215 | } __ec_todo_packed; |
| 2182 | 2216 | ||
| 2183 | /* | 2217 | /* |
| 2184 | * Command for retrieving the next pending MKBP event from the EC device | 2218 | * Command for retrieving the next pending MKBP event from the EC device |
| @@ -2216,8 +2250,8 @@ enum ec_mkbp_event { · 31 unmodified lines | |||
| 2216 | EC_MKBP_EVENT_COUNT, | 2250 | EC_MKBP_EVENT_COUNT, |
| 2217 | }; | 2251 | }; |
| 2218 | 2252 | ||
| 2219 | union ec_response_get_next_data { | 2253 | union __ec_align_offset1 ec_response_get_next_data { |
| 2220 | uint8_t key_matrix[13]; | 2254 | uint8_t key_matrix[13]; |
| 2221 | 2255 | ||
| 2222 | /* Unaligned */ | 2256 | /* Unaligned */ |
| 2223 | uint32_t host_event; | 2257 | uint32_t host_event; |
| @@ -2225,9 +2259,9 @@ union ec_response_get_next_data { · 1 unmodified line | |||
| 2225 | uint32_t buttons; | 2259 | uint32_t buttons; |
| 2226 | uint32_t switches; | 2260 | uint32_t switches; |
| 2227 | uint32_t sysrq; | 2261 | uint32_t sysrq; |
| 2228 | } __packed; | 2262 | }; |
| 2229 | 2263 | ||
| 2230 | union ec_response_get_next_data_v1 { | 2264 | union __ec_align_offset1 ec_response_get_next_data_v1 { |
| 2231 | uint8_t key_matrix[16]; | 2265 | uint8_t key_matrix[16]; |
| 2232 | uint32_t host_event; | 2266 | uint32_t host_event; |
| 2233 | uint32_t buttons; | 2267 | uint32_t buttons; |
| @@ -2235,19 +2269,19 @@ union ec_response_get_next_data_v1 { · 1 unmodified line | |||
| 2235 | uint32_t sysrq; | 2269 | uint32_t sysrq; |
| 2236 | uint32_t cec_events; | 2270 | uint32_t cec_events; |
| 2237 | uint8_t cec_message[16]; | 2271 | uint8_t cec_message[16]; |
| 2238 | } __packed; | 2272 | }; |
| 2239 | 2273 | ||
| 2240 | struct ec_response_get_next_event { | 2274 | struct ec_response_get_next_event { |
| 2241 | uint8_t event_type; | 2275 | uint8_t event_type; |
| 2242 | /* Followed by event data if any */ | 2276 | /* Followed by event data if any */ |
| 2243 | union ec_response_get_next_data data; | 2277 | union ec_response_get_next_data data; |
| 2244 | } __packed; | 2278 | } __ec_align1; |
| 2245 | 2279 | ||
| 2246 | struct ec_response_get_next_event_v1 { | 2280 | struct ec_response_get_next_event_v1 { |
| 2247 | uint8_t event_type; | 2281 | uint8_t event_type; |
| 2248 | /* Followed by event data if any */ | 2282 | /* Followed by event data if any */ |
| 2249 | union ec_response_get_next_data_v1 data; | 2283 | union ec_response_get_next_data_v1 data; |
| 2250 | } __packed; | 2284 | } __ec_align1; |
| 2251 | 2285 | ||
| 2252 | /* Bit indices for buttons and switches.*/ | 2286 | /* Bit indices for buttons and switches.*/ |
| 2253 | /* Buttons */ | 2287 | /* Buttons */ |
| @@ -2268,12 +2302,12 @@ struct ec_response_get_next_event_v1 { · 14 unmodified lines | |||
| 2268 | 2302 | ||
| 2269 | struct ec_params_temp_sensor_get_info { | 2303 | struct ec_params_temp_sensor_get_info { |
| 2270 | uint8_t id; | 2304 | uint8_t id; |
| 2271 | } __packed; | 2305 | } __ec_align1; |
| 2272 | 2306 | ||
| 2273 | struct ec_response_temp_sensor_get_info { | 2307 | struct ec_response_temp_sensor_get_info { |
| 2274 | char sensor_name[32]; | 2308 | char sensor_name[32]; |
| 2275 | uint8_t sensor_type; | 2309 | uint8_t sensor_type; |
| 2276 | } __packed; | 2310 | } __ec_align1; |
| 2277 | 2311 | ||
| 2278 | /*****************************************************************************/ | 2312 | /*****************************************************************************/ |
| 2279 | 2313 | ||
| @@ -2292,11 +2326,11 @@ struct ec_response_temp_sensor_get_info { · 12 unmodified lines | |||
| 2292 | */ | 2326 | */ |
| 2293 | struct ec_params_host_event_mask { | 2327 | struct ec_params_host_event_mask { |
| 2294 | uint32_t mask; | 2328 | uint32_t mask; |
| 2295 | } __packed; | 2329 | } __ec_align4; |
| 2296 | 2330 | ||
| 2297 | struct ec_response_host_event_mask { | 2331 | struct ec_response_host_event_mask { |
| 2298 | uint32_t mask; | 2332 | uint32_t mask; |
| 2299 | } __packed; | 2333 | } __ec_align4; |
| 2300 | 2334 | ||
| 2301 | /* These all use ec_response_host_event_mask */ | 2335 | /* These all use ec_response_host_event_mask */ |
| 2302 | #define EC_CMD_HOST_EVENT_GET_B 0x87 | 2336 | #define EC_CMD_HOST_EVENT_GET_B 0x87 |
| @@ -2319,7 +2353,7 @@ struct ec_response_host_event_mask { · 16 unmodified lines | |||
| 2319 | 2353 | ||
| 2320 | struct ec_params_switch_enable_backlight { | 2354 | struct ec_params_switch_enable_backlight { |
| 2321 | uint8_t enabled; | 2355 | uint8_t enabled; |
| 2322 | } __packed; | 2356 | } __ec_align1; |
| 2323 | 2357 | ||
| 2324 | /* Enable/disable WLAN/Bluetooth */ | 2358 | /* Enable/disable WLAN/Bluetooth */ |
| 2325 | #define EC_CMD_SWITCH_ENABLE_WIRELESS 0x91 | 2359 | #define EC_CMD_SWITCH_ENABLE_WIRELESS 0x91 |
| @@ -2328,7 +2362,7 @@ struct ec_params_switch_enable_backlight { · 2 unmodified lines | |||
| 2328 | /* Version 0 params; no response */ | 2362 | /* Version 0 params; no response */ |
| 2329 | struct ec_params_switch_enable_wireless_v0 { | 2363 | struct ec_params_switch_enable_wireless_v0 { |
| 2330 | uint8_t enabled; | 2364 | uint8_t enabled; |
| 2331 | } __packed; | 2365 | } __ec_align1; |
| 2332 | 2366 | ||
| 2333 | /* Version 1 params */ | 2367 | /* Version 1 params */ |
| 2334 | struct ec_params_switch_enable_wireless_v1 { | 2368 | struct ec_params_switch_enable_wireless_v1 { |
| @@ -2347,7 +2381,7 @@ struct ec_params_switch_enable_wireless_v1 { · 12 unmodified lines | |||
| 2347 | 2381 | ||
| 2348 | /* Which flags to copy from suspend_flags */ | 2382 | /* Which flags to copy from suspend_flags */ |
| 2349 | uint8_t suspend_mask; | 2383 | uint8_t suspend_mask; |
| 2350 | } __packed; | 2384 | } __ec_align1; |
| 2351 | 2385 | ||
| 2352 | /* Version 1 response */ | 2386 | /* Version 1 response */ |
| 2353 | struct ec_response_switch_enable_wireless_v1 { | 2387 | struct ec_response_switch_enable_wireless_v1 { |
| @@ -2356,7 +2390,7 @@ struct ec_response_switch_enable_wireless_v1 { · 2 unmodified lines | |||
| 2356 | 2390 | ||
| 2357 | /* Flags to leave enabled in S3 */ | 2391 | /* Flags to leave enabled in S3 */ |
| 2358 | uint8_t suspend_flags; | 2392 | uint8_t suspend_flags; |
| 2359 | } __packed; | 2393 | } __ec_align1; |
| 2360 | 2394 | ||
| 2361 | /*****************************************************************************/ | 2395 | /*****************************************************************************/ |
| 2362 | /* GPIO commands. Only available on EC if write protect has been disabled. */ | 2396 | /* GPIO commands. Only available on EC if write protect has been disabled. */ |
| @@ -2367,7 +2401,7 @@ struct ec_response_switch_enable_wireless_v1 { · 4 unmodified lines | |||
| 2367 | struct ec_params_gpio_set { | 2401 | struct ec_params_gpio_set { |
| 2368 | char name[32]; | 2402 | char name[32]; |
| 2369 | uint8_t val; | 2403 | uint8_t val; |
| 2370 | } __packed; | 2404 | } __ec_align1; |
| 2371 | 2405 | ||
| 2372 | /* Get GPIO value */ | 2406 | /* Get GPIO value */ |
| 2373 | #define EC_CMD_GPIO_GET 0x93 | 2407 | #define EC_CMD_GPIO_GET 0x93 |
| @@ -2375,37 +2409,37 @@ struct ec_params_gpio_set { · 1 unmodified line | |||
| 2375 | /* Version 0 of input params and response */ | 2409 | /* Version 0 of input params and response */ |
| 2376 | struct ec_params_gpio_get { | 2410 | struct ec_params_gpio_get { |
| 2377 | char name[32]; | 2411 | char name[32]; |
| 2378 | } __packed; | 2412 | } __ec_align1; |
| 2379 | 2413 | ||
| 2380 | struct ec_response_gpio_get { | 2414 | struct ec_response_gpio_get { |
| 2381 | uint8_t val; | 2415 | uint8_t val; |
| 2382 | } __packed; | 2416 | } __ec_align1; |
| 2383 | 2417 | ||
| 2384 | /* Version 1 of input params and response */ | 2418 | /* Version 1 of input params and response */ |
| 2385 | struct ec_params_gpio_get_v1 { | 2419 | struct ec_params_gpio_get_v1 { |
| 2386 | uint8_t subcmd; | 2420 | uint8_t subcmd; |
| 2387 | union { | 2421 | union { |
| 2388 | struct { | 2422 | struct __ec_align1 { |
| 2389 | char name[32]; | 2423 | char name[32]; |
| 2390 | } get_value_by_name; | 2424 | } get_value_by_name; |
| 2391 | struct { | 2425 | struct __ec_align1 { |
| 2392 | uint8_t index; | 2426 | uint8_t index; |
| 2393 | } get_info; | 2427 | } get_info; |
| 2394 | }; | 2428 | }; |
| 2395 | } __packed; | 2429 | } __ec_align1; |
| 2396 | 2430 | ||
| 2397 | struct ec_response_gpio_get_v1 { | 2431 | struct ec_response_gpio_get_v1 { |
| 2398 | union { | 2432 | union { |
| 2399 | struct { | 2433 | struct __ec_align1 { |
| 2400 | uint8_t val; | 2434 | uint8_t val; |
| 2401 | } get_value_by_name, get_count; | 2435 | } get_value_by_name, get_count; |
| 2402 | struct { | 2436 | struct __ec_todo_unpacked { |
| 2403 | uint8_t val; | 2437 | uint8_t val; |
| 2404 | char name[32]; | 2438 | char name[32]; |
| 2405 | uint32_t flags; | 2439 | uint32_t flags; |
| 2406 | } get_info; | 2440 | } get_info; |
| 2407 | }; | 2441 | }; |
| 2408 | } __packed; | 2442 | } __ec_todo_packed; |
| 2409 | 2443 | ||
| 2410 | enum gpio_get_subcmd { | 2444 | enum gpio_get_subcmd { |
| 2411 | EC_GPIO_GET_BY_NAME = 0, | 2445 | EC_GPIO_GET_BY_NAME = 0, |
| @@ -2431,11 +2465,11 @@ struct ec_params_i2c_read { · 19 unmodified lines | |||
| 2431 | uint8_t read_size; /* Either 8 or 16. */ | 2465 | uint8_t read_size; /* Either 8 or 16. */ |
| 2432 | uint8_t port; | 2466 | uint8_t port; |
| 2433 | uint8_t offset; | 2467 | uint8_t offset; |
| 2434 | } __packed; | 2468 | } __ec_align_size1; |
| 2435 | 2469 | ||
| 2436 | struct ec_response_i2c_read { | 2470 | struct ec_response_i2c_read { |
| 2437 | uint16_t data; | 2471 | uint16_t data; |
| 2438 | } __packed; | 2472 | } __ec_align2; |
| 2439 | 2473 | ||
| 2440 | /* Write I2C bus */ | 2474 | /* Write I2C bus */ |
| 2441 | #define EC_CMD_I2C_WRITE 0x95 | 2475 | #define EC_CMD_I2C_WRITE 0x95 |
| @@ -2446,7 +2480,7 @@ struct ec_params_i2c_write { · 4 unmodified lines | |||
| 2446 | uint8_t write_size; /* Either 8 or 16. */ | 2480 | uint8_t write_size; /* Either 8 or 16. */ |
| 2447 | uint8_t port; | 2481 | uint8_t port; |
| 2448 | uint8_t offset; | 2482 | uint8_t offset; |
| 2449 | } __packed; | 2483 | } __ec_align_size1; |
| 2450 | 2484 | ||
| 2451 | /*****************************************************************************/ | 2485 | /*****************************************************************************/ |
| 2452 | /* Charge state commands. Only available when flash write protect unlocked. */ | 2486 | /* Charge state commands. Only available when flash write protect unlocked. */ |
| @@ -2465,7 +2499,7 @@ enum ec_charge_control_mode { · 12 unmodified lines | |||
| 2465 | 2499 | ||
| 2466 | struct ec_params_charge_control { | 2500 | struct ec_params_charge_control { |
| 2467 | uint32_t mode; /* enum charge_control_mode */ | 2501 | uint32_t mode; /* enum charge_control_mode */ |
| 2468 | } __packed; | 2502 | } __ec_align4; |
| 2469 | 2503 | ||
| 2470 | /*****************************************************************************/ | 2504 | /*****************************************************************************/ |
| 2471 | 2505 | ||
| @@ -2493,7 +2527,7 @@ enum ec_console_read_subcmd { · 21 unmodified lines | |||
| 2493 | 2527 | ||
| 2494 | struct ec_params_console_read_v1 { | 2528 | struct ec_params_console_read_v1 { |
| 2495 | uint8_t subcmd; /* enum ec_console_read_subcmd */ | 2529 | uint8_t subcmd; /* enum ec_console_read_subcmd */ |
| 2496 | } __packed; | 2530 | } __ec_align1; |
| 2497 | 2531 | ||
| 2498 | /*****************************************************************************/ | 2532 | /*****************************************************************************/ |
| 2499 | 2533 | ||
| @@ -2511,7 +2545,7 @@ struct ec_params_console_read_v1 { · 11 unmodified lines | |||
| 2511 | 2545 | ||
| 2512 | struct ec_params_battery_cutoff { | 2546 | struct ec_params_battery_cutoff { |
| 2513 | uint8_t flags; | 2547 | uint8_t flags; |
| 2514 | } __packed; | 2548 | } __ec_align1; |
| 2515 | 2549 | ||
| 2516 | /*****************************************************************************/ | 2550 | /*****************************************************************************/ |
| 2517 | /* USB port mux control. */ | 2551 | /* USB port mux control. */ |
| @@ -2523,7 +2557,7 @@ struct ec_params_battery_cutoff { · 5 unmodified lines | |||
| 2523 | 2557 | ||
| 2524 | struct ec_params_usb_mux { | 2558 | struct ec_params_usb_mux { |
| 2525 | uint8_t mux; | 2559 | uint8_t mux; |
| 2526 | } __packed; | 2560 | } __ec_align1; |
| 2527 | 2561 | ||
| 2528 | /*****************************************************************************/ | 2562 | /*****************************************************************************/ |
| 2529 | /* LDOs / FETs control. */ | 2563 | /* LDOs / FETs control. */ |
| @@ -2541,7 +2575,7 @@ enum ec_ldo_state { · 11 unmodified lines | |||
| 2541 | struct ec_params_ldo_set { | 2575 | struct ec_params_ldo_set { |
| 2542 | uint8_t index; | 2576 | uint8_t index; |
| 2543 | uint8_t state; | 2577 | uint8_t state; |
| 2544 | } __packed; | 2578 | } __ec_align1; |
| 2545 | 2579 | ||
| 2546 | /* | 2580 | /* |
| 2547 | * Get LDO state. | 2581 | * Get LDO state. |
| @@ -2550,11 +2584,11 @@ struct ec_params_ldo_set { · 2 unmodified lines | |||
| 2550 | 2584 | ||
| 2551 | struct ec_params_ldo_get { | 2585 | struct ec_params_ldo_get { |
| 2552 | uint8_t index; | 2586 | uint8_t index; |
| 2553 | } __packed; | 2587 | } __ec_align1; |
| 2554 | 2588 | ||
| 2555 | struct ec_response_ldo_get { | 2589 | struct ec_response_ldo_get { |
| 2556 | uint8_t state; | 2590 | uint8_t state; |
| 2557 | } __packed; | 2591 | } __ec_align1; |
| 2558 | 2592 | ||
| 2559 | /*****************************************************************************/ | 2593 | /*****************************************************************************/ |
| 2560 | /* Power info. */ | 2594 | /* Power info. */ |
| @@ -2570,7 +2604,7 @@ struct ec_response_power_info { · 9 unmodified lines | |||
| 2570 | uint16_t voltage_system; | 2604 | uint16_t voltage_system; |
| 2571 | uint16_t current_system; | 2605 | uint16_t current_system; |
| 2572 | uint16_t usb_current_limit; | 2606 | uint16_t usb_current_limit; |
| 2573 | } __packed; | 2607 | } __ec_align4; |
| 2574 | 2608 | ||
| 2575 | /*****************************************************************************/ | 2609 | /*****************************************************************************/ |
| 2576 | /* I2C passthru command */ | 2610 | /* I2C passthru command */ |
| @@ -2592,20 +2626,20 @@ struct ec_response_power_info { · 15 unmodified lines | |||
| 2592 | struct ec_params_i2c_passthru_msg { | 2626 | struct ec_params_i2c_passthru_msg { |
| 2593 | uint16_t addr_flags; /* I2C slave address (7 or 10 bits) and flags */ | 2627 | uint16_t addr_flags; /* I2C slave address (7 or 10 bits) and flags */ |
| 2594 | uint16_t len; /* Number of bytes to read or write */ | 2628 | uint16_t len; /* Number of bytes to read or write */ |
| 2595 | } __packed; | 2629 | } __ec_align2; |
| 2596 | 2630 | ||
| 2597 | struct ec_params_i2c_passthru { | 2631 | struct ec_params_i2c_passthru { |
| 2598 | uint8_t port; /* I2C port number */ | 2632 | uint8_t port; /* I2C port number */ |
| 2599 | uint8_t num_msgs; /* Number of messages */ | 2633 | uint8_t num_msgs; /* Number of messages */ |
| 2600 | struct ec_params_i2c_passthru_msg msg[]; | 2634 | struct ec_params_i2c_passthru_msg msg[]; |
| 2601 | /* Data to write for all messages is concatenated here */ | 2635 | /* Data to write for all messages is concatenated here */ |
| 2602 | } __packed; | 2636 | } __ec_align2; |
| 2603 | 2637 | ||
| 2604 | struct ec_response_i2c_passthru { | 2638 | struct ec_response_i2c_passthru { |
| 2605 | uint8_t i2c_status; /* Status flags (EC_I2C_STATUS_...) */ | 2639 | uint8_t i2c_status; /* Status flags (EC_I2C_STATUS_...) */ |
| 2606 | uint8_t num_msgs; /* Number of messages processed */ | 2640 | uint8_t num_msgs; /* Number of messages processed */ |
| 2607 | uint8_t data[]; /* Data read by messages concatenated here */ | 2641 | uint8_t data[]; /* Data read by messages concatenated here */ |
| 2608 | } __packed; | 2642 | } __ec_align1; |
| 2609 | 2643 | ||
| 2610 | /*****************************************************************************/ | 2644 | /*****************************************************************************/ |
| 2611 | /* Power button hang detect */ | 2645 | /* Power button hang detect */ |
| @@ -2660,7 +2694,7 @@ struct ec_params_hang_detect { · 48 unmodified lines | |||
| 2660 | 2694 | ||
| 2661 | /* Timeout in msec before generating warm reboot, if enabled */ | 2695 | /* Timeout in msec before generating warm reboot, if enabled */ |
| 2662 | uint16_t warm_reboot_timeout_msec; | 2696 | uint16_t warm_reboot_timeout_msec; |
| 2663 | } __packed; | 2697 | } __ec_align4; |
| 2664 | 2698 | ||
| 2665 | /*****************************************************************************/ | 2699 | /*****************************************************************************/ |
| 2666 | /* Commands for battery charging */ | 2700 | /* Commands for battery charging */ |
| @@ -2706,20 +2740,20 @@ struct ec_params_charge_state { · 39 unmodified lines | |||
| 2706 | /* no args */ | 2740 | /* no args */ |
| 2707 | } get_state; | 2741 | } get_state; |
| 2708 | 2742 | ||
| 2709 | struct { | 2743 | struct __ec_todo_unpacked { |
| 2710 | uint32_t param; /* enum charge_state_param */ | 2744 | uint32_t param; /* enum charge_state_param */ |
| 2711 | } get_param; | 2745 | } get_param; |
| 2712 | 2746 | ||
| 2713 | struct { | 2747 | struct __ec_todo_unpacked { |
| 2714 | uint32_t param; /* param to set */ | 2748 | uint32_t param; /* param to set */ |
| 2715 | uint32_t value; /* value to set */ | 2749 | uint32_t value; /* value to set */ |
| 2716 | } set_param; | 2750 | } set_param; |
| 2717 | }; | 2751 | }; |
| 2718 | } __packed; | 2752 | } __ec_todo_packed; |
| 2719 | 2753 | ||
| 2720 | struct ec_response_charge_state { | 2754 | struct ec_response_charge_state { |
| 2721 | union { | 2755 | union { |
| 2722 | struct { | 2756 | struct __ec_align4 { |
| 2723 | int ac; | 2757 | int ac; |
| 2724 | int chg_voltage; | 2758 | int chg_voltage; |
| 2725 | int chg_current; | 2759 | int chg_current; |
| @@ -2727,14 +2761,14 @@ struct ec_response_charge_state { · 1 unmodified line | |||
| 2727 | int batt_state_of_charge; | 2761 | int batt_state_of_charge; |
| 2728 | } get_state; | 2762 | } get_state; |
| 2729 | 2763 | ||
| 2730 | struct { | 2764 | struct __ec_align4 { |
| 2731 | uint32_t value; | 2765 | uint32_t value; |
| 2732 | } get_param; | 2766 | } get_param; |
| 2733 | struct { | 2767 | struct { |
| 2734 | /* no return values */ | 2768 | /* no return values */ |
| 2735 | } set_param; | 2769 | } set_param; |
| 2736 | }; | 2770 | }; |
| 2737 | } __packed; | 2771 | } __ec_align4; |
| 2738 | 2772 | ||
| 2739 | 2773 | ||
| 2740 | /* | 2774 | /* |
| @@ -2744,7 +2778,7 @@ struct ec_response_charge_state { · 3 unmodified lines | |||
| 2744 | 2778 | ||
| 2745 | struct ec_params_current_limit { | 2779 | struct ec_params_current_limit { |
| 2746 | uint32_t limit; /* in mA */ | 2780 | uint32_t limit; /* in mA */ |
| 2747 | } __packed; | 2781 | } __ec_align4; |
| 2748 | 2782 | ||
| 2749 | /* | 2783 | /* |
| 2750 | * Set maximum external voltage / current. | 2784 | * Set maximum external voltage / current. |
| @@ -2755,7 +2789,7 @@ struct ec_params_current_limit { · 4 unmodified lines | |||
| 2755 | struct ec_params_external_power_limit_v1 { | 2789 | struct ec_params_external_power_limit_v1 { |
| 2756 | uint16_t current_lim; /* in mA, or EC_POWER_LIMIT_NONE to clear limit */ | 2790 | uint16_t current_lim; /* in mA, or EC_POWER_LIMIT_NONE to clear limit */ |
| 2757 | uint16_t voltage_lim; /* in mV, or EC_POWER_LIMIT_NONE to clear limit */ | 2791 | uint16_t voltage_lim; /* in mV, or EC_POWER_LIMIT_NONE to clear limit */ |
| 2758 | } __packed; | 2792 | } __ec_align2; |
| 2759 | 2793 | ||
| 2760 | #define EC_POWER_LIMIT_NONE 0xffff | 2794 | #define EC_POWER_LIMIT_NONE 0xffff |
| 2761 | 2795 | ||
| @@ -2771,7 +2805,7 @@ enum host_sleep_event { · 9 unmodified lines | |||
| 2771 | 2805 | ||
| 2772 | struct ec_params_host_sleep_event { | 2806 | struct ec_params_host_sleep_event { |
| 2773 | uint8_t sleep_event; | 2807 | uint8_t sleep_event; |
| 2774 | } __packed; | 2808 | } __ec_align1; |
| 2775 | 2809 | ||
| 2776 | /* | 2810 | /* |
| 2777 | * Use a default timeout value (CONFIG_SLEEP_TIMEOUT_MS) for detecting sleep | 2811 | * Use a default timeout value (CONFIG_SLEEP_TIMEOUT_MS) for detecting sleep |
| @@ -2802,7 +2836,7 @@ struct ec_params_host_sleep_event_v1 { · 24 unmodified lines | |||
| 2802 | 2836 | ||
| 2803 | /* No parameters for non-suspend messages. */ | 2837 | /* No parameters for non-suspend messages. */ |
| 2804 | }; | 2838 | }; |
| 2805 | } __packed; | 2839 | } __ec_align2; |
| 2806 | 2840 | ||
| 2807 | /* A timeout occurred when this bit is set */ | 2841 | /* A timeout occurred when this bit is set */ |
| 2808 | #define EC_HOST_RESUME_SLEEP_TIMEOUT 0x80000000 | 2842 | #define EC_HOST_RESUME_SLEEP_TIMEOUT 0x80000000 |
| @@ -2828,7 +2862,7 @@ struct ec_response_host_sleep_event_v1 { · 19 unmodified lines | |||
| 2828 | 2862 | ||
| 2829 | /* No response fields for non-resume messages. */ | 2863 | /* No response fields for non-resume messages. */ |
| 2830 | }; | 2864 | }; |
| 2831 | } __packed; | 2865 | } __ec_align4; |
| 2832 | 2866 | ||
| 2833 | /*****************************************************************************/ | 2867 | /*****************************************************************************/ |
| 2834 | /* Smart battery pass-through */ | 2868 | /* Smart battery pass-through */ |
| @@ -2845,25 +2879,25 @@ struct ec_response_host_sleep_event_v1 { · 10 unmodified lines | |||
| 2845 | 2879 | ||
| 2846 | struct ec_params_sb_rd { | 2880 | struct ec_params_sb_rd { |
| 2847 | uint8_t reg; | 2881 | uint8_t reg; |
| 2848 | } __packed; | 2882 | } __ec_align1; |
| 2849 | 2883 | ||
| 2850 | struct ec_response_sb_rd_word { | 2884 | struct ec_response_sb_rd_word { |
| 2851 | uint16_t value; | 2885 | uint16_t value; |
| 2852 | } __packed; | 2886 | } __ec_align2; |
| 2853 | 2887 | ||
| 2854 | struct ec_params_sb_wr_word { | 2888 | struct ec_params_sb_wr_word { |
| 2855 | uint8_t reg; | 2889 | uint8_t reg; |
| 2856 | uint16_t value; | 2890 | uint16_t value; |
| 2857 | } __packed; | 2891 | } __ec_align1; |
| 2858 | 2892 | ||
| 2859 | struct ec_response_sb_rd_block { | 2893 | struct ec_response_sb_rd_block { |
| 2860 | uint8_t data[32]; | 2894 | uint8_t data[32]; |
| 2861 | } __packed; | 2895 | } __ec_align1; |
| 2862 | 2896 | ||
| 2863 | struct ec_params_sb_wr_block { | 2897 | struct ec_params_sb_wr_block { |
| 2864 | uint8_t reg; | 2898 | uint8_t reg; |
| 2865 | uint16_t data[32]; | 2899 | uint16_t data[32]; |
| 2866 | } __packed; | 2900 | } __ec_align1; |
| 2867 | 2901 | ||
| 2868 | /*****************************************************************************/ | 2902 | /*****************************************************************************/ |
| 2869 | /* Battery vendor parameters | 2903 | /* Battery vendor parameters |
| @@ -2885,11 +2919,11 @@ struct ec_params_battery_vendor_param { · 15 unmodified lines | |||
| 2885 | uint32_t param; | 2919 | uint32_t param; |
| 2886 | uint32_t value; | 2920 | uint32_t value; |
| 2887 | uint8_t mode; | 2921 | uint8_t mode; |
| 2888 | } __packed; | 2922 | } __ec_align_size1; |
| 2889 | 2923 | ||
| 2890 | struct ec_response_battery_vendor_param { | 2924 | struct ec_response_battery_vendor_param { |
| 2891 | uint32_t value; | 2925 | uint32_t value; |
| 2892 | } __packed; | 2926 | } __ec_align4; |
| 2893 | 2927 | ||
| 2894 | /*****************************************************************************/ | 2928 | /*****************************************************************************/ |
| 2895 | /* Commands for I2S recording on audio codec. */ | 2929 | /* Commands for I2S recording on audio codec. */ |
| @@ -2920,7 +2954,7 @@ enum ec_i2s_config { · 24 unmodified lines | |||
| 2920 | EC_DAI_FMT_PCM_TDM = 5, | 2954 | EC_DAI_FMT_PCM_TDM = 5, |
| 2921 | }; | 2955 | }; |
| 2922 | 2956 | ||
| 2923 | struct ec_param_codec_i2s { | 2957 | struct __ec_todo_packed ec_param_codec_i2s { |
| 2924 | /* enum ec_codec_i2s_subcmd */ | 2958 | /* enum ec_codec_i2s_subcmd */ |
| 2925 | uint8_t cmd; | 2959 | uint8_t cmd; |
| 2926 | union { | 2960 | union { |
| @@ -2934,10 +2968,10 @@ struct ec_param_codec_i2s { · 7 unmodified lines | |||
| 2934 | * EC_CODEC_SET_GAIN | 2968 | * EC_CODEC_SET_GAIN |
| 2935 | * Value should be 0~43 for both channels. | 2969 | * Value should be 0~43 for both channels. |
| 2936 | */ | 2970 | */ |
| 2937 | struct ec_param_codec_i2s_set_gain { | 2971 | struct __ec_align1 ec_param_codec_i2s_set_gain { |
| 2938 | uint8_t left; | 2972 | uint8_t left; |
| 2939 | uint8_t right; | 2973 | uint8_t right; |
| 2940 | } __packed gain; | 2974 | } gain; |
| 2941 | 2975 | ||
| 2942 | /* | 2976 | /* |
| 2943 | * EC_CODEC_I2S_ENABLE | 2977 | * EC_CODEC_I2S_ENABLE |
| @@ -2955,7 +2989,7 @@ struct ec_param_codec_i2s { · 11 unmodified lines | |||
| 2955 | * EC_CODEC_I2S_SET_TDM_CONFIG | 2989 | * EC_CODEC_I2S_SET_TDM_CONFIG |
| 2956 | * Value should be one of ec_i2s_config. | 2990 | * Value should be one of ec_i2s_config. |
| 2957 | */ | 2991 | */ |
| 2958 | struct ec_param_codec_i2s_tdm { | 2992 | struct __ec_todo_unpacked ec_param_codec_i2s_tdm { |
| 2959 | /* | 2993 | /* |
| 2960 | * 0 to 496 | 2994 | * 0 to 496 |
| 2961 | */ | 2995 | */ |
| @@ -2966,14 +3000,14 @@ struct ec_param_codec_i2s { · 4 unmodified lines | |||
| 2966 | int16_t ch1_delay; | 3000 | int16_t ch1_delay; |
| 2967 | uint8_t adjacent_to_ch0; | 3001 | uint8_t adjacent_to_ch0; |
| 2968 | uint8_t adjacent_to_ch1; | 3002 | uint8_t adjacent_to_ch1; |
| 2969 | } __packed tdm_param; | 3003 | } tdm_param; |
| 2970 | 3004 | ||
| 2971 | /* | 3005 | /* |
| 2972 | * EC_CODEC_I2S_SET_BCLK | 3006 | * EC_CODEC_I2S_SET_BCLK |
| 2973 | */ | 3007 | */ |
| 2974 | uint32_t bclk; | 3008 | uint32_t bclk; |
| 2975 | }; | 3009 | }; |
| 2976 | } __packed; | 3010 | }; |
| 2977 | 3011 | ||
| 2978 | /* | 3012 | /* |
| 2979 | * For subcommand EC_CODEC_GET_GAIN. | 3013 | * For subcommand EC_CODEC_GET_GAIN. |
| @@ -2981,7 +3015,7 @@ struct ec_param_codec_i2s { · 1 unmodified line | |||
| 2981 | struct ec_response_codec_gain { | 3015 | struct ec_response_codec_gain { |
| 2982 | uint8_t left; | 3016 | uint8_t left; |
| 2983 | uint8_t right; | 3017 | uint8_t right; |
| 2984 | } __packed; | 3018 | } __ec_align1; |
| 2985 | 3019 | ||
| 2986 | /*****************************************************************************/ | 3020 | /*****************************************************************************/ |
| 2987 | /* System commands */ | 3021 | /* System commands */ |
| @@ -3010,7 +3044,7 @@ enum ec_reboot_cmd { · 22 unmodified lines | |||
| 3010 | struct ec_params_reboot_ec { | 3044 | struct ec_params_reboot_ec { |
| 3011 | uint8_t cmd; /* enum ec_reboot_cmd */ | 3045 | uint8_t cmd; /* enum ec_reboot_cmd */ |
| 3012 | uint8_t flags; /* See EC_REBOOT_FLAG_* */ | 3046 | uint8_t flags; /* See EC_REBOOT_FLAG_* */ |
| 3013 | } __packed; | 3047 | } __ec_align1; |
| 3014 | 3048 | ||
| 3015 | /* | 3049 | /* |
| 3016 | * Get information on last EC panic. | 3050 | * Get information on last EC panic. |
| @@ -3153,7 +3187,7 @@ struct ec_params_reboot_ec { · 136 unmodified lines | |||
| 3153 | */ | 3187 | */ |
| 3154 | struct ec_params_cec_write { | 3188 | struct ec_params_cec_write { |
| 3155 | uint8_t msg[EC_MAX_CEC_MSG_LEN]; | 3189 | uint8_t msg[EC_MAX_CEC_MSG_LEN]; |
| 3156 | } __packed; | 3190 | } __ec_align1; |
| 3157 | 3191 | ||
| 3158 | /* Set various CEC parameters */ | 3192 | /* Set various CEC parameters */ |
| 3159 | #define EC_CMD_CEC_SET 0x00BA | 3193 | #define EC_CMD_CEC_SET 0x00BA |
| @@ -3169,7 +3203,7 @@ struct ec_params_cec_write { · 9 unmodified lines | |||
| 3169 | struct ec_params_cec_set { | 3203 | struct ec_params_cec_set { |
| 3170 | uint8_t cmd; /* enum cec_command */ | 3204 | uint8_t cmd; /* enum cec_command */ |
| 3171 | uint8_t val; | 3205 | uint8_t val; |
| 3172 | } __packed; | 3206 | } __ec_align1; |
| 3173 | 3207 | ||
| 3174 | /* Read various CEC parameters */ | 3208 | /* Read various CEC parameters */ |
| 3175 | #define EC_CMD_CEC_GET 0x00BB | 3209 | #define EC_CMD_CEC_GET 0x00BB |
| @@ -3180,7 +3214,7 @@ struct ec_params_cec_set { · 4 unmodified lines | |||
| 3180 | */ | 3214 | */ |
| 3181 | struct ec_params_cec_get { | 3215 | struct ec_params_cec_get { |
| 3182 | uint8_t cmd; /* enum cec_command */ | 3216 | uint8_t cmd; /* enum cec_command */ |
| 3183 | } __packed; | 3217 | } __ec_align1; |
| 3184 | 3218 | ||
| 3185 | /** | 3219 | /** |
| 3186 | * struct ec_response_cec_get - CEC parameters get response | 3220 | * struct ec_response_cec_get - CEC parameters get response |
| @@ -3191,7 +3225,7 @@ struct ec_params_cec_get { · 4 unmodified lines | |||
| 3191 | */ | 3225 | */ |
| 3192 | struct ec_response_cec_get { | 3226 | struct ec_response_cec_get { |
| 3193 | uint8_t val; | 3227 | uint8_t val; |
| 3194 | } __packed; | 3228 | } __ec_align1; |
| 3195 | 3229 | ||
| 3196 | /* CEC parameters command */ | 3230 | /* CEC parameters command */ |
| 3197 | enum ec_cec_command { | 3231 | enum ec_cec_command { |
| @@ -3264,13 +3298,13 @@ enum mkbp_cec_event { · 66 unmodified lines | |||
| 3264 | /* Status of EC being sent to PD */ | 3298 | /* Status of EC being sent to PD */ |
| 3265 | struct ec_params_pd_status { | 3299 | struct ec_params_pd_status { |
| 3266 | int8_t batt_soc; /* battery state of charge */ | 3300 | int8_t batt_soc; /* battery state of charge */ |
| 3267 | } __packed; | 3301 | } __ec_align1; |
| 3268 | 3302 | ||
| 3269 | /* Status of PD being sent back to EC */ | 3303 | /* Status of PD being sent back to EC */ |
| 3270 | struct ec_response_pd_status { | 3304 | struct ec_response_pd_status { |
| 3271 | int8_t status; /* PD MCU status */ | 3305 | int8_t status; /* PD MCU status */ |
| 3272 | uint32_t curr_lim_ma; /* input current limit */ | 3306 | uint32_t curr_lim_ma; /* input current limit */ |
| 3273 | } __packed; | 3307 | } __ec_align_size1; |
| 3274 | 3308 | ||
| 3275 | /* Set USB type-C port role and muxes */ | 3309 | /* Set USB type-C port role and muxes */ |
| 3276 | #define EC_CMD_USB_PD_CONTROL 0x101 | 3310 | #define EC_CMD_USB_PD_CONTROL 0x101 |
| @@ -3305,7 +3339,7 @@ struct ec_params_usb_pd_control { · 28 unmodified lines | |||
| 3305 | uint8_t role; | 3339 | uint8_t role; |
| 3306 | uint8_t mux; | 3340 | uint8_t mux; |
| 3307 | uint8_t swap; | 3341 | uint8_t swap; |
| 3308 | } __packed; | 3342 | } __ec_align1; |
| 3309 | 3343 | ||
| 3310 | #define PD_CTRL_RESP_ENABLED_COMMS (1 << 0) /* Communication enabled */ | 3344 | #define PD_CTRL_RESP_ENABLED_COMMS (1 << 0) /* Communication enabled */ |
| 3311 | #define PD_CTRL_RESP_ENABLED_CONNECTED (1 << 1) /* Device connected */ | 3345 | #define PD_CTRL_RESP_ENABLED_CONNECTED (1 << 1) /* Device connected */ |
| @@ -3324,7 +3358,7 @@ struct ec_response_usb_pd_control_v1 { · 12 unmodified lines | |||
| 3324 | uint8_t role; | 3358 | uint8_t role; |
| 3325 | uint8_t polarity; | 3359 | uint8_t polarity; |
| 3326 | char state[32]; | 3360 | char state[32]; |
| 3327 | } __packed; | 3361 | } __ec_align1; |
| 3328 | 3362 | ||
| 3329 | #define EC_CMD_USB_PD_PORTS 0x102 | 3363 | #define EC_CMD_USB_PD_PORTS 0x102 |
| 3330 | 3364 | ||
| @@ -3333,14 +3367,14 @@ struct ec_response_usb_pd_control_v1 { · 2 unmodified lines | |||
| 3333 | 3367 | ||
| 3334 | struct ec_response_usb_pd_ports { | 3368 | struct ec_response_usb_pd_ports { |
| 3335 | uint8_t num_ports; | 3369 | uint8_t num_ports; |
| 3336 | } __packed; | 3370 | } __ec_align1; |
| 3337 | 3371 | ||
| 3338 | #define EC_CMD_USB_PD_POWER_INFO 0x103 | 3372 | #define EC_CMD_USB_PD_POWER_INFO 0x103 |
| 3339 | 3373 | ||
| 3340 | #define PD_POWER_CHARGING_PORT 0xff | 3374 | #define PD_POWER_CHARGING_PORT 0xff |
| 3341 | struct ec_params_usb_pd_power_info { | 3375 | struct ec_params_usb_pd_power_info { |
| 3342 | uint8_t port; | 3376 | uint8_t port; |
| 3343 | } __packed; | 3377 | } __ec_align1; |
| 3344 | 3378 | ||
| 3345 | enum usb_chg_type { | 3379 | enum usb_chg_type { |
| 3346 | USB_CHG_TYPE_NONE, | 3380 | USB_CHG_TYPE_NONE, |
| @@ -3366,7 +3400,7 @@ struct usb_chg_measures { · 19 unmodified lines | |||
| 3366 | uint16_t voltage_now; | 3400 | uint16_t voltage_now; |
| 3367 | uint16_t current_max; | 3401 | uint16_t current_max; |
| 3368 | uint16_t current_lim; | 3402 | uint16_t current_lim; |
| 3369 | } __packed; | 3403 | } __ec_align2; |
| 3370 | 3404 | ||
| 3371 | struct ec_response_usb_pd_power_info { | 3405 | struct ec_response_usb_pd_power_info { |
| 3372 | uint8_t role; | 3406 | uint8_t role; |
| @@ -3375,11 +3409,11 @@ struct ec_response_usb_pd_power_info { · 2 unmodified lines | |||
| 3375 | uint8_t reserved1; | 3409 | uint8_t reserved1; |
| 3376 | struct usb_chg_measures meas; | 3410 | struct usb_chg_measures meas; |
| 3377 | uint32_t max_power; | 3411 | uint32_t max_power; |
| 3378 | } __packed; | 3412 | } __ec_align4; |
| 3379 | 3413 | ||
| 3380 | struct ec_params_usb_pd_info_request { | 3414 | struct ec_params_usb_pd_info_request { |
| 3381 | uint8_t port; | 3415 | uint8_t port; |
| 3382 | } __packed; | 3416 | } __ec_align1; |
| 3383 | 3417 | ||
| 3384 | /* | 3418 | /* |
| 3385 | * This command will return the number of USB PD charge port + the number | 3419 | * This command will return the number of USB PD charge port + the number |
| @@ -3389,7 +3423,7 @@ struct ec_params_usb_pd_info_request { · 3 unmodified lines | |||
| 3389 | #define EC_CMD_CHARGE_PORT_COUNT 0x0105 | 3423 | #define EC_CMD_CHARGE_PORT_COUNT 0x0105 |
| 3390 | struct ec_response_charge_port_count { | 3424 | struct ec_response_charge_port_count { |
| 3391 | uint8_t port_count; | 3425 | uint8_t port_count; |
| 3392 | } __packed; | 3426 | } __ec_align1; |
| 3393 | 3427 | ||
| 3394 | /* Read USB-PD Device discovery info */ | 3428 | /* Read USB-PD Device discovery info */ |
| 3395 | #define EC_CMD_USB_PD_DISCOVERY 0x0113 | 3429 | #define EC_CMD_USB_PD_DISCOVERY 0x0113 |
| @@ -3397,7 +3431,7 @@ struct ec_params_usb_pd_discovery_entry { · 1 unmodified line | |||
| 3397 | uint16_t vid; /* USB-IF VID */ | 3431 | uint16_t vid; /* USB-IF VID */ |
| 3398 | uint16_t pid; /* USB-IF PID */ | 3432 | uint16_t pid; /* USB-IF PID */ |
| 3399 | uint8_t ptype; /* product type (hub,periph,cable,ama) */ | 3433 | uint8_t ptype; /* product type (hub,periph,cable,ama) */ |
| 3400 | } __packed; | 3434 | } __ec_align_size1; |
| 3401 | 3435 | ||
| 3402 | /* Override default charge behavior */ | 3436 | /* Override default charge behavior */ |
| 3403 | #define EC_CMD_PD_CHARGE_PORT_OVERRIDE 0x0114 | 3437 | #define EC_CMD_PD_CHARGE_PORT_OVERRIDE 0x0114 |
| @@ -3411,7 +3445,7 @@ enum usb_pd_override_ports { · 7 unmodified lines | |||
| 3411 | 3445 | ||
| 3412 | struct ec_params_charge_port_override { | 3446 | struct ec_params_charge_port_override { |
| 3413 | int16_t override_port; /* Override port# */ | 3447 | int16_t override_port; /* Override port# */ |
| 3414 | } __packed; | 3448 | } __ec_align2; |
| 3415 | 3449 | ||
| 3416 | /* Read (and delete) one entry of PD event log */ | 3450 | /* Read (and delete) one entry of PD event log */ |
| 3417 | #define EC_CMD_PD_GET_LOG_ENTRY 0x0115 | 3451 | #define EC_CMD_PD_GET_LOG_ENTRY 0x0115 |
| @@ -3422,7 +3456,7 @@ struct ec_response_pd_log { · 4 unmodified lines | |||
| 3422 | uint8_t size_port; /* [7:5] port number [4:0] payload size in bytes */ | 3456 | uint8_t size_port; /* [7:5] port number [4:0] payload size in bytes */ |
| 3423 | uint16_t data; /* type-defined data payload */ | 3457 | uint16_t data; /* type-defined data payload */ |
| 3424 | uint8_t payload[0]; /* optional additional data payload: 0..16 bytes */ | 3458 | uint8_t payload[0]; /* optional additional data payload: 0..16 bytes */ |
| 3425 | } __packed; | 3459 | } __ec_align4; |
| 3426 | 3460 | ||
| 3427 | /* The timestamp is the microsecond counter shifted to get about a ms. */ | 3461 | /* The timestamp is the microsecond counter shifted to get about a ms. */ |
| 3428 | #define PD_LOG_TIMESTAMP_SHIFT 10 /* 1 LSB = 1024us */ | 3462 | #define PD_LOG_TIMESTAMP_SHIFT 10 /* 1 LSB = 1024us */ |
| @@ -3488,14 +3522,14 @@ struct mcdp_version { · 59 unmodified lines | |||
| 3488 | uint8_t major; | 3522 | uint8_t major; |
| 3489 | uint8_t minor; | 3523 | uint8_t minor; |
| 3490 | uint16_t build; | 3524 | uint16_t build; |
| 3491 | } __packed; | 3525 | } __ec_align4; |
| 3492 | 3526 | ||
| 3493 | struct mcdp_info { | 3527 | struct mcdp_info { |
| 3494 | uint8_t family[2]; | 3528 | uint8_t family[2]; |
| 3495 | uint8_t chipid[2]; | 3529 | uint8_t chipid[2]; |
| 3496 | struct mcdp_version irom; | 3530 | struct mcdp_version irom; |
| 3497 | struct mcdp_version fw; | 3531 | struct mcdp_version fw; |
| 3498 | } __packed; | 3532 | } __ec_align4; |
| 3499 | 3533 | ||
| 3500 | /* struct mcdp_info field decoding */ | 3534 | /* struct mcdp_info field decoding */ |
| 3501 | #define MCDP_CHIPID(chipid) ((chipid[0] << 8) | chipid[1]) | 3535 | #define MCDP_CHIPID(chipid) ((chipid[0] << 8) | chipid[1]) |
| @@ -3506,7 +3540,7 @@ struct mcdp_info { · 4 unmodified lines | |||
| 3506 | 3540 | ||
| 3507 | struct ec_params_usb_pd_mux_info { | 3541 | struct ec_params_usb_pd_mux_info { |
| 3508 | uint8_t port; /* USB-C port number */ | 3542 | uint8_t port; /* USB-C port number */ |
| 3509 | } __packed; | 3543 | } __ec_align1; |
| 3510 | 3544 | ||
| 3511 | /* Flags representing mux state */ | 3545 | /* Flags representing mux state */ |
| 3512 | #define USB_PD_MUX_USB_ENABLED (1 << 0) | 3546 | #define USB_PD_MUX_USB_ENABLED (1 << 0) |
| @@ -3516,7 +3550,7 @@ struct ec_params_usb_pd_mux_info { · 3 unmodified lines | |||
| 3516 | 3550 | ||
| 3517 | struct ec_response_usb_pd_mux_info { | 3551 | struct ec_response_usb_pd_mux_info { |
| 3518 | uint8_t flags; /* USB_PD_MUX_*-encoded USB mux state */ | 3552 | uint8_t flags; /* USB_PD_MUX_*-encoded USB mux state */ |
| 3519 | } __packed; | 3553 | } __ec_align1; |
| 3520 | 3554 | ||
| 3521 | /*****************************************************************************/ | 3555 | /*****************************************************************************/ |
| 3522 | /* | 3556 | /* |