This source file includes following definitions.
- g94_gpio_intr_stat
- g94_gpio_intr_mask
- g94_gpio_new
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #include "priv.h"
25
26 void
27 g94_gpio_intr_stat(struct nvkm_gpio *gpio, u32 *hi, u32 *lo)
28 {
29 struct nvkm_device *device = gpio->subdev.device;
30 u32 intr0 = nvkm_rd32(device, 0x00e054);
31 u32 intr1 = nvkm_rd32(device, 0x00e074);
32 u32 stat0 = nvkm_rd32(device, 0x00e050) & intr0;
33 u32 stat1 = nvkm_rd32(device, 0x00e070) & intr1;
34 *lo = (stat1 & 0xffff0000) | (stat0 >> 16);
35 *hi = (stat1 << 16) | (stat0 & 0x0000ffff);
36 nvkm_wr32(device, 0x00e054, intr0);
37 nvkm_wr32(device, 0x00e074, intr1);
38 }
39
40 void
41 g94_gpio_intr_mask(struct nvkm_gpio *gpio, u32 type, u32 mask, u32 data)
42 {
43 struct nvkm_device *device = gpio->subdev.device;
44 u32 inte0 = nvkm_rd32(device, 0x00e050);
45 u32 inte1 = nvkm_rd32(device, 0x00e070);
46 if (type & NVKM_GPIO_LO)
47 inte0 = (inte0 & ~(mask << 16)) | (data << 16);
48 if (type & NVKM_GPIO_HI)
49 inte0 = (inte0 & ~(mask & 0xffff)) | (data & 0xffff);
50 mask >>= 16;
51 data >>= 16;
52 if (type & NVKM_GPIO_LO)
53 inte1 = (inte1 & ~(mask << 16)) | (data << 16);
54 if (type & NVKM_GPIO_HI)
55 inte1 = (inte1 & ~mask) | data;
56 nvkm_wr32(device, 0x00e050, inte0);
57 nvkm_wr32(device, 0x00e070, inte1);
58 }
59
60 static const struct nvkm_gpio_func
61 g94_gpio = {
62 .lines = 32,
63 .intr_stat = g94_gpio_intr_stat,
64 .intr_mask = g94_gpio_intr_mask,
65 .drive = nv50_gpio_drive,
66 .sense = nv50_gpio_sense,
67 .reset = nv50_gpio_reset,
68 };
69
70 int
71 g94_gpio_new(struct nvkm_device *device, int index, struct nvkm_gpio **pgpio)
72 {
73 return nvkm_gpio_new_(&g94_gpio, device, index, pgpio);
74 }