Merge series "Add support for voltage regulator on ChromeOS EC." from Pi-Hsun Shih <pihsun@chromium.org>:
Add support for controlling voltage regulator that is connected and
controlled by ChromeOS EC. Kernel controls these regulators through
newly added EC host commands.
Changes from v5:
* Move new host command to a separate patch.
* Use devm_regulator_register.
* Address review comments.
Changes from v4:
* Change compatible name from regulator-cros-ec to cros-ec-regulator.
Changes from v3:
* Fix dt bindings file name.
* Remove check around CONFIG_OF in driver.
* Add new host commands to cros_ec_trace.
* Address review comments.
Changes from v2:
* Add 'depends on OF' to Kconfig.
* Add Kconfig description about compiling as module.
Changes from v1:
* Change compatible string to google,regulator-cros-ec.
* Use reg property in device tree.
* Change license for dt binding according to checkpatch.pl.
* Address comments on code styles.
Pi-Hsun Shih (3):
dt-bindings: regulator: Add DT binding for cros-ec-regulator
platform/chrome: cros_ec: Add command for regulator control.
regulator: Add driver for cros-ec-regulator
.../regulator/google,cros-ec-regulator.yaml | 51 ++++
drivers/platform/chrome/cros_ec_trace.c | 5 +
drivers/regulator/Kconfig | 10 +
drivers/regulator/Makefile | 1 +
drivers/regulator/cros-ec-regulator.c | 257 ++++++++++++++++++
.../linux/platform_data/cros_ec_commands.h | 82 ++++++
6 files changed, 406 insertions(+)
create mode 100644 Documentation/devicetree/bindings/regulator/google,cros-ec-regulator.yaml
create mode 100644 drivers/regulator/cros-ec-regulator.c
base-commit: b791d1bdf9
--
2.27.0.290.gba653c62da-goog
This commit is contained in:
@@ -5430,6 +5430,88 @@ struct ec_response_rollback_info {
|
||||
/* Issue AP reset */
|
||||
#define EC_CMD_AP_RESET 0x0125
|
||||
|
||||
/*****************************************************************************/
|
||||
/* 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 0x012B
|
||||
|
||||
/* 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_align1;
|
||||
|
||||
/*
|
||||
* Configure the regulator as enabled / disabled.
|
||||
*/
|
||||
#define EC_CMD_REGULATOR_ENABLE 0x012C
|
||||
|
||||
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 0x012D
|
||||
|
||||
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 0x012E
|
||||
|
||||
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.
|
||||
*/
|
||||
#define EC_CMD_REGULATOR_GET_VOLTAGE 0x012F
|
||||
|
||||
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. */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user