xref: /linux/drivers/gpu/drm/nouveau/include/nvkm/subdev/gpio.h (revision e0bf6c5ca2d3281f231c5f0c9bf145e9513644de)
1 #ifndef __NVKM_GPIO_H__
2 #define __NVKM_GPIO_H__
3 #include <core/subdev.h>
4 #include <core/event.h>
5 
6 #include <subdev/bios.h>
7 #include <subdev/bios/gpio.h>
8 
9 struct nvkm_gpio_ntfy_req {
10 #define NVKM_GPIO_HI                                                       0x01
11 #define NVKM_GPIO_LO                                                       0x02
12 #define NVKM_GPIO_TOGGLED                                                  0x03
13 	u8 mask;
14 	u8 line;
15 };
16 
17 struct nvkm_gpio_ntfy_rep {
18 	u8 mask;
19 };
20 
21 struct nvkm_gpio {
22 	struct nvkm_subdev base;
23 
24 	struct nvkm_event event;
25 
26 	void (*reset)(struct nvkm_gpio *, u8 func);
27 	int  (*find)(struct nvkm_gpio *, int idx, u8 tag, u8 line,
28 		     struct dcb_gpio_func *);
29 	int  (*set)(struct nvkm_gpio *, int idx, u8 tag, u8 line, int state);
30 	int  (*get)(struct nvkm_gpio *, int idx, u8 tag, u8 line);
31 };
32 
33 static inline struct nvkm_gpio *
34 nvkm_gpio(void *obj)
35 {
36 	return (void *)nvkm_subdev(obj, NVDEV_SUBDEV_GPIO);
37 }
38 
39 extern struct nvkm_oclass *nv10_gpio_oclass;
40 extern struct nvkm_oclass *nv50_gpio_oclass;
41 extern struct nvkm_oclass *g94_gpio_oclass;
42 extern struct nvkm_oclass *gf110_gpio_oclass;
43 extern struct nvkm_oclass *gk104_gpio_oclass;
44 #endif
45