diff options
author | Vijay Hiremath <vijay.p.hiremath@intel.com> | 2019-10-25 03:38:30 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-11-01 02:46:00 +0000 |
commit | 3b390264a415ce121a8c6f8db9fa9c42c647aaec (patch) | |
tree | ef137798bf0672d035e644784c27f2f7162d3db2 /include/gpio.h | |
parent | 946402100fd0589b5480eebd8444a7c3eb9b6aa5 (diff) | |
download | chrome-ec-3b390264a415ce121a8c6f8db9fa9c42c647aaec.tar.gz |
Cleanup: Correct GPIO alternate function parameter
Added code to correct the GPIO alternate function parameter at Chipset
level. Optionally board level functions can cleanup the code in additional
change lists.
BUG=b:139427854
BRANCH=none
TEST=make buildall -j
Change-Id: I1171ca36a703291070fc89f972f84414adcf04fc
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1880974
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'include/gpio.h')
-rw-r--r-- | include/gpio.h | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/include/gpio.h b/include/gpio.h index 3b39ad9314..e5e8afe24a 100644 --- a/include/gpio.h +++ b/include/gpio.h @@ -11,6 +11,7 @@ #include "common.h" /* Flag definitions for gpio_info and gpio_alt_func */ +#define GPIO_FLAG_NONE 0 /* No flag needed, default setting */ /* The following are valid for both gpio_info and gpio_alt_func: */ #define GPIO_OPEN_DRAIN BIT(0) /* Output type is open-drain */ #define GPIO_PULL_UP BIT(1) /* Enable on-chip pullup */ @@ -64,6 +65,21 @@ enum gpio_signal { }; #endif /* __CROS_EC_GPIO_SIGNAL_H */ +/* Alternate functions for GPIOs */ +enum gpio_alternate_func { + GPIO_ALT_FUNC_NONE = -1, + GPIO_ALT_FUNC_DEFAULT, + GPIO_ALT_FUNC_1, + GPIO_ALT_FUNC_2, + GPIO_ALT_FUNC_3, + GPIO_ALT_FUNC_4, + GPIO_ALT_FUNC_5, + GPIO_ALT_FUNC_6, + GPIO_ALT_FUNC_7, + + GPIO_ALT_FUNC_MAX = 63, +}; + /* GPIO signal definition structure, for use by board.c */ struct gpio_info { /* Signal name */ @@ -278,10 +294,11 @@ void gpio_set_flags_by_mask(uint32_t port, uint32_t mask, uint32_t flags); * * @param port GPIO port to set (GPIO_*) * @param mask Bitmask of pins on that port to affect - * @param func Alternate function; if <0, configures the specified - * GPIOs for normal GPIO operation. + * @param func Alternate function; if GPIO_ALT_FUNC_NONE, configures + * the specified GPIOs for normal GPIO operation. */ -void gpio_set_alternate_function(uint32_t port, uint32_t mask, int func); +void gpio_set_alternate_function(uint32_t port, uint32_t mask, + enum gpio_alternate_func func); #ifdef CONFIG_GPIO_POWER_DOWN /** |