diff options
author | Randall Spangler <rspangler@chromium.org> | 2013-10-07 10:59:45 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-10-08 20:41:32 +0000 |
commit | ff8c8fee79e148567c0f2128db69563acb29ee54 (patch) | |
tree | 0d3daa52c091a36c997c0cd42be8267678a13f7f /board/rambi/board.c | |
parent | 99157c265c8353e166059e17d250d9991d4e7ae0 (diff) | |
download | chrome-ec-ff8c8fee79e148567c0f2128db69563acb29ee54.tar.gz |
rambi: Control LEDs using PWM
Rambi has a pair of LEDs which are attached to the PWM fan controller.
Add support for them. Also add a generic 'pwmduty' command which can
be used to get/set the duty cycle for any PWM channel.
Also fix rounding errors in pwm module, so that set/get duty doesn't
keep rounding down.
BUG=chrome-os-partner:22895
BRANCH=none
TEST=Boot rambi. LEDs are off.
pwmduty -> both are 0%
pwmduty 0 10 -> green LED on dimly
pwmduty 1 10 -> red LED on dimly
pwmduty 0 99 -> green LED on brightly
pwmduty 1 100 -> red LED on brightly
pwmduty 1 0 -> red LED off
pwmduty 1 -1 -> red LED turns back on because fan controller is disabled
pwmduty -> channel 0 at 99%, channel 1 disabled
Build all platforms. Pass all unit tests.
Change-Id: Ib0a6289a757554e696a9a0153a85bdc34e2ee2ae
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/172094
Diffstat (limited to 'board/rambi/board.c')
-rw-r--r-- | board/rambi/board.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/board/rambi/board.c b/board/rambi/board.c index b864de5ef1..7a6f926763 100644 --- a/board/rambi/board.c +++ b/board/rambi/board.c @@ -110,7 +110,7 @@ const struct gpio_alt_func gpio_alt_funcs[] = { {GPIO_D, 0x0f, 2, MODULE_SPI}, /* SPI1 */ {GPIO_L, 0x3f, 15, MODULE_LPC}, /* LPC */ {GPIO_M, 0x33, 15, MODULE_LPC}, /* LPC */ - {GPIO_N, 0x50, 1, MODULE_PWM_LED}, /* Power LEDs */ + {GPIO_N, 0x50, 1, MODULE_PWM_LED, GPIO_OPEN_DRAIN}, /* Power LEDs */ }; const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs); @@ -152,8 +152,8 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); /* PWM channels */ const struct pwm_t pwm_channels[] = { - [PWM_CH_LED_GREEN] = {4, 0}, - [PWM_CH_LED_RED] = {3, 0}, + [PWM_CH_LED_GREEN] = {4, PWM_CONFIG_ACTIVE_LOW}, + [PWM_CH_LED_RED] = {3, PWM_CONFIG_ACTIVE_LOW}, }; BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); |