drm/nouveau/kms/nv50-: Refactor and cleanup DP HPD handling
[linux-2.6-microblaze.git] / drivers / gpu / drm / nouveau / dispnv50 / core.h
1 #ifndef __NV50_KMS_CORE_H__
2 #define __NV50_KMS_CORE_H__
3 #include "disp.h"
4 #include "atom.h"
5 #include "crc.h"
6 #include <nouveau_encoder.h>
7
8 struct nv50_core {
9         const struct nv50_core_func *func;
10         struct nv50_dmac chan;
11         bool assign_windows;
12 };
13
14 int nv50_core_new(struct nouveau_drm *, struct nv50_core **);
15 void nv50_core_del(struct nv50_core **);
16
17 struct nv50_core_func {
18         int (*init)(struct nv50_core *);
19         void (*ntfy_init)(struct nouveau_bo *, u32 offset);
20         int (*caps_init)(struct nouveau_drm *, struct nv50_disp *);
21         int (*ntfy_wait_done)(struct nouveau_bo *, u32 offset,
22                               struct nvif_device *);
23         int (*update)(struct nv50_core *, u32 *interlock, bool ntfy);
24
25         struct {
26                 int (*owner)(struct nv50_core *);
27         } wndw;
28
29         const struct nv50_head_func *head;
30 #if IS_ENABLED(CONFIG_DEBUG_FS)
31         const struct nv50_crc_func *crc;
32 #endif
33         const struct nv50_outp_func {
34                 int (*ctrl)(struct nv50_core *, int or, u32 ctrl,
35                              struct nv50_head_atom *);
36                 /* XXX: Only used by SORs and PIORs for now */
37                 void (*get_caps)(struct nv50_disp *,
38                                  struct nouveau_encoder *, int or);
39         } *dac, *pior, *sor;
40 };
41
42 int core507d_new(struct nouveau_drm *, s32, struct nv50_core **);
43 int core507d_new_(const struct nv50_core_func *, struct nouveau_drm *, s32,
44                   struct nv50_core **);
45 int core507d_init(struct nv50_core *);
46 void core507d_ntfy_init(struct nouveau_bo *, u32);
47 int core507d_caps_init(struct nouveau_drm *, struct nv50_disp *);
48 int core507d_ntfy_wait_done(struct nouveau_bo *, u32, struct nvif_device *);
49 int core507d_update(struct nv50_core *, u32 *, bool);
50
51 extern const struct nv50_outp_func dac507d;
52 extern const struct nv50_outp_func sor507d;
53 extern const struct nv50_outp_func pior507d;
54
55 int core827d_new(struct nouveau_drm *, s32, struct nv50_core **);
56
57 int core907d_new(struct nouveau_drm *, s32, struct nv50_core **);
58 extern const struct nv50_outp_func dac907d;
59 extern const struct nv50_outp_func sor907d;
60
61 int core917d_new(struct nouveau_drm *, s32, struct nv50_core **);
62
63 int corec37d_new(struct nouveau_drm *, s32, struct nv50_core **);
64 int corec37d_caps_init(struct nouveau_drm *, struct nv50_disp *);
65 int corec37d_ntfy_wait_done(struct nouveau_bo *, u32, struct nvif_device *);
66 int corec37d_update(struct nv50_core *, u32 *, bool);
67 int corec37d_wndw_owner(struct nv50_core *);
68 extern const struct nv50_outp_func sorc37d;
69
70 int corec57d_new(struct nouveau_drm *, s32, struct nv50_core **);
71 #endif