From e41c34de74fbf1a50fde5a9419556c7209893951 Mon Sep 17 00:00:00 2001 From: Edward Hill Date: Thu, 10 Oct 2019 15:59:27 -0600 Subject: NPCX GPIO: Assert that gpio_get/set_level is passed a GPIO signal Ensure that IOEX and VW signals are not accidentally passed to NPCX's gpio_get_level or gpio_set_level. BUG=b:138600691 BRANCH=none TEST=saw assert when passing IOEX signal to gpio_set_level Change-Id: Ib3eea074a104820cea4095897f4174a84e8368d6 Signed-off-by: Edward Hill Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1854781 Reviewed-by: Denis Brockus Reviewed-by: Jett Rink --- include/gpio.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/gpio.h b/include/gpio.h index 75f23c5935..3b39ad9314 100644 --- a/include/gpio.h +++ b/include/gpio.h @@ -293,4 +293,13 @@ void gpio_set_alternate_function(uint32_t port, uint32_t mask, int func); int gpio_power_down_module(enum module_id id); #endif +/* + * Check if signal is a valid GPIO signal, and not IO expander (enum + * ioex_signal) or eSPI virtual wire (enum espi_vw_signal). + * + * @param signal GPIO or IOEX or VW signal + * @return 1 if signal is GPIO else return 0 + */ +int signal_is_gpio(int signal); + #endif /* __CROS_EC_GPIO_H */ -- cgit v1.2.1