diff options
author | Scott Collyer <scollyer@google.com> | 2018-12-19 11:06:58 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-01-30 13:06:36 -0800 |
commit | 9726522566fc1169df30d54764d78719e0dc75b3 (patch) | |
tree | e7c98eba3338ae66d31bf73d9ca5523a57488eab /board | |
parent | f0efcfb98fa5fca8a7c56b10ea48b808cc0f144a (diff) | |
download | chrome-ec-9726522566fc1169df30d54764d78719e0dc75b3.tar.gz |
hatch: Add support for keyboard backlight
This CL adds board specific config options, functions and GPIO signal
required for keyboard backlight support.
BRANCH=none
BUG=b:122251649
TEST=make buildall
Change-Id: Ib60a7c861d2a85939592556437bd6202e6815947
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1387590
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/hatch/board.c | 9 | ||||
-rw-r--r-- | board/hatch/board.h | 4 | ||||
-rw-r--r-- | board/hatch/gpio.inc | 5 |
3 files changed, 18 insertions, 0 deletions
diff --git a/board/hatch/board.c b/board/hatch/board.c index 0277164932..185794f0bc 100644 --- a/board/hatch/board.c +++ b/board/hatch/board.c @@ -12,6 +12,8 @@ #include "lid_switch.h" #include "power.h" #include "power_button.h" +#include "pwm.h" +#include "pwm_chip.h" #include "spi.h" #include "switch.h" #include "system.h" @@ -71,6 +73,13 @@ const struct spi_device_t spi_devices[] = { }; const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); +/******************************************************************************/ +/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */ +const struct pwm_t pwm_channels[] = { + [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 } +}; +BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); + void board_overcurrent_event(int port, int is_overcurrented) { /* Sanity check the port. */ diff --git a/board/hatch/board.h b/board/hatch/board.h index bf9c21bf9b..7f91551111 100644 --- a/board/hatch/board.h +++ b/board/hatch/board.h @@ -26,6 +26,9 @@ #undef CONFIG_UART_TX_BUF_SIZE #define CONFIG_UART_TX_BUF_SIZE 4096 +/* Keyboard features */ +#define CONFIG_PWM_KBLIGHT + /* * Macros for GPIO signals used in common code that don't match the * schematic names. Signal names in gpio.inc match the schematic and are @@ -50,6 +53,7 @@ enum adc_channel { }; enum pwm_channel { + PWM_CH_KBLIGHT, PWM_CH_COUNT }; diff --git a/board/hatch/gpio.inc b/board/hatch/gpio.inc index d277cf7fac..82a65b91d2 100644 --- a/board/hatch/gpio.inc +++ b/board/hatch/gpio.inc @@ -56,6 +56,8 @@ GPIO(LED_1_L, PIN(C, 4), GPIO_OUT_HIGH) /* Yellow (hatch GPIO(LED_2_L, PIN(C, 3), GPIO_OUT_HIGH) /* White (hatch) */ GPIO(LED_3_L, PIN(C, 2), GPIO_OUT_HIGH) GPIO(LED_4_L, PIN(6, 0), GPIO_OUT_HIGH) +GPIO(EC_KB_BL_EN, PIN(8, 6), GPIO_OUT_LOW) /* Keyboard backlight */ + /* I2C pins - Alternate function below configures I2C module on these pins */ GPIO(I2C0_SCL, PIN(B, 5), GPIO_INPUT | @@ -90,3 +92,6 @@ ALTERNATE(PIN_MASK(8, 0x80), 0, MODULE_I2C, 0) /* I2 ALTERNATE(PIN_MASK(D, 0x03), 0, MODULE_I2C, 0) /* I2C3 */ ALTERNATE(PIN_MASK(3, 0x48), 0, MODULE_I2C, 0) /* I2C5 */ ALTERNATE(PIN_MASK(B, 0x0C), 0, MODULE_I2C, 0) /* I2C7 */ + +/* PWM */ +ALTERNATE(PIN_MASK(8, 0x01), 0, MODULE_PWM, 0) /* PWM3 */ |