xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/clk/priv.h (revision 41ec02673d281bbb3d38e6c78504ce6e30c228c1)
1 /*	$NetBSD: priv.h,v 1.3 2021/12/18 23:45:39 riastradh Exp $	*/
2 
3 /* SPDX-License-Identifier: MIT */
4 #ifndef __NVKM_CLK_PRIV_H__
5 #define __NVKM_CLK_PRIV_H__
6 #define nvkm_clk(p) container_of((p), struct nvkm_clk, subdev)
7 #include <subdev/clk.h>
8 
9 struct nvkm_clk_func {
10 	int (*init)(struct nvkm_clk *);
11 	void (*fini)(struct nvkm_clk *);
12 	int (*read)(struct nvkm_clk *, enum nv_clk_src);
13 	int (*calc)(struct nvkm_clk *, struct nvkm_cstate *);
14 	int (*prog)(struct nvkm_clk *);
15 	void (*tidy)(struct nvkm_clk *);
16 	struct nvkm_pstate *pstates;
17 	int nr_pstates;
18 	struct nvkm_domain domains[];
19 };
20 
21 int nvkm_clk_ctor(const struct nvkm_clk_func *, struct nvkm_device *, int,
22 		  bool allow_reclock, struct nvkm_clk *);
23 int nvkm_clk_new_(const struct nvkm_clk_func *, struct nvkm_device *, int,
24 		  bool allow_reclock, struct nvkm_clk **);
25 
26 int nv04_clk_pll_calc(struct nvkm_clk *, struct nvbios_pll *, int clk,
27 		      struct nvkm_pll_vals *);
28 int nv04_clk_pll_prog(struct nvkm_clk *, u32 reg1, struct nvkm_pll_vals *);
29 #endif
30