Lines Matching +full:stm32f4 +full:- +full:i2c

1 /* SPDX-License-Identifier: GPL-2.0-only */
7 * NOTE: This file is auto-generated from ChromeOS EC Open Source code from
52 * The actual block is 0x800-0x8ff, but some BIOSes think it's 0x880-0x8ff
73 #define EC_MEMMAP_TEMP_SENSOR 0x00 /* Temp sensors 0x00 - 0x0f */
74 #define EC_MEMMAP_FAN 0x10 /* Fan speeds 0x10 - 0x17 */
75 #define EC_MEMMAP_TEMP_SENSOR_B 0x18 /* More temp sensors 0x18 - 0x1f */
77 #define EC_MEMMAP_ID_VERSION 0x22 /* Version of data in 0x20 - 0x2f */
78 #define EC_MEMMAP_THERMAL_VERSION 0x23 /* Version of data in 0x00 - 0x1f */
79 #define EC_MEMMAP_BATTERY_VERSION 0x24 /* Version of data in 0x40 - 0x7f */
80 #define EC_MEMMAP_SWITCHES_VERSION 0x25 /* Version of data in 0x30 - 0x33 */
81 #define EC_MEMMAP_EVENTS_VERSION 0x26 /* Version of data in 0x34 - 0x3f */
83 /* Unused 0x28 - 0x2f */
85 /* Unused 0x31 - 0x33 */
91 #define EC_MEMMAP_BATT_FLAG 0x4c /* Battery State, see below (8-bit) */
92 #define EC_MEMMAP_BATT_COUNT 0x4d /* Battery Count (8-bit) */
93 #define EC_MEMMAP_BATT_INDEX 0x4e /* Current Battery Data Index (8-bit) */
105 /* Unused 0x84 - 0x8f */
108 #define EC_MEMMAP_ACC_DATA 0x92 /* Accelerometers data 0x92 - 0x9f */
110 /* 0x94 - 0x99: 1st Accelerometer */
111 /* 0x9a - 0x9f: 2nd Accelerometer */
112 #define EC_MEMMAP_GYRO_DATA 0xa0 /* Gyroscope data 0xa0 - 0xa5 */
113 /* Unused 0xa6 - 0xdf */
117 * limitations of the ACPI protocol. Do not place data in the range 0xe0 - 0xfe
143 * reporting a temperature range of 200K to 454K = -73C to 181C.
157 #define EC_TEMP_SENSOR_DEFAULT (296 - EC_TEMP_SENSOR_OFFSET)
210 * - Write EC_CMD_ACPI_READ to EC_LPC_ADDR_ACPI_CMD
211 * - Wait for EC_LPC_CMDR_PENDING bit to clear
212 * - Write address to EC_LPC_ADDR_ACPI_DATA
213 * - Wait for EC_LPC_CMDR_DATA bit to set
214 * - Read value from EC_LPC_ADDR_ACPI_DATA
225 * - Write EC_CMD_ACPI_WRITE to EC_LPC_ADDR_ACPI_CMD
226 * - Wait for EC_LPC_CMDR_PENDING bit to clear
227 * - Write address to EC_LPC_ADDR_ACPI_DATA
228 * - Wait for EC_LPC_CMDR_PENDING bit to clear
229 * - Write value to EC_LPC_ADDR_ACPI_DATA
237 * commands back-to-back. While in this mode, writes to mapped multi-byte
246 * multi-byte data.
253 * This clears the lowest-order bit in the currently pending host events, and
254 * sets the result code to the 1-based index of the bit (event 0x00000001 = 1,
264 * Test location; writing value here updates test compliment byte to (0xff -
271 /* Keyboard backlight brightness percent (0 - 100) */
273 /* DPTF Target Fan Duty (0-100, 0xff for auto/none) */
281 * as the memory-mapped sensors. The COMMIT register applies those settings.
306 * write 2 to [0x05] -- select temp sensor 2
307 * write 0x7b to [0x06] -- C_TO_K(50) - EC_TEMP_SENSOR_OFFSET
308 * write 0x2 to [0x07] -- enable threshold 0 with this value
309 * write 0x85 to [0x06] -- C_TO_K(60) - EC_TEMP_SENSOR_OFFSET
310 * write 0x3 to [0x07] -- enable threshold 1 with this value
313 * write 2 to [0x05] -- select temp sensor 2
314 * write 0x1 to [0x07] -- disable threshold 1
346 * interpreting ACPI bytecode, to "EC_FEATURES[0-7] is not supported". Since
374 * ACPI addresses 0x20 - 0xff map to EC_MEMMAP offset 0x00 - 0xdf. This data
375 * is read-only from the AP. Added in EC_ACPI_MEM_VERSION 2.
386 * is pre-processed to handle constants but the ASL compiler is unable to
394 * 32-bit aligned, as it should be for all buffers.
401 * the parent structure. This is particularly important if the sub-structure
405 * Also be very careful using __packed - particularly when nesting non-packed
412 * "__packed" - generates inefficient code; all sub-structs must also be packed
414 * "struct [^_]" - all structs should be annotated, except for structs that are
421 * byte-wise reads.
459 * Host command response codes (16-bit). Note that response codes should be
487 * Host event codes. Note these are 1-based, not 0-based, because ACPI query
550 /* EC desires to change state of host-controlled USB mux */
572 #define EC_HOST_EVENT_MASK(event_code) BIT_ULL((event_code) - 1)
575 * struct ec_lpc_host_args - Arguments at EC_LPC_ADDR_HOST_ARGS
594 * If EC gets a command and this flag is not set, this is an old-style command.
596 * unknown length. EC must respond with an old-style response (that is,
603 * If EC responds to a command and this flag is not set, this is an old-style
618 * 1. - - AP asserts chip select (CS#)
619 * 2. EC_SPI_OLD_READY - AP sends first byte(s) of request
620 * 3. - - EC starts handling CS# interrupt
621 * 4. EC_SPI_RECEIVING - AP sends remaining byte(s) of request
622 * 5. EC_SPI_PROCESSING - EC starts processing request; AP is clocking in
624 * 6. - - EC finishes processing and sets up response
625 * 7. EC_SPI_FRAME_START - AP reads frame byte
626 * 8. (response packet) - AP reads response packet
627 * 9. EC_SPI_PAST_END - Any additional bytes read by AP
628 * 10 - - AP deasserts chip select
629 * 11 - - EC processes CS# interrupt and sets up DMA for
687 * by the AP as part of a request packet, or (for old-style ECs) is processing
695 * Protocol version 2 for I2C and SPI send a request this way:
701 * N+3 8-bit checksum of bytes 0..N+2
708 * M+2 8-bit checksum of bytes 0..M+1
733 * 3+ structs are being used. Usage is bus-dependent.
740 * struct ec_host_request - Version 3 request from host.
763 * struct ec_host_response - Version 3 response from EC.
786 * bytes are followed by a CRC-8 of that data, using using x^8 + x^2 + x + 1
806 * 301) If --tries_left <= 0, return error.
842 * bits 0-3: struct_version: Structure version (=4)
844 * bits 5-6: seq_num: Sequence number
850 * bits 0-4: command_version: Command version
851 * bits 5-6: Reserved (set 0, ignore on read)
865 /* CRC-8 of above fields, using x^8 + x^2 + x + 1 polynomial */
872 * bits 0-3: struct_version: Structure version (=4)
874 * bits 5-6: seq_num: Sequence number
880 * bits 0-6: Reserved (set 0, ignore on read)
894 /* CRC-8 of above fields, using x^8 + x^2 + x + 1 polynomial */
913 * Each command is an 16-bit command value. Commands which take params or
917 * communication protocols (I2C, SPI) may add length or checksum headers, but
918 * those are implementation-dependent and not defined here.
920 * All commands MUST be #defined to be 4-digit UPPER CASE hex values
928 * Get protocol version, used to deal with non-backward compatible protocol
934 * struct ec_response_proto_version - Response to the proto version command.
948 * struct ec_params_hello - Parameters to the hello command.
956 * struct ec_response_hello - Response to the hello command.
973 * struct ec_response_get_version - Response to the get version command.
974 * @version_string_ro: Null-terminated RO firmware version string.
975 * @version_string_rw: Null-terminated RW firmware version string.
976 * @reserved: Unused bytes; was previously RW-B firmware version string.
990 * struct ec_params_read_test - Parameters for the read test command.
1000 * struct ec_response_read_test - Response to the read test command.
1010 * Response is null-terminated string.
1018 * struct ec_response_get_chip_info - Response to the get chip info command.
1019 * @vendor: Null-terminated string for chip vendor.
1020 * @name: Null-terminated string for chip name.
1021 * @revision: Null-terminated string for chip mask version.
1033 * struct ec_response_board_version - Response to the board version command.
1041 * Read memory-mapped data.
1043 * This is an alternate interface to memory-mapped data for bus protocols
1044 * which don't support direct-mapped memory - I2C, SPI, etc.
1051 * struct ec_params_read_memmap - Parameters for the read memory map command.
1064 * struct ec_params_get_cmd_versions - Parameters for the get command versions.
1072 * struct ec_params_get_cmd_versions_v1 - Parameters for the get command
1081 * struct ec_response_get_cmd_version - Response to the get command versions.
1090 * Check EC communications status (busy). This is needed on i2c/spi but not
1091 * on lpc since it has its own out-of-band busy indicator.
1104 * struct ec_response_get_comms_status - Response to the get comms status
1135 * struct ec_response_get_protocol_info - Response to the get protocol info.
1230 /* The EC can send i2c messages to downstream devices. */
1255 /* EC decides on USB-C SS mux state, muxes configured by host */
1269 /* EC supports 64-bit host events */
1290 #define EC_FEATURE_MASK_1(event_code) BIT(event_code - 32)
1315 * struct ec_response_flash_info - Response to the flash info command.
1349 * struct ec_response_flash_info_1 - Response to the flash info v1 command.
1360 * half-page operations if data is aligned, and a slower
1361 * word-at-a-time write mode.
1368 * if they did we'd define the version 0 structure as a sub-structure of this
1399 /* Size in power of 2 of each sector (8 --> 256 bytes) */
1433 * struct ec_params_flash_read - Parameters for the flash read command.
1450 * struct ec_params_flash_write - Parameters for the flash write command.
1464 * struct ec_params_flash_erase - Parameters for the flash erase command, v0.
1488 * permitted while erasing. (For instance, STM32F4).
1497 * struct ec_params_flash_erase_v1 - Parameters for the flash erase command, v1.
1527 * RO flash code protected now. If this bit is set, at-boot status cannot
1535 /* Error - at least one bank of flash is stuck locked, and cannot be unlocked */
1538 * Error - flash protection is in inconsistent state. At least one bank of
1540 * re-requesting the desired flags, or by a hard reset if that fails.
1556 * struct ec_params_flash_protect - Parameters for the flash protect command.
1566 * struct ec_response_flash_protect - Response to the flash protect command.
1581 * Note: commands 0x14 - 0x19 version 0 were old commands to get/set flash
1590 /* Region which holds read-only EC image */
1594 * 'running'. Active means 'scheduled-to-run'. Since RO image always
1595 * scheduled to run, active/non-active applies only to RW images (for
1603 * Region which should be write-protected in the factory (a superset of
1607 /* Region which holds updatable (non-active) RW image */
1619 * struct ec_params_flash_region_info - Parameters for the flash region info
1674 * struct ec_params_flash_select - Parameters for the flash select command.
1707 /* OBSOLETE - Use EC_CMD_PWM_SET_DUTY */
1716 /* OBSOLETE - Use EC_CMD_PWM_SET_DUTY */
1742 /* All types, indexed by board-specific enum pwm_channel */
1754 uint8_t index; /* Type-specific index, or 0 if unique */
1761 uint8_t index; /* Type-specific index, or 0 if unique */
1811 uint8_t battery_threshold[LB_BATTERY_LEVELS - 1];
1818 struct rgb_s color[8]; /* 0-3 are Google colors */
1838 /* Tap-for-battery params */
1857 uint8_t battery_threshold[LB_BATTERY_LEVELS - 1];
1863 /* s5: single color pulse on inhibited power-up */
1867 struct rgb_s color[8]; /* 0-3 are Google colors */
1873 * lightbar_parms_v1 was too big for i2c, therefore in v2, we split them up by
1898 /* Tap-for-battery params */
1923 uint8_t battery_threshold[LB_BATTERY_LEVELS - 1];
1931 /* s5: single color pulse on inhibited power-up */
1935 struct rgb_s color[8]; /* 0-3 are Google colors */
2089 * May be on power button or on C-panel.
2178 EC_VBOOT_HASH_TYPE_SHA256 = 0, /* SHA-256 */
2204 * Motion sense commands. We'll make separate structs for sub-commands with
2244 * a specified motion sensor in +/-G's or +/- deg/s.
2253 * un-calibrated value, hence the wake angle isn't exact.
2331 /* Number of motionsense sub-commands. */
2395 /* Each sensor is up to 3-axis. */
2447 /* Module flag masks used for the dump sub-command. */
2450 /* Sensor flag masks used for the dump sub-command. */
2468 #define EC_MOTION_SENSE_NO_VALUE -1
2534 /* Rounding flag, true for round-up, false for down. */
2655 * lid_angle - hys_degree to trigger clamshell mode.
2853 /* Real-time clock */
2974 /* Version 0 - set */
2981 /* Version 0 - get */
3020 * Note that this structure is a sub-structure of
3030 /* Version 1 - get config for one sensor. */
3037 * Version 1 - set config for one sensor.
3038 * Use read-modify-write for best results!
3121 /* MKBP - Matrix KeyBoard Protocol */
3233 * Note that this is used as a sub-structure of
3244 * minimum post-scan relax time. Once we finish a scan we check
3338 #define EC_MKBP_EVENT_TYPE_MASK (BIT(EC_MKBP_HAS_MORE_EVENTS_SHIFT) - 1)
3350 /* The state of the non-matrixed buttons have changed. */
3366 * New 64-bit host event.
3518 * Note: host commands 0x80 - 0x87 are reserved to avoid conflict with ACPI
3554 * Unified host event programming interface - Should be used by newer versions
3560 /* Action requested by host - one of enum ec_host_event_action. */
3564 * Mask type that the host requested the action on - one of
3661 * Flags to leave enabled in S3, if they're on at the S0->S3
3662 * transition. (Other flags will be disabled by the S0->S3
3736 /* I2C commands. Only available when flash write protect is unlocked. */
3745 /* Read I2C bus */
3749 uint16_t addr; /* 8-bit address (7-bit shifted << 1) */
3759 /* Write I2C bus */
3764 uint16_t addr; /* 8-bit address (7-bit shifted << 1) */
3803 * Response is null-terminated string. Empty string, if there is no more
3894 /* I2C passthru command */
3911 uint16_t addr_flags; /* I2C slave address (7 or 10 bits) and flags */
3916 uint8_t port; /* I2C port number */
3943 /* Start of AP S3->S0 transition (booting or resuming from suspend) */
3954 /* Stop on end of AP S0->S3 transition (suspending or shutting down) */
3987 * This is the single catch-all host command to exchange data regarding the
4001 * Known param numbers are defined here. Ranges are reserved for board-specific
4008 CS_PARAM_CHG_STATUS, /* charger-specific status */
4009 CS_PARAM_CHG_OPTION, /* charger-specific options */
4180 /* No parameters for non-suspend messages. */
4206 /* No response fields for non-resume messages. */
4241 /* Smart battery pass-through */
4243 /* Get / Set 16-bit smart battery registers */
4278 * Get or set vendor-specific parameters in the battery. Implementations may
4376 * I2C passthru protection command: Protects I2C tunnels against access on
4377 * certain addresses (board-specific).
4388 uint8_t port; /* I2C port number */
4409 * struct ec_params_cec_write - Message to write to the CEC bus
4420 * struct ec_params_cec_set - CEC parameters set
4436 * struct ec_params_cec_get - CEC parameters get
4444 * struct ec_response_cec_get - CEC parameters get response
4727 /* (command 3 was jump to RW-B) */
4728 EC_REBOOT_COLD = 4, /* Cold-reboot */
4747 * Returns variable-length platform-dependent panic information. See panic.h
4774 * Returns EC_RES_UNAVAILABLE if there is no response available - for example,
4848 /* Set USB type-C port role and muxes */
4922 /* Optical/Non-optical cable */
4926 /* Active Link Uni-Direction */
4935 uint8_t dp_mode; /* Current DP pin mode (MODE_DP_PIN_[A-E]) */
5005 /* Write USB-PD device FW */
5023 /* Write USB-PD Accessory RW_HASH table entry */
5025 /* RW hash is first 20 bytes of SHA-256 of RW section */
5038 /* Read USB-PD Accessory info */
5045 /* Read USB-PD Device discovery info */
5048 uint16_t vid; /* USB-IF VID */
5049 uint16_t pid; /* USB-IF PID */
5058 OVERRIDE_DONT_CHARGE = -2,
5059 OVERRIDE_OFF = -1,
5070 * future non-PD logs that use the same internal EC event_log.
5078 uint16_t data; /* type-defined data payload */
5159 /* Get/Set USB-PD Alternate mode info */
5197 /* Control USB-PD chip */
5213 /* Get info about USB-C SS muxes */
5217 uint8_t port; /* USB-C port number */
5232 uint8_t flags; /* USB_PD_MUX_*-encoded USB mux state */
5238 uint8_t port; /* USB-C port number */
5300 * hardware write-protect enabled.
5532 /* The command range 0x200-0x2FF is reserved for Rotor. */
5542 /* Fingerprint MCU commands: range 0x0400-0x040x */
5566 /* Finger enrollment session on-going */
5572 /* Reset and re-initialize the sensor. */
5595 /* Full blown vendor-defined capture (produces 'frame_size' bytes) */
5782 /* Touchpad MCU commands: range 0x0500-0x05FF */
5808 /* EC-EC communication commands: range 0x0600-0x06FF */
5819 * struct ec_params_battery_static_info - Battery static info parameters
5827 * struct ec_response_battery_static_info - Battery static info response
5854 * struct ec_params_battery_dynamic_info - Battery dynamic info parameters
5862 * struct ec_response_battery_dynamic_info - Battery dynamic info response
5887 * struct ec_params_charger_control - Charger control parameters
5904 * Reserve a range of host commands for board-specific, experimental, or
5910 * All commands MUST be #defined to be 4-digit UPPER CASE hex values
5942 * Some platforms have sub-processors chained to each other. For example.
5944 * AP <--> EC <--> PD MCU
5948 * command; other device mapping is board-specific.
5950 * When a device receives a command to be passed to a sub-processor, it passes
5951 * it on with the device number set back to 0. This allows the sub-processor
5961 /* Offset and max command number for sub-device n */