summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-01-12 11:09:56 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-01-18 20:18:16 -0800
commitc7040bf38a2bc9b9566e9e8ddec0fed3bd15e897 (patch)
tree4c112288b7114ebb4a576b8a1b414d999ae9d3eb
parentead2428e915ba97185d35dfcfcf86feda5ff0059 (diff)
downloadchrome-ec-stabilize-10323.29.B.tar.gz
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>
-rw-r--r--board/grunt/board.c19
-rw-r--r--board/grunt/board.h4
-rw-r--r--board/grunt/gpio.inc1
3 files changed, 22 insertions, 2 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)
{
diff --git a/board/grunt/board.h b/board/grunt/board.h
index bcec4887f7..9356ad74f6 100644
--- a/board/grunt/board.h
+++ b/board/grunt/board.h
@@ -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
};
diff --git a/board/grunt/gpio.inc b/board/grunt/gpio.inc
index 2a4cc5bec8..03a5f9ed6d 100644
--- a/board/grunt/gpio.inc
+++ b/board/grunt/gpio.inc
@@ -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 */