1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#include "head.h"
23#include "atom.h"
24#include "core.h"
25
26static void
27headc37d_or(struct nv50_head *head, struct nv50_head_atom *asyh)
28{
29 struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
30 u32 *push;
31 if ((push = evo_wait(core, 2))) {
32
33
34
35 switch (asyh->or.depth) {
36 case 6: asyh->or.depth = 5; break;
37 case 5: asyh->or.depth = 4; break;
38 case 2: asyh->or.depth = 1; break;
39 case 0: asyh->or.depth = 4; break;
40 default:
41 WARN_ON(1);
42 break;
43 }
44
45 evo_mthd(push, 0x2004 + (head->base.index * 0x400), 1);
46 evo_data(push, 0x00000001 |
47 asyh->or.depth << 4 |
48 asyh->or.nvsync << 3 |
49 asyh->or.nhsync << 2);
50 evo_kick(push, core);
51 }
52}
53
54static void
55headc37d_procamp(struct nv50_head *head, struct nv50_head_atom *asyh)
56{
57 struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
58 u32 *push;
59 if ((push = evo_wait(core, 2))) {
60 evo_mthd(push, 0x2000 + (head->base.index * 0x400), 1);
61 evo_data(push, 0x80000000 |
62 asyh->procamp.sat.sin << 16 |
63 asyh->procamp.sat.cos << 4);
64 evo_kick(push, core);
65 }
66}
67
68static void
69headc37d_dither(struct nv50_head *head, struct nv50_head_atom *asyh)
70{
71 struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
72 u32 *push;
73 if ((push = evo_wait(core, 2))) {
74 evo_mthd(push, 0x2018 + (head->base.index * 0x0400), 1);
75 evo_data(push, asyh->dither.mode << 8 |
76 asyh->dither.bits << 4 |
77 asyh->dither.enable);
78 evo_kick(push, core);
79 }
80}
81
82static void
83headc37d_curs_clr(struct nv50_head *head)
84{
85 struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
86 u32 *push;
87 if ((push = evo_wait(core, 4))) {
88 evo_mthd(push, 0x209c + head->base.index * 0x400, 1);
89 evo_data(push, 0x000000cf);
90 evo_mthd(push, 0x2088 + head->base.index * 0x400, 1);
91 evo_data(push, 0x00000000);
92 evo_kick(push, core);
93 }
94}
95
96static void
97headc37d_curs_set(struct nv50_head *head, struct nv50_head_atom *asyh)
98{
99 struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
100 u32 *push;
101 if ((push = evo_wait(core, 7))) {
102 evo_mthd(push, 0x209c + head->base.index * 0x400, 2);
103 evo_data(push, 0x80000000 |
104 asyh->curs.layout << 8 |
105 asyh->curs.format << 0);
106 evo_data(push, 0x000072ff);
107 evo_mthd(push, 0x2088 + head->base.index * 0x400, 1);
108 evo_data(push, asyh->curs.handle);
109 evo_mthd(push, 0x2090 + head->base.index * 0x400, 1);
110 evo_data(push, asyh->curs.offset >> 8);
111 evo_kick(push, core);
112 }
113}
114
115static int
116headc37d_curs_format(struct nv50_head *head, struct nv50_wndw_atom *asyw,
117 struct nv50_head_atom *asyh)
118{
119 asyh->curs.format = asyw->image.format;
120 return 0;
121}
122
123static void
124headc37d_olut_clr(struct nv50_head *head)
125{
126 struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
127 u32 *push;
128 if ((push = evo_wait(core, 2))) {
129 evo_mthd(push, 0x20ac + (head->base.index * 0x400), 1);
130 evo_data(push, 0x00000000);
131 evo_kick(push, core);
132 }
133}
134
135static void
136headc37d_olut_set(struct nv50_head *head, struct nv50_head_atom *asyh)
137{
138 struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
139 u32 *push;
140 if ((push = evo_wait(core, 4))) {
141 evo_mthd(push, 0x20a4 + (head->base.index * 0x400), 3);
142 evo_data(push, asyh->olut.output_mode << 8 |
143 asyh->olut.range << 4 |
144 asyh->olut.size);
145 evo_data(push, asyh->olut.offset >> 8);
146 evo_data(push, asyh->olut.handle);
147 evo_kick(push, core);
148 }
149}
150
151static void
152headc37d_olut(struct nv50_head *head, struct nv50_head_atom *asyh)
153{
154 asyh->olut.mode = 2;
155 asyh->olut.size = 0;
156 asyh->olut.range = 0;
157 asyh->olut.output_mode = 1;
158}
159
160static void
161headc37d_mode(struct nv50_head *head, struct nv50_head_atom *asyh)
162{
163 struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
164 struct nv50_head_mode *m = &asyh->mode;
165 u32 *push;
166 if ((push = evo_wait(core, 12))) {
167 evo_mthd(push, 0x2064 + (head->base.index * 0x400), 5);
168 evo_data(push, (m->v.active << 16) | m->h.active );
169 evo_data(push, (m->v.synce << 16) | m->h.synce );
170 evo_data(push, (m->v.blanke << 16) | m->h.blanke );
171 evo_data(push, (m->v.blanks << 16) | m->h.blanks );
172 evo_data(push, (m->v.blank2e << 16) | m->v.blank2s);
173 evo_mthd(push, 0x200c + (head->base.index * 0x400), 1);
174 evo_data(push, m->clock * 1000);
175 evo_mthd(push, 0x2028 + (head->base.index * 0x400), 1);
176 evo_data(push, m->clock * 1000);
177
178 evo_mthd(push, 0x2030 + (head->base.index * 0x400), 1);
179 evo_data(push, 0x00000124);
180 evo_kick(push, core);
181 }
182}
183
184static void
185headc37d_view(struct nv50_head *head, struct nv50_head_atom *asyh)
186{
187 struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
188 u32 *push;
189 if ((push = evo_wait(core, 4))) {
190 evo_mthd(push, 0x204c + (head->base.index * 0x400), 1);
191 evo_data(push, (asyh->view.iH << 16) | asyh->view.iW);
192 evo_mthd(push, 0x2058 + (head->base.index * 0x400), 1);
193 evo_data(push, (asyh->view.oH << 16) | asyh->view.oW);
194 evo_kick(push, core);
195 }
196}
197
198const struct nv50_head_func
199headc37d = {
200 .view = headc37d_view,
201 .mode = headc37d_mode,
202 .olut = headc37d_olut,
203 .olut_set = headc37d_olut_set,
204 .olut_clr = headc37d_olut_clr,
205 .curs_layout = head917d_curs_layout,
206 .curs_format = headc37d_curs_format,
207 .curs_set = headc37d_curs_set,
208 .curs_clr = headc37d_curs_clr,
209 .dither = headc37d_dither,
210 .procamp = headc37d_procamp,
211 .or = headc37d_or,
212};
213