xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/nouveau/include/nvkm/subdev/gpio.h (revision 41ec02673d281bbb3d38e6c78504ce6e30c228c1)
1 /*	$NetBSD: gpio.h,v 1.3 2021/12/18 23:45:33 riastradh Exp $	*/
2 
3 /* SPDX-License-Identifier: MIT */
4 #ifndef __NVKM_GPIO_H__
5 #define __NVKM_GPIO_H__
6 #include <core/subdev.h>
7 #include <core/event.h>
8 
9 #include <subdev/bios.h>
10 #include <subdev/bios/gpio.h>
11 
12 struct nvkm_gpio_ntfy_req {
13 #define NVKM_GPIO_HI                                                       0x01
14 #define NVKM_GPIO_LO                                                       0x02
15 #define NVKM_GPIO_TOGGLED                                                  0x03
16 	u8 mask;
17 	u8 line;
18 };
19 
20 struct nvkm_gpio_ntfy_rep {
21 	u8 mask;
22 };
23 
24 struct nvkm_gpio {
25 	const struct nvkm_gpio_func *func;
26 	struct nvkm_subdev subdev;
27 
28 	struct nvkm_event event;
29 };
30 
31 void nvkm_gpio_reset(struct nvkm_gpio *, u8 func);
32 int nvkm_gpio_find(struct nvkm_gpio *, int idx, u8 tag, u8 line,
33 		   struct dcb_gpio_func *);
34 int nvkm_gpio_set(struct nvkm_gpio *, int idx, u8 tag, u8 line, int state);
35 int nvkm_gpio_get(struct nvkm_gpio *, int idx, u8 tag, u8 line);
36 
37 int nv10_gpio_new(struct nvkm_device *, int, struct nvkm_gpio **);
38 int nv50_gpio_new(struct nvkm_device *, int, struct nvkm_gpio **);
39 int g94_gpio_new(struct nvkm_device *, int, struct nvkm_gpio **);
40 int gf119_gpio_new(struct nvkm_device *, int, struct nvkm_gpio **);
41 int gk104_gpio_new(struct nvkm_device *, int, struct nvkm_gpio **);
42 #endif
43