Lines Matching +full:charging +full:- +full:algorithm

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.
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.
161 #define EC_TEMP_SENSOR_DEFAULT (296 - EC_TEMP_SENSOR_OFFSET)
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
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
239 * commands back-to-back. While in this mode, writes to mapped multi-byte
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.
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
319 /* DPTF battery charging current limit */
322 /* Charging limit is specified in 64 mA steps */
324 /* Value to disable DPTF battery charging limit */
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
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.
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 */
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.
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.
929 * on lpc since it has its own out-of-band busy indicator.
1086 /* EC decides on USB-C SS mux state, muxes configured by host */
1103 #define EC_FEATURE_MASK_1(event_code) (1UL << (event_code - 32))
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.
1202 /* Size in power of 2 of each sector (8 --> 256 bytes) */
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.
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 */
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 */
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 */
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 */
1840 * May be on power button or on C-panel.
1929 EC_VBOOT_HASH_TYPE_SHA256 = 0, /* SHA-256 */
1949 * Motion sense commands. We'll make separate structs for sub-commands with
1989 * a specified motion sensor in +/-G's or +/- deg/s.
1998 * un-calibrated value, hence the wake angle isn't exact.
2067 /* Number of motionsense sub-commands. */
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. */
2443 /* USB charging control commands */
2445 /* Set USB port charging mode */
2491 /* Real-time clock */
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! */
2682 * more. Since the algorithm is nothing but magic numbers anyway, we'll leave
2683 * the params opaque. The v1 "get" response will include the algorithm number
2685 * needing to update this file. We can also use a different algorithm on each
2713 uint8_t algorithm; member
2721 uint8_t algorithm; member
2741 /* MKBP - Matrix KeyBoard Protocol */
2840 * Configuration for our key scanning algorithm.
2842 * Note that this is used as a sub-structure of
2853 * minimum post-scan relax time. Once we finish a scan we check
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
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
3267 uint16_t addr; /* 8-bit address (7-bit shifted << 1) */
3282 uint16_t addr; /* 8-bit address (7-bit shifted << 1) */
3291 /* Force charge state machine to stop charging the battery or force it to
3322 * Response is null-terminated string. Empty string, if there is no more
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) */
3503 /* Commands for battery charging */
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 */
3583 * Set maximum battery charging current.
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
3831 * certain addresses (board-specific).
3863 /* (command 3 was jump to RW-B) */
3864 EC_REBOOT_COLD = 4, /* Cold-reboot */
3883 * Returns variable-length platform-dependent panic information. See panic.h
3910 * Returns EC_RES_UNAVAILABLE if there is no response available - for example,
3941 PD_CHARGE_NONE, /* No charging allowed */
3942 PD_CHARGE_5V, /* 5V charging only */
3952 uint8_t charge_state; /* charging state (from enum pd_charge_state) */
3969 int8_t active_charge_port; /* active charging port */
3984 /* Set USB type-C port role and muxes */
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 */
4368 * hardware write-protect enabled.
4411 /* The command range 0x200-0x2FF is reserved for Rotor. */
4421 /* Fingerprint MCU commands: range 0x0400-0x040x */
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
4584 /* Offset and max command number for sub-device n */