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
8struct 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
35int nvkm_volt_map(struct nvkm_volt *volt, u8 id, u8 temperature);
36int nvkm_volt_map_min(struct nvkm_volt *volt, u8 id);
37int nvkm_volt_get(struct nvkm_volt *);
38int nvkm_volt_set_id(struct nvkm_volt *, u8 id, u8 min_id, u8 temp,
39		     int condition);
40
41int nv40_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
42int gf100_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
43int gf117_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
44int gk104_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
45int gk20a_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
46int gm20b_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
47#endif
48