diff options
author | Simon Glass <sjg@chromium.org> | 2018-01-12 11:09:56 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-01-18 20:18:16 -0800 |
commit | c7040bf38a2bc9b9566e9e8ddec0fed3bd15e897 (patch) | |
tree | 4c112288b7114ebb4a576b8a1b414d999ae9d3eb /board/grunt/board.c | |
parent | ead2428e915ba97185d35dfcfcf86feda5ff0059 (diff) | |
download | chrome-ec-c7040bf38a2bc9b9566e9e8ddec0fed3bd15e897.tar.gz |
grunt: Add PWMs for battery / charger LEDsstabilize-10323.31.Bstabilize-10323.30.Bstabilize-10323.29.Bfactory-soraka-10323.B
Connect these up so that we can test the hardware.
BUG=b:71902053
BRANCH=none
TEST=manually on EC:
> pwm
PWM channels:
0: 0%
1: 100%
2: 100%
> pwm 1 50
Setting channel 1 to 50
1: 50%
> pwm 2 50
Setting channel 2 to 50
2: 50%
> pwm 1 10
Setting channel 1 to 10
1: 10%
See that the colours changes orange/blue
Change-Id: I9bc3f4c0eb033f58d7bfe524ba99f8dd2e177eef
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/865101
Reviewed-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'board/grunt/board.c')
-rw-r--r-- | board/grunt/board.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/board/grunt/board.c b/board/grunt/board.c index deac1ead57..7a5005df34 100644 --- a/board/grunt/board.c +++ b/board/grunt/board.c @@ -406,7 +406,15 @@ struct keyboard_scan_config keyscan_config = { /* PWM channels. Must be in the exactly same order as in enum pwm_channel. */ const struct pwm_t pwm_channels[] = { - [PWM_CH_KBLIGHT] = { 5, 0, 100 }, + [PWM_CH_KBLIGHT] = { 5, 0, 100 }, + [PWM_CH_LED1_ORANGE] = { + 0, PWM_CONFIG_OPEN_DRAIN | PWM_CONFIG_ACTIVE_LOW | + PWM_CONFIG_DSLEEP, 100 + }, + [PWM_CH_LED2_BLUE] = { + 2, PWM_CONFIG_OPEN_DRAIN | PWM_CONFIG_ACTIVE_LOW | + PWM_CONFIG_DSLEEP, 100 + }, }; BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); @@ -601,6 +609,15 @@ struct motion_sensor_t motion_sensors[] = { const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); +static void board_init_leds_off(void) +{ + /* Initialize the LEDs off. */ + /* TODO(sjg): Eventually do something with these LEDs. */ + pwm_set_duty(PWM_CH_LED1_ORANGE, 0); + pwm_set_duty(PWM_CH_LED2_BLUE, 0); +} +DECLARE_HOOK(HOOK_INIT, board_init_leds_off, HOOK_PRIO_INIT_PWM + 1); + #ifndef TEST_BUILD void lid_angle_peripheral_enable(int enable) { |