summaryrefslogtreecommitdiff
path: root/board/kevin
diff options
context:
space:
mode:
authorDavid Schneider <dnschneid@chromium.org>2016-12-01 18:48:44 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-12-05 16:43:18 -0800
commit3d4bb5f64917ab25f3538a8ec8c6410f41f46afd (patch)
treeda4467beb569ebdca757877c01c5d0c99ed3b867 /board/kevin
parentf66113247a7fb0f8fcc015a50b85137d1ab044a1 (diff)
downloadchrome-ec-3d4bb5f64917ab25f3538a8ec8c6410f41f46afd.tar.gz
gru: control LEDs by changing frequency
gru has circuitrythat selects the charge LED color based on the frequency of the PWM. By adjusting the PWM frequency instead of just the duty, we gain more control over the brightness of the charge LED. BUG=chrome-os-partner:54155 BRANCH=gru TEST=activate each LED in turn and confirm color and brightness Change-Id: Ie653125a528595c1ec68aea4d02cb70595a1b151 Signed-off-by: David Schneider <dnschneid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/415517 Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'board/kevin')
-rw-r--r--board/kevin/led_gru.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/board/kevin/led_gru.c b/board/kevin/led_gru.c
index 73c55b109d..35b9e22117 100644
--- a/board/kevin/led_gru.c
+++ b/board/kevin/led_gru.c
@@ -13,6 +13,7 @@
#include "led_common.h"
#include "lid_switch.h"
#include "pwm.h"
+#include "pwm_chip.h"
#include "util.h"
#define GRU_BAT_LED_PWM PWM_CH_LED_RED
@@ -29,16 +30,23 @@ enum led_color {
LED_COLOR_COUNT /* Number of colors, not a color itself */
};
-/* One LED active at a time. PWM low period determines which LED is active. */
+/* One LED active at a time. edge frequency determines which LED is active. */
static const int led_color_to_pwm_duty[LED_COLOR_COUNT] = {
[LED_OFF] = 100,
[LED_RED] = 0,
[LED_AMBER] = 80,
- [LED_GREEN] = 10,
+ [LED_GREEN] = 70,
+};
+static const int led_color_to_pwm_frequency[LED_COLOR_COUNT] = {
+ [LED_OFF] = 1,
+ [LED_RED] = 1,
+ [LED_AMBER] = 1100,
+ [LED_GREEN] = 200,
};
static int bat_led_set_color(enum led_color color)
{
+ pwm_set_freq(GRU_BAT_LED_PWM, led_color_to_pwm_frequency[color]);
pwm_set_duty(GRU_BAT_LED_PWM, led_color_to_pwm_duty[color]);
return EC_SUCCESS;
}