summaryrefslogtreecommitdiff
path: root/src/soc/intel/common/block/gpio/gpio_dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/intel/common/block/gpio/gpio_dev.c')
-rw-r--r--src/soc/intel/common/block/gpio/gpio_dev.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/soc/intel/common/block/gpio/gpio_dev.c b/src/soc/intel/common/block/gpio/gpio_dev.c
new file mode 100644
index 0000000000..c47d3a28ff
--- /dev/null
+++ b/src/soc/intel/common/block/gpio/gpio_dev.c
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <assert.h>
+#include <device/device.h>
+#include <device/gpio.h>
+#include <intelblocks/gpio.h>
+#include <gpio.h>
+
+static struct gpio_operations gpio_ops = {
+ .get = gpio_get,
+ .set = gpio_set,
+ .input_pulldown = gpio_input_pulldown,
+ .input_pullup = gpio_input_pullup,
+ .input = gpio_input,
+ .output = gpio_output,
+};
+
+static struct device_operations block_gpio_ops = {
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
+ .ops_gpio = &gpio_ops,
+};
+
+void block_gpio_enable(struct device *dev)
+{
+ assert(dev->path.type == DEVICE_PATH_GPIO);
+ dev->ops = &block_gpio_ops;
+}