diff options
author | Furquan Shaikh <furquan@chromium.org> | 2017-09-22 12:54:28 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-10-03 14:26:09 -0700 |
commit | a27f1049b6d92d46de9a648ba64f451387a598d4 (patch) | |
tree | d7396d9183f565c2fbbecf2b9d4da6bd2880c5e3 /include | |
parent | 29dc221f98fa85efd3b351f0816c037562952753 (diff) | |
download | chrome-ec-a27f1049b6d92d46de9a648ba64f451387a598d4.tar.gz |
power: Add flags parameter to power_signal_info
Replace structure member "level" in power_signal_info with "flags".
"level" has been used on all boards to indicate active-high or
active-low levels. Addition of "flags" allows easy extension of
power_signal_info structure to define various flags that might be
applicable to power signals (e.g. "level"). Going forward, additional
flag will be added in follow-up CLs.
Also, provide a helper function power_signal_is_asserted that checks
the actual level of a signal and compares it to the flags level to
identify if a power signal is asserted.
BUG=b:65421825
BRANCH=None
TEST=make -j buildall
Change-Id: Iacaabd1185b347c17b5159f05520731505b824b8
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/679979
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/power.h | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/include/power.h b/include/power.h index cdfcbcd173..9e0c29bd1b 100644 --- a/include/power.h +++ b/include/power.h @@ -36,10 +36,26 @@ enum power_state { #endif }; +/* + * Power signal flags: + * + * +-----------------+------------------------------------+ + * | Bit # | Description | + * +------------------------------------------------------+ + * | 0 | Active level (low/high) | + * +------------------------------------------------------+ + * | 1 : 32 | Reserved | + * +-----------------+------------------------------------+ + */ + +#define POWER_SIGNAL_ACTIVE_STATE (1 << 0) +#define POWER_SIGNAL_ACTIVE_LOW (0 << 0) +#define POWER_SIGNAL_ACTIVE_HIGH (1 << 0) + /* Information on an power signal */ struct power_signal_info { enum gpio_signal gpio; /* GPIO for signal */ - int level; /* GPIO level which sets signal bit */ + uint32_t flags; /* See POWER_SIGNAL_* macros */ const char *name; /* Name of signal */ }; @@ -58,6 +74,15 @@ extern const struct power_signal_info power_signal_list[]; uint32_t power_get_signals(void); /** + * Check if provided power signal is currently asserted. + * + * @param s Power signal that needs to be checked. + * + * @return 1 if power signal is asserted, 0 otherwise. + */ +int power_signal_is_asserted(const struct power_signal_info *s); + +/** * Check for required inputs * * @param want Mask of signals which must be present (one or more |