summaryrefslogtreecommitdiff
path: root/include/gpio.h
diff options
context:
space:
mode:
authorScott Worley <scott.worley@microchip.corp-partner.google.com>2017-12-20 15:18:12 -0500
committerchrome-bot <chrome-bot@chromium.org>2017-12-28 12:35:08 -0800
commit5b6ec95320d231fb15a9ec69e2eefeb5eed1fd25 (patch)
tree4d1ce3e29870d4c872fc74312a2de9f22e5e4549 /include/gpio.h
parent4e9588ddcffb9315b0a74ac62121efb76b7b2202 (diff)
downloadchrome-ec-5b6ec95320d231fb15a9ec69e2eefeb5eed1fd25.tar.gz
ec_gpio: Add GPIO power down support
Experimental and disabled by default feature for powering down GPIO pins on those EC's supporting it. Pins may be powered down by module ID or pin name. Goal is to make use of common GPIO pin table. If enabled, developer must implement power down support in chip level. Developer re-powers module pin(s) by calling the current gpio module enable API in the wake path. BRANCH=none BUG= TEST=Feature is disabled by default. Build all boards with feature disabled. Change-Id: Ifacd08e51def6424baf5c78c84b24f1d9f4bc4aa Signed-off-by: Scott Worley <scott.worley@microchip.corp-partner.google.com>
Diffstat (limited to 'include/gpio.h')
-rw-r--r--include/gpio.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/gpio.h b/include/gpio.h
index 195f644d67..1c80f7e32d 100644
--- a/include/gpio.h
+++ b/include/gpio.h
@@ -33,6 +33,9 @@
#define GPIO_ALTERNATE (1 << 17) /* GPIO used for alternate function. */
#define GPIO_LOCKED (1 << 18) /* Lock GPIO output and configuration */
#define GPIO_HIB_WAKE_HIGH (1 << 19) /* Hibernate wake on high level */
+#ifdef CONFIG_GPIO_POWER_DOWN
+#define GPIO_POWER_DOWN (1 << 20) /* Pin and pad is powered off */
+#endif
/* Common flag combinations */
#define GPIO_OUT_LOW (GPIO_OUTPUT | GPIO_LOW)
@@ -266,4 +269,14 @@ void gpio_set_flags_by_mask(uint32_t port, uint32_t mask, uint32_t flags);
*/
void gpio_set_alternate_function(uint32_t port, uint32_t mask, int func);
+#ifdef CONFIG_GPIO_POWER_DOWN
+/**
+ * Power down all GPIO pins in a module.
+ *
+ * @param id Module ID to initialize
+ * @return EC_SUCCESS, or non-zero if module_id is not found.
+ */
+int gpio_power_down_module(enum module_id id);
+#endif
+
#endif /* __CROS_EC_GPIO_H */