summaryrefslogtreecommitdiff
path: root/include/gpio.h
diff options
context:
space:
mode:
authorJulien Delayen <julien.delayen@intel.com>2016-11-03 13:44:34 +0000
committerAnas Nashif <nashif@linux.intel.com>2016-11-03 21:30:11 +0000
commitbd6285a3f1637a81978d4eedb79fde2c67249b61 (patch)
treea0fa1709c1837eb7c3eba86c43ed33cc883035bd /include/gpio.h
parent14711488db17f2938fc659e9b6881f179de889df (diff)
gpio_qmsi: Add get_pending_int API
For AON peripherals on Quark SE C1000, an API is needed to retrieve the interrupt status after wake up. This enables the application to know the wake source before enabling again the interrupts. Add this API to the gpio as this is a wake event on Quark SE C1000. Jira: ZEP-1188 Change-Id: Icc4aa6617bf18402b7e5dc3aab779ec2964e1c5b Signed-off-by: Julien Delayen <julien.delayen@intel.com>
Diffstat (limited to 'include/gpio.h')
-rw-r--r--include/gpio.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/gpio.h b/include/gpio.h
index 1e2aacaf4..e503a92c6 100644
--- a/include/gpio.h
+++ b/include/gpio.h
@@ -194,6 +194,7 @@ typedef int (*gpio_enable_callback_t)(struct device *port,
typedef int (*gpio_disable_callback_t)(struct device *port,
int access_op,
uint32_t pin);
+typedef uint32_t (*gpio_api_get_pending_int)(struct device *dev);
struct gpio_driver_api {
gpio_config_t config;
@@ -202,6 +203,7 @@ struct gpio_driver_api {
gpio_manage_callback_t manage_callback;
gpio_enable_callback_t enable_callback;
gpio_disable_callback_t disable_callback;
+ gpio_api_get_pending_int get_pending_int;
};
/**
* @endcond
@@ -394,6 +396,27 @@ static inline int gpio_port_disable_callback(struct device *port)
return api->disable_callback(port, GPIO_ACCESS_BY_PORT, 0);
}
+/**
+ * @brief Function to get pending interrupts
+ *
+ * The purpose of this function is to return the interrupt
+ * status register for the device.
+ * This is especially useful when waking up from
+ * low power states to check the wake up source.
+ *
+ * @param dev Pointer to the device structure for the driver instance.
+ *
+ * @retval status != 0 if at least one gpio interrupt is pending.
+ * @retval 0 if no gpio interrupt is pending.
+ */
+static inline int gpio_get_pending_int(struct device *dev)
+{
+ struct gpio_driver_api *api;
+
+ api = (struct gpio_driver_api *)dev->driver_api;
+ return api->get_pending_int(dev);
+}
+
struct gpio_pin_config {
char *gpio_controller;
uint32_t gpio_pin;