summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@chromium.org>2015-11-12 08:30:41 -0800
committerchrome-bot <chrome-bot@chromium.org>2015-11-13 15:28:24 -0800
commitd68cb398ab9b76eeab57230c32dd7c476c5e3377 (patch)
tree97da3f6c57c4729f34991b7afe6f2f3486758c94
parent43a4578a9b1b2f21a91c3747a29cca33bd27698c (diff)
downloadchrome-ec-d68cb398ab9b76eeab57230c32dd7c476c5e3377.tar.gz
chell: Add keyboard backlight
Add keyboard backlight to PWM2. BUG=chrome-os-partner:47435 BRANCH=none TEST=test keyboard backlight on chell Change-Id: Iab6b1ef95fc1428f0f8ac8b1503956fd990c0b60 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/312403 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r--board/chell/board.c8
-rw-r--r--board/chell/board.h9
-rw-r--r--board/chell/gpio.inc3
3 files changed, 19 insertions, 1 deletions
diff --git a/board/chell/board.c b/board/chell/board.c
index d16759d113..3e1c6e1b66 100644
--- a/board/chell/board.c
+++ b/board/chell/board.c
@@ -22,6 +22,8 @@
#include "pi3usb9281.h"
#include "power.h"
#include "power_button.h"
+#include "pwm.h"
+#include "pwm_chip.h"
#include "spi.h"
#include "switch.h"
#include "system.h"
@@ -102,6 +104,12 @@ const struct adc_t adc_channels[] = {
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
+/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
+const struct pwm_t pwm_channels[] = {
+ {2, PWM_CONFIG_ALT_CLOCK}, /* Use alternate 100kHz clock source */
+};
+BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
+
const struct i2c_port_t i2c_ports[] = {
{"pmic", MEC1322_I2C0_0, 400, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA},
{"muxes", MEC1322_I2C0_1, 400, GPIO_I2C0_1_SCL, GPIO_I2C0_1_SDA},
diff --git a/board/chell/board.h b/board/chell/board.h
index fc25f0a433..efff4de1b7 100644
--- a/board/chell/board.h
+++ b/board/chell/board.h
@@ -44,6 +44,8 @@
#define CONFIG_POWER_BUTTON
#define CONFIG_POWER_BUTTON_X86
#define CONFIG_POWER_COMMON
+#define CONFIG_PWM
+#define CONFIG_PWM_KBLIGHT
/* All data won't fit in data RAM. So, moving boundary slightly. */
#undef CONFIG_RO_SIZE
#define CONFIG_RO_SIZE (100 * 1024)
@@ -138,6 +140,13 @@ enum adc_channel {
ADC_CH_COUNT
};
+enum pwm_channel {
+ PWM_CH_KBLIGHT,
+
+ /* Number of PWM channels */
+ PWM_CH_COUNT
+};
+
/* power signal definitions */
enum power_signal {
X86_RSMRST_L_PWRGD = 0,
diff --git a/board/chell/gpio.inc b/board/chell/gpio.inc
index 469cb1d4a6..0fdfb4dd33 100644
--- a/board/chell/gpio.inc
+++ b/board/chell/gpio.inc
@@ -70,7 +70,6 @@ GPIO(WLAN_OFF_L, PIN(132), GPIO_OUT_LOW)
GPIO(TRACKPAD_INT_L, PIN(127), GPIO_INPUT)
GPIO(ENABLE_BACKLIGHT, PIN(202), GPIO_OUT_LOW)
GPIO(ENABLE_TOUCHPAD, PIN(53), GPIO_OUT_LOW)
-GPIO(PWM_KBLIGHT, PIN(34), GPIO_OUT_LOW)
GPIO(BAT_PRESENT_L, PIN(56), GPIO_INPUT)
GPIO(PLATFORM_EC_PROCHOT, PIN(151), GPIO_INPUT | GPIO_PULL_UP)
GPIO(CPU_PROCHOT, PIN(52), GPIO_OUT_LOW)
@@ -121,6 +120,8 @@ ALTERNATE(PIN_MASK(4, 0x0d), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT)
ALTERNATE(PIN_MASK(12, 0x60), 2, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT)
/* KB COL - GPIO142, GPIO144 */
ALTERNATE(PIN_MASK(14, 0x14), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT)
+/* Keyboard Backlight PWM - GPIO34 */
+ALTERNATE(PIN_MASK(3, 0x10), 1, MODULE_PWM_KBLIGHT, 0)
/* LPC pins */
/* LPC_CLK_RUN_L - GPIO014 */