Files
OpenCellular/include/pwm.h
Vic Yang 5d014fd2dd 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>
2013-08-27 23:20:33 +00:00

43 lines
933 B
C

/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef __CROS_EC_PWM_H
#define __CROS_EC_PWM_H
/**
* Enable/disable a PWM channel.
*/
void pwm_enable(enum pwm_channel ch, int enabled);
/**
* Get PWM channel enabled status.
*/
int pwm_get_enabled(enum pwm_channel ch);
/**
* Set PWM channel duty cycle (0-100).
*/
void pwm_set_duty(enum pwm_channel ch, int percent);
/**
* Get PWM channel duty cycle.
*/
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)
/**
* PWM channel has a fan controller with a tach input and can auto-adjust
* its duty cycle to produce a given fan RPM.
*/
#define PWM_CONFIG_HAS_RPM_MODE (1 << 1)
#endif /* __CROS_EC_PWM_H */