diff options
author | Josh-Tsai <josh_tsai@compal.corp-partner.google.com> | 2022-12-20 19:31:18 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-12-28 19:57:27 +0000 |
commit | 35805c0f419505e72857be3d933eb6ee1bdb9c9e (patch) | |
tree | be40e1388a603b52cd7e666a28df12377b65e620 /include/gpio.h | |
parent | 8870b48c9643ca22518105732194ed2800219157 (diff) | |
download | chrome-ec-35805c0f419505e72857be3d933eb6ee1bdb9c9e.tar.gz |
shim/src/gpio: Add save/restore GPIO controller port configure function
We need to save the IO expander GPIO status before the device reset,
and restore the status after the device is reset completely.
create the function to save and restore the port configure
BRANCH=None
BUG=b:260534665
TEST=zmake build winterhold
TEST=IO expander GPIOs status will not clear after tcpc reset
TEST=./twister -v -i --coverage -p native_posix -p unit_testing
-s external/platform/ec/zephyr/test/drivers/drivers.default
Change-Id: Ic35e7e412792a56fde670de252887a9bdb557b36
Signed-off-by: Josh-Tsai <josh_tsai@compal.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4115054
Reviewed-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com>
Reviewed-by: Keith Short <keithshort@chromium.org>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Commit-Queue: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'include/gpio.h')
-rw-r--r-- | include/gpio.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/gpio.h b/include/gpio.h index 2c5006a8ec..5fc0b07d66 100644 --- a/include/gpio.h +++ b/include/gpio.h @@ -402,6 +402,28 @@ void gpio_reset(enum gpio_signal signal); #ifdef CONFIG_ZEPHYR /** + * @brief Save state of a GPIO controller port + * + * This function saves all pins current state from selected port. + * + * @param port Port to save + * @param flags Buffer to hold gpio flags + */ +int gpio_save_port_config(const struct device *port, gpio_flags_t *flags, + int buff_size); + +/** + * @brief Restore state of a GPIO controller port + * + * This function restore all pins current state from selected port. + * + * @param port Port to restore + * @param flags Buffer with gpio flags saved by ioex_save_gpio_config + */ +int gpio_restore_port_config(const struct device *port, gpio_flags_t *flags, + int buff_size); + +/** * @brief Reset all the GPIOs to default state * * This returns all pins from selected port to default state. The default flags |