1b7019ac5SIlia Mirkin /* SPDX-License-Identifier: MIT */ 2a1c93078SBen Skeggs #ifndef __NVKM_DISP_HEAD_H__ 3a1c93078SBen Skeggs #define __NVKM_DISP_HEAD_H__ 4*a2b7eadfSBen Skeggs #include <nvif/object.h> 5a1c93078SBen Skeggs #include "priv.h" 6a1c93078SBen Skeggs 7a1c93078SBen Skeggs struct nvkm_head { 8a1c93078SBen Skeggs const struct nvkm_head_func *func; 9a1c93078SBen Skeggs struct nvkm_disp *disp; 10a1c93078SBen Skeggs int id; 11a1c93078SBen Skeggs 12a1c93078SBen Skeggs struct list_head head; 1357b2d73bSBen Skeggs 1457b2d73bSBen Skeggs struct nvkm_head_state { 1557b2d73bSBen Skeggs u16 htotal; 1657b2d73bSBen Skeggs u16 hsynce; 1757b2d73bSBen Skeggs u16 hblanke; 1857b2d73bSBen Skeggs u16 hblanks; 1957b2d73bSBen Skeggs u16 vtotal; 2057b2d73bSBen Skeggs u16 vsynce; 2157b2d73bSBen Skeggs u16 vblanke; 2257b2d73bSBen Skeggs u16 vblanks; 239648da5aSBen Skeggs u32 hz; 249648da5aSBen Skeggs 259648da5aSBen Skeggs /* Prior to GF119, these are set by the OR. */ 269648da5aSBen Skeggs struct { 279648da5aSBen Skeggs u8 depth; 289648da5aSBen Skeggs } or; 2957b2d73bSBen Skeggs } arm, asy; 30*a2b7eadfSBen Skeggs 31*a2b7eadfSBen Skeggs struct nvkm_object object; 32a1c93078SBen Skeggs }; 33a1c93078SBen Skeggs 34a1c93078SBen Skeggs int nvkm_head_new_(const struct nvkm_head_func *, struct nvkm_disp *, int id); 35a1c93078SBen Skeggs void nvkm_head_del(struct nvkm_head **); 36a1c93078SBen Skeggs struct nvkm_head *nvkm_head_find(struct nvkm_disp *, int id); 37a1c93078SBen Skeggs 38a1c93078SBen Skeggs struct nvkm_head_func { 3957b2d73bSBen Skeggs void (*state)(struct nvkm_head *, struct nvkm_head_state *); 4057b2d73bSBen Skeggs void (*rgpos)(struct nvkm_head *, u16 *hline, u16 *vline); 418d7ef84dSBen Skeggs void (*rgclk)(struct nvkm_head *, int div); 4214187b00SBen Skeggs void (*vblank_get)(struct nvkm_head *); 4314187b00SBen Skeggs void (*vblank_put)(struct nvkm_head *); 44a1c93078SBen Skeggs }; 45a1c93078SBen Skeggs 46f7b2ece3SBen Skeggs int nv50_head_cnt(struct nvkm_disp *, unsigned long *); 47a1c93078SBen Skeggs int nv50_head_new(struct nvkm_disp *, int id); 48acbe9ecfSBen Skeggs void nv50_head_rgpos(struct nvkm_head *, u16 *, u16 *); 49f7b2ece3SBen Skeggs 50f7b2ece3SBen Skeggs int gf119_head_cnt(struct nvkm_disp *, unsigned long *); 51a1c93078SBen Skeggs int gf119_head_new(struct nvkm_disp *, int id); 52290ffeafSBen Skeggs void gf119_head_rgclk(struct nvkm_head *, int); 53290ffeafSBen Skeggs 54290ffeafSBen Skeggs int gv100_head_cnt(struct nvkm_disp *, unsigned long *); 55290ffeafSBen Skeggs int gv100_head_new(struct nvkm_disp *, int id); 56acbe9ecfSBen Skeggs 57acbe9ecfSBen Skeggs #define HEAD_MSG(h,l,f,a...) do { \ 58acbe9ecfSBen Skeggs struct nvkm_head *_h = (h); \ 59acbe9ecfSBen Skeggs nvkm_##l(&_h->disp->engine.subdev, "head-%d: "f"\n", _h->id, ##a); \ 60acbe9ecfSBen Skeggs } while(0) 61acbe9ecfSBen Skeggs #define HEAD_WARN(h,f,a...) HEAD_MSG((h), warn, f, ##a) 62acbe9ecfSBen Skeggs #define HEAD_DBG(h,f,a...) HEAD_MSG((h), debug, f, ##a) 63a1c93078SBen Skeggs #endif 64