Lines Matching +full:wake +full:- +full:on +full:- +full:motion

2  * Use of this source code is governed by a BSD-style license that can be
18 * - CMD is the command code. (defined by EC_CMD_ constants)
19 * - ERR is the error code. (defined by EC_RES_ constants)
20 * - Px is the optional payload.
23 * - S is the checksum which is the sum of all payload bytes.
25 * On LPC, CMD and ERR are sent/received at EC_LPC_ADDR_KERNEL|USER_CMD
27 * On I2C, all bytes are sent serially in the same message.
35 * depends on it.
59 /* The actual block is 0x800-0x8ff, but some BIOSes think it's 0x880-0x8ff
79 #define EC_MEMMAP_TEMP_SENSOR 0x00 /* Temp sensors 0x00 - 0x0f */
80 #define EC_MEMMAP_FAN 0x10 /* Fan speeds 0x10 - 0x17 */
81 #define EC_MEMMAP_TEMP_SENSOR_B 0x18 /* More temp sensors 0x18 - 0x1f */
83 #define EC_MEMMAP_ID_VERSION 0x22 /* Version of data in 0x20 - 0x2f */
84 #define EC_MEMMAP_THERMAL_VERSION 0x23 /* Version of data in 0x00 - 0x1f */
85 #define EC_MEMMAP_BATTERY_VERSION 0x24 /* Version of data in 0x40 - 0x7f */
86 #define EC_MEMMAP_SWITCHES_VERSION 0x25 /* Version of data in 0x30 - 0x33 */
87 #define EC_MEMMAP_EVENTS_VERSION 0x26 /* Version of data in 0x34 - 0x3f */
89 /* Unused 0x28 - 0x2f */
91 /* Unused 0x31 - 0x33 */
93 /* Reserve 0x38 - 0x3f for additional host event-related stuff */
109 /* Unused 0x84 - 0x8f */
112 #define EC_MEMMAP_ACC_DATA 0x92 /* Accelerometers data 0x92 - 0x9f */
114 /* 0x94 - 0x99: 1st Accelerometer */
115 /* 0x9a - 0x9f: 2nd Accelerometer */
116 #define EC_MEMMAP_GYRO_DATA 0xa0 /* Gyroscope data 0xa0 - 0xa5 */
117 /* Unused 0xa6 - 0xdf */
121 * limitations of the ACPI protocol. Do not place data in the range 0xe0 - 0xfe
147 * reporting a temperature range of 200K to 454K = -73C to 181C.
159 * triggering alarms on the host.
161 #define EC_TEMP_SENSOR_DEFAULT (296 - EC_TEMP_SENSOR_OFFSET)
202 * These are valid ONLY on the ACPI command/data port.
208 * This reads from ACPI memory space on the EC (EC_ACPI_MEM_*).
212 * - Write EC_CMD_ACPI_READ to EC_LPC_ADDR_ACPI_CMD
213 * - Wait for EC_LPC_CMDR_PENDING bit to clear
214 * - Write address to EC_LPC_ADDR_ACPI_DATA
215 * - Wait for EC_LPC_CMDR_DATA bit to set
216 * - Read value from EC_LPC_ADDR_ACPI_DATA
223 * This reads from ACPI memory space on the EC (EC_ACPI_MEM_*).
227 * - Write EC_CMD_ACPI_WRITE to EC_LPC_ADDR_ACPI_CMD
228 * - Wait for EC_LPC_CMDR_PENDING bit to clear
229 * - Write address to EC_LPC_ADDR_ACPI_DATA
230 * - Wait for EC_LPC_CMDR_PENDING bit to clear
231 * - Write value to EC_LPC_ADDR_ACPI_DATA
238 * This enables burst mode on the EC to allow the host to issue several
239 * commands back-to-back. While in this mode, writes to mapped multi-byte
247 * This disables burst mode on the EC and stops preventing EC writes to mapped
248 * multi-byte data.
255 * This clears the lowest-order bit in the currently pending host events, and
256 * sets the result code to the 1-based index of the bit (event 0x00000001 = 1,
266 * Test location; writing value here updates test compliment byte to (0xff -
273 /* Keyboard backlight brightness percent (0 - 100) */
275 /* DPTF Target Fan Duty (0-100, 0xff for auto/none) */
283 * as the memory-mapped sensors. The COMMIT register applies those settings.
299 * bit 1 enables/disables the selected threshold (0 = off, 1 = on)
308 * write 2 to [0x05] -- select temp sensor 2
309 * write 0x7b to [0x06] -- C_TO_K(50) - EC_TEMP_SENSOR_OFFSET
310 * write 0x2 to [0x07] -- enable threshold 0 with this value
311 * write 0x85 to [0x06] -- C_TO_K(60) - EC_TEMP_SENSOR_OFFSET
312 * write 0x3 to [0x07] -- enable threshold 1 with this value
315 * write 2 to [0x05] -- select temp sensor 2
316 * write 0x1 to [0x07] -- disable threshold 1
335 * ACPI addresses 0x20 - 0xff map to EC_MEMMAP offset 0x00 - 0xdf. This data
336 * is read-only from the AP. Added in EC_ACPI_MEM_VERSION 2.
347 * is pre-processed to handle constants but the ASL compiler is unable to
366 * results in inefficient assembly code on ARM, if the structure is actually
367 * 32-bit aligned, as it should be for all buffers.
374 * the parent structure. This is particularly important if the sub-structure
378 * Also be very careful using __packed - particularly when nesting non-packed
385 * "__packed" - generates inefficient code; all sub-structs must also be packed
387 * "struct [^_]" - all structs should be annotated, except for structs that are
402 * Packed structure which must be under-aligned, because its size is not a
403 * 4-byte multiple. This is sub-optimal because it forces byte-wise access
404 * of all multi-byte fields in it, even though they are themselves aligned.
412 * Packed structure which must be under-aligned, because its offset inside a
413 * parent structure is not a 4-byte multiple.
419 * Structures which are complicated enough that I'm skipping them on the first
433 * byte-wise reads.
471 /* Host command response codes (16-bit). Note that response codes should be
495 * Host event codes. Note these are 1-based, not 0-based, because ACPI query
558 /* EC desires to change state of host-controlled USB mux */
578 * not initialized on the EC, or improperly configured on the host.
583 #define EC_HOST_EVENT_MASK(event_code) (1ULL << ((event_code) - 1))
602 * If EC gets a command and this flag is not set, this is an old-style command.
604 * unknown length. EC must respond with an old-style response (that is,
611 * If EC responds to a command and this flag is not set, this is an old-style
626 * 1. - - AP asserts chip select (CS#)
627 * 2. EC_SPI_OLD_READY - AP sends first byte(s) of request
628 * 3. - - EC starts handling CS# interrupt
629 * 4. EC_SPI_RECEIVING - AP sends remaining byte(s) of request
630 * 5. EC_SPI_PROCESSING - EC starts processing request; AP is clocking in
632 * 6. - - EC finishes processing and sets up response
633 * 7. EC_SPI_FRAME_START - AP reads frame byte
634 * 8. (response packet) - AP reads response packet
635 * 9. EC_SPI_PAST_END - Any additional bytes read by AP
636 * 10 - - AP deasserts chip select
637 * 11 - - EC processes CS# interrupt and sets up DMA for
695 * by the AP as part of a request packet, or (for old-style ECs) is processing
709 * N+3 8-bit checksum of bytes 0..N+2
716 * M+2 8-bit checksum of bytes 0..M+1
741 * 3+ structs are being used. Usage is bus-dependent.
800 * Notes on commands:
802 * Each command is an 16-bit command value. Commands which take params or
807 * those are implementation-dependent and not defined here.
809 * All commands MUST be #defined to be 4-digit UPPER CASE hex values
817 * Get protocol version, used to deal with non-backward compatible protocol
850 /* Null-terminated version strings for RO, RW */
853 char reserved[32]; /* Was previously RW-B string */
872 * Response is null-terminated string.
880 /* Null-terminated strings */
894 * Read memory-mapped data.
896 * This is an alternate interface to memory-mapped data for bus protocols
897 * which don't support direct-mapped memory - I2C, SPI, etc.
928 * Check EC communications status (busy). This is needed on i2c/spi but not
929 * on lpc since it has its own out-of-band busy indicator.
931 * lpc must read the status from the command register. Attempting this on
1032 * Support Google lightbar, introduced on Pixel.
1053 /* Can switch the screen backlight on/off */
1055 /* Can switch the wifi module on/off */
1082 /* Motion Sensor code has an internal software FIFO */
1086 /* EC decides on USB-C SS mux state, muxes configured by host */
1098 /* EC supports the unified wake masks for LPC/eSPI systems */
1103 #define EC_FEATURE_MASK_1(event_code) (1UL << (event_code - 32))
1152 * be necessary on a chip where write/erase can be corrupted by other board
1163 * if they did we'd define the version 0 structure as a sub-structure of this
1183 * may have a write buffer which can do half-page operations if data is
1184 * aligned, and a slower word-at-a-time write mode.
1195 /* Reserved; set 0; ignore on read */
1202 /* Size in power of 2 of each sector (8 --> 256 bytes) */
1210 /* Reserved; set 0; ignore on read */
1267 * EC_RES_INVALID_PARAM : offset/size are not aligned on a erase boundary.
1277 * ERASE_GET_RESULT command may timeout on EC where flash access is not
1300 * If mask!=0, sets/clear the requested bits of flags. Depending on the
1314 * RO flash code protected now. If this bit is set, at-boot status cannot
1322 /* Error - at least one bank of flash is stuck locked, and cannot be unlocked */
1325 * Error - flash protection is in inconsistent state. At least one bank of
1327 * re-requesting the desired flags, or by a hard reset if that fails.
1350 * Flags which are valid on this platform. This allows the caller
1352 * be set on this platform.
1360 * Note: commands 0x14 - 0x19 version 0 were old commands to get/set flash
1369 /* Region which holds read-only EC image */
1374 * Region which should be write-protected in the factory (a superset of
1465 /* OBSOLETE - Use EC_CMD_PWM_SET_DUTY */
1474 /* OBSOLETE - Use EC_CMD_PWM_SET_DUTY */
1500 /* All types, indexed by board-specific enum pwm_channel */
1512 uint8_t index; /* Type-specific index, or 0 if unique */
1519 uint8_t index; /* Type-specific index, or 0 if unique */
1561 /* Brightness limits based on the backlight and AC. */
1567 uint8_t battery_threshold[LB_BATTERY_LEVELS - 1];
1574 struct rgb_s color[8]; /* 0-3 are Google colors */
1594 /* Tap-for-battery params */
1607 /* Brightness limits based on the backlight and AC. */
1613 uint8_t battery_threshold[LB_BATTERY_LEVELS - 1];
1619 /* s5: single color pulse on inhibited power-up */
1623 struct rgb_s color[8]; /* 0-3 are Google colors */
1654 /* Tap-for-battery params */
1671 /* Brightness limits based on the backlight and AC. */
1679 uint8_t battery_threshold[LB_BATTERY_LEVELS - 1];
1687 /* s5: single color pulse on inhibited power-up */
1691 struct rgb_s color[8]; /* 0-3 are Google colors */
1706 } dump, off, on, init, get_seq, get_params_v0, get_params_v1, member
1782 } off, on, init, set_brightness, seq, reg, set_rgb, member
1839 * LED to indicate system power state (on or in suspend).
1840 * May be on power button or on C-panel.
1843 /* LED on power adapter or its plug */
1884 * Range 1 means on/off control.
1929 EC_VBOOT_HASH_TYPE_SHA256 = 0, /* SHA-256 */
1949 * Motion sense commands. We'll make separate structs for sub-commands with
1954 /* Motion sense commands */
1957 * Dump command returns all motion sensor data including motion sense
1977 * to process of all motion sensors in milliseconds.
1983 * rate of a specific motion sensor in millihertz.
1989 * a specified motion sensor in +/-G's or +/- deg/s.
1994 * Setter/getter command for the keyboard wake angle. When the lid
1995 * angle is greater than this value, keyboard wake is disabled in S3,
1996 * and when the lid angle goes less than this value, keyboard wake is
1998 * un-calibrated value, hence the wake angle isn't exact.
2025 * On sensors that support it, ask to do offset calibration.
2038 * List available activities for a MOTION sensor.
2067 /* Number of motionsense sub-commands. */
2071 /* List of motion sensor types. */
2083 /* List of motion sensor locations. */
2090 /* List of motion sensor chips. */
2110 /* Each sensor is up to 3-axis. */
2159 /* Module flag masks used for the dump sub-command. */
2162 /* Sensor flag masks used for the dump sub-command. */
2179 #define EC_MOTION_SENSE_NO_VALUE -1
2240 /* Rounding flag, true for round-up, false for down. */
2326 /* Flags representing the motion sensor module. */
2491 /* Real-time clock */
2601 * Version 0 is what originally shipped on Link.
2612 /* Version 0 - set */
2619 /* Version 0 - get */
2643 * Note that this structure is a sub-structure of
2652 /* Version 1 - get config for one sensor. */
2658 /* Version 1 - set config for one sensor.
2659 * Use read-modify-write for best results! */
2685 * needing to update this file. We can also use a different algorithm on each
2741 /* MKBP - Matrix KeyBoard Protocol */
2842 * Note that this is used as a sub-structure of
2853 * minimum post-scan relax time. Once we finish a scan we check
2860 uint16_t debounce_down_us; /* time for debounce on key down */
2861 uint16_t debounce_up_us; /* time for debounce on key up */
2948 /* The state of the non-matrixed buttons have changed. */
3036 * Note: host commands 0x80 - 0x87 are reserved to avoid conflict with ACPI
3072 * Unified host event programming interface - Should be used by newer versions
3078 /* Action requested by host - one of enum ec_host_event_action. */
3082 * Mask type that the host requested the action on - one of
3087 /* Set to 0, ignore on read */
3096 * Update the value on a GET request. Set to 0 on GET/CLEAR
3136 /* Active wake mask */
3139 /* Lazy wake mask for S0ix */
3142 /* Lazy wake mask for S3 */
3145 /* Lazy wake mask for S5 */
3179 * Flags to leave enabled in S3, if they're on at the S0->S3
3180 * transition. (Other flags will be disabled by the S0->S3
3199 /* GPIO commands. Only available on EC if write protect has been disabled. */
3267 uint16_t addr; /* 8-bit address (7-bit shifted << 1) */
3282 uint16_t addr; /* 8-bit address (7-bit shifted << 1) */
3322 * Response is null-terminated string. Empty string, if there is no more
3370 EC_LDO_STATE_ON = 1, /* the LDO / FET is ON / providing power */
3374 * Switch on/off a LDO.
3462 /* Start of AP S3->S0 transition (booting or resuming from suspend) */
3473 /* Stop on end of AP S0->S3 transition (suspending or shutting down) */
3506 * This is the single catch-all host command to exchange data regarding the
3520 * Known param numbers are defined here. Ranges are reserved for board-specific
3527 CS_PARAM_CHG_STATUS, /* charger-specific status */
3528 CS_PARAM_CHG_OPTION, /* charger-specific options */
3596 /* Command v0 is used only on Spring and is obsolete + unsupported */
3693 /* Smart battery pass-through */
3695 /* Get / Set 16-bit smart battery registers */
3730 * Get or set vendor-specific parameters in the battery. Implementations may
3731 * differ between boards or batteries. On a set operation, the response
3830 * I2C passthru protection command: Protects I2C tunnels against access on
3831 * certain addresses (board-specific).
3863 /* (command 3 was jump to RW-B) */
3864 EC_REBOOT_COLD = 4, /* Cold-reboot */
3881 * Get information on last EC panic.
3883 * Returns variable-length platform-dependent panic information. See panic.h
3908 * Resend last response (not supported on LPC).
3910 * Returns EC_RES_UNAVAILABLE if there is no response available - for example,
3917 * This header byte on a command indicate version 0. Any header byte less
3972 /* AP to PD MCU host event status command, cleared on read */
3984 /* Set USB type-C port role and muxes */
4049 /* Maximum number of PD ports on a device, num_ports will be <= this */
4098 /* Write USB-PD device FW */
4116 /* Write USB-PD Accessory RW_HASH table entry */
4118 /* RW hash is first 20 bytes of SHA-256 of RW section */
4129 /* Read USB-PD Accessory info */
4136 /* Read USB-PD Device discovery info */
4139 uint16_t vid; /* USB-IF VID */
4140 uint16_t pid; /* USB-IF PID */
4149 OVERRIDE_DONT_CHARGE = -2,
4150 OVERRIDE_OFF = -1,
4165 uint16_t data; /* type-defined data payload */
4247 /* Get/Set USB-PD Alternate mode info */
4285 /* Control USB-PD chip */
4300 /* Get info about USB-C SS muxes */
4304 uint8_t port; /* USB-C port number */
4314 uint8_t flags; /* USB_PD_MUX_*-encoded USB mux state */
4320 uint8_t port; /* USB-C port number */
4353 /* Run verification on a slot */
4361 * Retrieve info from Cros Board Info store. Response is based on the data
4367 * Write info into Cros Board Info on EEPROM. Write fails if the board has
4368 * hardware write-protect enabled.
4411 /* The command range 0x200-0x2FF is reserved for Rotor. */
4421 /* Fingerprint MCU commands: range 0x0400-0x040x */
4455 /* Wait to see a finger on the sensor */
4491 /* Get the last captured finger frame: TODO: will be AES-encrypted */
4500 /* Touchpad MCU commands: range 0x0500-0x05FF */
4527 * Reserve a range of host commands for board-specific, experimental, or
4533 * All commands MUST be #defined to be 4-digit UPPER CASE hex values
4565 * Some platforms have sub-processors chained to each other. For example.
4567 * AP <--> EC <--> PD MCU
4571 * command; other device mapping is board-specific.
4573 * When a device receives a command to be passed to a sub-processor, it passes
4574 * it on with the device number set back to 0. This allows the sub-processor
4575 * to remain blissfully unaware of whether the command originated on the next
4584 /* Offset and max command number for sub-device n */