diff options
Diffstat (limited to 'driver')
-rw-r--r-- | driver/charger/rt946x.c | 16 | ||||
-rw-r--r-- | driver/charger/rt946x.h | 10 |
2 files changed, 11 insertions, 15 deletions
diff --git a/driver/charger/rt946x.c b/driver/charger/rt946x.c index c6f748017d..35fb6fcb15 100644 --- a/driver/charger/rt946x.c +++ b/driver/charger/rt946x.c @@ -1033,20 +1033,10 @@ int mt6370_led_set_dim_mode(enum mt6370_led_index index, return EC_SUCCESS; } -int mt6370_led_set_color(enum mt6370_led_index index) +int mt6370_led_set_color(uint8_t mask) { - int val; - - if (index >= MT6370_LED_ID_COUNT) - return EC_ERROR_INVAL; - - if (index == MT6370_LED_ID_OFF) - val = 0; - else - val = 1 << (MT6370_SHIFT_RGB_ISNKDIM_BASE - index); - - rt946x_update_bits(MT6370_REG_RGBEN, MT6370_MASK_RGB_ISNK_ALL_EN, val); - return EC_SUCCESS; + return rt946x_update_bits(MT6370_REG_RGBEN, MT6370_MASK_RGB_ISNK_ALL_EN, + mask); } int mt6370_led_set_brightness(enum mt6370_led_index index, uint8_t brightness) diff --git a/driver/charger/rt946x.h b/driver/charger/rt946x.h index 21ce65536b..9f1d682901 100644 --- a/driver/charger/rt946x.h +++ b/driver/charger/rt946x.h @@ -566,8 +566,14 @@ enum mt6370_led_pwm_freq { /* Set LED brightness */ int mt6370_led_set_brightness(enum mt6370_led_index index, uint8_t brightness); -/* Set LED Color */ -int mt6370_led_set_color(enum mt6370_led_index index); +/** + * Set LED Color + * + * mask: Bitmap indicating 1=on 0=off for each LED. 000 = all off. + * Combination of MT6370_MASK_RGB_ISNK1/2/3DIM_EN. + * return: EC_SUCCESS or EC_ERROR_* on error. + */ +int mt6370_led_set_color(uint8_t mask); /* Set LED dim mode, available modes: REGISTER, PWM, BREATH. */ int mt6370_led_set_dim_mode(enum mt6370_led_index index, |