1 /* SPDX-License-Identifier: MIT */
4 #include <core/subdev.h>
5 #include <core/notify.h>
6 #include <subdev/pci.h>
10 #define NVKM_CLK_CSTATE_DEFAULT -1 /* POSTed default */
11 #define NVKM_CLK_CSTATE_BASE -2 /* pstate base */
12 #define NVKM_CLK_CSTATE_HIGHEST -3 /* highest possible */
21 nv_clk_src_hclkm2d3
, /* NVAA */
22 nv_clk_src_hclkm4
, /* NVAA */
23 nv_clk_src_cclk
, /* NVAA */
30 nv_clk_src_mpllsrcref
,
57 struct list_head head
;
59 u32 domain
[nv_clk_src_max
];
64 struct list_head head
;
65 struct list_head list
; /* c-states */
66 struct nvkm_cstate base
;
69 enum nvkm_pcie_speed pcie_speed
;
75 u8 bios
; /* 0xff for none */
76 #define NVKM_CLK_DOM_FLAG_CORE 0x01
77 #define NVKM_CLK_DOM_FLAG_VPSTATE 0x02
84 const struct nvkm_clk_func
*func
;
85 struct nvkm_subdev subdev
;
87 const struct nvkm_domain
*domains
;
88 struct nvkm_pstate bstate
;
90 struct list_head states
;
93 struct work_struct work
;
94 wait_queue_head_t wait
;
97 struct nvkm_notify pwrsrc_ntfy
;
99 int pstate
; /* current */
100 int ustate_ac
; /* user-requested (-1 disabled, -2 perfmon) */
101 int ustate_dc
; /* user-requested (-1 disabled, -2 perfmon) */
102 int astate
; /* perfmon adjustment (base) */
103 int dstate
; /* display adjustment (min+) */
107 #define NVKM_CLK_BOOST_NONE 0x0
108 #define NVKM_CLK_BOOST_BIOS 0x1
109 #define NVKM_CLK_BOOST_FULL 0x2
114 /*XXX: die, these are here *only* to support the completely
115 * bat-shit insane what-was-nouveau_hw.c code
117 int (*pll_calc
)(struct nvkm_clk
*, struct nvbios_pll
*, int clk
,
118 struct nvkm_pll_vals
*pv
);
119 int (*pll_prog
)(struct nvkm_clk
*, u32 reg1
, struct nvkm_pll_vals
*pv
);
122 int nvkm_clk_read(struct nvkm_clk
*, enum nv_clk_src
);
123 int nvkm_clk_ustate(struct nvkm_clk
*, int req
, int pwr
);
124 int nvkm_clk_astate(struct nvkm_clk
*, int req
, int rel
, bool wait
);
125 int nvkm_clk_dstate(struct nvkm_clk
*, int req
, int rel
);
126 int nvkm_clk_tstate(struct nvkm_clk
*, u8 temperature
);
128 int nv04_clk_new(struct nvkm_device
*, int, struct nvkm_clk
**);
129 int nv40_clk_new(struct nvkm_device
*, int, struct nvkm_clk
**);
130 int nv50_clk_new(struct nvkm_device
*, int, struct nvkm_clk
**);
131 int g84_clk_new(struct nvkm_device
*, int, struct nvkm_clk
**);
132 int mcp77_clk_new(struct nvkm_device
*, int, struct nvkm_clk
**);
133 int gt215_clk_new(struct nvkm_device
*, int, struct nvkm_clk
**);
134 int gf100_clk_new(struct nvkm_device
*, int, struct nvkm_clk
**);
135 int gk104_clk_new(struct nvkm_device
*, int, struct nvkm_clk
**);
136 int gk20a_clk_new(struct nvkm_device
*, int, struct nvkm_clk
**);
137 int gm20b_clk_new(struct nvkm_device
*, int, struct nvkm_clk
**);