diff options
| author | Linus Torvalds <[email protected]> | 2024-07-15 17:25:38 -0700 | 
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2024-07-15 17:25:38 -0700 | 
| commit | 89c491389331faea09a247da47ebd95982dae06e (patch) | |
| tree | ac8101800b1f0ebd5579039a9be51717d274a3b1 /include/linux/platform_data/cros_ec_commands.h | |
| parent | d8764c1931a4c91b9b53ee183757f70999da2bb3 (diff) | |
| parent | 4baf1cc54433ff7c6e5178517bc8768001416681 (diff) | |
Merge tag 'tag-chrome-platform-for-v6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux
Pull chrome platform updates from Tzung-Bi Shih:
 "New code:
   - Add "cros_ec_hwmon" driver to expose fan speed and temperature
   - Add "cros_charge-control" driver to control charge thresholds and
     behaviour
   - Add module parameter "log_poll_period_ms" in cros_ec_debugfs for
     tuning the poll period
   - Support version 3 of EC_CMD_GET_NEXT_EVENT and keyboard matrix
  Fixes:
   - Fix a race condition in accessing MEC (Microchip EC) memory between
     ACPI and kernel. Serialize the memory access by an AML (ACPI
     Machine Language) mutex
   - Fix an issue of wrong EC message version in cros_ec_debugfs
  Misc:
   - Fix kernel-doc errors and cleanups"
* tag 'tag-chrome-platform-for-v6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux: (28 commits)
  power: supply: cros_charge-control: Fix signedness bug in charge_behaviour_store()
  power: supply: cros_charge-control: Avoid accessing attributes out of bounds
  power: supply: cros_charge-control: don't load if Framework control is present
  power: supply: add ChromeOS EC based charge control driver
  platform/chrome: cros_ec_proto: Introduce cros_ec_get_cmd_versions()
  platform/chrome: Update binary interface for EC-based charge control
  ACPI: battery: add devm_battery_hook_register()
  dt-bindings: input: cros-ec-keyboard: Add keyboard matrix v3.0
  platform/chrome: cros_ec_lpc: Handle zero length read/write
  platform/chrome: cros_ec_lpc: Fix error code in cros_ec_lpc_mec_read_bytes()
  platform/chrome: cros_ec_debugfs: fix wrong EC message version
  platform/chrome: cros_ec_proto: update Kunit test for get_next_data_v3
  platform/chrome: cros_ec_proto: add missing MODULE_DESCRIPTION() macro
  hwmon: (cros_ec) Fix access to restricted __le16
  hwmon: (cros_ec) Prevent read overflow in probe()
  platform/chrome: cros_ec_lpc: Add quirks for Framework Laptop
  platform/chrome: cros_ec_lpc: Add a new quirk for AML mutex
  platform/chrome: cros_ec_lpc: Add a new quirk for ACPI id
  platform/chrome: cros_ec_lpc: MEC access can use an AML mutex
  platform/chrome: cros_ec_lpc: MEC access can return error code
  ...
Diffstat (limited to 'include/linux/platform_data/cros_ec_commands.h')
| -rw-r--r-- | include/linux/platform_data/cros_ec_commands.h | 83 | 
1 files changed, 81 insertions, 2 deletions
diff --git a/include/linux/platform_data/cros_ec_commands.h b/include/linux/platform_data/cros_ec_commands.h index ecc47d5fe239..e574b790be6f 100644 --- a/include/linux/platform_data/cros_ec_commands.h +++ b/include/linux/platform_data/cros_ec_commands.h @@ -3463,6 +3463,34 @@ union __ec_align_offset1 ec_response_get_next_data_v1 {  };  BUILD_ASSERT(sizeof(union ec_response_get_next_data_v1) == 16); +union __ec_align_offset1 ec_response_get_next_data_v3 { +	uint8_t key_matrix[18]; + +	/* Unaligned */ +	uint32_t host_event; +	uint64_t host_event64; + +	struct __ec_todo_unpacked { +		/* For aligning the fifo_info */ +		uint8_t reserved[3]; +		struct ec_response_motion_sense_fifo_info info; +	} sensor_fifo; + +	uint32_t buttons; + +	uint32_t switches; + +	uint32_t fp_events; + +	uint32_t sysrq; + +	/* CEC events from enum mkbp_cec_event */ +	uint32_t cec_events; + +	uint8_t cec_message[16]; +}; +BUILD_ASSERT(sizeof(union ec_response_get_next_data_v3) == 18); +  struct ec_response_get_next_event {  	uint8_t event_type;  	/* Followed by event data if any */ @@ -3475,6 +3503,12 @@ struct ec_response_get_next_event_v1 {  	union ec_response_get_next_data_v1 data;  } __ec_align1; +struct ec_response_get_next_event_v3 { +	uint8_t event_type; +	/* Followed by event data if any */ +	union ec_response_get_next_data_v3 data; +} __ec_align1; +  /* Bit indices for buttons and switches.*/  /* Buttons */  #define EC_MKBP_POWER_BUTTON	0 @@ -3809,16 +3843,61 @@ struct ec_params_i2c_write {   * discharge the battery.   */  #define EC_CMD_CHARGE_CONTROL 0x0096 -#define EC_VER_CHARGE_CONTROL 1 +#define EC_VER_CHARGE_CONTROL 3  enum ec_charge_control_mode {  	CHARGE_CONTROL_NORMAL = 0,  	CHARGE_CONTROL_IDLE,  	CHARGE_CONTROL_DISCHARGE, +	/* Add no more entry below. */ +	CHARGE_CONTROL_COUNT, +}; + +#define EC_CHARGE_MODE_TEXT                               \ +	{                                                 \ +		[CHARGE_CONTROL_NORMAL] = "NORMAL",       \ +		[CHARGE_CONTROL_IDLE] = "IDLE",           \ +		[CHARGE_CONTROL_DISCHARGE] = "DISCHARGE", \ +	} + +enum ec_charge_control_cmd { +	EC_CHARGE_CONTROL_CMD_SET = 0, +	EC_CHARGE_CONTROL_CMD_GET, +}; + +enum ec_charge_control_flag { +	EC_CHARGE_CONTROL_FLAG_NO_IDLE = BIT(0),  };  struct ec_params_charge_control { -	uint32_t mode;  /* enum charge_control_mode */ +	uint32_t mode; /* enum charge_control_mode */ + +	/* Below are the fields added in V2. */ +	uint8_t cmd; /* enum ec_charge_control_cmd. */ +	uint8_t flags; /* enum ec_charge_control_flag (v3+) */ +	/* +	 * Lower and upper thresholds for battery sustainer. This struct isn't +	 * named to avoid tainting foreign projects' name spaces. +	 * +	 * If charge mode is explicitly set (e.g. DISCHARGE), battery sustainer +	 * will be disabled. To disable battery sustainer, set mode=NORMAL, +	 * lower=-1, upper=-1. +	 */ +	struct { +		int8_t lower; /* Display SoC in percentage. */ +		int8_t upper; /* Display SoC in percentage. */ +	} sustain_soc; +} __ec_align4; + +/* Added in v2 */ +struct ec_response_charge_control { +	uint32_t mode; /* enum charge_control_mode */ +	struct { /* Battery sustainer thresholds */ +		int8_t lower; +		int8_t upper; +	} sustain_soc; +	uint8_t flags; /* enum ec_charge_control_flag (v3+) */ +	uint8_t reserved;  } __ec_align4;  /*****************************************************************************/  |