Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / nouveau / core / include / subdev / pwr.h
1 #ifndef __NOUVEAU_PWR_H__
2 #define __NOUVEAU_PWR_H__
3
4 #include <core/subdev.h>
5 #include <core/device.h>
6
7 struct nouveau_pwr {
8         struct nouveau_subdev base;
9
10         struct {
11                 u32 base;
12                 u32 size;
13         } send;
14
15         struct {
16                 u32 base;
17                 u32 size;
18
19                 struct work_struct work;
20                 wait_queue_head_t wait;
21                 u32 process;
22                 u32 message;
23                 u32 data[2];
24         } recv;
25
26         int  (*message)(struct nouveau_pwr *, u32[2], u32, u32, u32, u32);
27         void (*pgob)(struct nouveau_pwr *, bool);
28 };
29
30 static inline struct nouveau_pwr *
31 nouveau_pwr(void *obj)
32 {
33         return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_PWR];
34 }
35
36 extern struct nouveau_oclass *nva3_pwr_oclass;
37 extern struct nouveau_oclass *nvc0_pwr_oclass;
38 extern struct nouveau_oclass *nvd0_pwr_oclass;
39 extern struct nouveau_oclass *gk104_pwr_oclass;
40 extern struct nouveau_oclass *nv108_pwr_oclass;
41
42 /* interface to MEMX process running on PPWR */
43 struct nouveau_memx;
44 int  nouveau_memx_init(struct nouveau_pwr *, struct nouveau_memx **);
45 int  nouveau_memx_fini(struct nouveau_memx **, bool exec);
46 void nouveau_memx_wr32(struct nouveau_memx *, u32 addr, u32 data);
47 void nouveau_memx_wait(struct nouveau_memx *,
48                        u32 addr, u32 mask, u32 data, u32 nsec);
49 void nouveau_memx_nsec(struct nouveau_memx *, u32 nsec);
50
51 #endif