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