From d7efe5cdda9286d8ffd4cbc6165f83dee5e9b898 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Thu, 16 May 2013 08:14:25 -0700 Subject: [PATCH] lm4: break out board-specific fan/tach pin config The current lm4 pwm module was using board-specific pins during this configuration. Move the implementation of configure_fan_gpios() to the board-specific files so that the pin configuration policy isn't a part of the common infrastructure. BUG=chrome-os-partner:19504 BRANCH=none TEST=successfully booted slippy with backlight turning on in OS. Change-Id: I325f1ac4639b4a78d8b860df7a8b688ca385b71b Signed-off-by: Aaron Durbin Reviewed-on: https://gerrit.chromium.org/gerrit/51471 Reviewed-by: Duncan Laurie --- board/link/board.c | 9 +++++++++ board/slippy/board.c | 9 +++++++++ chip/lm4/pwm_fan.c | 10 ---------- include/pwm.h | 5 +++++ 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/board/link/board.c b/board/link/board.c index 28ff9b3a14..e5eca5a79a 100644 --- a/board/link/board.c +++ b/board/link/board.c @@ -193,3 +193,12 @@ struct keyboard_scan_config keyscan_config = { 0xa4, 0xff, 0xf6, 0x55, 0xfa, 0xc8 /* full set */ }, }; + +/** + * Configure the GPIOs for the pwm module. + */ +void configure_fan_gpios(void) +{ + /* PM6:7 alternate function 1 = channel 0 PWM/tach */ + gpio_set_alternate_function(LM4_GPIO_M, 0xc0, 1); +} diff --git a/board/slippy/board.c b/board/slippy/board.c index 5d8016423f..5fe222ff33 100644 --- a/board/slippy/board.c +++ b/board/slippy/board.c @@ -157,3 +157,12 @@ struct keyboard_scan_config keyscan_config = { 0xa4, 0xff, 0xf6, 0x55, 0xfa, 0xc8 /* full set */ }, }; + +/** + * Configure the GPIOs for the pwm module. + */ +void configure_fan_gpios(void) +{ + /* PN2:3 alternate function 1 = channel 0 PWM/tach */ + gpio_set_alternate_function(LM4_GPIO_N, 0x0c, 1); +} diff --git a/chip/lm4/pwm_fan.c b/chip/lm4/pwm_fan.c index a19e42cca2..525b9daca2 100644 --- a/chip/lm4/pwm_fan.c +++ b/chip/lm4/pwm_fan.c @@ -42,16 +42,6 @@ struct pwm_fan_state { char pad; /* Pad to multiple of 4 bytes. */ }; -/** - * Configure the GPIOs for the pwm module. - */ -static void configure_fan_gpios(void) -{ - /* HEY: this is Link only. Slippy is PM2:3 */ - /* PM6:7 alternate function 1 = channel 0 PWM/tach */ - gpio_set_alternate_function(LM4_GPIO_M, 0xc0, 1); -} - void pwm_enable_fan(int enable) { if (enable) diff --git a/include/pwm.h b/include/pwm.h index bb6b5a8549..9c97ea2fda 100644 --- a/include/pwm.h +++ b/include/pwm.h @@ -67,4 +67,9 @@ int pwm_get_keyboard_backlight(void); */ void pwm_set_keyboard_backlight(int percent); +/** + * Configure the GPIOs for the pwm module -- board-specific. + */ +void configure_fan_gpios(void); + #endif /* __CROS_EC_PWM_H */