diff options
author | xiong.huang <xiong.huang@bitland.corp-partner.google.com> | 2020-04-20 22:08:52 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-04-28 06:45:21 +0000 |
commit | 5630318f65ceefa82e5f69efec64f07c2d81cdb2 (patch) | |
tree | dff8352b1b2da4e0aaaa1096cf52757dfd12c219 /board/malefor/board.c | |
parent | 6430b8b4536758473cfe4c71ef6afaeaeecc9c63 (diff) | |
download | chrome-ec-5630318f65ceefa82e5f69efec64f07c2d81cdb2.tar.gz |
volteer: move the PWM configuration and LED support from baseboard to boards
Considering the LED circuits for the derived boards differ significantly
from Volteer and every OEM would have different requirements for LED
behavior. So move the PWM configuration and LED support from baseboard
(volteer) to board (halvor, malefor and volteer), there will be happy to
redefine LED behavior in boards.
BUG=b:154447182
BRANCH=none
TEST=make buildall
Signed-off-by: xiong.huang <xiong.huang@bitland.corp-partner.google.com>
Change-Id: I578459d4dd75abce4eed83e1f69a14886bb6a0f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2156688
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'board/malefor/board.c')
-rw-r--r-- | board/malefor/board.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/board/malefor/board.c b/board/malefor/board.c index d6299edc0a..0b382469c5 100644 --- a/board/malefor/board.c +++ b/board/malefor/board.c @@ -18,6 +18,8 @@ #include "lid_switch.h" #include "power.h" #include "power_button.h" +#include "pwm.h" +#include "pwm_chip.h" #include "switch.h" #include "system.h" #include "task.h" @@ -35,6 +37,10 @@ static void board_init(void) /* Enable gpio interrupt for camera vsync */ gpio_enable_interrupt(GPIO_EC_CAM_VSYN_SLP_S0IX); + + /* Illuminate motherboard and daughter board LEDs equally to start. */ + pwm_enable(PWM_CH_LED4_SIDESEL, 1); + pwm_set_duty(PWM_CH_LED4_SIDESEL, 50); } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); @@ -269,3 +275,48 @@ const struct i2c_port_t i2c_ports[] = { }, }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); + +/******************************************************************************/ +/* PWM configuration */ +const struct pwm_t pwm_channels[] = { + [PWM_CH_LED1_BLUE] = { + .channel = 2, + .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, + .freq = 2400, + }, + [PWM_CH_LED2_GREEN] = { + .channel = 0, + .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, + .freq = 2400, + }, + [PWM_CH_LED3_RED] = { + .channel = 1, + .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, + .freq = 2400, + }, + [PWM_CH_LED4_SIDESEL] = { + .channel = 7, + .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, + /* Run at a higher frequency than the color PWM signals to avoid + * timing-based color shifts. + */ + .freq = 4800, + }, + [PWM_CH_FAN] = { + .channel = 5, + .flags = PWM_CONFIG_OPEN_DRAIN, + .freq = 25000 + }, + [PWM_CH_KBLIGHT] = { + .channel = 3, + .flags = 0, + /* + * Set PWM frequency to multiple of 50 Hz and 60 Hz to prevent + * flicker. Higher frequencies consume similar average power to + * lower PWM frequencies, but higher frequencies record a much + * lower maximum power. + */ + .freq = 2400, + }, +}; +BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); |