aboutsummaryrefslogtreecommitdiff
path: root/src/soc/intel/common/block/gpio/gpio_dev.c
blob: c47d3a28ffba6a4723f8775df0d3a75d2549cd4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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;
}