diff options
author | Pi-Hsun Shih <pihsun@chromium.org> | 2020-06-16 13:45:37 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-07-23 23:21:27 +0000 |
commit | c10bb98f5381a477540a094dcddfe1d1c5ee7ade (patch) | |
tree | 952e68c725fd53941ad41fe6182d77f6dd06425f /include/ec_commands.h | |
parent | 23748c2f49b52a279970e7e2f6862ba336726346 (diff) | |
download | chrome-ec-c10bb98f5381a477540a094dcddfe1d1c5ee7ade.tar.gz |
ec_commands: Add host commands for regulator control.
BUG=b:149274957
TEST=build
BRANCH=none
Change-Id: I9c7b5dec7e2f66ab64750b48acd914a1c86dfd3d
Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2247431
Reviewed-by: Jett Rink <jettrink@chromium.org>
Commit-Queue: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'include/ec_commands.h')
-rw-r--r-- | include/ec_commands.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h index d141996c41..49e861b151 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -6181,6 +6181,89 @@ struct ec_response_smart_discharge { }; /*****************************************************************************/ +/* Voltage regulator controls */ + +/* + * Get basic info of voltage regulator for given index. + * + * Returns the regulator name and supported voltage list in mV. + */ +#define EC_CMD_REGULATOR_GET_INFO 0x012C + +/* Maximum length of regulator name */ +#define EC_REGULATOR_NAME_MAX_LEN 16 + +/* Maximum length of the supported voltage list. */ +#define EC_REGULATOR_VOLTAGE_MAX_COUNT 16 + +struct ec_params_regulator_get_info { + uint32_t index; +} __ec_align4; + +struct ec_response_regulator_get_info { + char name[EC_REGULATOR_NAME_MAX_LEN]; + uint16_t num_voltages; + uint16_t voltages_mv[EC_REGULATOR_VOLTAGE_MAX_COUNT]; +} __ec_align2; + +/* + * Configure the regulator as enabled / disabled. + */ +#define EC_CMD_REGULATOR_ENABLE 0x012D + +struct ec_params_regulator_enable { + uint32_t index; + uint8_t enable; +} __ec_align4; + +/* + * Query if the regulator is enabled. + * + * Returns 1 if the regulator is enabled, 0 if not. + */ +#define EC_CMD_REGULATOR_IS_ENABLED 0x012E + +struct ec_params_regulator_is_enabled { + uint32_t index; +} __ec_align4; + +struct ec_response_regulator_is_enabled { + uint8_t enabled; +} __ec_align1; + +/* + * Set voltage for the voltage regulator within the range specified. + * + * The driver should select the voltage in range closest to min_mv. + * + * Also note that this might be called before the regulator is enabled, and the + * setting should be in effect after the regulator is enabled. + */ +#define EC_CMD_REGULATOR_SET_VOLTAGE 0x012F + +struct ec_params_regulator_set_voltage { + uint32_t index; + uint32_t min_mv; + uint32_t max_mv; +} __ec_align4; + +/* + * Get the currently configured voltage for the voltage regulator. + * + * Note that this might be called before the regulator is enabled, and this + * should return the configured output voltage if the regulator is enabled. + */ +#define EC_CMD_REGULATOR_GET_VOLTAGE 0x0130 + +struct ec_params_regulator_get_voltage { + uint32_t index; +} __ec_align4; + +struct ec_response_regulator_get_voltage { + uint32_t voltage_mv; +} __ec_align4; + +/*****************************************************************************/ /* The command range 0x200-0x2FF is reserved for Rotor. */ /*****************************************************************************/ |