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 "head.h"
25
26static void
27nv04_head_vblank_put(struct nvkm_head *head)
28{
29 struct nvkm_device *device = head->disp->engine.subdev.device;
30 nvkm_wr32(device, 0x600140 + (head->id * 0x2000) , 0x00000000);
31}
32
33static void
34nv04_head_vblank_get(struct nvkm_head *head)
35{
36 struct nvkm_device *device = head->disp->engine.subdev.device;
37 nvkm_wr32(device, 0x600140 + (head->id * 0x2000) , 0x00000001);
38}
39
40static void
41nv04_head_rgpos(struct nvkm_head *head, u16 *hline, u16 *vline)
42{
43 struct nvkm_device *device = head->disp->engine.subdev.device;
44 u32 data = nvkm_rd32(device, 0x600868 + (head->id * 0x2000));
45 *hline = (data & 0xffff0000) >> 16;
46 *vline = (data & 0x0000ffff);
47}
48
49static void
50nv04_head_state(struct nvkm_head *head, struct nvkm_head_state *state)
51{
52 struct nvkm_device *device = head->disp->engine.subdev.device;
53 const u32 hoff = head->id * 0x0200;
54 state->vblanks = nvkm_rd32(device, 0x680800 + hoff) & 0x0000ffff;
55 state->vtotal = nvkm_rd32(device, 0x680804 + hoff) & 0x0000ffff;
56 state->vblanke = state->vtotal - 1;
57 state->hblanks = nvkm_rd32(device, 0x680820 + hoff) & 0x0000ffff;
58 state->htotal = nvkm_rd32(device, 0x680824 + hoff) & 0x0000ffff;
59 state->hblanke = state->htotal - 1;
60}
61
62static const struct nvkm_head_func
63nv04_head = {
64 .state = nv04_head_state,
65 .rgpos = nv04_head_rgpos,
66 .vblank_get = nv04_head_vblank_get,
67 .vblank_put = nv04_head_vblank_put,
68};
69
70int
71nv04_head_new(struct nvkm_disp *disp, int id)
72{
73 return nvkm_head_new_(&nv04_head, disp, id);
74}
75