hammer: Enable PWM output for keyboard backlight

BRANCH=none
BUG=chrome-os-partner:59083
TEST=make BOARD=hammer -j

Change-Id: Ibbf82c6c0f8115cbf611c74fc0585e97850d2019
Reviewed-on: https://chromium-review.googlesource.com/430575
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Nicolas Boichat
2016-11-17 18:12:59 +08:00
committed by chrome-bot
parent 047f41b978
commit 358bc0a7fd
2 changed files with 19 additions and 1 deletions

View File

@@ -11,6 +11,8 @@
#include "hooks.h"
#include "i2c.h"
#include "keyboard_raw.h"
#include "pwm.h"
#include "pwm_chip.h"
#include "registers.h"
#include "task.h"
#include "update_fw.h"
@@ -47,6 +49,12 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
{STM32_TIM(TIM_KBLIGHT), STM32_TIM_CH(1), 0, 100 /* Hz */ },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/******************************************************************************
* Support firmware upgrade over USB. We can update whichever section is not
* the current section.

View File

@@ -70,6 +70,9 @@
#define CONFIG_I2C_MASTER
#define I2C_PORT_MASTER 0
/* Enable PWM */
#define CONFIG_PWM
/* Sign and switch to RW partition on boot. */
#define CONFIG_RWSIG
#define CONFIG_RSA
@@ -86,7 +89,8 @@
/* Timer selection */
#define TIM_CLOCK32 2
#define TIM_WATCHDOG 17
#define TIM_WATCHDOG 16
#define TIM_KBLIGHT 17
#include "gpio_signal.h"
@@ -101,5 +105,11 @@ enum usb_strings {
USB_STR_COUNT
};
enum pwm_channel {
PWM_CH_KBLIGHT = 0,
/* Number of PWM channels */
PWM_CH_COUNT
};
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BOARD_H */