ec/google/chromeec: Add API to turn off lightbar
Implement google_chromeec_lightbar_off() to allow the host to explicitly disable the Chrome EC lightbar. This is achieved by sending the LIGHTBAR_CMD_OFF sub-command via the multiplexed EC_CMD_LIGHTBAR_CMD host command. This API is useful for power-saving scenarios or UI synchronization during specific boot modes, such as low-battery or off-mode charging. BUG=None TEST=Verified that the lightbar turns off when this function is called on supported hardware. Change-Id: Ic118dbd5e9af64d06490dd16aa115aca2c1df3a5 Signed-off-by: Subrata Banik <subratabanik@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/91377 Reviewed-by: Kapil Porwal <kapilporwal@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
4028996c9d
commit
5f9a1ad962
2 changed files with 35 additions and 0 deletions
|
|
@ -1982,6 +1982,31 @@ int google_chromeec_set_lightbar_rgb(unsigned int led, int red, int green,
|
|||
return google_chromeec_command(&cmd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sends a command to turn off the Chrome EC lightbar.
|
||||
*
|
||||
* This function packages a LIGHTBAR_CMD_OFF sub-command into a standard
|
||||
* EC_CMD_LIGHTBAR_CMD packet.
|
||||
*
|
||||
* @return 0 on success, non-zero error code from the EC transport on failure.
|
||||
*/
|
||||
int google_chromeec_lightbar_off(void)
|
||||
{
|
||||
const struct ec_params_lightbar req = {
|
||||
.cmd = LIGHTBAR_CMD_OFF,
|
||||
};
|
||||
|
||||
struct chromeec_command cmd = {
|
||||
.cmd_code = EC_CMD_LIGHTBAR_CMD,
|
||||
.cmd_size_out = 0,
|
||||
.cmd_data_out = NULL,
|
||||
.cmd_size_in = sizeof(req),
|
||||
.cmd_data_in = &req,
|
||||
};
|
||||
|
||||
return google_chromeec_command(&cmd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if the battery is critically low and not currently charging.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -562,6 +562,16 @@ int google_chromeec_read_batt_state_of_charge(uint32_t *state);
|
|||
int google_chromeec_set_lightbar_rgb(unsigned int led, int red, int green,
|
||||
int blue);
|
||||
|
||||
/*
|
||||
* Sends a command to turn off the Chrome EC lightbar.
|
||||
*
|
||||
* This function packages a LIGHTBAR_CMD_OFF sub-command into a standard
|
||||
* EC_CMD_LIGHTBAR_CMD packet.
|
||||
*
|
||||
* @return 0 on success, non-zero error code from the EC transport on failure.
|
||||
*/
|
||||
int google_chromeec_lightbar_off(void);
|
||||
|
||||
/*
|
||||
* Check if the battery is critically low and AC is not present.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue