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 "outpdp.h"
25#include "nv50.h"
26
27#include <core/client.h>
28#include <subdev/i2c.h>
29#include <subdev/timer.h>
30
31#include <nvif/cl5070.h>
32#include <nvif/unpack.h>
33
34int
35nv50_pior_power(NV50_DISP_MTHD_V1)
36{
37 struct nvkm_device *device = disp->base.engine.subdev.device;
38 const u32 soff = outp->or * 0x800;
39 union {
40 struct nv50_disp_pior_pwr_v0 v0;
41 } *args = data;
42 u32 ctrl, type;
43 int ret = -ENOSYS;
44
45 nvif_ioctl(object, "disp pior pwr size %d\n", size);
46 if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
47 nvif_ioctl(object, "disp pior pwr vers %d state %d type %x\n",
48 args->v0.version, args->v0.state, args->v0.type);
49 if (args->v0.type > 0x0f)
50 return -EINVAL;
51 ctrl = !!args->v0.state;
52 type = args->v0.type;
53 } else
54 return ret;
55
56 nvkm_msec(device, 2000,
57 if (!(nvkm_rd32(device, 0x61e004 + soff) & 0x80000000))
58 break;
59 );
60 nvkm_mask(device, 0x61e004 + soff, 0x80000101, 0x80000000 | ctrl);
61 nvkm_msec(device, 2000,
62 if (!(nvkm_rd32(device, 0x61e004 + soff) & 0x80000000))
63 break;
64 );
65 disp->pior.type[outp->or] = type;
66 return 0;
67}
68
69
70
71
72static const struct nvkm_output_func
73nv50_pior_output_func = {
74};
75
76int
77nv50_pior_output_new(struct nvkm_disp *disp, int index,
78 struct dcb_output *dcbE, struct nvkm_output **poutp)
79{
80 return nvkm_output_new_(&nv50_pior_output_func, disp,
81 index, dcbE, poutp);
82}
83
84
85
86
87static int
88nv50_pior_output_dp_pattern(struct nvkm_output_dp *outp, int pattern)
89{
90 return 0;
91}
92
93static int
94nv50_pior_output_dp_lnk_pwr(struct nvkm_output_dp *outp, int nr)
95{
96 return 0;
97}
98
99static int
100nv50_pior_output_dp_lnk_ctl(struct nvkm_output_dp *outp,
101 int nr, int bw, bool ef)
102{
103 int ret = nvkm_i2c_aux_lnk_ctl(outp->aux, nr, bw, ef);
104 if (ret)
105 return ret;
106 return 1;
107}
108
109static const struct nvkm_output_dp_func
110nv50_pior_output_dp_func = {
111 .pattern = nv50_pior_output_dp_pattern,
112 .lnk_pwr = nv50_pior_output_dp_lnk_pwr,
113 .lnk_ctl = nv50_pior_output_dp_lnk_ctl,
114};
115
116int
117nv50_pior_dp_new(struct nvkm_disp *disp, int index, struct dcb_output *dcbE,
118 struct nvkm_output **poutp)
119{
120 struct nvkm_i2c *i2c = disp->engine.subdev.device->i2c;
121 struct nvkm_i2c_aux *aux =
122 nvkm_i2c_aux_find(i2c, NVKM_I2C_AUX_EXT(dcbE->extdev));
123 struct nvkm_output_dp *outp;
124
125 if (!(outp = kzalloc(sizeof(*outp), GFP_KERNEL)))
126 return -ENOMEM;
127 *poutp = &outp->base;
128
129 return nvkm_output_dp_ctor(&nv50_pior_output_dp_func, disp,
130 index, dcbE, aux, outp);
131}
132