xref: /aosp_15_r20/external/coreboot/src/soc/intel/common/block/gpio/gpio_dev.c (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include <assert.h>
4 #include <device/device.h>
5 #include <device/gpio.h>
6 #include <gpio.h>
7 #include <intelblocks/gpio.h>
8 
9 static struct gpio_operations gpio_ops = {
10 	.get		= gpio_get,
11 	.set		= gpio_set,
12 	.input_pulldown	= gpio_input_pulldown,
13 	.input_pullup	= gpio_input_pullup,
14 	.input		= gpio_input,
15 	.output		= gpio_output,
16 };
17 
18 struct device_operations block_gpio_ops = {
19 	.read_resources	= noop_read_resources,
20 	.set_resources	= noop_set_resources,
21 	.ops_gpio	= &gpio_ops,
22 };
23 
block_gpio_enable(struct device * dev)24 void block_gpio_enable(struct device *dev)
25 {
26 	assert(dev->path.type == DEVICE_PATH_GPIO);
27 	dev->ops = &block_gpio_ops;
28 }
29