blob: 140d53c83e252a5155b5ca3d743a2027b5dbe425 (
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
40
41
42
43
44
45
46
47
|
#ifndef __GPIO_H
#define __GPIO_H
#include <asm/gpio.h>
#ifndef CONFIG_GPIOLIB
static inline int gpio_request(unsigned gpio, const char *label)
{
return 0;
}
static inline void gpio_free(unsigned gpio)
{
}
#else
int gpio_request(unsigned gpio, const char *label);
void gpio_free(unsigned gpio);
#endif
struct gpio_chip;
struct gpio_ops {
int (*request)(struct gpio_chip *chip, unsigned offset);
void (*free)(struct gpio_chip *chip, unsigned offset);
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);
void gpiochip_remove(struct gpio_chip *chip);
int gpio_get_num(struct device_d *dev, int gpio);
#endif /* __GPIO_H */
|