Files
OpenCellular/include/pwm.h
Shawn Nematbakhsh ab27f42f56 pwm: Add PWM_CONFIG_DSLEEP config flag
Add PWM_CONFIG_DSLEEP PWM config flag, which can be set to keep a
channel active during low-power idle / deep sleep. Currently it's
supported by npcx and mec1322.

BUG=chrome-os-partner:52783
BRANCH=glados
TEST=Manual on chell w/ subsequent commit + CONFIG_LOW_POWER_S0. Verify
KB backlight does not flicker during idle.

Change-Id: Ib9df5879aaa7dfa5764de1583496de84d40d2bb5
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341002
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
2016-04-27 23:58:04 -07:00

59 lines
1.4 KiB
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
/* The values are defined in board.h */
enum pwm_channel;
/**
* 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)
/**
* PWM clock select alternate source. The actual clock and alternate
* source are chip dependent.
*/
#define PWM_CONFIG_ALT_CLOCK (1 << 2)
/**
* PWM channel has a complementary output signal which should be enabled in
* addition to the primary output.
*/
#define PWM_CONFIG_COMPLEMENTARY_OUTPUT (1 << 3)
/**
* PWM channel must stay active in low-power idle, if enabled.
*/
#define PWM_CONFIG_DSLEEP (1 << 4)
#endif /* __CROS_EC_PWM_H */