|
30 | 30 | #include <nvif/cl5070.h>
|
31 | 31 | #include <nvif/unpack.h>
|
32 | 32 |
|
| 33 | +static const struct nvkm_output_func |
| 34 | +nv50_dac_output_func = { |
| 35 | +}; |
| 36 | + |
33 | 37 | int
|
34 |
| -nv50_dac_power(NV50_DISP_MTHD_V1) |
| 38 | +nv50_dac_output_new(struct nvkm_disp *disp, int index, |
| 39 | + struct dcb_output *dcbE, struct nvkm_output **poutp) |
35 | 40 | {
|
36 |
| - struct nvkm_device *device = disp->base.engine.subdev.device; |
37 |
| - const u32 doff = outp->or * 0x800; |
38 |
| - union { |
39 |
| - struct nv50_disp_dac_pwr_v0 v0; |
40 |
| - } *args = data; |
41 |
| - u32 stat; |
42 |
| - int ret = -ENOSYS; |
43 |
| - |
44 |
| - nvif_ioctl(object, "disp dac pwr size %d\n", size); |
45 |
| - if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { |
46 |
| - nvif_ioctl(object, "disp dac pwr vers %d state %d data %d " |
47 |
| - "vsync %d hsync %d\n", |
48 |
| - args->v0.version, args->v0.state, args->v0.data, |
49 |
| - args->v0.vsync, args->v0.hsync); |
50 |
| - stat = 0x00000040 * !args->v0.state; |
51 |
| - stat |= 0x00000010 * !args->v0.data; |
52 |
| - stat |= 0x00000004 * !args->v0.vsync; |
53 |
| - stat |= 0x00000001 * !args->v0.hsync; |
54 |
| - } else |
55 |
| - return ret; |
56 |
| - |
57 |
| - nvkm_msec(device, 2000, |
58 |
| - if (!(nvkm_rd32(device, 0x61a004 + doff) & 0x80000000)) |
59 |
| - break; |
60 |
| - ); |
61 |
| - nvkm_mask(device, 0x61a004 + doff, 0xc000007f, 0x80000000 | stat); |
62 |
| - nvkm_msec(device, 2000, |
63 |
| - if (!(nvkm_rd32(device, 0x61a004 + doff) & 0x80000000)) |
64 |
| - break; |
65 |
| - ); |
66 |
| - return 0; |
| 41 | + return nvkm_output_new_(&nv50_dac_output_func, disp, |
| 42 | + index, dcbE, poutp); |
67 | 43 | }
|
68 | 44 |
|
69 | 45 | int
|
@@ -113,14 +89,38 @@ nv50_dac_sense(NV50_DISP_MTHD_V1)
|
113 | 89 | return 0;
|
114 | 90 | }
|
115 | 91 |
|
116 |
| -static const struct nvkm_output_func |
117 |
| -nv50_dac_output_func = { |
118 |
| -}; |
119 |
| - |
120 | 92 | int
|
121 |
| -nv50_dac_output_new(struct nvkm_disp *disp, int index, |
122 |
| - struct dcb_output *dcbE, struct nvkm_output **poutp) |
| 93 | +nv50_dac_power(NV50_DISP_MTHD_V1) |
123 | 94 | {
|
124 |
| - return nvkm_output_new_(&nv50_dac_output_func, disp, |
125 |
| - index, dcbE, poutp); |
| 95 | + struct nvkm_device *device = disp->base.engine.subdev.device; |
| 96 | + const u32 doff = outp->or * 0x800; |
| 97 | + union { |
| 98 | + struct nv50_disp_dac_pwr_v0 v0; |
| 99 | + } *args = data; |
| 100 | + u32 stat; |
| 101 | + int ret = -ENOSYS; |
| 102 | + |
| 103 | + nvif_ioctl(object, "disp dac pwr size %d\n", size); |
| 104 | + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { |
| 105 | + nvif_ioctl(object, "disp dac pwr vers %d state %d data %d " |
| 106 | + "vsync %d hsync %d\n", |
| 107 | + args->v0.version, args->v0.state, args->v0.data, |
| 108 | + args->v0.vsync, args->v0.hsync); |
| 109 | + stat = 0x00000040 * !args->v0.state; |
| 110 | + stat |= 0x00000010 * !args->v0.data; |
| 111 | + stat |= 0x00000004 * !args->v0.vsync; |
| 112 | + stat |= 0x00000001 * !args->v0.hsync; |
| 113 | + } else |
| 114 | + return ret; |
| 115 | + |
| 116 | + nvkm_msec(device, 2000, |
| 117 | + if (!(nvkm_rd32(device, 0x61a004 + doff) & 0x80000000)) |
| 118 | + break; |
| 119 | + ); |
| 120 | + nvkm_mask(device, 0x61a004 + doff, 0xc000007f, 0x80000000 | stat); |
| 121 | + nvkm_msec(device, 2000, |
| 122 | + if (!(nvkm_rd32(device, 0x61a004 + doff) & 0x80000000)) |
| 123 | + break; |
| 124 | + ); |
| 125 | + return 0; |
126 | 126 | }
|
0 commit comments