ec/google/chromeec: Add helper to set LED RGB colors
This patch adds google_chromeec_set_lightbar_rgb() to allow mainboards to manually control the individual LED colors. This is useful for providing visual feedback during early boot or platform-specific events, such as low-battery warnings. TEST=Build and boot google/fatcat. Change-Id: I146006511ea727787ea496b0674b67fa950ce8f2 Signed-off-by: Subrata Banik <subratabanik@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/90807 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Kapil Porwal <kapilporwal@google.com>
This commit is contained in:
parent
d216ea151c
commit
a7a627d8f5
2 changed files with 52 additions and 0 deletions
|
|
@ -1945,3 +1945,39 @@ int google_chromeec_read_batt_state_of_charge(uint32_t *state)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the RGB color of a specific LED on the Lightbar.
|
||||
*
|
||||
* This function communicates with the Embedded Controller (EC)
|
||||
* to update the color of an individual LED.
|
||||
*
|
||||
* led: The index of the LED to be updated.
|
||||
* red: Red intensity value (0x00 - 0xff).
|
||||
* green: Green intensity value (0x00 - 0xff).
|
||||
* blue: Blue intensity value (0x00 - 0xff).
|
||||
* Return: 0 on success, or a non-zero error code from the EC host command.
|
||||
*/
|
||||
int google_chromeec_set_lightbar_rgb(unsigned int led, int red, int green,
|
||||
int blue)
|
||||
{
|
||||
const struct ec_params_lightbar req = {
|
||||
.cmd = LIGHTBAR_CMD_SET_RGB,
|
||||
.set_rgb = {
|
||||
.led = led,
|
||||
.red = red,
|
||||
.green = green,
|
||||
.blue = blue
|
||||
}
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -546,4 +546,20 @@ void chipset_ioport_range(uint16_t *base, size_t *size);
|
|||
*/
|
||||
int google_chromeec_read_batt_state_of_charge(uint32_t *state);
|
||||
|
||||
/*
|
||||
* Set the RGB color of a specific LED on the Lightbar.
|
||||
*
|
||||
* This function communicates with the Embedded Controller (EC)
|
||||
* to update the color of an individual LED.
|
||||
*
|
||||
* @param led: The index of the LED to be updated.
|
||||
* @param red: Red intensity value (0x00 - 0xff).
|
||||
* @param green: Green intensity value (0x00 - 0xff).
|
||||
* @param blue: Blue intensity value (0x00 - 0xff).
|
||||
*
|
||||
* @return 0 on success, or a non-zero error code from the EC host command.
|
||||
*/
|
||||
int google_chromeec_set_lightbar_rgb(unsigned int led, int red, int green,
|
||||
int blue);
|
||||
|
||||
#endif /* _EC_GOOGLE_CHROMEEC_EC_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue