diff --git a/board/hammer/board.c b/board/hammer/board.c index eccf6f5cac..2f03082a6b 100644 --- a/board/hammer/board.c +++ b/board/hammer/board.c @@ -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. diff --git a/board/hammer/board.h b/board/hammer/board.h index ca7b636309..f627a2474c 100644 --- a/board/hammer/board.h +++ b/board/hammer/board.h @@ -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 */