1 #ifndef __NV50_DISP_H__ 2 #define __NV50_DISP_H__ 3 4 #include <core/parent.h> 5 #include <core/namedb.h> 6 #include <core/engctx.h> 7 #include <core/ramht.h> 8 #include <core/event.h> 9 10 #include <engine/dmaobj.h> 11 12 #include "dport.h" 13 #include "priv.h" 14 #include "outp.h" 15 #include "outpdp.h" 16 17 #define NV50_DISP_MTHD_ struct nouveau_object *object, \ 18 struct nv50_disp_priv *priv, void *data, u32 size 19 #define NV50_DISP_MTHD_V0 NV50_DISP_MTHD_, int head 20 #define NV50_DISP_MTHD_V1 NV50_DISP_MTHD_, int head, struct nvkm_output *outp 21 22 struct nv50_disp_priv { 23 struct nouveau_disp base; 24 struct nouveau_oclass *sclass; 25 26 struct work_struct supervisor; 27 u32 super; 28 29 struct nvkm_event uevent; 30 31 struct { 32 int nr; 33 } head; 34 struct { 35 int nr; 36 int (*power)(NV50_DISP_MTHD_V1); 37 int (*sense)(NV50_DISP_MTHD_V1); 38 } dac; 39 struct { 40 int nr; 41 int (*power)(NV50_DISP_MTHD_V1); 42 int (*hda_eld)(NV50_DISP_MTHD_V1); 43 int (*hdmi)(NV50_DISP_MTHD_V1); 44 u32 lvdsconf; 45 } sor; 46 struct { 47 int nr; 48 int (*power)(NV50_DISP_MTHD_V1); 49 u8 type[3]; 50 } pior; 51 }; 52 53 struct nv50_disp_impl { 54 struct nouveau_disp_impl base; 55 struct { 56 const struct nv50_disp_mthd_chan *core; 57 const struct nv50_disp_mthd_chan *base; 58 const struct nv50_disp_mthd_chan *ovly; 59 int prev; 60 } mthd; 61 struct { 62 int (*scanoutpos)(NV50_DISP_MTHD_V0); 63 } head; 64 }; 65 66 int nv50_disp_base_scanoutpos(NV50_DISP_MTHD_V0); 67 int nv50_disp_base_mthd(struct nouveau_object *, u32, void *, u32); 68 69 int nvd0_disp_base_scanoutpos(NV50_DISP_MTHD_V0); 70 71 int nv50_dac_power(NV50_DISP_MTHD_V1); 72 int nv50_dac_sense(NV50_DISP_MTHD_V1); 73 74 int nva3_hda_eld(NV50_DISP_MTHD_V1); 75 int nvd0_hda_eld(NV50_DISP_MTHD_V1); 76 77 int nv84_hdmi_ctrl(NV50_DISP_MTHD_V1); 78 int nva3_hdmi_ctrl(NV50_DISP_MTHD_V1); 79 int nvd0_hdmi_ctrl(NV50_DISP_MTHD_V1); 80 int nve0_hdmi_ctrl(NV50_DISP_MTHD_V1); 81 82 int nv50_sor_power(NV50_DISP_MTHD_V1); 83 84 int nv94_sor_dp_train_init(struct nv50_disp_priv *, int, int, int, u16, u16, 85 u32, struct dcb_output *); 86 int nv94_sor_dp_train_fini(struct nv50_disp_priv *, int, int, int, u16, u16, 87 u32, struct dcb_output *); 88 int nv94_sor_dp_train(struct nv50_disp_priv *, int, int, u16, u16, u32, 89 struct dcb_output *); 90 int nv94_sor_dp_lnkctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32, 91 struct dcb_output *); 92 int nv94_sor_dp_drvctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32, 93 struct dcb_output *); 94 95 int nvd0_sor_dp_train(struct nv50_disp_priv *, int, int, u16, u16, u32, 96 struct dcb_output *); 97 int nvd0_sor_dp_lnkctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32, 98 struct dcb_output *); 99 int nvd0_sor_dp_drvctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32, 100 struct dcb_output *); 101 102 int nv50_pior_power(NV50_DISP_MTHD_V1); 103 104 struct nv50_disp_base { 105 struct nouveau_parent base; 106 struct nouveau_ramht *ramht; 107 u32 chan; 108 }; 109 110 struct nv50_disp_chan_impl { 111 struct nouveau_ofuncs base; 112 int chid; 113 int (*attach)(struct nouveau_object *, struct nouveau_object *, u32); 114 void (*detach)(struct nouveau_object *, int); 115 }; 116 117 struct nv50_disp_chan { 118 struct nouveau_namedb base; 119 int chid; 120 }; 121 122 int nv50_disp_chan_ntfy(struct nouveau_object *, u32, struct nvkm_event **); 123 int nv50_disp_chan_map(struct nouveau_object *, u64 *, u32 *); 124 u32 nv50_disp_chan_rd32(struct nouveau_object *, u64); 125 void nv50_disp_chan_wr32(struct nouveau_object *, u64, u32); 126 extern const struct nvkm_event_func nv50_disp_chan_uevent; 127 int nv50_disp_chan_uevent_ctor(struct nouveau_object *, void *, u32, 128 struct nvkm_notify *); 129 void nv50_disp_chan_uevent_send(struct nv50_disp_priv *, int); 130 131 extern const struct nvkm_event_func nvd0_disp_chan_uevent; 132 133 #define nv50_disp_chan_init(a) \ 134 nouveau_namedb_init(&(a)->base) 135 #define nv50_disp_chan_fini(a,b) \ 136 nouveau_namedb_fini(&(a)->base, (b)) 137 138 struct nv50_disp_dmac { 139 struct nv50_disp_chan base; 140 struct nouveau_dmaobj *pushdma; 141 u32 push; 142 }; 143 144 void nv50_disp_dmac_dtor(struct nouveau_object *); 145 146 struct nv50_disp_pioc { 147 struct nv50_disp_chan base; 148 }; 149 150 void nv50_disp_pioc_dtor(struct nouveau_object *); 151 152 struct nv50_disp_mthd_list { 153 u32 mthd; 154 u32 addr; 155 struct { 156 u32 mthd; 157 u32 addr; 158 const char *name; 159 } data[]; 160 }; 161 162 struct nv50_disp_mthd_chan { 163 const char *name; 164 u32 addr; 165 struct { 166 const char *name; 167 int nr; 168 const struct nv50_disp_mthd_list *mthd; 169 } data[]; 170 }; 171 172 extern struct nv50_disp_chan_impl nv50_disp_mast_ofuncs; 173 int nv50_disp_mast_ctor(struct nouveau_object *, struct nouveau_object *, 174 struct nouveau_oclass *, void *, u32, 175 struct nouveau_object **); 176 extern const struct nv50_disp_mthd_list nv50_disp_mast_mthd_base; 177 extern const struct nv50_disp_mthd_list nv50_disp_mast_mthd_sor; 178 extern const struct nv50_disp_mthd_list nv50_disp_mast_mthd_pior; 179 extern struct nv50_disp_chan_impl nv50_disp_sync_ofuncs; 180 int nv50_disp_sync_ctor(struct nouveau_object *, struct nouveau_object *, 181 struct nouveau_oclass *, void *, u32, 182 struct nouveau_object **); 183 extern const struct nv50_disp_mthd_list nv50_disp_sync_mthd_image; 184 extern struct nv50_disp_chan_impl nv50_disp_ovly_ofuncs; 185 int nv50_disp_ovly_ctor(struct nouveau_object *, struct nouveau_object *, 186 struct nouveau_oclass *, void *, u32, 187 struct nouveau_object **); 188 extern const struct nv50_disp_mthd_list nv50_disp_ovly_mthd_base; 189 extern struct nv50_disp_chan_impl nv50_disp_oimm_ofuncs; 190 int nv50_disp_oimm_ctor(struct nouveau_object *, struct nouveau_object *, 191 struct nouveau_oclass *, void *, u32, 192 struct nouveau_object **); 193 extern struct nv50_disp_chan_impl nv50_disp_curs_ofuncs; 194 int nv50_disp_curs_ctor(struct nouveau_object *, struct nouveau_object *, 195 struct nouveau_oclass *, void *, u32, 196 struct nouveau_object **); 197 extern struct nouveau_ofuncs nv50_disp_base_ofuncs; 198 int nv50_disp_base_ctor(struct nouveau_object *, struct nouveau_object *, 199 struct nouveau_oclass *, void *, u32, 200 struct nouveau_object **); 201 void nv50_disp_base_dtor(struct nouveau_object *); 202 extern struct nouveau_omthds nv50_disp_base_omthds[]; 203 extern struct nouveau_oclass nv50_disp_cclass; 204 void nv50_disp_mthd_chan(struct nv50_disp_priv *, int debug, int head, 205 const struct nv50_disp_mthd_chan *); 206 void nv50_disp_intr_supervisor(struct work_struct *); 207 void nv50_disp_intr(struct nouveau_subdev *); 208 extern const struct nvkm_event_func nv50_disp_vblank_func; 209 210 extern const struct nv50_disp_mthd_chan nv84_disp_mast_mthd_chan; 211 extern const struct nv50_disp_mthd_list nv84_disp_mast_mthd_dac; 212 extern const struct nv50_disp_mthd_list nv84_disp_mast_mthd_head; 213 extern const struct nv50_disp_mthd_chan nv84_disp_sync_mthd_chan; 214 extern const struct nv50_disp_mthd_chan nv84_disp_ovly_mthd_chan; 215 216 extern const struct nv50_disp_mthd_chan nv94_disp_mast_mthd_chan; 217 218 extern struct nv50_disp_chan_impl nvd0_disp_mast_ofuncs; 219 extern const struct nv50_disp_mthd_list nvd0_disp_mast_mthd_base; 220 extern const struct nv50_disp_mthd_list nvd0_disp_mast_mthd_dac; 221 extern const struct nv50_disp_mthd_list nvd0_disp_mast_mthd_sor; 222 extern const struct nv50_disp_mthd_list nvd0_disp_mast_mthd_pior; 223 extern struct nv50_disp_chan_impl nvd0_disp_sync_ofuncs; 224 extern struct nv50_disp_chan_impl nvd0_disp_ovly_ofuncs; 225 extern const struct nv50_disp_mthd_chan nvd0_disp_sync_mthd_chan; 226 extern struct nv50_disp_chan_impl nvd0_disp_oimm_ofuncs; 227 extern struct nv50_disp_chan_impl nvd0_disp_curs_ofuncs; 228 extern struct nouveau_ofuncs nvd0_disp_base_ofuncs; 229 extern struct nouveau_oclass nvd0_disp_cclass; 230 void nvd0_disp_intr_supervisor(struct work_struct *); 231 void nvd0_disp_intr(struct nouveau_subdev *); 232 extern const struct nvkm_event_func nvd0_disp_vblank_func; 233 234 extern const struct nv50_disp_mthd_chan nve0_disp_mast_mthd_chan; 235 extern const struct nv50_disp_mthd_chan nve0_disp_ovly_mthd_chan; 236 237 extern struct nvkm_output_dp_impl nv50_pior_dp_impl; 238 extern struct nouveau_oclass *nv50_disp_outp_sclass[]; 239 240 extern struct nvkm_output_dp_impl nv94_sor_dp_impl; 241 int nv94_sor_dp_lnk_pwr(struct nvkm_output_dp *, int); 242 extern struct nouveau_oclass *nv94_disp_outp_sclass[]; 243 244 extern struct nvkm_output_dp_impl nvd0_sor_dp_impl; 245 extern struct nouveau_oclass *nvd0_disp_outp_sclass[]; 246 247 #endif 248