0001 #ifndef __NVTHERM_PRIV_H__
0002 #define __NVTHERM_PRIV_H__
0003 #define nvkm_therm(p) container_of((p), struct nvkm_therm, subdev)
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 #include <subdev/therm.h>
0028 #include <subdev/bios.h>
0029 #include <subdev/bios/extdev.h>
0030 #include <subdev/bios/gpio.h>
0031 #include <subdev/bios/perf.h>
0032
0033 int nvkm_therm_new_(const struct nvkm_therm_func *, struct nvkm_device *, enum nvkm_subdev_type,
0034 int, struct nvkm_therm **);
0035 void nvkm_therm_ctor(struct nvkm_therm *, struct nvkm_device *, enum nvkm_subdev_type, int,
0036 const struct nvkm_therm_func *);
0037
0038 struct nvkm_fan {
0039 struct nvkm_therm *parent;
0040 const char *type;
0041
0042 struct nvbios_therm_fan bios;
0043 struct nvbios_perf_fan perf;
0044
0045 struct nvkm_alarm alarm;
0046 spinlock_t lock;
0047 int percent;
0048
0049 int (*get)(struct nvkm_therm *);
0050 int (*set)(struct nvkm_therm *, int percent);
0051
0052 struct dcb_gpio_func tach;
0053 };
0054
0055 int nvkm_therm_fan_mode(struct nvkm_therm *, int mode);
0056 int nvkm_therm_attr_get(struct nvkm_therm *, enum nvkm_therm_attr_type);
0057 int nvkm_therm_attr_set(struct nvkm_therm *, enum nvkm_therm_attr_type, int);
0058
0059 void nvkm_therm_ic_ctor(struct nvkm_therm *);
0060
0061 int nvkm_therm_sensor_ctor(struct nvkm_therm *);
0062
0063 int nvkm_therm_fan_ctor(struct nvkm_therm *);
0064 int nvkm_therm_fan_init(struct nvkm_therm *);
0065 int nvkm_therm_fan_fini(struct nvkm_therm *, bool suspend);
0066 int nvkm_therm_fan_get(struct nvkm_therm *);
0067 int nvkm_therm_fan_set(struct nvkm_therm *, bool now, int percent);
0068 int nvkm_therm_fan_user_get(struct nvkm_therm *);
0069 int nvkm_therm_fan_user_set(struct nvkm_therm *, int percent);
0070
0071 int nvkm_therm_sensor_init(struct nvkm_therm *);
0072 int nvkm_therm_sensor_fini(struct nvkm_therm *, bool suspend);
0073 void nvkm_therm_sensor_preinit(struct nvkm_therm *);
0074 void nvkm_therm_sensor_set_threshold_state(struct nvkm_therm *,
0075 enum nvkm_therm_thrs,
0076 enum nvkm_therm_thrs_state);
0077 enum nvkm_therm_thrs_state
0078 nvkm_therm_sensor_get_threshold_state(struct nvkm_therm *,
0079 enum nvkm_therm_thrs);
0080 void nvkm_therm_sensor_event(struct nvkm_therm *, enum nvkm_therm_thrs,
0081 enum nvkm_therm_thrs_direction);
0082 void nvkm_therm_program_alarms_polling(struct nvkm_therm *);
0083
0084 struct nvkm_therm_func {
0085 void (*init)(struct nvkm_therm *);
0086 void (*fini)(struct nvkm_therm *);
0087 void (*intr)(struct nvkm_therm *);
0088
0089 int (*pwm_ctrl)(struct nvkm_therm *, int line, bool);
0090 int (*pwm_get)(struct nvkm_therm *, int line, u32 *, u32 *);
0091 int (*pwm_set)(struct nvkm_therm *, int line, u32, u32);
0092 int (*pwm_clock)(struct nvkm_therm *, int line);
0093
0094 int (*temp_get)(struct nvkm_therm *);
0095
0096 int (*fan_sense)(struct nvkm_therm *);
0097
0098 void (*program_alarms)(struct nvkm_therm *);
0099
0100 void (*clkgate_init)(struct nvkm_therm *,
0101 const struct nvkm_therm_clkgate_pack *);
0102 void (*clkgate_enable)(struct nvkm_therm *);
0103 void (*clkgate_fini)(struct nvkm_therm *, bool);
0104 };
0105
0106 void nv40_therm_intr(struct nvkm_therm *);
0107
0108 int nv50_fan_pwm_ctrl(struct nvkm_therm *, int, bool);
0109 int nv50_fan_pwm_get(struct nvkm_therm *, int, u32 *, u32 *);
0110 int nv50_fan_pwm_set(struct nvkm_therm *, int, u32, u32);
0111 int nv50_fan_pwm_clock(struct nvkm_therm *, int);
0112
0113 int g84_temp_get(struct nvkm_therm *);
0114 void g84_sensor_setup(struct nvkm_therm *);
0115 void g84_therm_fini(struct nvkm_therm *);
0116
0117 int gt215_therm_fan_sense(struct nvkm_therm *);
0118
0119 void gf100_clkgate_init(struct nvkm_therm *,
0120 const struct nvkm_therm_clkgate_pack *);
0121
0122 void g84_therm_init(struct nvkm_therm *);
0123
0124 int gf119_fan_pwm_ctrl(struct nvkm_therm *, int, bool);
0125 int gf119_fan_pwm_get(struct nvkm_therm *, int, u32 *, u32 *);
0126 int gf119_fan_pwm_set(struct nvkm_therm *, int, u32, u32);
0127 int gf119_fan_pwm_clock(struct nvkm_therm *, int);
0128 void gf119_therm_init(struct nvkm_therm *);
0129
0130 void gk104_therm_init(struct nvkm_therm *);
0131 void gk104_clkgate_enable(struct nvkm_therm *);
0132 void gk104_clkgate_fini(struct nvkm_therm *, bool);
0133
0134 int nvkm_fanpwm_create(struct nvkm_therm *, struct dcb_gpio_func *);
0135 int nvkm_fantog_create(struct nvkm_therm *, struct dcb_gpio_func *);
0136 int nvkm_fannil_create(struct nvkm_therm *);
0137 #endif