summaryrefslogtreecommitdiff
path: root/board/volteer/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/volteer/board.c')
-rw-r--r--board/volteer/board.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/board/volteer/board.c b/board/volteer/board.c
index dc81ada7d5..4f0e0ef6be 100644
--- a/board/volteer/board.c
+++ b/board/volteer/board.c
@@ -21,6 +21,8 @@
#include "lid_switch.h"
#include "power.h"
#include "power_button.h"
+#include "pwm.h"
+#include "pwm_chip.h"
#include "switch.h"
#include "system.h"
#include "task.h"
@@ -56,7 +58,9 @@ __override void config_volteer_gpios(void)
static void board_init(void)
{
- /* TODO */
+ /* Illuminate motherboard and daughter board LEDs equally to start. */
+ pwm_enable(PWM_CH_LED4_SIDESEL, 1);
+ pwm_set_duty(PWM_CH_LED4_SIDESEL, 50);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -174,3 +178,48 @@ const struct i2c_port_t i2c_ports[] = {
},
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+
+/******************************************************************************/
+/* PWM configuration */
+const struct pwm_t pwm_channels[] = {
+ [PWM_CH_LED1_BLUE] = {
+ .channel = 2,
+ .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ .freq = 2400,
+ },
+ [PWM_CH_LED2_GREEN] = {
+ .channel = 0,
+ .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ .freq = 2400,
+ },
+ [PWM_CH_LED3_RED] = {
+ .channel = 1,
+ .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ .freq = 2400,
+ },
+ [PWM_CH_LED4_SIDESEL] = {
+ .channel = 7,
+ .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ /* Run at a higher frequency than the color PWM signals to avoid
+ * timing-based color shifts.
+ */
+ .freq = 4800,
+ },
+ [PWM_CH_FAN] = {
+ .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000
+ },
+ [PWM_CH_KBLIGHT] = {
+ .channel = 3,
+ .flags = 0,
+ /*
+ * Set PWM frequency to multiple of 50 Hz and 60 Hz to prevent
+ * flicker. Higher frequencies consume similar average power to
+ * lower PWM frequencies, but higher frequencies record a much
+ * lower maximum power.
+ */
+ .freq = 2400,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);