summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-07-08 10:54:20 -0700
committerChromeBot <chrome-bot@google.com>2013-07-08 18:03:30 -0700
commit958e43840eb64e5403d08e5d3289f6fa65500ba0 (patch)
tree82f8f8e7261982148ce7487432e9a51bf25ade54
parent49799b827856bd911e6b86821a9ec95687c4ca78 (diff)
downloadchrome-ec-958e43840eb64e5403d08e5d3289f6fa65500ba0.tar.gz
snow: Snow is the exception for power LED settings
Instead of #if defined(BOARD_foo) for all new boards, flip around the No functional changes, just rearranging code. BUG=chrome-os-partner:20529 BRANCH=none TEST=keyboard LED still blinks in suspend on pit Change-Id: I185d642a5f412c8b4b0d16e62373c6b2bba71b0f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61108 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--chip/stm32/power_led.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/chip/stm32/power_led.c b/chip/stm32/power_led.c
index 4e33e239f1..8794c82d7c 100644
--- a/chip/stm32/power_led.c
+++ b/chip/stm32/power_led.c
@@ -49,24 +49,24 @@ static void power_led_set_duty(int percent)
* Set the duty cycle. CCRx = percent * ARR / 100. Since we set
* ARR=100, this is just percent.
*/
-#if defined(BOARD_pit) || defined(BOARD_puppy)
- STM32_TIM_CCR3(TIM_POWER_LED) = percent;
-#else
+#ifdef BOARD_snow
STM32_TIM_CCR2(TIM_POWER_LED) = percent;
+#else
+ STM32_TIM_CCR3(TIM_POWER_LED) = percent;
#endif
}
static void power_led_use_pwm(void)
{
/* Configure power LED GPIO for TIM2/PWM alternate function */
-#if defined(BOARD_pit) || defined(BOARD_puppy)
- /* PA2 = TIM2_CH3 */
- gpio_set_alternate_function(GPIO_A, (1 << 2), GPIO_ALT_TIM2);
-#else
+#ifdef BOARD_snow
/* PB3 = TIM2_CH2 */
uint32_t val = STM32_GPIO_CRL(GPIO_B) & ~0x0000f000;
val |= 0x00009000; /* alt. function (TIM2/PWM) */
STM32_GPIO_CRL(GPIO_B) = val;
+#else
+ /* PA2 = TIM2_CH3 */
+ gpio_set_alternate_function(GPIO_A, (1 << 2), GPIO_ALT_TIM2);
#endif
/* Enable timer */
@@ -87,18 +87,18 @@ static void power_led_use_pwm(void)
power_led_set_duty(100);
-#if defined(BOARD_pit) || defined(BOARD_puppy)
- /* CC3 configured as output, PWM mode 1, preload enable */
- STM32_TIM_CCMR2(TIM_POWER_LED) = (6 << 4) | (1 << 3);
-
- /* CC3 output enable, active low */
- STM32_TIM_CCER(TIM_POWER_LED) = (1 << 8) | (1 << 9);
-#else
+#ifdef BOARD_snow
/* CC2 configured as output, PWM mode 1, preload enable */
STM32_TIM_CCMR1(TIM_POWER_LED) = (6 << 12) | (1 << 11);
/* CC2 output enable, active low */
STM32_TIM_CCER(TIM_POWER_LED) = (1 << 4) | (1 << 5);
+#else
+ /* CC3 configured as output, PWM mode 1, preload enable */
+ STM32_TIM_CCMR2(TIM_POWER_LED) = (6 << 4) | (1 << 3);
+
+ /* CC3 output enable, active low */
+ STM32_TIM_CCER(TIM_POWER_LED) = (1 << 8) | (1 << 9);
#endif
/* Generate update event to force loading of shadow registers */