From aceec6e4b83235bc732ab00b77ec0a2d0383b55b Mon Sep 17 00:00:00 2001 From: Aseda Aboagye Date: Tue, 12 Dec 2017 10:33:19 -0800 Subject: [PATCH] meowth: zoombini: Reduce LED brightness. Having seen how bright the LEDs are without a diffuser, let's turn the brightness way down for the time being. BUG=None BRANCH=None TEST=Flash a meowth, notice it's much less bright, listen to the praises of my retinas. TEST=Flash zoombini, verify that LEDs still work as before, just dimmer. Change-Id: I7762ba9f0a7ce930b7b177c6d11ed664a87019e0 Signed-off-by: Aseda Aboagye Reviewed-on: https://chromium-review.googlesource.com/823281 Commit-Ready: Aseda Aboagye Tested-by: Aseda Aboagye Reviewed-by: Shawn N --- board/zoombini/board.c | 21 +++++++++++++++++++-- board/zoombini/board.h | 9 +++++++++ board/zoombini/led.c | 14 +++++++++++++- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/board/zoombini/board.c b/board/zoombini/board.c index 3f32d1b03c..d9c36d375b 100644 --- a/board/zoombini/board.c +++ b/board/zoombini/board.c @@ -123,9 +123,18 @@ const struct adc_t adc_channels[] = { /* PWM channels. Must be in the exactly same order as in enum pwm_channel. */ /* TODO(aaboagye): Add the additional Meowth LEDs */ const struct pwm_t pwm_channels[] = { - [PWM_CH_LED_GREEN] = { 0, PWM_CONFIG_DSLEEP, 100 }, - [PWM_CH_LED_RED] = { 2, PWM_CONFIG_DSLEEP, 100 }, +#ifdef BOARD_MEOWTH + [PWM_CH_DB0_LED_RED] = { 3, PWM_CONFIG_DSLEEP, 120 }, + [PWM_CH_DB0_LED_GREEN] = { 0, PWM_CONFIG_DSLEEP, 120 }, + [PWM_CH_DB0_LED_BLUE] = { 2, PWM_CONFIG_DSLEEP, 120 }, + [PWM_CH_DB1_LED_RED] = { 7, PWM_CONFIG_DSLEEP, 120 }, + [PWM_CH_DB1_LED_GREEN] = { 5, PWM_CONFIG_DSLEEP, 120 }, + [PWM_CH_DB1_LED_BLUE] = { 6, PWM_CONFIG_DSLEEP, 120 }, +#else /* !defined(BOARD_MEOWTH) */ + [PWM_CH_LED_GREEN] = { 0, PWM_CONFIG_DSLEEP, 120 }, + [PWM_CH_LED_RED] = { 2, PWM_CONFIG_DSLEEP, 120 }, [PWM_CH_KBLIGHT] = { 3, 0, 100 }, +#endif /* defined(BOARD_MEOWTH) */ }; BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); @@ -290,6 +299,14 @@ static void board_init(void) int i; #endif /* defined(BOARD_ZOOMBINI) */ +#ifdef BOARD_MEOWTH + /* TODO(aaboagye): Eventually do something with these LEDs. */ + pwm_set_duty(PWM_CH_DB0_LED_BLUE, 100); + pwm_set_duty(PWM_CH_DB1_LED_RED, 100); + pwm_set_duty(PWM_CH_DB1_LED_GREEN, 100); + pwm_set_duty(PWM_CH_DB1_LED_BLUE, 100); +#endif /* defined(BOARD_MEOWTH) */ + #ifdef BOARD_ZOOMBINI /* Enable PPC interrupts. */ gpio_enable_interrupt(GPIO_USB_C0_PPC_INT_L); diff --git a/board/zoombini/board.h b/board/zoombini/board.h index 11ae9b5d68..7b66234628 100644 --- a/board/zoombini/board.h +++ b/board/zoombini/board.h @@ -189,9 +189,18 @@ enum adc_channel { }; enum pwm_channel { +#ifdef BOARD_MEOWTH + PWM_CH_DB0_LED_RED = 0, + PWM_CH_DB0_LED_GREEN, + PWM_CH_DB0_LED_BLUE, + PWM_CH_DB1_LED_RED, + PWM_CH_DB1_LED_GREEN, + PWM_CH_DB1_LED_BLUE, +#else /* !defined(BOARD_MEOWTH) */ PWM_CH_LED_GREEN = 0, PWM_CH_LED_RED, PWM_CH_KBLIGHT, +#endif /* defined(BOARD_MEOWTH) */ PWM_CH_COUNT }; diff --git a/board/zoombini/led.c b/board/zoombini/led.c index 2ba4d6511e..b74734ea78 100644 --- a/board/zoombini/led.c +++ b/board/zoombini/led.c @@ -25,13 +25,25 @@ enum led_id { }; static enum pwm_channel led_pwm_ch_map[EC_LED_ID_COUNT] = { +#ifdef BOARD_MEOWTH + [EC_LED_ID_POWER] = PWM_CH_DB0_LED_GREEN, + [EC_LED_ID_BATTERY] = PWM_CH_DB0_LED_RED, +#else /* !defined(BOARD_MEOWTH) */ [EC_LED_ID_POWER] = PWM_CH_LED_GREEN, [EC_LED_ID_BATTERY] = PWM_CH_LED_RED, +#endif /* defined(BOARD_MEOWTH) */ }; static void set_led_state(enum led_id id, int on) { - pwm_set_duty(led_pwm_ch_map[id], on ? 20 : 100); + int val; +#ifdef BOARD_MEOWTH + val = on ? 98 : 100; +#else /* !defined(BOARD_MEOWTH) */ + val = on ? 90 : 100; +#endif /* defined(BOARD_MEOWTH) */ + + pwm_set_duty(led_pwm_ch_map[id], val); } static uint8_t power_led_is_pulsing;