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 int (*pll_set)(struct nouveau_clock *, u32 type, u32 freq);
15 /*XXX: die, these are here *only* to support the completely
16 * bat-shit insane what-was-nouveau_hw.c code
18 int (*pll_calc)(struct nouveau_clock *, struct nvbios_pll *,
19 int clk, struct nouveau_pll_vals *pv);
20 int (*pll_prog)(struct nouveau_clock *, u32 reg1,
21 struct nouveau_pll_vals *pv);
24 static inline struct nouveau_clock *
25 nouveau_clock(void *obj)
27 return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_CLOCK];
30 #define nouveau_clock_create(p,e,o,d) \
31 nouveau_subdev_create((p), (e), (o), 0, "CLOCK", "clock", d)
32 #define nouveau_clock_destroy(p) \
33 nouveau_subdev_destroy(&(p)->base)
34 #define nouveau_clock_init(p) \
35 nouveau_subdev_init(&(p)->base)
36 #define nouveau_clock_fini(p,s) \
37 nouveau_subdev_fini(&(p)->base, (s))
39 int nouveau_clock_create_(struct nouveau_object *, struct nouveau_object *,
40 struct nouveau_oclass *, void *, u32, int, void **);
42 #define _nouveau_clock_dtor _nouveau_subdev_dtor
43 #define _nouveau_clock_init _nouveau_subdev_init
44 #define _nouveau_clock_fini _nouveau_subdev_fini
46 extern struct nouveau_oclass nv04_clock_oclass;
47 extern struct nouveau_oclass nv40_clock_oclass;
48 extern struct nouveau_oclass nv50_clock_oclass;
49 extern struct nouveau_oclass nva3_clock_oclass;
50 extern struct nouveau_oclass nvc0_clock_oclass;
52 int nv04_clock_pll_set(struct nouveau_clock *, u32 type, u32 freq);
53 int nv04_clock_pll_calc(struct nouveau_clock *, struct nvbios_pll *,
54 int clk, struct nouveau_pll_vals *);
55 int nv04_clock_pll_prog(struct nouveau_clock *, u32 reg1,
56 struct nouveau_pll_vals *);
57 int nva3_clock_pll_calc(struct nouveau_clock *, struct nvbios_pll *,
58 int clk, struct nouveau_pll_vals *);