diff options
author | Yilun Lin <yllin@google.com> | 2018-07-12 17:00:17 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-07-12 11:35:42 -0700 |
commit | 37ff3e662aacfbe796ee4e93771d25acde56aa7f (patch) | |
tree | b4d1475797e3659f56eeeae28a18c44e3106095b /driver | |
parent | 4e0c9a26fe5024145d07c00790a93a892b34a12c (diff) | |
download | chrome-ec-37ff3e662aacfbe796ee4e93771d25acde56aa7f.tar.gz |
charger/mt6370: Fix led_set_color enables wrong LED.
The index of LED enable bit in the register is counting from
the MSB.
BRANCH=None
TEST=mt6370_led_set_color() on EVB, checks the LED flash accordingly.
BUG=b:80160408
Change-Id: I9c748b5f91a62746adaeab59899cd0222305e06b
Signed-off-by: Yilun Lin <yllin@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1134927
Commit-Ready: Yilun Lin <yllin@chromium.org>
Tested-by: Yilun Lin <yllin@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/charger/rt946x.c | 2 | ||||
-rw-r--r-- | driver/charger/rt946x.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/driver/charger/rt946x.c b/driver/charger/rt946x.c index d7dcbf82a6..a6cf203a34 100644 --- a/driver/charger/rt946x.c +++ b/driver/charger/rt946x.c @@ -1007,7 +1007,7 @@ int mt6370_led_set_color(enum mt6370_led_index index) if (index == MT6370_LED_ID_OFF) val = 0; else - val = 1 << (MT6370_SHIFT_RGB_ISNKDIM_BASE + index); + val = 1 << (MT6370_SHIFT_RGB_ISNKDIM_BASE - index); rt946x_update_bits(MT6370_REG_RGBEN, MT6370_MASK_RGB_ISNK_ALL_EN, val); return EC_SUCCESS; diff --git a/driver/charger/rt946x.h b/driver/charger/rt946x.h index 69e7b8b6af..d82d6e8e6d 100644 --- a/driver/charger/rt946x.h +++ b/driver/charger/rt946x.h @@ -393,7 +393,7 @@ #define MT6370_SHIFT_RGB_ISNK1DIM 7 #define MT6370_SHIFT_RGB_ISNK2DIM 6 #define MT6370_SHIFT_RGB_ISNK3DIM 5 -#define MT6370_SHIFT_RGB_ISNKDIM_BASE 4 +#define MT6370_SHIFT_RGB_ISNKDIM_BASE 8 #define MT6370_MASK_RGB_ISNK1DIM_EN (1 << MT6370_SHIFT_RGB_ISNK1DIM) #define MT6370_MASK_RGB_ISNK2DIM_EN (1 << MT6370_SHIFT_RGB_ISNK2DIM) |