1 #ifndef __NOUVEAU_GPIO_H__
2 #define __NOUVEAU_GPIO_H__
3
4 #include <core/subdev.h>
5 #include <core/device.h>
6 #include <core/event.h>
7
8 #include <subdev/bios.h>
9 #include <subdev/bios/gpio.h>
10
11 struct nvkm_gpio_ntfy_req {
12 #define NVKM_GPIO_HI 0x01
13 #define NVKM_GPIO_LO 0x02
14 #define NVKM_GPIO_TOGGLED 0x03
15 u8 mask;
16 u8 line;
17 };
18
19 struct nvkm_gpio_ntfy_rep {
20 u8 mask;
21 };
22
23 struct nouveau_gpio {
24 struct nouveau_subdev base;
25
26 struct nvkm_event event;
27
28 void (*reset)(struct nouveau_gpio *, u8 func);
29 int (*find)(struct nouveau_gpio *, int idx, u8 tag, u8 line,
30 struct dcb_gpio_func *);
31 int (*set)(struct nouveau_gpio *, int idx, u8 tag, u8 line, int state);
32 int (*get)(struct nouveau_gpio *, int idx, u8 tag, u8 line);
33 };
34
35 static inline struct nouveau_gpio *
nouveau_gpio(void * obj)36 nouveau_gpio(void *obj)
37 {
38 return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_GPIO];
39 }
40
41 extern struct nouveau_oclass *nv10_gpio_oclass;
42 extern struct nouveau_oclass *nv50_gpio_oclass;
43 extern struct nouveau_oclass *nv94_gpio_oclass;
44 extern struct nouveau_oclass *nvd0_gpio_oclass;
45 extern struct nouveau_oclass *nve0_gpio_oclass;
46
47 #endif
48