1 #ifndef __NV50_DISP_H__ 2 #define __NV50_DISP_H__ 3 #include "priv.h" 4 struct nvkm_output; 5 struct nvkm_output_dp; 6 7 #define NV50_DISP_MTHD_ struct nvkm_object *object, \ 8 struct nv50_disp_priv *priv, void *data, u32 size 9 #define NV50_DISP_MTHD_V0 NV50_DISP_MTHD_, int head 10 #define NV50_DISP_MTHD_V1 NV50_DISP_MTHD_, int head, struct nvkm_output *outp 11 12 struct nv50_disp_priv { 13 struct nvkm_disp base; 14 struct nvkm_oclass *sclass; 15 16 struct work_struct supervisor; 17 u32 super; 18 19 struct nvkm_event uevent; 20 21 struct { 22 int nr; 23 } head; 24 struct { 25 int nr; 26 int (*power)(NV50_DISP_MTHD_V1); 27 int (*sense)(NV50_DISP_MTHD_V1); 28 } dac; 29 struct { 30 int nr; 31 int (*power)(NV50_DISP_MTHD_V1); 32 int (*hda_eld)(NV50_DISP_MTHD_V1); 33 int (*hdmi)(NV50_DISP_MTHD_V1); 34 u32 lvdsconf; 35 void (*magic)(struct nvkm_output *); 36 } sor; 37 struct { 38 int nr; 39 int (*power)(NV50_DISP_MTHD_V1); 40 u8 type[3]; 41 } pior; 42 }; 43 44 struct nv50_disp_impl { 45 struct nvkm_disp_impl base; 46 struct { 47 const struct nv50_disp_mthd_chan *core; 48 const struct nv50_disp_mthd_chan *base; 49 const struct nv50_disp_mthd_chan *ovly; 50 int prev; 51 } mthd; 52 struct { 53 int (*scanoutpos)(NV50_DISP_MTHD_V0); 54 } head; 55 }; 56 57 int nv50_disp_main_scanoutpos(NV50_DISP_MTHD_V0); 58 int nv50_disp_main_mthd(struct nvkm_object *, u32, void *, u32); 59 60 int gf110_disp_main_scanoutpos(NV50_DISP_MTHD_V0); 61 62 int nv50_dac_power(NV50_DISP_MTHD_V1); 63 int nv50_dac_sense(NV50_DISP_MTHD_V1); 64 65 int gt215_hda_eld(NV50_DISP_MTHD_V1); 66 int gf110_hda_eld(NV50_DISP_MTHD_V1); 67 68 int g84_hdmi_ctrl(NV50_DISP_MTHD_V1); 69 int gt215_hdmi_ctrl(NV50_DISP_MTHD_V1); 70 int gf110_hdmi_ctrl(NV50_DISP_MTHD_V1); 71 int gk104_hdmi_ctrl(NV50_DISP_MTHD_V1); 72 73 int nv50_sor_power(NV50_DISP_MTHD_V1); 74 int nv50_pior_power(NV50_DISP_MTHD_V1); 75 76 #include <core/parent.h> 77 78 struct nv50_disp_base { 79 struct nvkm_parent base; 80 struct nvkm_ramht *ramht; 81 u32 chan; 82 }; 83 84 struct nv50_disp_chan_impl { 85 struct nvkm_ofuncs base; 86 int chid; 87 int (*attach)(struct nvkm_object *, struct nvkm_object *, u32); 88 void (*detach)(struct nvkm_object *, int); 89 }; 90 91 #include <core/namedb.h> 92 93 struct nv50_disp_chan { 94 struct nvkm_namedb base; 95 int chid; 96 }; 97 98 int nv50_disp_chan_ntfy(struct nvkm_object *, u32, struct nvkm_event **); 99 int nv50_disp_chan_map(struct nvkm_object *, u64 *, u32 *); 100 u32 nv50_disp_chan_rd32(struct nvkm_object *, u64); 101 void nv50_disp_chan_wr32(struct nvkm_object *, u64, u32); 102 extern const struct nvkm_event_func nv50_disp_chan_uevent; 103 int nv50_disp_chan_uevent_ctor(struct nvkm_object *, void *, u32, 104 struct nvkm_notify *); 105 void nv50_disp_chan_uevent_send(struct nv50_disp_priv *, int); 106 107 extern const struct nvkm_event_func gf110_disp_chan_uevent; 108 109 #define nv50_disp_chan_init(a) \ 110 nvkm_namedb_init(&(a)->base) 111 #define nv50_disp_chan_fini(a,b) \ 112 nvkm_namedb_fini(&(a)->base, (b)) 113 114 struct nv50_disp_dmac { 115 struct nv50_disp_chan base; 116 struct nvkm_dmaobj *pushdma; 117 u32 push; 118 }; 119 120 void nv50_disp_dmac_dtor(struct nvkm_object *); 121 122 struct nv50_disp_pioc { 123 struct nv50_disp_chan base; 124 }; 125 126 void nv50_disp_pioc_dtor(struct nvkm_object *); 127 128 struct nv50_disp_mthd_list { 129 u32 mthd; 130 u32 addr; 131 struct { 132 u32 mthd; 133 u32 addr; 134 const char *name; 135 } data[]; 136 }; 137 138 struct nv50_disp_mthd_chan { 139 const char *name; 140 u32 addr; 141 struct { 142 const char *name; 143 int nr; 144 const struct nv50_disp_mthd_list *mthd; 145 } data[]; 146 }; 147 148 extern struct nv50_disp_chan_impl nv50_disp_core_ofuncs; 149 int nv50_disp_core_ctor(struct nvkm_object *, struct nvkm_object *, 150 struct nvkm_oclass *, void *, u32, 151 struct nvkm_object **); 152 extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_base; 153 extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_sor; 154 extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_pior; 155 extern struct nv50_disp_chan_impl nv50_disp_base_ofuncs; 156 int nv50_disp_base_ctor(struct nvkm_object *, struct nvkm_object *, 157 struct nvkm_oclass *, void *, u32, 158 struct nvkm_object **); 159 extern const struct nv50_disp_mthd_list nv50_disp_base_mthd_image; 160 extern struct nv50_disp_chan_impl nv50_disp_ovly_ofuncs; 161 int nv50_disp_ovly_ctor(struct nvkm_object *, struct nvkm_object *, 162 struct nvkm_oclass *, void *, u32, 163 struct nvkm_object **); 164 extern const struct nv50_disp_mthd_list nv50_disp_ovly_mthd_base; 165 extern struct nv50_disp_chan_impl nv50_disp_oimm_ofuncs; 166 int nv50_disp_oimm_ctor(struct nvkm_object *, struct nvkm_object *, 167 struct nvkm_oclass *, void *, u32, 168 struct nvkm_object **); 169 extern struct nv50_disp_chan_impl nv50_disp_curs_ofuncs; 170 int nv50_disp_curs_ctor(struct nvkm_object *, struct nvkm_object *, 171 struct nvkm_oclass *, void *, u32, 172 struct nvkm_object **); 173 extern struct nvkm_ofuncs nv50_disp_main_ofuncs; 174 int nv50_disp_main_ctor(struct nvkm_object *, struct nvkm_object *, 175 struct nvkm_oclass *, void *, u32, 176 struct nvkm_object **); 177 void nv50_disp_main_dtor(struct nvkm_object *); 178 extern struct nvkm_omthds nv50_disp_main_omthds[]; 179 extern struct nvkm_oclass nv50_disp_cclass; 180 void nv50_disp_mthd_chan(struct nv50_disp_priv *, int debug, int head, 181 const struct nv50_disp_mthd_chan *); 182 void nv50_disp_intr_supervisor(struct work_struct *); 183 void nv50_disp_intr(struct nvkm_subdev *); 184 extern const struct nvkm_event_func nv50_disp_vblank_func; 185 186 extern const struct nv50_disp_mthd_chan g84_disp_core_mthd_chan; 187 extern const struct nv50_disp_mthd_list g84_disp_core_mthd_dac; 188 extern const struct nv50_disp_mthd_list g84_disp_core_mthd_head; 189 extern const struct nv50_disp_mthd_chan g84_disp_base_mthd_chan; 190 extern const struct nv50_disp_mthd_chan g84_disp_ovly_mthd_chan; 191 192 extern const struct nv50_disp_mthd_chan g94_disp_core_mthd_chan; 193 194 extern struct nv50_disp_chan_impl gf110_disp_core_ofuncs; 195 extern const struct nv50_disp_mthd_list gf110_disp_core_mthd_base; 196 extern const struct nv50_disp_mthd_list gf110_disp_core_mthd_dac; 197 extern const struct nv50_disp_mthd_list gf110_disp_core_mthd_sor; 198 extern const struct nv50_disp_mthd_list gf110_disp_core_mthd_pior; 199 extern struct nv50_disp_chan_impl gf110_disp_base_ofuncs; 200 extern struct nv50_disp_chan_impl gf110_disp_ovly_ofuncs; 201 extern const struct nv50_disp_mthd_chan gf110_disp_base_mthd_chan; 202 extern struct nv50_disp_chan_impl gf110_disp_oimm_ofuncs; 203 extern struct nv50_disp_chan_impl gf110_disp_curs_ofuncs; 204 extern struct nvkm_ofuncs gf110_disp_main_ofuncs; 205 extern struct nvkm_oclass gf110_disp_cclass; 206 void gf110_disp_intr_supervisor(struct work_struct *); 207 void gf110_disp_intr(struct nvkm_subdev *); 208 extern const struct nvkm_event_func gf110_disp_vblank_func; 209 210 extern const struct nv50_disp_mthd_chan gk104_disp_core_mthd_chan; 211 extern const struct nv50_disp_mthd_chan gk104_disp_ovly_mthd_chan; 212 213 extern struct nvkm_output_dp_impl nv50_pior_dp_impl; 214 extern struct nvkm_oclass *nv50_disp_outp_sclass[]; 215 216 extern struct nvkm_output_dp_impl g94_sor_dp_impl; 217 int g94_sor_dp_lnk_pwr(struct nvkm_output_dp *, int); 218 extern struct nvkm_oclass *g94_disp_outp_sclass[]; 219 220 extern struct nvkm_output_dp_impl gf110_sor_dp_impl; 221 int gf110_sor_dp_lnk_ctl(struct nvkm_output_dp *, int, int, bool); 222 extern struct nvkm_oclass *gf110_disp_outp_sclass[]; 223 224 void gm204_sor_magic(struct nvkm_output *outp); 225 extern struct nvkm_output_dp_impl gm204_sor_dp_impl; 226 #endif 227