grunt: Add PWMs for battery / charger LEDs

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>
This commit is contained in:
Simon Glass
2018-01-12 11:09:56 -08:00
committed by chrome-bot
parent ead2428e91
commit c7040bf38a
3 changed files with 22 additions and 2 deletions

View File

@@ -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)
{

View File

@@ -172,7 +172,9 @@ enum temp_sensor_id {
};
enum pwm_channel {
PWM_CH_KBLIGHT,
PWM_CH_KBLIGHT = 0,
PWM_CH_LED1_ORANGE,
PWM_CH_LED2_BLUE,
PWM_CH_COUNT
};

View File

@@ -96,6 +96,7 @@ ALTERNATE(PIN_MASK(3, 0x48), 1, MODULE_I2C, 0) /* I2C5 */
ALTERNATE(PIN_MASK(B, 0x0C), 1, MODULE_I2C, 0) /* I2C7 */
ALTERNATE(PIN_MASK(4, 0x30), 1, MODULE_ADC, 0) /* ADC0-1 */
ALTERNATE(PIN_MASK(B, 0x80), 1, MODULE_PWM, 0) /* KB Backlight */
ALTERNATE(PIN_MASK(C, 0x18), 1, MODULE_PWM, 0) /* LED 1 & 2 */
/* Keyboard Pins */
ALTERNATE(PIN_MASK(3, 0x03), 0, MODULE_KEYBOARD_SCAN, GPIO_INPUT) /* KSI_00-01 */