ec/starlabs/merlin: Add support for setting the charging speed
Allow boards that use the merlin EC to configure the charging speed, as all versions of the merlin EC support this. All coreboot does it write a value to the EC RAM and the EC will handle the rest. Change-Id: I46faa540530c5bd7f5473021561380213158152e Signed-off-by: Sean Rhodes <sean@starlabs.systems> Reviewed-on: https://review.coreboot.org/c/coreboot/+/84633 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
This commit is contained in:
parent
6da56eeeab
commit
e1fcb2db78
18 changed files with 64 additions and 0 deletions
|
|
@ -64,6 +64,12 @@ config EC_STARLABS_MAX_CHARGE
|
|||
help
|
||||
Select if the mainboard supports limiting the maximum charge of the battery.
|
||||
|
||||
config EC_STARLABS_CHARGING_SPEED
|
||||
bool "Enable setting the charging speed"
|
||||
depends on EC_STARLABS_MERLIN
|
||||
help
|
||||
Select if the mainboard supports configuring the charging speed.
|
||||
|
||||
config EC_STARLABS_MERLIN
|
||||
bool "Use open-source Merlin EC Firmware"
|
||||
default n
|
||||
|
|
|
|||
|
|
@ -98,6 +98,11 @@
|
|||
#define KBL_DISABLED 0x00
|
||||
#define KBL_ENABLED 0xdd
|
||||
|
||||
/* Charging Speed */
|
||||
#define SPEED_1_0C 0x00
|
||||
#define SPEED_0_5C 0x01
|
||||
#define SPEED_0_2C 0x02
|
||||
|
||||
uint16_t ec_get_version(void);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ static void merlin_init(struct device *dev)
|
|||
* trackpad_state
|
||||
* kbl_brightness
|
||||
* kbl_state
|
||||
* charging_speed
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
@ -240,6 +241,28 @@ static void merlin_init(struct device *dev)
|
|||
*/
|
||||
|
||||
ec_write(ECRAM_KBL_STATE, KBL_ENABLED);
|
||||
|
||||
/*
|
||||
* Charging Speed
|
||||
*
|
||||
* Setting: charging_speed
|
||||
*
|
||||
* Values: 1.0C, 0.5C, 0.2C
|
||||
* Default: 0.5C
|
||||
*
|
||||
*/
|
||||
const uint8_t charging_speed[] = {
|
||||
SPEED_1_0C,
|
||||
SPEED_0_5C,
|
||||
SPEED_0_2C
|
||||
};
|
||||
|
||||
if (CONFIG(EC_STARLABS_CHARGING_SPEED))
|
||||
ec_write(ECRAM_CHARGING_SPEED,
|
||||
get_ec_value_from_option("charging_speed",
|
||||
SPEED_0_5C,
|
||||
charging_speed,
|
||||
ARRAY_SIZE(charging_speed)));
|
||||
}
|
||||
|
||||
static struct device_operations ops = {
|
||||
|
|
|
|||
|
|
@ -20,5 +20,6 @@
|
|||
#define ECRAM_MAX_CHARGE dead_code_t(uint8_t)
|
||||
#define ECRAM_FAN_MODE dead_code_t(uint8_t)
|
||||
#define ECRAM_FAST_CHARGE dead_code_t(uint8_t)
|
||||
#define ECRAM_CHARGING_SPEED dead_code_t(uint8_t)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,5 +23,6 @@
|
|||
#define ECRAM_KBL_BRIGHTNESS 0x36
|
||||
#define ECRAM_FN_LOCK_STATE 0x70
|
||||
#define ECRAM_FAST_CHARGE dead_code_t(uint8_t)
|
||||
#define ECRAM_CHARGING_SPEED dead_code_t(uint8_t)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,5 +20,6 @@
|
|||
#define ECRAM_MAX_CHARGE dead_code_t(uint8_t)
|
||||
#define ECRAM_FAN_MODE dead_code_t(uint8_t)
|
||||
#define ECRAM_FAST_CHARGE dead_code_t(uint8_t)
|
||||
#define ECRAM_CHARGING_SPEED dead_code_t(uint8_t)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,5 +23,6 @@
|
|||
#define ECRAM_MAX_CHARGE dead_code_t(uint8_t)
|
||||
#define ECRAM_FAN_MODE dead_code_t(uint8_t)
|
||||
#define ECRAM_FAST_CHARGE 0x18
|
||||
#define ECRAM_CHARGING_SPEED dead_code_t(uint8_t)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,5 +20,6 @@
|
|||
#define ECRAM_FN_CTRL_REVERSE 0x43
|
||||
#define ECRAM_MAX_CHARGE dead_code_t(uint8_t)
|
||||
#define ECRAM_FAST_CHARGE dead_code_t(uint8_t)
|
||||
#define ECRAM_CHARGING_SPEED dead_code_t(uint8_t)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,5 +20,6 @@
|
|||
#define ECRAM_MAX_CHARGE 0x1a
|
||||
#define ECRAM_FAN_MODE 0x1b
|
||||
#define ECRAM_FAST_CHARGE dead_code_t(uint8_t)
|
||||
#define ECRAM_CHARGING_SPEED 0x1d
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue