diff options
author | Caveh Jalali <caveh@chromium.org> | 2022-01-26 18:32:51 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-01-28 00:32:52 +0000 |
commit | 5010e2e9daec3166ce7ece3a0db743d367a0e306 (patch) | |
tree | 72af9a4568e2bc9e5b46017ae7f4c7edee0b4bb7 | |
parent | a071bd98d74ce2f5806b53302c14bc73a157c6d8 (diff) | |
download | chrome-ec-5010e2e9daec3166ce7ece3a0db743d367a0e306.tar.gz |
zephyr: Implement gpio_or_ioex_[gs]et_level
This implements gpio_or_ioex_set_level and gpio_or_ioex_get_level in the
shim layer to match cros ec functionality.
BRANCH=none
BUG=b:216410108
TEST=zmake build for volteer and brya pass
Change-Id: Ifcb85afe8355e16c975da23dee860b8ac7ad097d
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3419576
Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r-- | zephyr/shim/src/gpio.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/zephyr/shim/src/gpio.c b/zephyr/shim/src/gpio.c index 406244bbb3..8dafe6e93a 100644 --- a/zephyr/shim/src/gpio.c +++ b/zephyr/shim/src/gpio.c @@ -10,6 +10,7 @@ #include "gpio.h" #include "gpio/gpio.h" +#include "ioexpander.h" #include "sysjump.h" #include "cros_version.h" @@ -148,6 +149,22 @@ void gpio_set_level_verbose(enum console_channel channel, gpio_set_level(signal, value); } +void gpio_or_ioex_set_level(int signal, int value) +{ + if (IS_ENABLED(CONFIG_PLATFORM_EC_IOEX) && signal_is_ioex(signal)) + ioex_set_level(signal, value); + else + gpio_set_level(signal, value); +} + +int gpio_or_ioex_get_level(int signal, int *value) +{ + if (IS_ENABLED(CONFIG_PLATFORM_EC_IOEX) && signal_is_ioex(signal)) + return ioex_get_level(signal, value); + *value = gpio_get_level(signal); + return EC_SUCCESS; +} + /* GPIO flags which are the same in Zephyr and this codebase */ #define GPIO_CONVERSION_SAME_BITS \ (GPIO_OPEN_DRAIN | GPIO_PULL_UP | GPIO_PULL_DOWN | GPIO_INPUT | \ |