xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/nouveau/include/nvkm/subdev/volt.h (revision 41ec02673d281bbb3d38e6c78504ce6e30c228c1)
1 /*	$NetBSD: volt.h,v 1.3 2021/12/18 23:45:33 riastradh Exp $	*/
2 
3 /* SPDX-License-Identifier: MIT */
4 #ifndef __NVKM_VOLT_H__
5 #define __NVKM_VOLT_H__
6 #include <core/subdev.h>
7 
8 struct nvkm_volt {
9 	const struct nvkm_volt_func *func;
10 	struct nvkm_subdev subdev;
11 
12 	u8 vid_mask;
13 	u8 vid_nr;
14 	struct {
15 		u32 uv;
16 		u8 vid;
17 	} vid[256];
18 
19 	u32 max_uv;
20 	u32 min_uv;
21 
22 	/*
23 	 * These are fully functional map entries creating a sw ceiling for
24 	 * the voltage. These all can describe different kind of curves, so
25 	 * that for any given temperature a different one can return the lowest
26 	 * value of all three.
27 	 */
28 	u8 max0_id;
29 	u8 max1_id;
30 	u8 max2_id;
31 
32 	int speedo;
33 };
34 
35 int nvkm_volt_map(struct nvkm_volt *volt, u8 id, u8 temperature);
36 int nvkm_volt_map_min(struct nvkm_volt *volt, u8 id);
37 int nvkm_volt_get(struct nvkm_volt *);
38 int nvkm_volt_set_id(struct nvkm_volt *, u8 id, u8 min_id, u8 temp,
39 		     int condition);
40 
41 int nv40_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
42 int gf100_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
43 int gf117_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
44 int gk104_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
45 int gk20a_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
46 int gm20b_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
47 #endif
48