summaryrefslogtreecommitdiffstats
path: root/include/gpio.h
blob: 9fb11c3268ab1763388114ecdc110bb56d2fea8f (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
29
30
31
32
33
34
35
36
37
38
39
#ifndef __GPIO_H
#define __GPIO_H

#include <asm/gpio.h>

static inline int gpio_request(unsigned gpio, const char *label)
{
       return 0;
}

static inline void gpio_free(unsigned gpio)
{
}

struct gpio_chip;

struct gpio_ops {
	int (*direction_input)(struct gpio_chip *chip, unsigned offset);
	int (*direction_output)(struct gpio_chip *chip, unsigned offset, int value);
	int (*get)(struct gpio_chip *chip, unsigned offset);
	void (*set)(struct gpio_chip *chip, unsigned offset, int value);
};

struct gpio_chip {
	struct device_d *dev;

	int base;
	int ngpio;

	struct gpio_ops *ops;

	struct list_head list;
};

int gpiochip_add(struct gpio_chip *chip);

int gpio_get_num(struct device_d *dev, int gpio);

#endif /* __GPIO_H */