1 #ifndef __NOUVEAU_CLOCK_H__
2 #define __NOUVEAU_CLOCK_H__
4 #include <core/device.h>
5 #include <core/subdev.h>
7 struct nouveau_pll_vals;
10 struct nouveau_clock {
11 struct nouveau_subdev base;
13 /*XXX: die, these are here *only* to support the completely
14 * bat-shit insane what-was-nouveau_hw.c code
16 int (*pll_calc)(struct nouveau_clock *, struct nvbios_pll *,
17 int clk, struct nouveau_pll_vals *pv);
18 int (*pll_prog)(struct nouveau_clock *, u32 reg1,
19 struct nouveau_pll_vals *pv);
22 static inline struct nouveau_clock *
23 nouveau_clock(void *obj)
25 return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_CLOCK];
28 #define nouveau_clock_create(p,e,o,d) \
29 nouveau_subdev_create((p), (e), (o), 0, "CLOCK", "clock", d)
30 #define nouveau_clock_destroy(p) \
31 nouveau_subdev_destroy(&(p)->base)
32 #define nouveau_clock_init(p) \
33 nouveau_subdev_init(&(p)->base)
34 #define nouveau_clock_fini(p,s) \
35 nouveau_subdev_fini(&(p)->base, (s))
37 int nouveau_clock_create_(struct nouveau_object *, struct nouveau_object *,
38 struct nouveau_oclass *, void *, u32, int, void **);
40 #define _nouveau_clock_dtor _nouveau_subdev_dtor
41 #define _nouveau_clock_init _nouveau_subdev_init
42 #define _nouveau_clock_fini _nouveau_subdev_fini
44 extern struct nouveau_oclass nv04_clock_oclass;
45 extern struct nouveau_oclass nv40_clock_oclass;
46 extern struct nouveau_oclass nv50_clock_oclass;
47 extern struct nouveau_oclass nva3_clock_oclass;
48 extern struct nouveau_oclass nvc0_clock_oclass;
50 int nv04_clock_pll_set(struct nouveau_clock *, u32 type, u32 freq);
51 int nv04_clock_pll_calc(struct nouveau_clock *, struct nvbios_pll *,
52 int clk, struct nouveau_pll_vals *);
53 int nv04_clock_pll_prog(struct nouveau_clock *, u32 reg1,
54 struct nouveau_pll_vals *);
55 int nva3_clock_pll_calc(struct nouveau_clock *, struct nvbios_pll *,
56 int clk, struct nouveau_pll_vals *);