diff options
author | Vic Yang <victoryang@chromium.org> | 2013-08-05 11:17:35 +0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-08-27 23:20:33 +0000 |
commit | 5d014fd2dd5e92ad35a4f2dd1b58e0b1baebb65e (patch) | |
tree | 2078f9831177392f22ba202cbea4b09d69a9a710 /include/pwm.h | |
parent | 99f06c39aabd262653c96c589c5cd26fc1fb8389 (diff) | |
download | chrome-ec-5d014fd2dd5e92ad35a4f2dd1b58e0b1baebb65e.tar.gz |
Refactor PWM module
This unifies the PWM module interface for LM4 and STM32. Now PWM
channels are defined in board.h/board.c. Instead of calling functions
named pwm_set_fan_duty(x), one can now use pwm_set_duty(PWM_CH_FAN, x),
which prevents additional functions added when we have a new PWM
channel.
BUG=chrome-os-partner:18343
TEST=Limit input current on Spring.
TEST=Check power LED in S0/S3/S5 on Snow.
TEST=Check keyboard backlight functionality on Link.
TEST=Check fan speed control/detecting on Link.
BRANCH=None
Change-Id: Ibac4d79f72e65c94776d503558a7592f7db859dc
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/64450
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include/pwm.h')
-rw-r--r-- | include/pwm.h | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/include/pwm.h b/include/pwm.h index 4f399832c2..cb0f961713 100644 --- a/include/pwm.h +++ b/include/pwm.h @@ -7,28 +7,36 @@ #define __CROS_EC_PWM_H /** - * Set the fan PWM duty cycle (0-100), disabling the automatic control. + * Enable/disable a PWM channel. */ -void pwm_set_fan_duty(int percent); +void pwm_enable(enum pwm_channel ch, int enabled); /** - * Enable/disable the keyboard backlight. + * Get PWM channel enabled status. */ -void pwm_enable_keyboard_backlight(int enable); +int pwm_get_enabled(enum pwm_channel ch); /** - * Get the keyboard backlight enable/disable status (1=enabled, 0=disabled). + * Set PWM channel duty cycle (0-100). */ -int pwm_get_keyboard_backlight_enabled(void); +void pwm_set_duty(enum pwm_channel ch, int percent); /** - * Get the keyboard backlight percentage (0=off, 100=max). + * Get PWM channel duty cycle. */ -int pwm_get_keyboard_backlight(void); +int pwm_get_duty(enum pwm_channel ch); + +/* Flags for PWM config table */ + +/** + * PWM output signal is inverted, so 100% duty means always low + */ +#define PWM_CONFIG_ACTIVE_LOW (1 << 0) /** - * Set the keyboard backlight percentage (0=off, 100=max). + * PWM channel has a fan controller with a tach input and can auto-adjust + * its duty cycle to produce a given fan RPM. */ -void pwm_set_keyboard_backlight(int percent); +#define PWM_CONFIG_HAS_RPM_MODE (1 << 1) #endif /* __CROS_EC_PWM_H */ |