mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-13 14:14:37 +00:00
drm/nouveau/therm: namespace + nvidia gpu names (no binary change)
The namespace of NVKM is being changed to nvkm_ instead of nouveau_, which will be used for the DRM part of the driver. This is being done in order to make it very clear as to what part of the driver a given symbol belongs to, and as a minor step towards splitting the DRM driver out to be able to stand on its own (for virt). Because there's already a large amount of churn here anyway, this is as good a time as any to also switch to NVIDIA's device and chipset naming to ease collaboration with them. A comparison of objdump disassemblies proves no code changes. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
21b137916e
commit
e1404611d5
20 changed files with 632 additions and 678 deletions
|
@ -1,83 +1,79 @@
|
||||||
#ifndef __NOUVEAU_THERM_H__
|
#ifndef __NVKM_THERM_H__
|
||||||
#define __NOUVEAU_THERM_H__
|
#define __NVKM_THERM_H__
|
||||||
|
|
||||||
#include <core/device.h>
|
|
||||||
#include <core/subdev.h>
|
#include <core/subdev.h>
|
||||||
|
|
||||||
enum nouveau_therm_fan_mode {
|
enum nvkm_therm_fan_mode {
|
||||||
NOUVEAU_THERM_CTRL_NONE = 0,
|
NVKM_THERM_CTRL_NONE = 0,
|
||||||
NOUVEAU_THERM_CTRL_MANUAL = 1,
|
NVKM_THERM_CTRL_MANUAL = 1,
|
||||||
NOUVEAU_THERM_CTRL_AUTO = 2,
|
NVKM_THERM_CTRL_AUTO = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum nouveau_therm_attr_type {
|
enum nvkm_therm_attr_type {
|
||||||
NOUVEAU_THERM_ATTR_FAN_MIN_DUTY = 0,
|
NVKM_THERM_ATTR_FAN_MIN_DUTY = 0,
|
||||||
NOUVEAU_THERM_ATTR_FAN_MAX_DUTY = 1,
|
NVKM_THERM_ATTR_FAN_MAX_DUTY = 1,
|
||||||
NOUVEAU_THERM_ATTR_FAN_MODE = 2,
|
NVKM_THERM_ATTR_FAN_MODE = 2,
|
||||||
|
|
||||||
NOUVEAU_THERM_ATTR_THRS_FAN_BOOST = 10,
|
NVKM_THERM_ATTR_THRS_FAN_BOOST = 10,
|
||||||
NOUVEAU_THERM_ATTR_THRS_FAN_BOOST_HYST = 11,
|
NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST = 11,
|
||||||
NOUVEAU_THERM_ATTR_THRS_DOWN_CLK = 12,
|
NVKM_THERM_ATTR_THRS_DOWN_CLK = 12,
|
||||||
NOUVEAU_THERM_ATTR_THRS_DOWN_CLK_HYST = 13,
|
NVKM_THERM_ATTR_THRS_DOWN_CLK_HYST = 13,
|
||||||
NOUVEAU_THERM_ATTR_THRS_CRITICAL = 14,
|
NVKM_THERM_ATTR_THRS_CRITICAL = 14,
|
||||||
NOUVEAU_THERM_ATTR_THRS_CRITICAL_HYST = 15,
|
NVKM_THERM_ATTR_THRS_CRITICAL_HYST = 15,
|
||||||
NOUVEAU_THERM_ATTR_THRS_SHUTDOWN = 16,
|
NVKM_THERM_ATTR_THRS_SHUTDOWN = 16,
|
||||||
NOUVEAU_THERM_ATTR_THRS_SHUTDOWN_HYST = 17,
|
NVKM_THERM_ATTR_THRS_SHUTDOWN_HYST = 17,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nouveau_therm {
|
struct nvkm_therm {
|
||||||
struct nouveau_subdev base;
|
struct nvkm_subdev base;
|
||||||
|
|
||||||
int (*pwm_ctrl)(struct nouveau_therm *, int line, bool);
|
int (*pwm_ctrl)(struct nvkm_therm *, int line, bool);
|
||||||
int (*pwm_get)(struct nouveau_therm *, int line, u32 *, u32 *);
|
int (*pwm_get)(struct nvkm_therm *, int line, u32 *, u32 *);
|
||||||
int (*pwm_set)(struct nouveau_therm *, int line, u32, u32);
|
int (*pwm_set)(struct nvkm_therm *, int line, u32, u32);
|
||||||
int (*pwm_clock)(struct nouveau_therm *, int line);
|
int (*pwm_clock)(struct nvkm_therm *, int line);
|
||||||
|
|
||||||
int (*fan_get)(struct nouveau_therm *);
|
int (*fan_get)(struct nvkm_therm *);
|
||||||
int (*fan_set)(struct nouveau_therm *, int);
|
int (*fan_set)(struct nvkm_therm *, int);
|
||||||
int (*fan_sense)(struct nouveau_therm *);
|
int (*fan_sense)(struct nvkm_therm *);
|
||||||
|
|
||||||
int (*temp_get)(struct nouveau_therm *);
|
int (*temp_get)(struct nvkm_therm *);
|
||||||
|
|
||||||
int (*attr_get)(struct nouveau_therm *, enum nouveau_therm_attr_type);
|
int (*attr_get)(struct nvkm_therm *, enum nvkm_therm_attr_type);
|
||||||
int (*attr_set)(struct nouveau_therm *,
|
int (*attr_set)(struct nvkm_therm *, enum nvkm_therm_attr_type, int);
|
||||||
enum nouveau_therm_attr_type, int);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct nouveau_therm *
|
static inline struct nvkm_therm *
|
||||||
nouveau_therm(void *obj)
|
nvkm_therm(void *obj)
|
||||||
{
|
{
|
||||||
return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_THERM);
|
return (void *)nvkm_subdev(obj, NVDEV_SUBDEV_THERM);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define nouveau_therm_create(p,e,o,d) \
|
#define nvkm_therm_create(p,e,o,d) \
|
||||||
nouveau_therm_create_((p), (e), (o), sizeof(**d), (void **)d)
|
nvkm_therm_create_((p), (e), (o), sizeof(**d), (void **)d)
|
||||||
#define nouveau_therm_destroy(p) ({ \
|
#define nvkm_therm_destroy(p) ({ \
|
||||||
struct nouveau_therm *therm = (p); \
|
struct nvkm_therm *therm = (p); \
|
||||||
_nouveau_therm_dtor(nv_object(therm)); \
|
_nvkm_therm_dtor(nv_object(therm)); \
|
||||||
})
|
})
|
||||||
#define nouveau_therm_init(p) ({ \
|
#define nvkm_therm_init(p) ({ \
|
||||||
struct nouveau_therm *therm = (p); \
|
struct nvkm_therm *therm = (p); \
|
||||||
_nouveau_therm_init(nv_object(therm)); \
|
_nvkm_therm_init(nv_object(therm)); \
|
||||||
})
|
})
|
||||||
#define nouveau_therm_fini(p,s) ({ \
|
#define nvkm_therm_fini(p,s) ({ \
|
||||||
struct nouveau_therm *therm = (p); \
|
struct nvkm_therm *therm = (p); \
|
||||||
_nouveau_therm_init(nv_object(therm), (s)); \
|
_nvkm_therm_init(nv_object(therm), (s)); \
|
||||||
})
|
})
|
||||||
|
|
||||||
int nouveau_therm_create_(struct nouveau_object *, struct nouveau_object *,
|
int nvkm_therm_create_(struct nvkm_object *, struct nvkm_object *,
|
||||||
struct nouveau_oclass *, int, void **);
|
struct nvkm_oclass *, int, void **);
|
||||||
void _nouveau_therm_dtor(struct nouveau_object *);
|
void _nvkm_therm_dtor(struct nvkm_object *);
|
||||||
int _nouveau_therm_init(struct nouveau_object *);
|
int _nvkm_therm_init(struct nvkm_object *);
|
||||||
int _nouveau_therm_fini(struct nouveau_object *, bool);
|
int _nvkm_therm_fini(struct nvkm_object *, bool);
|
||||||
|
|
||||||
int nouveau_therm_cstate(struct nouveau_therm *, int, int);
|
int nvkm_therm_cstate(struct nvkm_therm *, int, int);
|
||||||
|
|
||||||
extern struct nouveau_oclass nv40_therm_oclass;
|
|
||||||
extern struct nouveau_oclass nv50_therm_oclass;
|
|
||||||
extern struct nouveau_oclass nv84_therm_oclass;
|
|
||||||
extern struct nouveau_oclass nva3_therm_oclass;
|
|
||||||
extern struct nouveau_oclass nvd0_therm_oclass;
|
|
||||||
extern struct nouveau_oclass gm107_therm_oclass;
|
|
||||||
|
|
||||||
|
extern struct nvkm_oclass nv40_therm_oclass;
|
||||||
|
extern struct nvkm_oclass nv50_therm_oclass;
|
||||||
|
extern struct nvkm_oclass g84_therm_oclass;
|
||||||
|
extern struct nvkm_oclass gt215_therm_oclass;
|
||||||
|
extern struct nvkm_oclass gf110_therm_oclass;
|
||||||
|
extern struct nvkm_oclass gm107_therm_oclass;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -69,7 +69,7 @@ nouveau_hwmon_temp1_auto_point1_temp(struct device *d,
|
||||||
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
||||||
|
|
||||||
return snprintf(buf, PAGE_SIZE, "%d\n",
|
return snprintf(buf, PAGE_SIZE, "%d\n",
|
||||||
therm->attr_get(therm, NOUVEAU_THERM_ATTR_THRS_FAN_BOOST) * 1000);
|
therm->attr_get(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST) * 1000);
|
||||||
}
|
}
|
||||||
static ssize_t
|
static ssize_t
|
||||||
nouveau_hwmon_set_temp1_auto_point1_temp(struct device *d,
|
nouveau_hwmon_set_temp1_auto_point1_temp(struct device *d,
|
||||||
|
@ -84,7 +84,7 @@ nouveau_hwmon_set_temp1_auto_point1_temp(struct device *d,
|
||||||
if (kstrtol(buf, 10, &value) == -EINVAL)
|
if (kstrtol(buf, 10, &value) == -EINVAL)
|
||||||
return count;
|
return count;
|
||||||
|
|
||||||
therm->attr_set(therm, NOUVEAU_THERM_ATTR_THRS_FAN_BOOST,
|
therm->attr_set(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST,
|
||||||
value / 1000);
|
value / 1000);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
@ -102,7 +102,7 @@ nouveau_hwmon_temp1_auto_point1_temp_hyst(struct device *d,
|
||||||
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
||||||
|
|
||||||
return snprintf(buf, PAGE_SIZE, "%d\n",
|
return snprintf(buf, PAGE_SIZE, "%d\n",
|
||||||
therm->attr_get(therm, NOUVEAU_THERM_ATTR_THRS_FAN_BOOST_HYST) * 1000);
|
therm->attr_get(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST) * 1000);
|
||||||
}
|
}
|
||||||
static ssize_t
|
static ssize_t
|
||||||
nouveau_hwmon_set_temp1_auto_point1_temp_hyst(struct device *d,
|
nouveau_hwmon_set_temp1_auto_point1_temp_hyst(struct device *d,
|
||||||
|
@ -117,7 +117,7 @@ nouveau_hwmon_set_temp1_auto_point1_temp_hyst(struct device *d,
|
||||||
if (kstrtol(buf, 10, &value) == -EINVAL)
|
if (kstrtol(buf, 10, &value) == -EINVAL)
|
||||||
return count;
|
return count;
|
||||||
|
|
||||||
therm->attr_set(therm, NOUVEAU_THERM_ATTR_THRS_FAN_BOOST_HYST,
|
therm->attr_set(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST,
|
||||||
value / 1000);
|
value / 1000);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
@ -134,7 +134,7 @@ nouveau_hwmon_max_temp(struct device *d, struct device_attribute *a, char *buf)
|
||||||
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
||||||
|
|
||||||
return snprintf(buf, PAGE_SIZE, "%d\n",
|
return snprintf(buf, PAGE_SIZE, "%d\n",
|
||||||
therm->attr_get(therm, NOUVEAU_THERM_ATTR_THRS_DOWN_CLK) * 1000);
|
therm->attr_get(therm, NVKM_THERM_ATTR_THRS_DOWN_CLK) * 1000);
|
||||||
}
|
}
|
||||||
static ssize_t
|
static ssize_t
|
||||||
nouveau_hwmon_set_max_temp(struct device *d, struct device_attribute *a,
|
nouveau_hwmon_set_max_temp(struct device *d, struct device_attribute *a,
|
||||||
|
@ -148,7 +148,7 @@ nouveau_hwmon_set_max_temp(struct device *d, struct device_attribute *a,
|
||||||
if (kstrtol(buf, 10, &value) == -EINVAL)
|
if (kstrtol(buf, 10, &value) == -EINVAL)
|
||||||
return count;
|
return count;
|
||||||
|
|
||||||
therm->attr_set(therm, NOUVEAU_THERM_ATTR_THRS_DOWN_CLK, value / 1000);
|
therm->attr_set(therm, NVKM_THERM_ATTR_THRS_DOWN_CLK, value / 1000);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ nouveau_hwmon_max_temp_hyst(struct device *d, struct device_attribute *a,
|
||||||
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
||||||
|
|
||||||
return snprintf(buf, PAGE_SIZE, "%d\n",
|
return snprintf(buf, PAGE_SIZE, "%d\n",
|
||||||
therm->attr_get(therm, NOUVEAU_THERM_ATTR_THRS_DOWN_CLK_HYST) * 1000);
|
therm->attr_get(therm, NVKM_THERM_ATTR_THRS_DOWN_CLK_HYST) * 1000);
|
||||||
}
|
}
|
||||||
static ssize_t
|
static ssize_t
|
||||||
nouveau_hwmon_set_max_temp_hyst(struct device *d, struct device_attribute *a,
|
nouveau_hwmon_set_max_temp_hyst(struct device *d, struct device_attribute *a,
|
||||||
|
@ -179,7 +179,7 @@ nouveau_hwmon_set_max_temp_hyst(struct device *d, struct device_attribute *a,
|
||||||
if (kstrtol(buf, 10, &value) == -EINVAL)
|
if (kstrtol(buf, 10, &value) == -EINVAL)
|
||||||
return count;
|
return count;
|
||||||
|
|
||||||
therm->attr_set(therm, NOUVEAU_THERM_ATTR_THRS_DOWN_CLK_HYST,
|
therm->attr_set(therm, NVKM_THERM_ATTR_THRS_DOWN_CLK_HYST,
|
||||||
value / 1000);
|
value / 1000);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
@ -197,7 +197,7 @@ nouveau_hwmon_critical_temp(struct device *d, struct device_attribute *a,
|
||||||
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
||||||
|
|
||||||
return snprintf(buf, PAGE_SIZE, "%d\n",
|
return snprintf(buf, PAGE_SIZE, "%d\n",
|
||||||
therm->attr_get(therm, NOUVEAU_THERM_ATTR_THRS_CRITICAL) * 1000);
|
therm->attr_get(therm, NVKM_THERM_ATTR_THRS_CRITICAL) * 1000);
|
||||||
}
|
}
|
||||||
static ssize_t
|
static ssize_t
|
||||||
nouveau_hwmon_set_critical_temp(struct device *d, struct device_attribute *a,
|
nouveau_hwmon_set_critical_temp(struct device *d, struct device_attribute *a,
|
||||||
|
@ -212,7 +212,7 @@ nouveau_hwmon_set_critical_temp(struct device *d, struct device_attribute *a,
|
||||||
if (kstrtol(buf, 10, &value) == -EINVAL)
|
if (kstrtol(buf, 10, &value) == -EINVAL)
|
||||||
return count;
|
return count;
|
||||||
|
|
||||||
therm->attr_set(therm, NOUVEAU_THERM_ATTR_THRS_CRITICAL, value / 1000);
|
therm->attr_set(therm, NVKM_THERM_ATTR_THRS_CRITICAL, value / 1000);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ nouveau_hwmon_critical_temp_hyst(struct device *d, struct device_attribute *a,
|
||||||
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
||||||
|
|
||||||
return snprintf(buf, PAGE_SIZE, "%d\n",
|
return snprintf(buf, PAGE_SIZE, "%d\n",
|
||||||
therm->attr_get(therm, NOUVEAU_THERM_ATTR_THRS_CRITICAL_HYST) * 1000);
|
therm->attr_get(therm, NVKM_THERM_ATTR_THRS_CRITICAL_HYST) * 1000);
|
||||||
}
|
}
|
||||||
static ssize_t
|
static ssize_t
|
||||||
nouveau_hwmon_set_critical_temp_hyst(struct device *d,
|
nouveau_hwmon_set_critical_temp_hyst(struct device *d,
|
||||||
|
@ -246,7 +246,7 @@ nouveau_hwmon_set_critical_temp_hyst(struct device *d,
|
||||||
if (kstrtol(buf, 10, &value) == -EINVAL)
|
if (kstrtol(buf, 10, &value) == -EINVAL)
|
||||||
return count;
|
return count;
|
||||||
|
|
||||||
therm->attr_set(therm, NOUVEAU_THERM_ATTR_THRS_CRITICAL_HYST,
|
therm->attr_set(therm, NVKM_THERM_ATTR_THRS_CRITICAL_HYST,
|
||||||
value / 1000);
|
value / 1000);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
@ -263,7 +263,7 @@ nouveau_hwmon_emergency_temp(struct device *d, struct device_attribute *a,
|
||||||
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
||||||
|
|
||||||
return snprintf(buf, PAGE_SIZE, "%d\n",
|
return snprintf(buf, PAGE_SIZE, "%d\n",
|
||||||
therm->attr_get(therm, NOUVEAU_THERM_ATTR_THRS_SHUTDOWN) * 1000);
|
therm->attr_get(therm, NVKM_THERM_ATTR_THRS_SHUTDOWN) * 1000);
|
||||||
}
|
}
|
||||||
static ssize_t
|
static ssize_t
|
||||||
nouveau_hwmon_set_emergency_temp(struct device *d, struct device_attribute *a,
|
nouveau_hwmon_set_emergency_temp(struct device *d, struct device_attribute *a,
|
||||||
|
@ -278,7 +278,7 @@ nouveau_hwmon_set_emergency_temp(struct device *d, struct device_attribute *a,
|
||||||
if (kstrtol(buf, 10, &value) == -EINVAL)
|
if (kstrtol(buf, 10, &value) == -EINVAL)
|
||||||
return count;
|
return count;
|
||||||
|
|
||||||
therm->attr_set(therm, NOUVEAU_THERM_ATTR_THRS_SHUTDOWN, value / 1000);
|
therm->attr_set(therm, NVKM_THERM_ATTR_THRS_SHUTDOWN, value / 1000);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
@ -296,7 +296,7 @@ nouveau_hwmon_emergency_temp_hyst(struct device *d, struct device_attribute *a,
|
||||||
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
||||||
|
|
||||||
return snprintf(buf, PAGE_SIZE, "%d\n",
|
return snprintf(buf, PAGE_SIZE, "%d\n",
|
||||||
therm->attr_get(therm, NOUVEAU_THERM_ATTR_THRS_SHUTDOWN_HYST) * 1000);
|
therm->attr_get(therm, NVKM_THERM_ATTR_THRS_SHUTDOWN_HYST) * 1000);
|
||||||
}
|
}
|
||||||
static ssize_t
|
static ssize_t
|
||||||
nouveau_hwmon_set_emergency_temp_hyst(struct device *d,
|
nouveau_hwmon_set_emergency_temp_hyst(struct device *d,
|
||||||
|
@ -312,7 +312,7 @@ nouveau_hwmon_set_emergency_temp_hyst(struct device *d,
|
||||||
if (kstrtol(buf, 10, &value) == -EINVAL)
|
if (kstrtol(buf, 10, &value) == -EINVAL)
|
||||||
return count;
|
return count;
|
||||||
|
|
||||||
therm->attr_set(therm, NOUVEAU_THERM_ATTR_THRS_SHUTDOWN_HYST,
|
therm->attr_set(therm, NVKM_THERM_ATTR_THRS_SHUTDOWN_HYST,
|
||||||
value / 1000);
|
value / 1000);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
@ -362,7 +362,7 @@ nouveau_hwmon_get_pwm1_enable(struct device *d,
|
||||||
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = therm->attr_get(therm, NOUVEAU_THERM_ATTR_FAN_MODE);
|
ret = therm->attr_get(therm, NVKM_THERM_ATTR_FAN_MODE);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -383,7 +383,7 @@ nouveau_hwmon_set_pwm1_enable(struct device *d, struct device_attribute *a,
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = therm->attr_set(therm, NOUVEAU_THERM_ATTR_FAN_MODE, value);
|
ret = therm->attr_set(therm, NVKM_THERM_ATTR_FAN_MODE, value);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
else
|
else
|
||||||
|
@ -441,7 +441,7 @@ nouveau_hwmon_get_pwm1_min(struct device *d,
|
||||||
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = therm->attr_get(therm, NOUVEAU_THERM_ATTR_FAN_MIN_DUTY);
|
ret = therm->attr_get(therm, NVKM_THERM_ATTR_FAN_MIN_DUTY);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -461,7 +461,7 @@ nouveau_hwmon_set_pwm1_min(struct device *d, struct device_attribute *a,
|
||||||
if (kstrtol(buf, 10, &value) == -EINVAL)
|
if (kstrtol(buf, 10, &value) == -EINVAL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
ret = therm->attr_set(therm, NOUVEAU_THERM_ATTR_FAN_MIN_DUTY, value);
|
ret = therm->attr_set(therm, NVKM_THERM_ATTR_FAN_MIN_DUTY, value);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -481,7 +481,7 @@ nouveau_hwmon_get_pwm1_max(struct device *d,
|
||||||
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
struct nouveau_therm *therm = nvxx_therm(&drm->device);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = therm->attr_get(therm, NOUVEAU_THERM_ATTR_FAN_MAX_DUTY);
|
ret = therm->attr_get(therm, NVKM_THERM_ATTR_FAN_MAX_DUTY);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -501,7 +501,7 @@ nouveau_hwmon_set_pwm1_max(struct device *d, struct device_attribute *a,
|
||||||
if (kstrtol(buf, 10, &value) == -EINVAL)
|
if (kstrtol(buf, 10, &value) == -EINVAL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
ret = therm->attr_set(therm, NOUVEAU_THERM_ATTR_FAN_MAX_DUTY, value);
|
ret = therm->attr_set(therm, NVKM_THERM_ATTR_FAN_MAX_DUTY, value);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ nv50_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = nv50_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = nv50_mc_oclass;
|
||||||
|
@ -123,7 +123,7 @@ nv50_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = nv50_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = nv50_mc_oclass;
|
||||||
|
@ -152,7 +152,7 @@ nv50_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = nv50_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = nv50_mc_oclass;
|
||||||
|
@ -181,7 +181,7 @@ nv50_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = g94_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = g94_mc_oclass;
|
||||||
|
@ -210,7 +210,7 @@ nv50_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = g94_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = g94_mc_oclass;
|
||||||
|
@ -239,7 +239,7 @@ nv50_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = g98_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = g98_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = g98_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = g98_mc_oclass;
|
||||||
|
@ -268,7 +268,7 @@ nv50_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = nv50_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = g84_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = g98_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = g98_mc_oclass;
|
||||||
|
@ -297,7 +297,7 @@ nv50_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = mcp77_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = mcp77_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = g98_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = g98_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = g98_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = g98_mc_oclass;
|
||||||
|
@ -326,7 +326,7 @@ nv50_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = mcp77_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = mcp77_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = &g84_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = g98_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = g98_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = g98_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = g98_mc_oclass;
|
||||||
|
@ -355,7 +355,7 @@ nv50_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = >215_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = >215_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = >215_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = gt215_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = gt215_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = g98_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = g98_mc_oclass;
|
||||||
|
@ -386,7 +386,7 @@ nv50_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = >215_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = >215_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = >215_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = gt215_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = gt215_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = g98_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = g98_mc_oclass;
|
||||||
|
@ -416,7 +416,7 @@ nv50_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = >215_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = >215_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = >215_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = gt215_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = gt215_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = g98_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = g98_mc_oclass;
|
||||||
|
@ -446,7 +446,7 @@ nv50_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = >215_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = >215_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = >215_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = mcp89_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = mcp89_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = g98_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = g98_mc_oclass;
|
||||||
|
|
|
@ -66,7 +66,7 @@ nvc0_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = >215_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = gf100_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = gf100_mc_oclass;
|
||||||
|
@ -99,7 +99,7 @@ nvc0_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = >215_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = gf100_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = gf100_mc_oclass;
|
||||||
|
@ -132,7 +132,7 @@ nvc0_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = >215_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = gf106_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = gf106_mc_oclass;
|
||||||
|
@ -164,7 +164,7 @@ nvc0_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = >215_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = gf100_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = gf100_mc_oclass;
|
||||||
|
@ -197,7 +197,7 @@ nvc0_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = >215_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = gf106_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = gf106_mc_oclass;
|
||||||
|
@ -229,7 +229,7 @@ nvc0_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = >215_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = gf106_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = gf106_mc_oclass;
|
||||||
|
@ -261,7 +261,7 @@ nvc0_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = >215_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = gf100_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = gf100_mc_oclass;
|
||||||
|
@ -294,7 +294,7 @@ nvc0_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = gf110_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = gf110_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = gf106_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = gf106_mc_oclass;
|
||||||
|
@ -326,7 +326,7 @@ nvc0_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = gf117_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = gf117_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = gf106_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = gf106_mc_oclass;
|
||||||
|
|
|
@ -66,7 +66,7 @@ nve0_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = gf106_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = gf106_mc_oclass;
|
||||||
|
@ -100,7 +100,7 @@ nve0_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = gf106_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = gf106_mc_oclass;
|
||||||
|
@ -134,7 +134,7 @@ nve0_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = gf106_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = gf106_mc_oclass;
|
||||||
|
@ -190,7 +190,7 @@ nve0_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = gf106_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = gf106_mc_oclass;
|
||||||
|
@ -224,7 +224,7 @@ nve0_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = gf110_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = gf110_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = gf106_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = gf106_mc_oclass;
|
||||||
|
@ -258,7 +258,7 @@ nve0_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = gk20a_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = gk20a_mc_oclass;
|
||||||
|
@ -291,7 +291,7 @@ nve0_identify(struct nouveau_device *device)
|
||||||
device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass;
|
device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
|
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
|
device->oclass[NVDEV_SUBDEV_THERM ] = &gf110_therm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
device->oclass[NVDEV_SUBDEV_DEVINIT] = gf100_devinit_oclass;
|
||||||
device->oclass[NVDEV_SUBDEV_MC ] = gk20a_mc_oclass;
|
device->oclass[NVDEV_SUBDEV_MC ] = gk20a_mc_oclass;
|
||||||
|
|
|
@ -7,7 +7,7 @@ nvkm-y += nvkm/subdev/therm/ic.o
|
||||||
nvkm-y += nvkm/subdev/therm/temp.o
|
nvkm-y += nvkm/subdev/therm/temp.o
|
||||||
nvkm-y += nvkm/subdev/therm/nv40.o
|
nvkm-y += nvkm/subdev/therm/nv40.o
|
||||||
nvkm-y += nvkm/subdev/therm/nv50.o
|
nvkm-y += nvkm/subdev/therm/nv50.o
|
||||||
nvkm-y += nvkm/subdev/therm/nv84.o
|
nvkm-y += nvkm/subdev/therm/g84.o
|
||||||
nvkm-y += nvkm/subdev/therm/nva3.o
|
nvkm-y += nvkm/subdev/therm/gt215.o
|
||||||
nvkm-y += nvkm/subdev/therm/nvd0.o
|
nvkm-y += nvkm/subdev/therm/gf110.o
|
||||||
nvkm-y += nvkm/subdev/therm/gm107.o
|
nvkm-y += nvkm/subdev/therm/gm107.o
|
||||||
|
|
|
@ -21,18 +21,14 @@
|
||||||
*
|
*
|
||||||
* Authors: Martin Peres
|
* Authors: Martin Peres
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <core/object.h>
|
|
||||||
#include <core/device.h>
|
|
||||||
|
|
||||||
#include <subdev/bios.h>
|
|
||||||
|
|
||||||
#include "priv.h"
|
#include "priv.h"
|
||||||
|
|
||||||
|
#include <core/device.h>
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nouveau_therm_update_trip(struct nouveau_therm *therm)
|
nvkm_therm_update_trip(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
struct nvbios_therm_trip_point *trip = priv->fan->bios.trip,
|
struct nvbios_therm_trip_point *trip = priv->fan->bios.trip,
|
||||||
*cur_trip = NULL,
|
*cur_trip = NULL,
|
||||||
*last_trip = priv->last_trip;
|
*last_trip = priv->last_trip;
|
||||||
|
@ -63,9 +59,9 @@ nouveau_therm_update_trip(struct nouveau_therm *therm)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nouveau_therm_update_linear(struct nouveau_therm *therm)
|
nvkm_therm_update_linear(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
u8 linear_min_temp = priv->fan->bios.linear_min_temp;
|
u8 linear_min_temp = priv->fan->bios.linear_min_temp;
|
||||||
u8 linear_max_temp = priv->fan->bios.linear_max_temp;
|
u8 linear_max_temp = priv->fan->bios.linear_max_temp;
|
||||||
u8 temp = therm->temp_get(therm);
|
u8 temp = therm->temp_get(therm);
|
||||||
|
@ -82,15 +78,14 @@ nouveau_therm_update_linear(struct nouveau_therm *therm)
|
||||||
duty *= (priv->fan->bios.max_duty - priv->fan->bios.min_duty);
|
duty *= (priv->fan->bios.max_duty - priv->fan->bios.min_duty);
|
||||||
duty /= (linear_max_temp - linear_min_temp);
|
duty /= (linear_max_temp - linear_min_temp);
|
||||||
duty += priv->fan->bios.min_duty;
|
duty += priv->fan->bios.min_duty;
|
||||||
|
|
||||||
return duty;
|
return duty;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nouveau_therm_update(struct nouveau_therm *therm, int mode)
|
nvkm_therm_update(struct nvkm_therm *therm, int mode)
|
||||||
{
|
{
|
||||||
struct nouveau_timer *ptimer = nouveau_timer(therm);
|
struct nvkm_timer *ptimer = nvkm_timer(therm);
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
bool immd = true;
|
bool immd = true;
|
||||||
bool poll = true;
|
bool poll = true;
|
||||||
|
@ -102,20 +97,20 @@ nouveau_therm_update(struct nouveau_therm *therm, int mode)
|
||||||
priv->mode = mode;
|
priv->mode = mode;
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case NOUVEAU_THERM_CTRL_MANUAL:
|
case NVKM_THERM_CTRL_MANUAL:
|
||||||
ptimer->alarm_cancel(ptimer, &priv->alarm);
|
ptimer->alarm_cancel(ptimer, &priv->alarm);
|
||||||
duty = nouveau_therm_fan_get(therm);
|
duty = nvkm_therm_fan_get(therm);
|
||||||
if (duty < 0)
|
if (duty < 0)
|
||||||
duty = 100;
|
duty = 100;
|
||||||
poll = false;
|
poll = false;
|
||||||
break;
|
break;
|
||||||
case NOUVEAU_THERM_CTRL_AUTO:
|
case NVKM_THERM_CTRL_AUTO:
|
||||||
switch(priv->fan->bios.fan_mode) {
|
switch(priv->fan->bios.fan_mode) {
|
||||||
case NVBIOS_THERM_FAN_TRIP:
|
case NVBIOS_THERM_FAN_TRIP:
|
||||||
duty = nouveau_therm_update_trip(therm);
|
duty = nvkm_therm_update_trip(therm);
|
||||||
break;
|
break;
|
||||||
case NVBIOS_THERM_FAN_LINEAR:
|
case NVBIOS_THERM_FAN_LINEAR:
|
||||||
duty = nouveau_therm_update_linear(therm);
|
duty = nvkm_therm_update_linear(therm);
|
||||||
break;
|
break;
|
||||||
case NVBIOS_THERM_FAN_OTHER:
|
case NVBIOS_THERM_FAN_OTHER:
|
||||||
if (priv->cstate)
|
if (priv->cstate)
|
||||||
|
@ -125,7 +120,7 @@ nouveau_therm_update(struct nouveau_therm *therm, int mode)
|
||||||
}
|
}
|
||||||
immd = false;
|
immd = false;
|
||||||
break;
|
break;
|
||||||
case NOUVEAU_THERM_CTRL_NONE:
|
case NVKM_THERM_CTRL_NONE:
|
||||||
default:
|
default:
|
||||||
ptimer->alarm_cancel(ptimer, &priv->alarm);
|
ptimer->alarm_cancel(ptimer, &priv->alarm);
|
||||||
poll = false;
|
poll = false;
|
||||||
|
@ -137,36 +132,36 @@ nouveau_therm_update(struct nouveau_therm *therm, int mode)
|
||||||
|
|
||||||
if (duty >= 0) {
|
if (duty >= 0) {
|
||||||
nv_debug(therm, "FAN target request: %d%%\n", duty);
|
nv_debug(therm, "FAN target request: %d%%\n", duty);
|
||||||
nouveau_therm_fan_set(therm, immd, duty);
|
nvkm_therm_fan_set(therm, immd, duty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_therm_cstate(struct nouveau_therm *ptherm, int fan, int dir)
|
nvkm_therm_cstate(struct nvkm_therm *ptherm, int fan, int dir)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)ptherm;
|
struct nvkm_therm_priv *priv = (void *)ptherm;
|
||||||
if (!dir || (dir < 0 && fan < priv->cstate) ||
|
if (!dir || (dir < 0 && fan < priv->cstate) ||
|
||||||
(dir > 0 && fan > priv->cstate)) {
|
(dir > 0 && fan > priv->cstate)) {
|
||||||
nv_debug(ptherm, "default fan speed -> %d%%\n", fan);
|
nv_debug(ptherm, "default fan speed -> %d%%\n", fan);
|
||||||
priv->cstate = fan;
|
priv->cstate = fan;
|
||||||
nouveau_therm_update(ptherm, -1);
|
nvkm_therm_update(ptherm, -1);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nouveau_therm_alarm(struct nouveau_alarm *alarm)
|
nvkm_therm_alarm(struct nvkm_alarm *alarm)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv =
|
struct nvkm_therm_priv *priv =
|
||||||
container_of(alarm, struct nouveau_therm_priv, alarm);
|
container_of(alarm, struct nvkm_therm_priv, alarm);
|
||||||
nouveau_therm_update(&priv->base, -1);
|
nvkm_therm_update(&priv->base, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_therm_fan_mode(struct nouveau_therm *therm, int mode)
|
nvkm_therm_fan_mode(struct nvkm_therm *therm, int mode)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
struct nouveau_device *device = nv_device(therm);
|
struct nvkm_device *device = nv_device(therm);
|
||||||
static const char *name[] = {
|
static const char *name[] = {
|
||||||
"disabled",
|
"disabled",
|
||||||
"manual",
|
"manual",
|
||||||
|
@ -175,51 +170,51 @@ nouveau_therm_fan_mode(struct nouveau_therm *therm, int mode)
|
||||||
|
|
||||||
/* The default PPWR ucode on fermi interferes with fan management */
|
/* The default PPWR ucode on fermi interferes with fan management */
|
||||||
if ((mode >= ARRAY_SIZE(name)) ||
|
if ((mode >= ARRAY_SIZE(name)) ||
|
||||||
(mode != NOUVEAU_THERM_CTRL_NONE && device->card_type >= NV_C0 &&
|
(mode != NVKM_THERM_CTRL_NONE && device->card_type >= NV_C0 &&
|
||||||
!nouveau_subdev(device, NVDEV_SUBDEV_PMU)))
|
!nvkm_subdev(device, NVDEV_SUBDEV_PMU)))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* do not allow automatic fan management if the thermal sensor is
|
/* do not allow automatic fan management if the thermal sensor is
|
||||||
* not available */
|
* not available */
|
||||||
if (mode == NOUVEAU_THERM_CTRL_AUTO && therm->temp_get(therm) < 0)
|
if (mode == NVKM_THERM_CTRL_AUTO && therm->temp_get(therm) < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (priv->mode == mode)
|
if (priv->mode == mode)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
nv_info(therm, "fan management: %s\n", name[mode]);
|
nv_info(therm, "fan management: %s\n", name[mode]);
|
||||||
nouveau_therm_update(therm, mode);
|
nvkm_therm_update(therm, mode);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_therm_attr_get(struct nouveau_therm *therm,
|
nvkm_therm_attr_get(struct nvkm_therm *therm,
|
||||||
enum nouveau_therm_attr_type type)
|
enum nvkm_therm_attr_type type)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case NOUVEAU_THERM_ATTR_FAN_MIN_DUTY:
|
case NVKM_THERM_ATTR_FAN_MIN_DUTY:
|
||||||
return priv->fan->bios.min_duty;
|
return priv->fan->bios.min_duty;
|
||||||
case NOUVEAU_THERM_ATTR_FAN_MAX_DUTY:
|
case NVKM_THERM_ATTR_FAN_MAX_DUTY:
|
||||||
return priv->fan->bios.max_duty;
|
return priv->fan->bios.max_duty;
|
||||||
case NOUVEAU_THERM_ATTR_FAN_MODE:
|
case NVKM_THERM_ATTR_FAN_MODE:
|
||||||
return priv->mode;
|
return priv->mode;
|
||||||
case NOUVEAU_THERM_ATTR_THRS_FAN_BOOST:
|
case NVKM_THERM_ATTR_THRS_FAN_BOOST:
|
||||||
return priv->bios_sensor.thrs_fan_boost.temp;
|
return priv->bios_sensor.thrs_fan_boost.temp;
|
||||||
case NOUVEAU_THERM_ATTR_THRS_FAN_BOOST_HYST:
|
case NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST:
|
||||||
return priv->bios_sensor.thrs_fan_boost.hysteresis;
|
return priv->bios_sensor.thrs_fan_boost.hysteresis;
|
||||||
case NOUVEAU_THERM_ATTR_THRS_DOWN_CLK:
|
case NVKM_THERM_ATTR_THRS_DOWN_CLK:
|
||||||
return priv->bios_sensor.thrs_down_clock.temp;
|
return priv->bios_sensor.thrs_down_clock.temp;
|
||||||
case NOUVEAU_THERM_ATTR_THRS_DOWN_CLK_HYST:
|
case NVKM_THERM_ATTR_THRS_DOWN_CLK_HYST:
|
||||||
return priv->bios_sensor.thrs_down_clock.hysteresis;
|
return priv->bios_sensor.thrs_down_clock.hysteresis;
|
||||||
case NOUVEAU_THERM_ATTR_THRS_CRITICAL:
|
case NVKM_THERM_ATTR_THRS_CRITICAL:
|
||||||
return priv->bios_sensor.thrs_critical.temp;
|
return priv->bios_sensor.thrs_critical.temp;
|
||||||
case NOUVEAU_THERM_ATTR_THRS_CRITICAL_HYST:
|
case NVKM_THERM_ATTR_THRS_CRITICAL_HYST:
|
||||||
return priv->bios_sensor.thrs_critical.hysteresis;
|
return priv->bios_sensor.thrs_critical.hysteresis;
|
||||||
case NOUVEAU_THERM_ATTR_THRS_SHUTDOWN:
|
case NVKM_THERM_ATTR_THRS_SHUTDOWN:
|
||||||
return priv->bios_sensor.thrs_shutdown.temp;
|
return priv->bios_sensor.thrs_shutdown.temp;
|
||||||
case NOUVEAU_THERM_ATTR_THRS_SHUTDOWN_HYST:
|
case NVKM_THERM_ATTR_THRS_SHUTDOWN_HYST:
|
||||||
return priv->bios_sensor.thrs_shutdown.hysteresis;
|
return priv->bios_sensor.thrs_shutdown.hysteresis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,57 +222,57 @@ nouveau_therm_attr_get(struct nouveau_therm *therm,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_therm_attr_set(struct nouveau_therm *therm,
|
nvkm_therm_attr_set(struct nvkm_therm *therm,
|
||||||
enum nouveau_therm_attr_type type, int value)
|
enum nvkm_therm_attr_type type, int value)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case NOUVEAU_THERM_ATTR_FAN_MIN_DUTY:
|
case NVKM_THERM_ATTR_FAN_MIN_DUTY:
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
value = 0;
|
value = 0;
|
||||||
if (value > priv->fan->bios.max_duty)
|
if (value > priv->fan->bios.max_duty)
|
||||||
value = priv->fan->bios.max_duty;
|
value = priv->fan->bios.max_duty;
|
||||||
priv->fan->bios.min_duty = value;
|
priv->fan->bios.min_duty = value;
|
||||||
return 0;
|
return 0;
|
||||||
case NOUVEAU_THERM_ATTR_FAN_MAX_DUTY:
|
case NVKM_THERM_ATTR_FAN_MAX_DUTY:
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
value = 0;
|
value = 0;
|
||||||
if (value < priv->fan->bios.min_duty)
|
if (value < priv->fan->bios.min_duty)
|
||||||
value = priv->fan->bios.min_duty;
|
value = priv->fan->bios.min_duty;
|
||||||
priv->fan->bios.max_duty = value;
|
priv->fan->bios.max_duty = value;
|
||||||
return 0;
|
return 0;
|
||||||
case NOUVEAU_THERM_ATTR_FAN_MODE:
|
case NVKM_THERM_ATTR_FAN_MODE:
|
||||||
return nouveau_therm_fan_mode(therm, value);
|
return nvkm_therm_fan_mode(therm, value);
|
||||||
case NOUVEAU_THERM_ATTR_THRS_FAN_BOOST:
|
case NVKM_THERM_ATTR_THRS_FAN_BOOST:
|
||||||
priv->bios_sensor.thrs_fan_boost.temp = value;
|
priv->bios_sensor.thrs_fan_boost.temp = value;
|
||||||
priv->sensor.program_alarms(therm);
|
priv->sensor.program_alarms(therm);
|
||||||
return 0;
|
return 0;
|
||||||
case NOUVEAU_THERM_ATTR_THRS_FAN_BOOST_HYST:
|
case NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST:
|
||||||
priv->bios_sensor.thrs_fan_boost.hysteresis = value;
|
priv->bios_sensor.thrs_fan_boost.hysteresis = value;
|
||||||
priv->sensor.program_alarms(therm);
|
priv->sensor.program_alarms(therm);
|
||||||
return 0;
|
return 0;
|
||||||
case NOUVEAU_THERM_ATTR_THRS_DOWN_CLK:
|
case NVKM_THERM_ATTR_THRS_DOWN_CLK:
|
||||||
priv->bios_sensor.thrs_down_clock.temp = value;
|
priv->bios_sensor.thrs_down_clock.temp = value;
|
||||||
priv->sensor.program_alarms(therm);
|
priv->sensor.program_alarms(therm);
|
||||||
return 0;
|
return 0;
|
||||||
case NOUVEAU_THERM_ATTR_THRS_DOWN_CLK_HYST:
|
case NVKM_THERM_ATTR_THRS_DOWN_CLK_HYST:
|
||||||
priv->bios_sensor.thrs_down_clock.hysteresis = value;
|
priv->bios_sensor.thrs_down_clock.hysteresis = value;
|
||||||
priv->sensor.program_alarms(therm);
|
priv->sensor.program_alarms(therm);
|
||||||
return 0;
|
return 0;
|
||||||
case NOUVEAU_THERM_ATTR_THRS_CRITICAL:
|
case NVKM_THERM_ATTR_THRS_CRITICAL:
|
||||||
priv->bios_sensor.thrs_critical.temp = value;
|
priv->bios_sensor.thrs_critical.temp = value;
|
||||||
priv->sensor.program_alarms(therm);
|
priv->sensor.program_alarms(therm);
|
||||||
return 0;
|
return 0;
|
||||||
case NOUVEAU_THERM_ATTR_THRS_CRITICAL_HYST:
|
case NVKM_THERM_ATTR_THRS_CRITICAL_HYST:
|
||||||
priv->bios_sensor.thrs_critical.hysteresis = value;
|
priv->bios_sensor.thrs_critical.hysteresis = value;
|
||||||
priv->sensor.program_alarms(therm);
|
priv->sensor.program_alarms(therm);
|
||||||
return 0;
|
return 0;
|
||||||
case NOUVEAU_THERM_ATTR_THRS_SHUTDOWN:
|
case NVKM_THERM_ATTR_THRS_SHUTDOWN:
|
||||||
priv->bios_sensor.thrs_shutdown.temp = value;
|
priv->bios_sensor.thrs_shutdown.temp = value;
|
||||||
priv->sensor.program_alarms(therm);
|
priv->sensor.program_alarms(therm);
|
||||||
return 0;
|
return 0;
|
||||||
case NOUVEAU_THERM_ATTR_THRS_SHUTDOWN_HYST:
|
case NVKM_THERM_ATTR_THRS_SHUTDOWN_HYST:
|
||||||
priv->bios_sensor.thrs_shutdown.hysteresis = value;
|
priv->bios_sensor.thrs_shutdown.hysteresis = value;
|
||||||
priv->sensor.program_alarms(therm);
|
priv->sensor.program_alarms(therm);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -287,88 +282,86 @@ nouveau_therm_attr_set(struct nouveau_therm *therm,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
_nouveau_therm_init(struct nouveau_object *object)
|
_nvkm_therm_init(struct nvkm_object *object)
|
||||||
{
|
{
|
||||||
struct nouveau_therm *therm = (void *)object;
|
struct nvkm_therm *therm = (void *)object;
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nouveau_subdev_init(&therm->base);
|
ret = nvkm_subdev_init(&therm->base);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (priv->suspend >= 0) {
|
if (priv->suspend >= 0) {
|
||||||
/* restore the pwm value only when on manual or auto mode */
|
/* restore the pwm value only when on manual or auto mode */
|
||||||
if (priv->suspend > 0)
|
if (priv->suspend > 0)
|
||||||
nouveau_therm_fan_set(therm, true, priv->fan->percent);
|
nvkm_therm_fan_set(therm, true, priv->fan->percent);
|
||||||
|
|
||||||
nouveau_therm_fan_mode(therm, priv->suspend);
|
nvkm_therm_fan_mode(therm, priv->suspend);
|
||||||
}
|
}
|
||||||
nouveau_therm_sensor_init(therm);
|
nvkm_therm_sensor_init(therm);
|
||||||
nouveau_therm_fan_init(therm);
|
nvkm_therm_fan_init(therm);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
_nouveau_therm_fini(struct nouveau_object *object, bool suspend)
|
_nvkm_therm_fini(struct nvkm_object *object, bool suspend)
|
||||||
{
|
{
|
||||||
struct nouveau_therm *therm = (void *)object;
|
struct nvkm_therm *therm = (void *)object;
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
|
|
||||||
nouveau_therm_fan_fini(therm, suspend);
|
nvkm_therm_fan_fini(therm, suspend);
|
||||||
nouveau_therm_sensor_fini(therm, suspend);
|
nvkm_therm_sensor_fini(therm, suspend);
|
||||||
if (suspend) {
|
if (suspend) {
|
||||||
priv->suspend = priv->mode;
|
priv->suspend = priv->mode;
|
||||||
priv->mode = NOUVEAU_THERM_CTRL_NONE;
|
priv->mode = NVKM_THERM_CTRL_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nouveau_subdev_fini(&therm->base, suspend);
|
return nvkm_subdev_fini(&therm->base, suspend);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_therm_create_(struct nouveau_object *parent,
|
nvkm_therm_create_(struct nvkm_object *parent, struct nvkm_object *engine,
|
||||||
struct nouveau_object *engine,
|
struct nvkm_oclass *oclass, int length, void **pobject)
|
||||||
struct nouveau_oclass *oclass,
|
|
||||||
int length, void **pobject)
|
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv;
|
struct nvkm_therm_priv *priv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nouveau_subdev_create_(parent, engine, oclass, 0, "PTHERM",
|
ret = nvkm_subdev_create_(parent, engine, oclass, 0, "PTHERM",
|
||||||
"therm", length, pobject);
|
"therm", length, pobject);
|
||||||
priv = *pobject;
|
priv = *pobject;
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
nouveau_alarm_init(&priv->alarm, nouveau_therm_alarm);
|
nvkm_alarm_init(&priv->alarm, nvkm_therm_alarm);
|
||||||
spin_lock_init(&priv->lock);
|
spin_lock_init(&priv->lock);
|
||||||
spin_lock_init(&priv->sensor.alarm_program_lock);
|
spin_lock_init(&priv->sensor.alarm_program_lock);
|
||||||
|
|
||||||
priv->base.fan_get = nouveau_therm_fan_user_get;
|
priv->base.fan_get = nvkm_therm_fan_user_get;
|
||||||
priv->base.fan_set = nouveau_therm_fan_user_set;
|
priv->base.fan_set = nvkm_therm_fan_user_set;
|
||||||
priv->base.fan_sense = nouveau_therm_fan_sense;
|
priv->base.fan_sense = nvkm_therm_fan_sense;
|
||||||
priv->base.attr_get = nouveau_therm_attr_get;
|
priv->base.attr_get = nvkm_therm_attr_get;
|
||||||
priv->base.attr_set = nouveau_therm_attr_set;
|
priv->base.attr_set = nvkm_therm_attr_set;
|
||||||
priv->mode = priv->suspend = -1; /* undefined */
|
priv->mode = priv->suspend = -1; /* undefined */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_therm_preinit(struct nouveau_therm *therm)
|
nvkm_therm_preinit(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
nouveau_therm_sensor_ctor(therm);
|
nvkm_therm_sensor_ctor(therm);
|
||||||
nouveau_therm_ic_ctor(therm);
|
nvkm_therm_ic_ctor(therm);
|
||||||
nouveau_therm_fan_ctor(therm);
|
nvkm_therm_fan_ctor(therm);
|
||||||
|
|
||||||
nouveau_therm_fan_mode(therm, NOUVEAU_THERM_CTRL_AUTO);
|
nvkm_therm_fan_mode(therm, NVKM_THERM_CTRL_AUTO);
|
||||||
nouveau_therm_sensor_preinit(therm);
|
nvkm_therm_sensor_preinit(therm);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_nouveau_therm_dtor(struct nouveau_object *object)
|
_nvkm_therm_dtor(struct nvkm_object *object)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)object;
|
struct nvkm_therm_priv *priv = (void *)object;
|
||||||
kfree(priv->fan);
|
kfree(priv->fan);
|
||||||
nouveau_subdev_destroy(&priv->base.base);
|
nvkm_subdev_destroy(&priv->base.base);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,23 +22,18 @@
|
||||||
* Authors: Ben Skeggs
|
* Authors: Ben Skeggs
|
||||||
* Martin Peres
|
* Martin Peres
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "priv.h"
|
#include "priv.h"
|
||||||
|
|
||||||
#include <core/object.h>
|
#include <subdev/bios/fan.h>
|
||||||
#include <core/device.h>
|
|
||||||
|
|
||||||
#include <subdev/gpio.h>
|
#include <subdev/gpio.h>
|
||||||
#include <subdev/timer.h>
|
#include <subdev/timer.h>
|
||||||
|
|
||||||
#include <subdev/bios/fan.h>
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nouveau_fan_update(struct nouveau_fan *fan, bool immediate, int target)
|
nvkm_fan_update(struct nvkm_fan *fan, bool immediate, int target)
|
||||||
{
|
{
|
||||||
struct nouveau_therm *therm = fan->parent;
|
struct nvkm_therm *therm = fan->parent;
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
struct nouveau_timer *ptimer = nouveau_timer(priv);
|
struct nvkm_timer *ptimer = nvkm_timer(priv);
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int duty;
|
int duty;
|
||||||
|
@ -107,32 +102,32 @@ nouveau_fan_update(struct nouveau_fan *fan, bool immediate, int target)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nouveau_fan_alarm(struct nouveau_alarm *alarm)
|
nvkm_fan_alarm(struct nvkm_alarm *alarm)
|
||||||
{
|
{
|
||||||
struct nouveau_fan *fan = container_of(alarm, struct nouveau_fan, alarm);
|
struct nvkm_fan *fan = container_of(alarm, struct nvkm_fan, alarm);
|
||||||
nouveau_fan_update(fan, false, -1);
|
nvkm_fan_update(fan, false, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_therm_fan_get(struct nouveau_therm *therm)
|
nvkm_therm_fan_get(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
return priv->fan->get(therm);
|
return priv->fan->get(therm);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_therm_fan_set(struct nouveau_therm *therm, bool immediate, int percent)
|
nvkm_therm_fan_set(struct nvkm_therm *therm, bool immediate, int percent)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
return nouveau_fan_update(priv->fan, immediate, percent);
|
return nvkm_fan_update(priv->fan, immediate, percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_therm_fan_sense(struct nouveau_therm *therm)
|
nvkm_therm_fan_sense(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
struct nouveau_timer *ptimer = nouveau_timer(therm);
|
struct nvkm_timer *ptimer = nvkm_timer(therm);
|
||||||
struct nouveau_gpio *gpio = nouveau_gpio(therm);
|
struct nvkm_gpio *gpio = nvkm_gpio(therm);
|
||||||
u32 cycles, cur, prev;
|
u32 cycles, cur, prev;
|
||||||
u64 start, end, tach;
|
u64 start, end, tach;
|
||||||
|
|
||||||
|
@ -168,26 +163,26 @@ nouveau_therm_fan_sense(struct nouveau_therm *therm)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_therm_fan_user_get(struct nouveau_therm *therm)
|
nvkm_therm_fan_user_get(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
return nouveau_therm_fan_get(therm);
|
return nvkm_therm_fan_get(therm);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_therm_fan_user_set(struct nouveau_therm *therm, int percent)
|
nvkm_therm_fan_user_set(struct nvkm_therm *therm, int percent)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
|
|
||||||
if (priv->mode != NOUVEAU_THERM_CTRL_MANUAL)
|
if (priv->mode != NVKM_THERM_CTRL_MANUAL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
return nouveau_therm_fan_set(therm, true, percent);
|
return nvkm_therm_fan_set(therm, true, percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nouveau_therm_fan_set_defaults(struct nouveau_therm *therm)
|
nvkm_therm_fan_set_defaults(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
|
|
||||||
priv->fan->bios.pwm_freq = 0;
|
priv->fan->bios.pwm_freq = 0;
|
||||||
priv->fan->bios.min_duty = 0;
|
priv->fan->bios.min_duty = 0;
|
||||||
|
@ -199,9 +194,9 @@ nouveau_therm_fan_set_defaults(struct nouveau_therm *therm)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nouveau_therm_fan_safety_checks(struct nouveau_therm *therm)
|
nvkm_therm_fan_safety_checks(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
|
|
||||||
if (priv->fan->bios.min_duty > 100)
|
if (priv->fan->bios.min_duty > 100)
|
||||||
priv->fan->bios.min_duty = 100;
|
priv->fan->bios.min_duty = 100;
|
||||||
|
@ -213,16 +208,16 @@ nouveau_therm_fan_safety_checks(struct nouveau_therm *therm)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_therm_fan_init(struct nouveau_therm *therm)
|
nvkm_therm_fan_init(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_therm_fan_fini(struct nouveau_therm *therm, bool suspend)
|
nvkm_therm_fan_fini(struct nvkm_therm *therm, bool suspend)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
struct nouveau_timer *ptimer = nouveau_timer(therm);
|
struct nvkm_timer *ptimer = nvkm_timer(therm);
|
||||||
|
|
||||||
if (suspend)
|
if (suspend)
|
||||||
ptimer->alarm_cancel(ptimer, &priv->fan->alarm);
|
ptimer->alarm_cancel(ptimer, &priv->fan->alarm);
|
||||||
|
@ -230,11 +225,11 @@ nouveau_therm_fan_fini(struct nouveau_therm *therm, bool suspend)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_therm_fan_ctor(struct nouveau_therm *therm)
|
nvkm_therm_fan_ctor(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
struct nouveau_gpio *gpio = nouveau_gpio(therm);
|
struct nvkm_gpio *gpio = nvkm_gpio(therm);
|
||||||
struct nouveau_bios *bios = nouveau_bios(therm);
|
struct nvkm_bios *bios = nvkm_bios(therm);
|
||||||
struct dcb_gpio_func func;
|
struct dcb_gpio_func func;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -246,15 +241,15 @@ nouveau_therm_fan_ctor(struct nouveau_therm *therm)
|
||||||
nv_debug(therm, "GPIO_FAN is in input mode\n");
|
nv_debug(therm, "GPIO_FAN is in input mode\n");
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
} else {
|
} else {
|
||||||
ret = nouveau_fanpwm_create(therm, &func);
|
ret = nvkm_fanpwm_create(therm, &func);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
ret = nouveau_fantog_create(therm, &func);
|
ret = nvkm_fantog_create(therm, &func);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* no controllable fan found, create a dummy fan module */
|
/* no controllable fan found, create a dummy fan module */
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
ret = nouveau_fannil_create(therm);
|
ret = nvkm_fannil_create(therm);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -262,7 +257,7 @@ nouveau_therm_fan_ctor(struct nouveau_therm *therm)
|
||||||
nv_info(therm, "FAN control: %s\n", priv->fan->type);
|
nv_info(therm, "FAN control: %s\n", priv->fan->type);
|
||||||
|
|
||||||
/* read the current speed, it is useful when resuming */
|
/* read the current speed, it is useful when resuming */
|
||||||
priv->fan->percent = nouveau_therm_fan_get(therm);
|
priv->fan->percent = nvkm_therm_fan_get(therm);
|
||||||
|
|
||||||
/* attempt to detect a tachometer connection */
|
/* attempt to detect a tachometer connection */
|
||||||
ret = gpio->find(gpio, 0, DCB_GPIO_FAN_SENSE, 0xff, &priv->fan->tach);
|
ret = gpio->find(gpio, 0, DCB_GPIO_FAN_SENSE, 0xff, &priv->fan->tach);
|
||||||
|
@ -271,17 +266,17 @@ nouveau_therm_fan_ctor(struct nouveau_therm *therm)
|
||||||
|
|
||||||
/* initialise fan bump/slow update handling */
|
/* initialise fan bump/slow update handling */
|
||||||
priv->fan->parent = therm;
|
priv->fan->parent = therm;
|
||||||
nouveau_alarm_init(&priv->fan->alarm, nouveau_fan_alarm);
|
nvkm_alarm_init(&priv->fan->alarm, nvkm_fan_alarm);
|
||||||
spin_lock_init(&priv->fan->lock);
|
spin_lock_init(&priv->fan->lock);
|
||||||
|
|
||||||
/* other random init... */
|
/* other random init... */
|
||||||
nouveau_therm_fan_set_defaults(therm);
|
nvkm_therm_fan_set_defaults(therm);
|
||||||
nvbios_perf_fan_parse(bios, &priv->fan->perf);
|
nvbios_perf_fan_parse(bios, &priv->fan->perf);
|
||||||
if (!nvbios_fan_parse(bios, &priv->fan->bios)) {
|
if (!nvbios_fan_parse(bios, &priv->fan->bios)) {
|
||||||
nv_debug(therm, "parsing the fan table failed\n");
|
nv_debug(therm, "parsing the fan table failed\n");
|
||||||
if (nvbios_therm_fan_parse(bios, &priv->fan->bios))
|
if (nvbios_therm_fan_parse(bios, &priv->fan->bios))
|
||||||
nv_error(therm, "parsing both fan tables failed\n");
|
nv_error(therm, "parsing both fan tables failed\n");
|
||||||
}
|
}
|
||||||
nouveau_therm_fan_safety_checks(therm);
|
nvkm_therm_fan_safety_checks(therm);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,26 +21,25 @@
|
||||||
*
|
*
|
||||||
* Authors: Ben Skeggs
|
* Authors: Ben Skeggs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "priv.h"
|
#include "priv.h"
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nouveau_fannil_get(struct nouveau_therm *therm)
|
nvkm_fannil_get(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nouveau_fannil_set(struct nouveau_therm *therm, int percent)
|
nvkm_fannil_set(struct nvkm_therm *therm, int percent)
|
||||||
{
|
{
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_fannil_create(struct nouveau_therm *therm)
|
nvkm_fannil_create(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *tpriv = (void *)therm;
|
struct nvkm_therm_priv *tpriv = (void *)therm;
|
||||||
struct nouveau_fan *priv;
|
struct nvkm_fan *priv;
|
||||||
|
|
||||||
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
|
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
|
||||||
tpriv->fan = priv;
|
tpriv->fan = priv;
|
||||||
|
@ -48,7 +47,7 @@ nouveau_fannil_create(struct nouveau_therm *therm)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
priv->type = "none / external";
|
priv->type = "none / external";
|
||||||
priv->get = nouveau_fannil_get;
|
priv->get = nvkm_fannil_get;
|
||||||
priv->set = nouveau_fannil_set;
|
priv->set = nvkm_fannil_set;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,25 +22,24 @@
|
||||||
* Authors: Ben Skeggs
|
* Authors: Ben Skeggs
|
||||||
* Martin Peres
|
* Martin Peres
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <core/option.h>
|
|
||||||
#include <subdev/gpio.h>
|
|
||||||
#include <subdev/bios.h>
|
|
||||||
#include <subdev/bios/fan.h>
|
|
||||||
|
|
||||||
#include "priv.h"
|
#include "priv.h"
|
||||||
|
|
||||||
struct nouveau_fanpwm_priv {
|
#include <core/option.h>
|
||||||
struct nouveau_fan base;
|
#include <subdev/bios.h>
|
||||||
|
#include <subdev/bios/fan.h>
|
||||||
|
#include <subdev/gpio.h>
|
||||||
|
|
||||||
|
struct nvkm_fanpwm_priv {
|
||||||
|
struct nvkm_fan base;
|
||||||
struct dcb_gpio_func func;
|
struct dcb_gpio_func func;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nouveau_fanpwm_get(struct nouveau_therm *therm)
|
nvkm_fanpwm_get(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *tpriv = (void *)therm;
|
struct nvkm_therm_priv *tpriv = (void *)therm;
|
||||||
struct nouveau_fanpwm_priv *priv = (void *)tpriv->fan;
|
struct nvkm_fanpwm_priv *priv = (void *)tpriv->fan;
|
||||||
struct nouveau_gpio *gpio = nouveau_gpio(therm);
|
struct nvkm_gpio *gpio = nvkm_gpio(therm);
|
||||||
int card_type = nv_device(therm)->card_type;
|
int card_type = nv_device(therm)->card_type;
|
||||||
u32 divs, duty;
|
u32 divs, duty;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -57,10 +56,10 @@ nouveau_fanpwm_get(struct nouveau_therm *therm)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nouveau_fanpwm_set(struct nouveau_therm *therm, int percent)
|
nvkm_fanpwm_set(struct nvkm_therm *therm, int percent)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *tpriv = (void *)therm;
|
struct nvkm_therm_priv *tpriv = (void *)therm;
|
||||||
struct nouveau_fanpwm_priv *priv = (void *)tpriv->fan;
|
struct nvkm_fanpwm_priv *priv = (void *)tpriv->fan;
|
||||||
int card_type = nv_device(therm)->card_type;
|
int card_type = nv_device(therm)->card_type;
|
||||||
u32 divs, duty;
|
u32 divs, duty;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -84,18 +83,18 @@ nouveau_fanpwm_set(struct nouveau_therm *therm, int percent)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_fanpwm_create(struct nouveau_therm *therm, struct dcb_gpio_func *func)
|
nvkm_fanpwm_create(struct nvkm_therm *therm, struct dcb_gpio_func *func)
|
||||||
{
|
{
|
||||||
struct nouveau_device *device = nv_device(therm);
|
struct nvkm_device *device = nv_device(therm);
|
||||||
struct nouveau_therm_priv *tpriv = (void *)therm;
|
struct nvkm_therm_priv *tpriv = (void *)therm;
|
||||||
struct nouveau_bios *bios = nouveau_bios(therm);
|
struct nvkm_bios *bios = nvkm_bios(therm);
|
||||||
struct nouveau_fanpwm_priv *priv;
|
struct nvkm_fanpwm_priv *priv;
|
||||||
struct nvbios_therm_fan fan;
|
struct nvbios_therm_fan fan;
|
||||||
u32 divs, duty;
|
u32 divs, duty;
|
||||||
|
|
||||||
nvbios_fan_parse(bios, &fan);
|
nvbios_fan_parse(bios, &fan);
|
||||||
|
|
||||||
if (!nouveau_boolopt(device->cfgopt, "NvFanPWM", func->param) ||
|
if (!nvkm_boolopt(device->cfgopt, "NvFanPWM", func->param) ||
|
||||||
!therm->pwm_ctrl || fan.type == NVBIOS_THERM_FAN_TOGGLE ||
|
!therm->pwm_ctrl || fan.type == NVBIOS_THERM_FAN_TOGGLE ||
|
||||||
therm->pwm_get(therm, func->line, &divs, &duty) == -ENODEV)
|
therm->pwm_get(therm, func->line, &divs, &duty) == -ENODEV)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
@ -106,8 +105,8 @@ nouveau_fanpwm_create(struct nouveau_therm *therm, struct dcb_gpio_func *func)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
priv->base.type = "PWM";
|
priv->base.type = "PWM";
|
||||||
priv->base.get = nouveau_fanpwm_get;
|
priv->base.get = nvkm_fanpwm_get;
|
||||||
priv->base.set = nouveau_fanpwm_set;
|
priv->base.set = nvkm_fanpwm_set;
|
||||||
priv->func = *func;
|
priv->func = *func;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,18 +21,14 @@
|
||||||
*
|
*
|
||||||
* Authors: Martin Peres
|
* Authors: Martin Peres
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "priv.h"
|
#include "priv.h"
|
||||||
|
|
||||||
#include <core/object.h>
|
|
||||||
#include <core/device.h>
|
|
||||||
|
|
||||||
#include <subdev/gpio.h>
|
#include <subdev/gpio.h>
|
||||||
#include <subdev/timer.h>
|
#include <subdev/timer.h>
|
||||||
|
|
||||||
struct nouveau_fantog_priv {
|
struct nvkm_fantog_priv {
|
||||||
struct nouveau_fan base;
|
struct nvkm_fan base;
|
||||||
struct nouveau_alarm alarm;
|
struct nvkm_alarm alarm;
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
u32 period_us;
|
u32 period_us;
|
||||||
u32 percent;
|
u32 percent;
|
||||||
|
@ -40,11 +36,11 @@ struct nouveau_fantog_priv {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nouveau_fantog_update(struct nouveau_fantog_priv *priv, int percent)
|
nvkm_fantog_update(struct nvkm_fantog_priv *priv, int percent)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *tpriv = (void *)priv->base.parent;
|
struct nvkm_therm_priv *tpriv = (void *)priv->base.parent;
|
||||||
struct nouveau_timer *ptimer = nouveau_timer(tpriv);
|
struct nvkm_timer *ptimer = nvkm_timer(tpriv);
|
||||||
struct nouveau_gpio *gpio = nouveau_gpio(tpriv);
|
struct nvkm_gpio *gpio = nvkm_gpio(tpriv);
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int duty;
|
int duty;
|
||||||
|
|
||||||
|
@ -66,37 +62,37 @@ nouveau_fantog_update(struct nouveau_fantog_priv *priv, int percent)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nouveau_fantog_alarm(struct nouveau_alarm *alarm)
|
nvkm_fantog_alarm(struct nvkm_alarm *alarm)
|
||||||
{
|
{
|
||||||
struct nouveau_fantog_priv *priv =
|
struct nvkm_fantog_priv *priv =
|
||||||
container_of(alarm, struct nouveau_fantog_priv, alarm);
|
container_of(alarm, struct nvkm_fantog_priv, alarm);
|
||||||
nouveau_fantog_update(priv, -1);
|
nvkm_fantog_update(priv, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nouveau_fantog_get(struct nouveau_therm *therm)
|
nvkm_fantog_get(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *tpriv = (void *)therm;
|
struct nvkm_therm_priv *tpriv = (void *)therm;
|
||||||
struct nouveau_fantog_priv *priv = (void *)tpriv->fan;
|
struct nvkm_fantog_priv *priv = (void *)tpriv->fan;
|
||||||
return priv->percent;
|
return priv->percent;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nouveau_fantog_set(struct nouveau_therm *therm, int percent)
|
nvkm_fantog_set(struct nvkm_therm *therm, int percent)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *tpriv = (void *)therm;
|
struct nvkm_therm_priv *tpriv = (void *)therm;
|
||||||
struct nouveau_fantog_priv *priv = (void *)tpriv->fan;
|
struct nvkm_fantog_priv *priv = (void *)tpriv->fan;
|
||||||
if (therm->pwm_ctrl)
|
if (therm->pwm_ctrl)
|
||||||
therm->pwm_ctrl(therm, priv->func.line, false);
|
therm->pwm_ctrl(therm, priv->func.line, false);
|
||||||
nouveau_fantog_update(priv, percent);
|
nvkm_fantog_update(priv, percent);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_fantog_create(struct nouveau_therm *therm, struct dcb_gpio_func *func)
|
nvkm_fantog_create(struct nvkm_therm *therm, struct dcb_gpio_func *func)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *tpriv = (void *)therm;
|
struct nvkm_therm_priv *tpriv = (void *)therm;
|
||||||
struct nouveau_fantog_priv *priv;
|
struct nvkm_fantog_priv *priv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (therm->pwm_ctrl) {
|
if (therm->pwm_ctrl) {
|
||||||
|
@ -111,9 +107,9 @@ nouveau_fantog_create(struct nouveau_therm *therm, struct dcb_gpio_func *func)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
priv->base.type = "toggle";
|
priv->base.type = "toggle";
|
||||||
priv->base.get = nouveau_fantog_get;
|
priv->base.get = nvkm_fantog_get;
|
||||||
priv->base.set = nouveau_fantog_set;
|
priv->base.set = nvkm_fantog_set;
|
||||||
nouveau_alarm_init(&priv->alarm, nouveau_fantog_alarm);
|
nvkm_alarm_init(&priv->alarm, nvkm_fantog_alarm);
|
||||||
priv->period_us = 100000; /* 10Hz */
|
priv->period_us = 100000; /* 10Hz */
|
||||||
priv->percent = 100;
|
priv->percent = 100;
|
||||||
priv->func = *func;
|
priv->func = *func;
|
||||||
|
|
|
@ -22,18 +22,18 @@
|
||||||
* Authors: Ben Skeggs
|
* Authors: Ben Skeggs
|
||||||
* Martin Peres
|
* Martin Peres
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "priv.h"
|
#include "priv.h"
|
||||||
|
|
||||||
#include <subdev/fuse.h>
|
#include <subdev/fuse.h>
|
||||||
|
|
||||||
struct nv84_therm_priv {
|
struct g84_therm_priv {
|
||||||
struct nouveau_therm_priv base;
|
struct nvkm_therm_priv base;
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
nv84_temp_get(struct nouveau_therm *therm)
|
g84_temp_get(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_fuse *fuse = nouveau_fuse(therm);
|
struct nvkm_fuse *fuse = nvkm_fuse(therm);
|
||||||
|
|
||||||
if (nv_ro32(fuse, 0x1a8) == 1)
|
if (nv_ro32(fuse, 0x1a8) == 1)
|
||||||
return nv_rd32(therm, 0x20400);
|
return nv_rd32(therm, 0x20400);
|
||||||
|
@ -42,9 +42,9 @@ nv84_temp_get(struct nouveau_therm *therm)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nv84_sensor_setup(struct nouveau_therm *therm)
|
g84_sensor_setup(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_fuse *fuse = nouveau_fuse(therm);
|
struct nvkm_fuse *fuse = nvkm_fuse(therm);
|
||||||
|
|
||||||
/* enable temperature reading for cards with insane defaults */
|
/* enable temperature reading for cards with insane defaults */
|
||||||
if (nv_ro32(fuse, 0x1a8) == 1) {
|
if (nv_ro32(fuse, 0x1a8) == 1) {
|
||||||
|
@ -55,9 +55,9 @@ nv84_sensor_setup(struct nouveau_therm *therm)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nv84_therm_program_alarms(struct nouveau_therm *therm)
|
g84_therm_program_alarms(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
|
struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
|
@ -92,53 +92,53 @@ nv84_therm_program_alarms(struct nouveau_therm *therm)
|
||||||
|
|
||||||
/* must be called with alarm_program_lock taken ! */
|
/* must be called with alarm_program_lock taken ! */
|
||||||
static void
|
static void
|
||||||
nv84_therm_threshold_hyst_emulation(struct nouveau_therm *therm,
|
g84_therm_threshold_hyst_emulation(struct nvkm_therm *therm,
|
||||||
uint32_t thrs_reg, u8 status_bit,
|
uint32_t thrs_reg, u8 status_bit,
|
||||||
const struct nvbios_therm_threshold *thrs,
|
const struct nvbios_therm_threshold *thrs,
|
||||||
enum nouveau_therm_thrs thrs_name)
|
enum nvkm_therm_thrs thrs_name)
|
||||||
{
|
{
|
||||||
enum nouveau_therm_thrs_direction direction;
|
enum nvkm_therm_thrs_direction direction;
|
||||||
enum nouveau_therm_thrs_state prev_state, new_state;
|
enum nvkm_therm_thrs_state prev_state, new_state;
|
||||||
int temp, cur;
|
int temp, cur;
|
||||||
|
|
||||||
prev_state = nouveau_therm_sensor_get_threshold_state(therm, thrs_name);
|
prev_state = nvkm_therm_sensor_get_threshold_state(therm, thrs_name);
|
||||||
temp = nv_rd32(therm, thrs_reg);
|
temp = nv_rd32(therm, thrs_reg);
|
||||||
|
|
||||||
/* program the next threshold */
|
/* program the next threshold */
|
||||||
if (temp == thrs->temp) {
|
if (temp == thrs->temp) {
|
||||||
nv_wr32(therm, thrs_reg, thrs->temp - thrs->hysteresis);
|
nv_wr32(therm, thrs_reg, thrs->temp - thrs->hysteresis);
|
||||||
new_state = NOUVEAU_THERM_THRS_HIGHER;
|
new_state = NVKM_THERM_THRS_HIGHER;
|
||||||
} else {
|
} else {
|
||||||
nv_wr32(therm, thrs_reg, thrs->temp);
|
nv_wr32(therm, thrs_reg, thrs->temp);
|
||||||
new_state = NOUVEAU_THERM_THRS_LOWER;
|
new_state = NVKM_THERM_THRS_LOWER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fix the state (in case someone reprogrammed the alarms) */
|
/* fix the state (in case someone reprogrammed the alarms) */
|
||||||
cur = therm->temp_get(therm);
|
cur = therm->temp_get(therm);
|
||||||
if (new_state == NOUVEAU_THERM_THRS_LOWER && cur > thrs->temp)
|
if (new_state == NVKM_THERM_THRS_LOWER && cur > thrs->temp)
|
||||||
new_state = NOUVEAU_THERM_THRS_HIGHER;
|
new_state = NVKM_THERM_THRS_HIGHER;
|
||||||
else if (new_state == NOUVEAU_THERM_THRS_HIGHER &&
|
else if (new_state == NVKM_THERM_THRS_HIGHER &&
|
||||||
cur < thrs->temp - thrs->hysteresis)
|
cur < thrs->temp - thrs->hysteresis)
|
||||||
new_state = NOUVEAU_THERM_THRS_LOWER;
|
new_state = NVKM_THERM_THRS_LOWER;
|
||||||
nouveau_therm_sensor_set_threshold_state(therm, thrs_name, new_state);
|
nvkm_therm_sensor_set_threshold_state(therm, thrs_name, new_state);
|
||||||
|
|
||||||
/* find the direction */
|
/* find the direction */
|
||||||
if (prev_state < new_state)
|
if (prev_state < new_state)
|
||||||
direction = NOUVEAU_THERM_THRS_RISING;
|
direction = NVKM_THERM_THRS_RISING;
|
||||||
else if (prev_state > new_state)
|
else if (prev_state > new_state)
|
||||||
direction = NOUVEAU_THERM_THRS_FALLING;
|
direction = NVKM_THERM_THRS_FALLING;
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* advertise a change in direction */
|
/* advertise a change in direction */
|
||||||
nouveau_therm_sensor_event(therm, thrs_name, direction);
|
nvkm_therm_sensor_event(therm, thrs_name, direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nv84_therm_intr(struct nouveau_subdev *subdev)
|
g84_therm_intr(struct nvkm_subdev *subdev)
|
||||||
{
|
{
|
||||||
struct nouveau_therm *therm = nouveau_therm(subdev);
|
struct nvkm_therm *therm = nvkm_therm(subdev);
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
|
struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
uint32_t intr;
|
uint32_t intr;
|
||||||
|
@ -149,33 +149,33 @@ nv84_therm_intr(struct nouveau_subdev *subdev)
|
||||||
|
|
||||||
/* THRS_4: downclock */
|
/* THRS_4: downclock */
|
||||||
if (intr & 0x002) {
|
if (intr & 0x002) {
|
||||||
nv84_therm_threshold_hyst_emulation(therm, 0x20414, 24,
|
g84_therm_threshold_hyst_emulation(therm, 0x20414, 24,
|
||||||
&sensor->thrs_down_clock,
|
&sensor->thrs_down_clock,
|
||||||
NOUVEAU_THERM_THRS_DOWNCLOCK);
|
NVKM_THERM_THRS_DOWNCLOCK);
|
||||||
intr &= ~0x002;
|
intr &= ~0x002;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* shutdown */
|
/* shutdown */
|
||||||
if (intr & 0x004) {
|
if (intr & 0x004) {
|
||||||
nv84_therm_threshold_hyst_emulation(therm, 0x20480, 20,
|
g84_therm_threshold_hyst_emulation(therm, 0x20480, 20,
|
||||||
&sensor->thrs_shutdown,
|
&sensor->thrs_shutdown,
|
||||||
NOUVEAU_THERM_THRS_SHUTDOWN);
|
NVKM_THERM_THRS_SHUTDOWN);
|
||||||
intr &= ~0x004;
|
intr &= ~0x004;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* THRS_1 : fan boost */
|
/* THRS_1 : fan boost */
|
||||||
if (intr & 0x008) {
|
if (intr & 0x008) {
|
||||||
nv84_therm_threshold_hyst_emulation(therm, 0x204c4, 21,
|
g84_therm_threshold_hyst_emulation(therm, 0x204c4, 21,
|
||||||
&sensor->thrs_fan_boost,
|
&sensor->thrs_fan_boost,
|
||||||
NOUVEAU_THERM_THRS_FANBOOST);
|
NVKM_THERM_THRS_FANBOOST);
|
||||||
intr &= ~0x008;
|
intr &= ~0x008;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* THRS_2 : critical */
|
/* THRS_2 : critical */
|
||||||
if (intr & 0x010) {
|
if (intr & 0x010) {
|
||||||
nv84_therm_threshold_hyst_emulation(therm, 0x204c0, 22,
|
g84_therm_threshold_hyst_emulation(therm, 0x204c0, 22,
|
||||||
&sensor->thrs_critical,
|
&sensor->thrs_critical,
|
||||||
NOUVEAU_THERM_THRS_CRITICAL);
|
NVKM_THERM_THRS_CRITICAL);
|
||||||
intr &= ~0x010;
|
intr &= ~0x010;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,30 +190,28 @@ nv84_therm_intr(struct nouveau_subdev *subdev)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nv84_therm_init(struct nouveau_object *object)
|
g84_therm_init(struct nvkm_object *object)
|
||||||
{
|
{
|
||||||
struct nv84_therm_priv *priv = (void *)object;
|
struct g84_therm_priv *priv = (void *)object;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nouveau_therm_init(&priv->base.base);
|
ret = nvkm_therm_init(&priv->base.base);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
nv84_sensor_setup(&priv->base.base);
|
g84_sensor_setup(&priv->base.base);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nv84_therm_ctor(struct nouveau_object *parent,
|
g84_therm_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
|
||||||
struct nouveau_object *engine,
|
struct nvkm_oclass *oclass, void *data, u32 size,
|
||||||
struct nouveau_oclass *oclass, void *data, u32 size,
|
struct nvkm_object **pobject)
|
||||||
struct nouveau_object **pobject)
|
|
||||||
{
|
{
|
||||||
struct nv84_therm_priv *priv;
|
struct g84_therm_priv *priv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nouveau_therm_create(parent, engine, oclass, &priv);
|
ret = nvkm_therm_create(parent, engine, oclass, &priv);
|
||||||
*pobject = nv_object(priv);
|
*pobject = nv_object(priv);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -222,29 +220,29 @@ nv84_therm_ctor(struct nouveau_object *parent,
|
||||||
priv->base.base.pwm_get = nv50_fan_pwm_get;
|
priv->base.base.pwm_get = nv50_fan_pwm_get;
|
||||||
priv->base.base.pwm_set = nv50_fan_pwm_set;
|
priv->base.base.pwm_set = nv50_fan_pwm_set;
|
||||||
priv->base.base.pwm_clock = nv50_fan_pwm_clock;
|
priv->base.base.pwm_clock = nv50_fan_pwm_clock;
|
||||||
priv->base.base.temp_get = nv84_temp_get;
|
priv->base.base.temp_get = g84_temp_get;
|
||||||
priv->base.sensor.program_alarms = nv84_therm_program_alarms;
|
priv->base.sensor.program_alarms = g84_therm_program_alarms;
|
||||||
nv_subdev(priv)->intr = nv84_therm_intr;
|
nv_subdev(priv)->intr = g84_therm_intr;
|
||||||
|
|
||||||
/* init the thresholds */
|
/* init the thresholds */
|
||||||
nouveau_therm_sensor_set_threshold_state(&priv->base.base,
|
nvkm_therm_sensor_set_threshold_state(&priv->base.base,
|
||||||
NOUVEAU_THERM_THRS_SHUTDOWN,
|
NVKM_THERM_THRS_SHUTDOWN,
|
||||||
NOUVEAU_THERM_THRS_LOWER);
|
NVKM_THERM_THRS_LOWER);
|
||||||
nouveau_therm_sensor_set_threshold_state(&priv->base.base,
|
nvkm_therm_sensor_set_threshold_state(&priv->base.base,
|
||||||
NOUVEAU_THERM_THRS_FANBOOST,
|
NVKM_THERM_THRS_FANBOOST,
|
||||||
NOUVEAU_THERM_THRS_LOWER);
|
NVKM_THERM_THRS_LOWER);
|
||||||
nouveau_therm_sensor_set_threshold_state(&priv->base.base,
|
nvkm_therm_sensor_set_threshold_state(&priv->base.base,
|
||||||
NOUVEAU_THERM_THRS_CRITICAL,
|
NVKM_THERM_THRS_CRITICAL,
|
||||||
NOUVEAU_THERM_THRS_LOWER);
|
NVKM_THERM_THRS_LOWER);
|
||||||
nouveau_therm_sensor_set_threshold_state(&priv->base.base,
|
nvkm_therm_sensor_set_threshold_state(&priv->base.base,
|
||||||
NOUVEAU_THERM_THRS_DOWNCLOCK,
|
NVKM_THERM_THRS_DOWNCLOCK,
|
||||||
NOUVEAU_THERM_THRS_LOWER);
|
NVKM_THERM_THRS_LOWER);
|
||||||
|
|
||||||
return nouveau_therm_preinit(&priv->base.base);
|
return nvkm_therm_preinit(&priv->base.base);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nv84_therm_fini(struct nouveau_object *object, bool suspend)
|
g84_therm_fini(struct nvkm_object *object, bool suspend)
|
||||||
{
|
{
|
||||||
/* Disable PTherm IRQs */
|
/* Disable PTherm IRQs */
|
||||||
nv_wr32(object, 0x20000, 0x00000000);
|
nv_wr32(object, 0x20000, 0x00000000);
|
||||||
|
@ -253,16 +251,16 @@ nv84_therm_fini(struct nouveau_object *object, bool suspend)
|
||||||
nv_wr32(object, 0x20100, 0xffffffff);
|
nv_wr32(object, 0x20100, 0xffffffff);
|
||||||
nv_wr32(object, 0x1100, 0x10000); /* PBUS */
|
nv_wr32(object, 0x1100, 0x10000); /* PBUS */
|
||||||
|
|
||||||
return _nouveau_therm_fini(object, suspend);
|
return _nvkm_therm_fini(object, suspend);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct nouveau_oclass
|
struct nvkm_oclass
|
||||||
nv84_therm_oclass = {
|
g84_therm_oclass = {
|
||||||
.handle = NV_SUBDEV(THERM, 0x84),
|
.handle = NV_SUBDEV(THERM, 0x84),
|
||||||
.ofuncs = &(struct nouveau_ofuncs) {
|
.ofuncs = &(struct nvkm_ofuncs) {
|
||||||
.ctor = nv84_therm_ctor,
|
.ctor = g84_therm_ctor,
|
||||||
.dtor = _nouveau_therm_dtor,
|
.dtor = _nvkm_therm_dtor,
|
||||||
.init = nv84_therm_init,
|
.init = g84_therm_init,
|
||||||
.fini = nv84_therm_fini,
|
.fini = g84_therm_fini,
|
||||||
},
|
},
|
||||||
};
|
};
|
|
@ -21,15 +21,14 @@
|
||||||
*
|
*
|
||||||
* Authors: Ben Skeggs
|
* Authors: Ben Skeggs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "priv.h"
|
#include "priv.h"
|
||||||
|
|
||||||
struct nvd0_therm_priv {
|
struct gf110_therm_priv {
|
||||||
struct nouveau_therm_priv base;
|
struct nvkm_therm_priv base;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
pwm_info(struct nouveau_therm *therm, int line)
|
pwm_info(struct nvkm_therm *therm, int line)
|
||||||
{
|
{
|
||||||
u32 gpio = nv_rd32(therm, 0x00d610 + (line * 0x04));
|
u32 gpio = nv_rd32(therm, 0x00d610 + (line * 0x04));
|
||||||
|
|
||||||
|
@ -53,7 +52,7 @@ pwm_info(struct nouveau_therm *therm, int line)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nvd0_fan_pwm_ctrl(struct nouveau_therm *therm, int line, bool enable)
|
gf110_fan_pwm_ctrl(struct nvkm_therm *therm, int line, bool enable)
|
||||||
{
|
{
|
||||||
u32 data = enable ? 0x00000040 : 0x00000000;
|
u32 data = enable ? 0x00000040 : 0x00000000;
|
||||||
int indx = pwm_info(therm, line);
|
int indx = pwm_info(therm, line);
|
||||||
|
@ -66,7 +65,7 @@ nvd0_fan_pwm_ctrl(struct nouveau_therm *therm, int line, bool enable)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nvd0_fan_pwm_get(struct nouveau_therm *therm, int line, u32 *divs, u32 *duty)
|
gf110_fan_pwm_get(struct nvkm_therm *therm, int line, u32 *divs, u32 *duty)
|
||||||
{
|
{
|
||||||
int indx = pwm_info(therm, line);
|
int indx = pwm_info(therm, line);
|
||||||
if (indx < 0)
|
if (indx < 0)
|
||||||
|
@ -87,7 +86,7 @@ nvd0_fan_pwm_get(struct nouveau_therm *therm, int line, u32 *divs, u32 *duty)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nvd0_fan_pwm_set(struct nouveau_therm *therm, int line, u32 divs, u32 duty)
|
gf110_fan_pwm_set(struct nvkm_therm *therm, int line, u32 divs, u32 duty)
|
||||||
{
|
{
|
||||||
int indx = pwm_info(therm, line);
|
int indx = pwm_info(therm, line);
|
||||||
if (indx < 0)
|
if (indx < 0)
|
||||||
|
@ -103,7 +102,7 @@ nvd0_fan_pwm_set(struct nouveau_therm *therm, int line, u32 divs, u32 duty)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nvd0_fan_pwm_clock(struct nouveau_therm *therm, int line)
|
gf110_fan_pwm_clock(struct nvkm_therm *therm, int line)
|
||||||
{
|
{
|
||||||
int indx = pwm_info(therm, line);
|
int indx = pwm_info(therm, line);
|
||||||
if (indx < 0)
|
if (indx < 0)
|
||||||
|
@ -115,12 +114,12 @@ nvd0_fan_pwm_clock(struct nouveau_therm *therm, int line)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nvd0_therm_init(struct nouveau_object *object)
|
gf110_therm_init(struct nvkm_object *object)
|
||||||
{
|
{
|
||||||
struct nvd0_therm_priv *priv = (void *)object;
|
struct gf110_therm_priv *priv = (void *)object;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nouveau_therm_init(&priv->base.base);
|
ret = nvkm_therm_init(&priv->base.base);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -137,38 +136,37 @@ nvd0_therm_init(struct nouveau_object *object)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nvd0_therm_ctor(struct nouveau_object *parent,
|
gf110_therm_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
|
||||||
struct nouveau_object *engine,
|
struct nvkm_oclass *oclass, void *data, u32 size,
|
||||||
struct nouveau_oclass *oclass, void *data, u32 size,
|
struct nvkm_object **pobject)
|
||||||
struct nouveau_object **pobject)
|
|
||||||
{
|
{
|
||||||
struct nvd0_therm_priv *priv;
|
struct gf110_therm_priv *priv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nouveau_therm_create(parent, engine, oclass, &priv);
|
ret = nvkm_therm_create(parent, engine, oclass, &priv);
|
||||||
*pobject = nv_object(priv);
|
*pobject = nv_object(priv);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
nv84_sensor_setup(&priv->base.base);
|
g84_sensor_setup(&priv->base.base);
|
||||||
|
|
||||||
priv->base.base.pwm_ctrl = nvd0_fan_pwm_ctrl;
|
priv->base.base.pwm_ctrl = gf110_fan_pwm_ctrl;
|
||||||
priv->base.base.pwm_get = nvd0_fan_pwm_get;
|
priv->base.base.pwm_get = gf110_fan_pwm_get;
|
||||||
priv->base.base.pwm_set = nvd0_fan_pwm_set;
|
priv->base.base.pwm_set = gf110_fan_pwm_set;
|
||||||
priv->base.base.pwm_clock = nvd0_fan_pwm_clock;
|
priv->base.base.pwm_clock = gf110_fan_pwm_clock;
|
||||||
priv->base.base.temp_get = nv84_temp_get;
|
priv->base.base.temp_get = g84_temp_get;
|
||||||
priv->base.base.fan_sense = nva3_therm_fan_sense;
|
priv->base.base.fan_sense = gt215_therm_fan_sense;
|
||||||
priv->base.sensor.program_alarms = nouveau_therm_program_alarms_polling;
|
priv->base.sensor.program_alarms = nvkm_therm_program_alarms_polling;
|
||||||
return nouveau_therm_preinit(&priv->base.base);
|
return nvkm_therm_preinit(&priv->base.base);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct nouveau_oclass
|
struct nvkm_oclass
|
||||||
nvd0_therm_oclass = {
|
gf110_therm_oclass = {
|
||||||
.handle = NV_SUBDEV(THERM, 0xd0),
|
.handle = NV_SUBDEV(THERM, 0xd0),
|
||||||
.ofuncs = &(struct nouveau_ofuncs) {
|
.ofuncs = &(struct nvkm_ofuncs) {
|
||||||
.ctor = nvd0_therm_ctor,
|
.ctor = gf110_therm_ctor,
|
||||||
.dtor = _nouveau_therm_dtor,
|
.dtor = _nvkm_therm_dtor,
|
||||||
.init = nvd0_therm_init,
|
.init = gf110_therm_init,
|
||||||
.fini = nv84_therm_fini,
|
.fini = g84_therm_fini,
|
||||||
},
|
},
|
||||||
};
|
};
|
|
@ -21,22 +21,21 @@
|
||||||
*
|
*
|
||||||
* Authors: Martin Peres
|
* Authors: Martin Peres
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "priv.h"
|
#include "priv.h"
|
||||||
|
|
||||||
struct gm107_therm_priv {
|
struct gm107_therm_priv {
|
||||||
struct nouveau_therm_priv base;
|
struct nvkm_therm_priv base;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
gm107_fan_pwm_ctrl(struct nouveau_therm *therm, int line, bool enable)
|
gm107_fan_pwm_ctrl(struct nvkm_therm *therm, int line, bool enable)
|
||||||
{
|
{
|
||||||
/* nothing to do, it seems hardwired */
|
/* nothing to do, it seems hardwired */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
gm107_fan_pwm_get(struct nouveau_therm *therm, int line, u32 *divs, u32 *duty)
|
gm107_fan_pwm_get(struct nvkm_therm *therm, int line, u32 *divs, u32 *duty)
|
||||||
{
|
{
|
||||||
*divs = nv_rd32(therm, 0x10eb20) & 0x1fff;
|
*divs = nv_rd32(therm, 0x10eb20) & 0x1fff;
|
||||||
*duty = nv_rd32(therm, 0x10eb24) & 0x1fff;
|
*duty = nv_rd32(therm, 0x10eb24) & 0x1fff;
|
||||||
|
@ -44,7 +43,7 @@ gm107_fan_pwm_get(struct nouveau_therm *therm, int line, u32 *divs, u32 *duty)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
gm107_fan_pwm_set(struct nouveau_therm *therm, int line, u32 divs, u32 duty)
|
gm107_fan_pwm_set(struct nvkm_therm *therm, int line, u32 divs, u32 duty)
|
||||||
{
|
{
|
||||||
nv_mask(therm, 0x10eb10, 0x1fff, divs); /* keep the high bits */
|
nv_mask(therm, 0x10eb10, 0x1fff, divs); /* keep the high bits */
|
||||||
nv_wr32(therm, 0x10eb14, duty | 0x80000000);
|
nv_wr32(therm, 0x10eb14, duty | 0x80000000);
|
||||||
|
@ -52,21 +51,20 @@ gm107_fan_pwm_set(struct nouveau_therm *therm, int line, u32 divs, u32 duty)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
gm107_fan_pwm_clock(struct nouveau_therm *therm, int line)
|
gm107_fan_pwm_clock(struct nvkm_therm *therm, int line)
|
||||||
{
|
{
|
||||||
return nv_device(therm)->crystal * 1000;
|
return nv_device(therm)->crystal * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
gm107_therm_ctor(struct nouveau_object *parent,
|
gm107_therm_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
|
||||||
struct nouveau_object *engine,
|
struct nvkm_oclass *oclass, void *data, u32 size,
|
||||||
struct nouveau_oclass *oclass, void *data, u32 size,
|
struct nvkm_object **pobject)
|
||||||
struct nouveau_object **pobject)
|
|
||||||
{
|
{
|
||||||
struct gm107_therm_priv *priv;
|
struct gm107_therm_priv *priv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nouveau_therm_create(parent, engine, oclass, &priv);
|
ret = nvkm_therm_create(parent, engine, oclass, &priv);
|
||||||
*pobject = nv_object(priv);
|
*pobject = nv_object(priv);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -75,19 +73,19 @@ gm107_therm_ctor(struct nouveau_object *parent,
|
||||||
priv->base.base.pwm_get = gm107_fan_pwm_get;
|
priv->base.base.pwm_get = gm107_fan_pwm_get;
|
||||||
priv->base.base.pwm_set = gm107_fan_pwm_set;
|
priv->base.base.pwm_set = gm107_fan_pwm_set;
|
||||||
priv->base.base.pwm_clock = gm107_fan_pwm_clock;
|
priv->base.base.pwm_clock = gm107_fan_pwm_clock;
|
||||||
priv->base.base.temp_get = nv84_temp_get;
|
priv->base.base.temp_get = g84_temp_get;
|
||||||
priv->base.base.fan_sense = nva3_therm_fan_sense;
|
priv->base.base.fan_sense = gt215_therm_fan_sense;
|
||||||
priv->base.sensor.program_alarms = nouveau_therm_program_alarms_polling;
|
priv->base.sensor.program_alarms = nvkm_therm_program_alarms_polling;
|
||||||
return nouveau_therm_preinit(&priv->base.base);
|
return nvkm_therm_preinit(&priv->base.base);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct nouveau_oclass
|
struct nvkm_oclass
|
||||||
gm107_therm_oclass = {
|
gm107_therm_oclass = {
|
||||||
.handle = NV_SUBDEV(THERM, 0x117),
|
.handle = NV_SUBDEV(THERM, 0x117),
|
||||||
.ofuncs = &(struct nouveau_ofuncs) {
|
.ofuncs = &(struct nvkm_ofuncs) {
|
||||||
.ctor = gm107_therm_ctor,
|
.ctor = gm107_therm_ctor,
|
||||||
.dtor = _nouveau_therm_dtor,
|
.dtor = _nvkm_therm_dtor,
|
||||||
.init = nvd0_therm_init,
|
.init = gf110_therm_init,
|
||||||
.fini = nv84_therm_fini,
|
.fini = g84_therm_fini,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,17 +21,16 @@
|
||||||
*
|
*
|
||||||
* Authors: Ben Skeggs
|
* Authors: Ben Skeggs
|
||||||
*/
|
*/
|
||||||
|
#include "priv.h"
|
||||||
|
|
||||||
#include <subdev/gpio.h>
|
#include <subdev/gpio.h>
|
||||||
|
|
||||||
#include "priv.h"
|
struct gt215_therm_priv {
|
||||||
|
struct nvkm_therm_priv base;
|
||||||
struct nva3_therm_priv {
|
|
||||||
struct nouveau_therm_priv base;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
nva3_therm_fan_sense(struct nouveau_therm *therm)
|
gt215_therm_fan_sense(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
u32 tach = nv_rd32(therm, 0x00e728) & 0x0000ffff;
|
u32 tach = nv_rd32(therm, 0x00e728) & 0x0000ffff;
|
||||||
u32 ctrl = nv_rd32(therm, 0x00e720);
|
u32 ctrl = nv_rd32(therm, 0x00e720);
|
||||||
|
@ -41,17 +40,17 @@ nva3_therm_fan_sense(struct nouveau_therm *therm)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nva3_therm_init(struct nouveau_object *object)
|
gt215_therm_init(struct nvkm_object *object)
|
||||||
{
|
{
|
||||||
struct nva3_therm_priv *priv = (void *)object;
|
struct gt215_therm_priv *priv = (void *)object;
|
||||||
struct dcb_gpio_func *tach = &priv->base.fan->tach;
|
struct dcb_gpio_func *tach = &priv->base.fan->tach;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nouveau_therm_init(&priv->base.base);
|
ret = nvkm_therm_init(&priv->base.base);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
nv84_sensor_setup(&priv->base.base);
|
g84_sensor_setup(&priv->base.base);
|
||||||
|
|
||||||
/* enable fan tach, count revolutions per-second */
|
/* enable fan tach, count revolutions per-second */
|
||||||
nv_mask(priv, 0x00e720, 0x00000003, 0x00000002);
|
nv_mask(priv, 0x00e720, 0x00000003, 0x00000002);
|
||||||
|
@ -66,15 +65,14 @@ nva3_therm_init(struct nouveau_object *object)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nva3_therm_ctor(struct nouveau_object *parent,
|
gt215_therm_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
|
||||||
struct nouveau_object *engine,
|
struct nvkm_oclass *oclass, void *data, u32 size,
|
||||||
struct nouveau_oclass *oclass, void *data, u32 size,
|
struct nvkm_object **pobject)
|
||||||
struct nouveau_object **pobject)
|
|
||||||
{
|
{
|
||||||
struct nva3_therm_priv *priv;
|
struct gt215_therm_priv *priv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nouveau_therm_create(parent, engine, oclass, &priv);
|
ret = nvkm_therm_create(parent, engine, oclass, &priv);
|
||||||
*pobject = nv_object(priv);
|
*pobject = nv_object(priv);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -83,19 +81,19 @@ nva3_therm_ctor(struct nouveau_object *parent,
|
||||||
priv->base.base.pwm_get = nv50_fan_pwm_get;
|
priv->base.base.pwm_get = nv50_fan_pwm_get;
|
||||||
priv->base.base.pwm_set = nv50_fan_pwm_set;
|
priv->base.base.pwm_set = nv50_fan_pwm_set;
|
||||||
priv->base.base.pwm_clock = nv50_fan_pwm_clock;
|
priv->base.base.pwm_clock = nv50_fan_pwm_clock;
|
||||||
priv->base.base.temp_get = nv84_temp_get;
|
priv->base.base.temp_get = g84_temp_get;
|
||||||
priv->base.base.fan_sense = nva3_therm_fan_sense;
|
priv->base.base.fan_sense = gt215_therm_fan_sense;
|
||||||
priv->base.sensor.program_alarms = nouveau_therm_program_alarms_polling;
|
priv->base.sensor.program_alarms = nvkm_therm_program_alarms_polling;
|
||||||
return nouveau_therm_preinit(&priv->base.base);
|
return nvkm_therm_preinit(&priv->base.base);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct nouveau_oclass
|
struct nvkm_oclass
|
||||||
nva3_therm_oclass = {
|
gt215_therm_oclass = {
|
||||||
.handle = NV_SUBDEV(THERM, 0xa3),
|
.handle = NV_SUBDEV(THERM, 0xa3),
|
||||||
.ofuncs = &(struct nouveau_ofuncs) {
|
.ofuncs = &(struct nvkm_ofuncs) {
|
||||||
.ctor = nva3_therm_ctor,
|
.ctor = gt215_therm_ctor,
|
||||||
.dtor = _nouveau_therm_dtor,
|
.dtor = _nvkm_therm_dtor,
|
||||||
.init = nva3_therm_init,
|
.init = gt215_therm_init,
|
||||||
.fini = nv84_therm_fini,
|
.fini = g84_therm_fini,
|
||||||
},
|
},
|
||||||
};
|
};
|
|
@ -21,17 +21,16 @@
|
||||||
*
|
*
|
||||||
* Authors: Martin Peres
|
* Authors: Martin Peres
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "priv.h"
|
#include "priv.h"
|
||||||
|
|
||||||
#include <subdev/i2c.h>
|
|
||||||
#include <subdev/bios/extdev.h>
|
#include <subdev/bios/extdev.h>
|
||||||
|
#include <subdev/i2c.h>
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
probe_monitoring_device(struct nouveau_i2c_port *i2c,
|
probe_monitoring_device(struct nvkm_i2c_port *i2c,
|
||||||
struct i2c_board_info *info, void *data)
|
struct i2c_board_info *info, void *data)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = data;
|
struct nvkm_therm_priv *priv = data;
|
||||||
struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
|
struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
|
||||||
struct i2c_client *client;
|
struct i2c_client *client;
|
||||||
|
|
||||||
|
@ -52,11 +51,10 @@ probe_monitoring_device(struct nouveau_i2c_port *i2c,
|
||||||
"temp offset %+i C)\n",
|
"temp offset %+i C)\n",
|
||||||
info->type, info->addr, sensor->offset_constant);
|
info->type, info->addr, sensor->offset_constant);
|
||||||
priv->ic = client;
|
priv->ic = client;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nouveau_i2c_board_info
|
static struct nvkm_i2c_board_info
|
||||||
nv_board_infos[] = {
|
nv_board_infos[] = {
|
||||||
{ { I2C_BOARD_INFO("w83l785ts", 0x2d) }, 0 },
|
{ { I2C_BOARD_INFO("w83l785ts", 0x2d) }, 0 },
|
||||||
{ { I2C_BOARD_INFO("w83781d", 0x2d) }, 0 },
|
{ { I2C_BOARD_INFO("w83781d", 0x2d) }, 0 },
|
||||||
|
@ -82,15 +80,15 @@ nv_board_infos[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
nouveau_therm_ic_ctor(struct nouveau_therm *therm)
|
nvkm_therm_ic_ctor(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
struct nouveau_bios *bios = nouveau_bios(therm);
|
struct nvkm_bios *bios = nvkm_bios(therm);
|
||||||
struct nouveau_i2c *i2c = nouveau_i2c(therm);
|
struct nvkm_i2c *i2c = nvkm_i2c(therm);
|
||||||
struct nvbios_extdev_func extdev_entry;
|
struct nvbios_extdev_func extdev_entry;
|
||||||
|
|
||||||
if (!nvbios_extdev_find(bios, NVBIOS_EXTDEV_LM89, &extdev_entry)) {
|
if (!nvbios_extdev_find(bios, NVBIOS_EXTDEV_LM89, &extdev_entry)) {
|
||||||
struct nouveau_i2c_board_info board[] = {
|
struct nvkm_i2c_board_info board[] = {
|
||||||
{ { I2C_BOARD_INFO("lm90", extdev_entry.addr >> 1) }, 0},
|
{ { I2C_BOARD_INFO("lm90", extdev_entry.addr >> 1) }, 0},
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
@ -102,7 +100,7 @@ nouveau_therm_ic_ctor(struct nouveau_therm *therm)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nvbios_extdev_find(bios, NVBIOS_EXTDEV_ADT7473, &extdev_entry)) {
|
if (!nvbios_extdev_find(bios, NVBIOS_EXTDEV_ADT7473, &extdev_entry)) {
|
||||||
struct nouveau_i2c_board_info board[] = {
|
struct nvkm_i2c_board_info board[] = {
|
||||||
{ { I2C_BOARD_INFO("adt7473", extdev_entry.addr >> 1) }, 20 },
|
{ { I2C_BOARD_INFO("adt7473", extdev_entry.addr >> 1) }, 20 },
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,19 +22,18 @@
|
||||||
* Authors: Ben Skeggs
|
* Authors: Ben Skeggs
|
||||||
* Martin Peres
|
* Martin Peres
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "priv.h"
|
#include "priv.h"
|
||||||
|
|
||||||
struct nv40_therm_priv {
|
struct nv40_therm_priv {
|
||||||
struct nouveau_therm_priv base;
|
struct nvkm_therm_priv base;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum nv40_sensor_style { INVALID_STYLE = -1, OLD_STYLE = 0, NEW_STYLE = 1 };
|
enum nv40_sensor_style { INVALID_STYLE = -1, OLD_STYLE = 0, NEW_STYLE = 1 };
|
||||||
|
|
||||||
static enum nv40_sensor_style
|
static enum nv40_sensor_style
|
||||||
nv40_sensor_style(struct nouveau_therm *therm)
|
nv40_sensor_style(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_device *device = nv_device(therm);
|
struct nvkm_device *device = nv_device(therm);
|
||||||
|
|
||||||
switch (device->chipset) {
|
switch (device->chipset) {
|
||||||
case 0x43:
|
case 0x43:
|
||||||
|
@ -58,7 +57,7 @@ nv40_sensor_style(struct nouveau_therm *therm)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nv40_sensor_setup(struct nouveau_therm *therm)
|
nv40_sensor_setup(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
enum nv40_sensor_style style = nv40_sensor_style(therm);
|
enum nv40_sensor_style style = nv40_sensor_style(therm);
|
||||||
|
|
||||||
|
@ -77,9 +76,9 @@ nv40_sensor_setup(struct nouveau_therm *therm)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nv40_temp_get(struct nouveau_therm *therm)
|
nv40_temp_get(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
|
struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
|
||||||
enum nv40_sensor_style style = nv40_sensor_style(therm);
|
enum nv40_sensor_style style = nv40_sensor_style(therm);
|
||||||
int core_temp;
|
int core_temp;
|
||||||
|
@ -110,7 +109,7 @@ nv40_temp_get(struct nouveau_therm *therm)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nv40_fan_pwm_ctrl(struct nouveau_therm *therm, int line, bool enable)
|
nv40_fan_pwm_ctrl(struct nvkm_therm *therm, int line, bool enable)
|
||||||
{
|
{
|
||||||
u32 mask = enable ? 0x80000000 : 0x0000000;
|
u32 mask = enable ? 0x80000000 : 0x0000000;
|
||||||
if (line == 2) nv_mask(therm, 0x0010f0, 0x80000000, mask);
|
if (line == 2) nv_mask(therm, 0x0010f0, 0x80000000, mask);
|
||||||
|
@ -123,7 +122,7 @@ nv40_fan_pwm_ctrl(struct nouveau_therm *therm, int line, bool enable)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nv40_fan_pwm_get(struct nouveau_therm *therm, int line, u32 *divs, u32 *duty)
|
nv40_fan_pwm_get(struct nvkm_therm *therm, int line, u32 *divs, u32 *duty)
|
||||||
{
|
{
|
||||||
if (line == 2) {
|
if (line == 2) {
|
||||||
u32 reg = nv_rd32(therm, 0x0010f0);
|
u32 reg = nv_rd32(therm, 0x0010f0);
|
||||||
|
@ -149,7 +148,7 @@ nv40_fan_pwm_get(struct nouveau_therm *therm, int line, u32 *divs, u32 *duty)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nv40_fan_pwm_set(struct nouveau_therm *therm, int line, u32 divs, u32 duty)
|
nv40_fan_pwm_set(struct nvkm_therm *therm, int line, u32 divs, u32 duty)
|
||||||
{
|
{
|
||||||
if (line == 2) {
|
if (line == 2) {
|
||||||
nv_mask(therm, 0x0010f0, 0x7fff7fff, (duty << 16) | divs);
|
nv_mask(therm, 0x0010f0, 0x7fff7fff, (duty << 16) | divs);
|
||||||
|
@ -166,9 +165,9 @@ nv40_fan_pwm_set(struct nouveau_therm *therm, int line, u32 divs, u32 duty)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nv40_therm_intr(struct nouveau_subdev *subdev)
|
nv40_therm_intr(struct nvkm_subdev *subdev)
|
||||||
{
|
{
|
||||||
struct nouveau_therm *therm = nouveau_therm(subdev);
|
struct nvkm_therm *therm = nvkm_therm(subdev);
|
||||||
uint32_t stat = nv_rd32(therm, 0x1100);
|
uint32_t stat = nv_rd32(therm, 0x1100);
|
||||||
|
|
||||||
/* traitement */
|
/* traitement */
|
||||||
|
@ -180,15 +179,15 @@ nv40_therm_intr(struct nouveau_subdev *subdev)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nv40_therm_ctor(struct nouveau_object *parent,
|
nv40_therm_ctor(struct nvkm_object *parent,
|
||||||
struct nouveau_object *engine,
|
struct nvkm_object *engine,
|
||||||
struct nouveau_oclass *oclass, void *data, u32 size,
|
struct nvkm_oclass *oclass, void *data, u32 size,
|
||||||
struct nouveau_object **pobject)
|
struct nvkm_object **pobject)
|
||||||
{
|
{
|
||||||
struct nv40_therm_priv *priv;
|
struct nv40_therm_priv *priv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nouveau_therm_create(parent, engine, oclass, &priv);
|
ret = nvkm_therm_create(parent, engine, oclass, &priv);
|
||||||
*pobject = nv_object(priv);
|
*pobject = nv_object(priv);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -197,28 +196,28 @@ nv40_therm_ctor(struct nouveau_object *parent,
|
||||||
priv->base.base.pwm_get = nv40_fan_pwm_get;
|
priv->base.base.pwm_get = nv40_fan_pwm_get;
|
||||||
priv->base.base.pwm_set = nv40_fan_pwm_set;
|
priv->base.base.pwm_set = nv40_fan_pwm_set;
|
||||||
priv->base.base.temp_get = nv40_temp_get;
|
priv->base.base.temp_get = nv40_temp_get;
|
||||||
priv->base.sensor.program_alarms = nouveau_therm_program_alarms_polling;
|
priv->base.sensor.program_alarms = nvkm_therm_program_alarms_polling;
|
||||||
nv_subdev(priv)->intr = nv40_therm_intr;
|
nv_subdev(priv)->intr = nv40_therm_intr;
|
||||||
return nouveau_therm_preinit(&priv->base.base);
|
return nvkm_therm_preinit(&priv->base.base);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nv40_therm_init(struct nouveau_object *object)
|
nv40_therm_init(struct nvkm_object *object)
|
||||||
{
|
{
|
||||||
struct nouveau_therm *therm = (void *)object;
|
struct nvkm_therm *therm = (void *)object;
|
||||||
|
|
||||||
nv40_sensor_setup(therm);
|
nv40_sensor_setup(therm);
|
||||||
|
|
||||||
return _nouveau_therm_init(object);
|
return _nvkm_therm_init(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct nouveau_oclass
|
struct nvkm_oclass
|
||||||
nv40_therm_oclass = {
|
nv40_therm_oclass = {
|
||||||
.handle = NV_SUBDEV(THERM, 0x40),
|
.handle = NV_SUBDEV(THERM, 0x40),
|
||||||
.ofuncs = &(struct nouveau_ofuncs) {
|
.ofuncs = &(struct nvkm_ofuncs) {
|
||||||
.ctor = nv40_therm_ctor,
|
.ctor = nv40_therm_ctor,
|
||||||
.dtor = _nouveau_therm_dtor,
|
.dtor = _nvkm_therm_dtor,
|
||||||
.init = nv40_therm_init,
|
.init = nv40_therm_init,
|
||||||
.fini = _nouveau_therm_fini,
|
.fini = _nvkm_therm_fini,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,15 +22,14 @@
|
||||||
* Authors: Ben Skeggs
|
* Authors: Ben Skeggs
|
||||||
* Martin Peres
|
* Martin Peres
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "priv.h"
|
#include "priv.h"
|
||||||
|
|
||||||
struct nv50_therm_priv {
|
struct nv50_therm_priv {
|
||||||
struct nouveau_therm_priv base;
|
struct nvkm_therm_priv base;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
pwm_info(struct nouveau_therm *therm, int *line, int *ctrl, int *indx)
|
pwm_info(struct nvkm_therm *therm, int *line, int *ctrl, int *indx)
|
||||||
{
|
{
|
||||||
if (*line == 0x04) {
|
if (*line == 0x04) {
|
||||||
*ctrl = 0x00e100;
|
*ctrl = 0x00e100;
|
||||||
|
@ -55,7 +54,7 @@ pwm_info(struct nouveau_therm *therm, int *line, int *ctrl, int *indx)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nv50_fan_pwm_ctrl(struct nouveau_therm *therm, int line, bool enable)
|
nv50_fan_pwm_ctrl(struct nvkm_therm *therm, int line, bool enable)
|
||||||
{
|
{
|
||||||
u32 data = enable ? 0x00000001 : 0x00000000;
|
u32 data = enable ? 0x00000001 : 0x00000000;
|
||||||
int ctrl, id, ret = pwm_info(therm, &line, &ctrl, &id);
|
int ctrl, id, ret = pwm_info(therm, &line, &ctrl, &id);
|
||||||
|
@ -65,7 +64,7 @@ nv50_fan_pwm_ctrl(struct nouveau_therm *therm, int line, bool enable)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nv50_fan_pwm_get(struct nouveau_therm *therm, int line, u32 *divs, u32 *duty)
|
nv50_fan_pwm_get(struct nvkm_therm *therm, int line, u32 *divs, u32 *duty)
|
||||||
{
|
{
|
||||||
int ctrl, id, ret = pwm_info(therm, &line, &ctrl, &id);
|
int ctrl, id, ret = pwm_info(therm, &line, &ctrl, &id);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -81,7 +80,7 @@ nv50_fan_pwm_get(struct nouveau_therm *therm, int line, u32 *divs, u32 *duty)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nv50_fan_pwm_set(struct nouveau_therm *therm, int line, u32 divs, u32 duty)
|
nv50_fan_pwm_set(struct nvkm_therm *therm, int line, u32 divs, u32 duty)
|
||||||
{
|
{
|
||||||
int ctrl, id, ret = pwm_info(therm, &line, &ctrl, &id);
|
int ctrl, id, ret = pwm_info(therm, &line, &ctrl, &id);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -93,7 +92,7 @@ nv50_fan_pwm_set(struct nouveau_therm *therm, int line, u32 divs, u32 duty)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nv50_fan_pwm_clock(struct nouveau_therm *therm, int line)
|
nv50_fan_pwm_clock(struct nvkm_therm *therm, int line)
|
||||||
{
|
{
|
||||||
int chipset = nv_device(therm)->chipset;
|
int chipset = nv_device(therm)->chipset;
|
||||||
int crystal = nv_device(therm)->crystal;
|
int crystal = nv_device(therm)->crystal;
|
||||||
|
@ -119,16 +118,16 @@ nv50_fan_pwm_clock(struct nouveau_therm *therm, int line)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nv50_sensor_setup(struct nouveau_therm *therm)
|
nv50_sensor_setup(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
nv_mask(therm, 0x20010, 0x40000000, 0x0);
|
nv_mask(therm, 0x20010, 0x40000000, 0x0);
|
||||||
mdelay(20); /* wait for the temperature to stabilize */
|
mdelay(20); /* wait for the temperature to stabilize */
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nv50_temp_get(struct nouveau_therm *therm)
|
nv50_temp_get(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
|
struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
|
||||||
int core_temp;
|
int core_temp;
|
||||||
|
|
||||||
|
@ -151,15 +150,15 @@ nv50_temp_get(struct nouveau_therm *therm)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nv50_therm_ctor(struct nouveau_object *parent,
|
nv50_therm_ctor(struct nvkm_object *parent,
|
||||||
struct nouveau_object *engine,
|
struct nvkm_object *engine,
|
||||||
struct nouveau_oclass *oclass, void *data, u32 size,
|
struct nvkm_oclass *oclass, void *data, u32 size,
|
||||||
struct nouveau_object **pobject)
|
struct nvkm_object **pobject)
|
||||||
{
|
{
|
||||||
struct nv50_therm_priv *priv;
|
struct nv50_therm_priv *priv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nouveau_therm_create(parent, engine, oclass, &priv);
|
ret = nvkm_therm_create(parent, engine, oclass, &priv);
|
||||||
*pobject = nv_object(priv);
|
*pobject = nv_object(priv);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -169,29 +168,29 @@ nv50_therm_ctor(struct nouveau_object *parent,
|
||||||
priv->base.base.pwm_set = nv50_fan_pwm_set;
|
priv->base.base.pwm_set = nv50_fan_pwm_set;
|
||||||
priv->base.base.pwm_clock = nv50_fan_pwm_clock;
|
priv->base.base.pwm_clock = nv50_fan_pwm_clock;
|
||||||
priv->base.base.temp_get = nv50_temp_get;
|
priv->base.base.temp_get = nv50_temp_get;
|
||||||
priv->base.sensor.program_alarms = nouveau_therm_program_alarms_polling;
|
priv->base.sensor.program_alarms = nvkm_therm_program_alarms_polling;
|
||||||
nv_subdev(priv)->intr = nv40_therm_intr;
|
nv_subdev(priv)->intr = nv40_therm_intr;
|
||||||
|
|
||||||
return nouveau_therm_preinit(&priv->base.base);
|
return nvkm_therm_preinit(&priv->base.base);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nv50_therm_init(struct nouveau_object *object)
|
nv50_therm_init(struct nvkm_object *object)
|
||||||
{
|
{
|
||||||
struct nouveau_therm *therm = (void *)object;
|
struct nvkm_therm *therm = (void *)object;
|
||||||
|
|
||||||
nv50_sensor_setup(therm);
|
nv50_sensor_setup(therm);
|
||||||
|
|
||||||
return _nouveau_therm_init(object);
|
return _nvkm_therm_init(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct nouveau_oclass
|
struct nvkm_oclass
|
||||||
nv50_therm_oclass = {
|
nv50_therm_oclass = {
|
||||||
.handle = NV_SUBDEV(THERM, 0x50),
|
.handle = NV_SUBDEV(THERM, 0x50),
|
||||||
.ofuncs = &(struct nouveau_ofuncs) {
|
.ofuncs = &(struct nvkm_ofuncs) {
|
||||||
.ctor = nv50_therm_ctor,
|
.ctor = nv50_therm_ctor,
|
||||||
.dtor = _nouveau_therm_dtor,
|
.dtor = _nvkm_therm_dtor,
|
||||||
.init = nv50_therm_init,
|
.init = nv50_therm_init,
|
||||||
.fini = _nouveau_therm_fini,
|
.fini = _nvkm_therm_fini,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#ifndef __NVTHERM_PRIV_H__
|
#ifndef __NVTHERM_PRIV_H__
|
||||||
#define __NVTHERM_PRIV_H__
|
#define __NVTHERM_PRIV_H__
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2012 The Nouveau community
|
* Copyright 2012 The Nouveau community
|
||||||
*
|
*
|
||||||
|
@ -24,9 +23,7 @@
|
||||||
*
|
*
|
||||||
* Authors: Martin Peres
|
* Authors: Martin Peres
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <subdev/therm.h>
|
#include <subdev/therm.h>
|
||||||
|
|
||||||
#include <subdev/bios.h>
|
#include <subdev/bios.h>
|
||||||
#include <subdev/bios/extdev.h>
|
#include <subdev/bios/extdev.h>
|
||||||
#include <subdev/bios/gpio.h>
|
#include <subdev/bios/gpio.h>
|
||||||
|
@ -34,46 +31,46 @@
|
||||||
#include <subdev/bios/therm.h>
|
#include <subdev/bios/therm.h>
|
||||||
#include <subdev/timer.h>
|
#include <subdev/timer.h>
|
||||||
|
|
||||||
struct nouveau_fan {
|
struct nvkm_fan {
|
||||||
struct nouveau_therm *parent;
|
struct nvkm_therm *parent;
|
||||||
const char *type;
|
const char *type;
|
||||||
|
|
||||||
struct nvbios_therm_fan bios;
|
struct nvbios_therm_fan bios;
|
||||||
struct nvbios_perf_fan perf;
|
struct nvbios_perf_fan perf;
|
||||||
|
|
||||||
struct nouveau_alarm alarm;
|
struct nvkm_alarm alarm;
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
int percent;
|
int percent;
|
||||||
|
|
||||||
int (*get)(struct nouveau_therm *therm);
|
int (*get)(struct nvkm_therm *);
|
||||||
int (*set)(struct nouveau_therm *therm, int percent);
|
int (*set)(struct nvkm_therm *, int percent);
|
||||||
|
|
||||||
struct dcb_gpio_func tach;
|
struct dcb_gpio_func tach;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum nouveau_therm_thrs_direction {
|
enum nvkm_therm_thrs_direction {
|
||||||
NOUVEAU_THERM_THRS_FALLING = 0,
|
NVKM_THERM_THRS_FALLING = 0,
|
||||||
NOUVEAU_THERM_THRS_RISING = 1
|
NVKM_THERM_THRS_RISING = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
enum nouveau_therm_thrs_state {
|
enum nvkm_therm_thrs_state {
|
||||||
NOUVEAU_THERM_THRS_LOWER = 0,
|
NVKM_THERM_THRS_LOWER = 0,
|
||||||
NOUVEAU_THERM_THRS_HIGHER = 1
|
NVKM_THERM_THRS_HIGHER = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
enum nouveau_therm_thrs {
|
enum nvkm_therm_thrs {
|
||||||
NOUVEAU_THERM_THRS_FANBOOST = 0,
|
NVKM_THERM_THRS_FANBOOST = 0,
|
||||||
NOUVEAU_THERM_THRS_DOWNCLOCK = 1,
|
NVKM_THERM_THRS_DOWNCLOCK = 1,
|
||||||
NOUVEAU_THERM_THRS_CRITICAL = 2,
|
NVKM_THERM_THRS_CRITICAL = 2,
|
||||||
NOUVEAU_THERM_THRS_SHUTDOWN = 3,
|
NVKM_THERM_THRS_SHUTDOWN = 3,
|
||||||
NOUVEAU_THERM_THRS_NR
|
NVKM_THERM_THRS_NR
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nouveau_therm_priv {
|
struct nvkm_therm_priv {
|
||||||
struct nouveau_therm base;
|
struct nvkm_therm base;
|
||||||
|
|
||||||
/* automatic thermal management */
|
/* automatic thermal management */
|
||||||
struct nouveau_alarm alarm;
|
struct nvkm_alarm alarm;
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
struct nvbios_therm_trip_point *last_trip;
|
struct nvbios_therm_trip_point *last_trip;
|
||||||
int mode;
|
int mode;
|
||||||
|
@ -84,77 +81,73 @@ struct nouveau_therm_priv {
|
||||||
struct nvbios_therm_sensor bios_sensor;
|
struct nvbios_therm_sensor bios_sensor;
|
||||||
|
|
||||||
/* fan priv */
|
/* fan priv */
|
||||||
struct nouveau_fan *fan;
|
struct nvkm_fan *fan;
|
||||||
|
|
||||||
/* alarms priv */
|
/* alarms priv */
|
||||||
struct {
|
struct {
|
||||||
spinlock_t alarm_program_lock;
|
spinlock_t alarm_program_lock;
|
||||||
struct nouveau_alarm therm_poll_alarm;
|
struct nvkm_alarm therm_poll_alarm;
|
||||||
enum nouveau_therm_thrs_state alarm_state[NOUVEAU_THERM_THRS_NR];
|
enum nvkm_therm_thrs_state alarm_state[NVKM_THERM_THRS_NR];
|
||||||
void (*program_alarms)(struct nouveau_therm *);
|
void (*program_alarms)(struct nvkm_therm *);
|
||||||
} sensor;
|
} sensor;
|
||||||
|
|
||||||
/* what should be done if the card overheats */
|
/* what should be done if the card overheats */
|
||||||
struct {
|
struct {
|
||||||
void (*downclock)(struct nouveau_therm *, bool active);
|
void (*downclock)(struct nvkm_therm *, bool active);
|
||||||
void (*pause)(struct nouveau_therm *, bool active);
|
void (*pause)(struct nvkm_therm *, bool active);
|
||||||
} emergency;
|
} emergency;
|
||||||
|
|
||||||
/* ic */
|
/* ic */
|
||||||
struct i2c_client *ic;
|
struct i2c_client *ic;
|
||||||
};
|
};
|
||||||
|
|
||||||
int nouveau_therm_fan_mode(struct nouveau_therm *therm, int mode);
|
int nvkm_therm_fan_mode(struct nvkm_therm *, int mode);
|
||||||
int nouveau_therm_attr_get(struct nouveau_therm *therm,
|
int nvkm_therm_attr_get(struct nvkm_therm *, enum nvkm_therm_attr_type);
|
||||||
enum nouveau_therm_attr_type type);
|
int nvkm_therm_attr_set(struct nvkm_therm *, enum nvkm_therm_attr_type, int);
|
||||||
int nouveau_therm_attr_set(struct nouveau_therm *therm,
|
|
||||||
enum nouveau_therm_attr_type type, int value);
|
|
||||||
|
|
||||||
void nouveau_therm_ic_ctor(struct nouveau_therm *therm);
|
void nvkm_therm_ic_ctor(struct nvkm_therm *);
|
||||||
|
|
||||||
int nouveau_therm_sensor_ctor(struct nouveau_therm *therm);
|
int nvkm_therm_sensor_ctor(struct nvkm_therm *);
|
||||||
|
|
||||||
int nouveau_therm_fan_ctor(struct nouveau_therm *therm);
|
int nvkm_therm_fan_ctor(struct nvkm_therm *);
|
||||||
int nouveau_therm_fan_init(struct nouveau_therm *therm);
|
int nvkm_therm_fan_init(struct nvkm_therm *);
|
||||||
int nouveau_therm_fan_fini(struct nouveau_therm *therm, bool suspend);
|
int nvkm_therm_fan_fini(struct nvkm_therm *, bool suspend);
|
||||||
int nouveau_therm_fan_get(struct nouveau_therm *therm);
|
int nvkm_therm_fan_get(struct nvkm_therm *);
|
||||||
int nouveau_therm_fan_set(struct nouveau_therm *therm, bool now, int percent);
|
int nvkm_therm_fan_set(struct nvkm_therm *, bool now, int percent);
|
||||||
int nouveau_therm_fan_user_get(struct nouveau_therm *therm);
|
int nvkm_therm_fan_user_get(struct nvkm_therm *);
|
||||||
int nouveau_therm_fan_user_set(struct nouveau_therm *therm, int percent);
|
int nvkm_therm_fan_user_set(struct nvkm_therm *, int percent);
|
||||||
|
|
||||||
int nouveau_therm_fan_sense(struct nouveau_therm *therm);
|
int nvkm_therm_fan_sense(struct nvkm_therm *);
|
||||||
|
|
||||||
int nouveau_therm_preinit(struct nouveau_therm *);
|
int nvkm_therm_preinit(struct nvkm_therm *);
|
||||||
|
|
||||||
int nouveau_therm_sensor_init(struct nouveau_therm *therm);
|
int nvkm_therm_sensor_init(struct nvkm_therm *);
|
||||||
int nouveau_therm_sensor_fini(struct nouveau_therm *therm, bool suspend);
|
int nvkm_therm_sensor_fini(struct nvkm_therm *, bool suspend);
|
||||||
void nouveau_therm_sensor_preinit(struct nouveau_therm *);
|
void nvkm_therm_sensor_preinit(struct nvkm_therm *);
|
||||||
void nouveau_therm_sensor_set_threshold_state(struct nouveau_therm *therm,
|
void nvkm_therm_sensor_set_threshold_state(struct nvkm_therm *,
|
||||||
enum nouveau_therm_thrs thrs,
|
enum nvkm_therm_thrs,
|
||||||
enum nouveau_therm_thrs_state st);
|
enum nvkm_therm_thrs_state);
|
||||||
enum nouveau_therm_thrs_state
|
enum nvkm_therm_thrs_state
|
||||||
nouveau_therm_sensor_get_threshold_state(struct nouveau_therm *therm,
|
nvkm_therm_sensor_get_threshold_state(struct nvkm_therm *,
|
||||||
enum nouveau_therm_thrs thrs);
|
enum nvkm_therm_thrs);
|
||||||
void nouveau_therm_sensor_event(struct nouveau_therm *therm,
|
void nvkm_therm_sensor_event(struct nvkm_therm *, enum nvkm_therm_thrs,
|
||||||
enum nouveau_therm_thrs thrs,
|
enum nvkm_therm_thrs_direction);
|
||||||
enum nouveau_therm_thrs_direction dir);
|
void nvkm_therm_program_alarms_polling(struct nvkm_therm *);
|
||||||
void nouveau_therm_program_alarms_polling(struct nouveau_therm *therm);
|
|
||||||
|
|
||||||
void nv40_therm_intr(struct nouveau_subdev *);
|
void nv40_therm_intr(struct nvkm_subdev *);
|
||||||
int nv50_fan_pwm_ctrl(struct nouveau_therm *, int, bool);
|
int nv50_fan_pwm_ctrl(struct nvkm_therm *, int, bool);
|
||||||
int nv50_fan_pwm_get(struct nouveau_therm *, int, u32 *, u32 *);
|
int nv50_fan_pwm_get(struct nvkm_therm *, int, u32 *, u32 *);
|
||||||
int nv50_fan_pwm_set(struct nouveau_therm *, int, u32, u32);
|
int nv50_fan_pwm_set(struct nvkm_therm *, int, u32, u32);
|
||||||
int nv50_fan_pwm_clock(struct nouveau_therm *, int);
|
int nv50_fan_pwm_clock(struct nvkm_therm *, int);
|
||||||
int nv84_temp_get(struct nouveau_therm *therm);
|
int g84_temp_get(struct nvkm_therm *);
|
||||||
void nv84_sensor_setup(struct nouveau_therm *therm);
|
void g84_sensor_setup(struct nvkm_therm *);
|
||||||
int nv84_therm_fini(struct nouveau_object *object, bool suspend);
|
int g84_therm_fini(struct nvkm_object *, bool suspend);
|
||||||
|
|
||||||
int nva3_therm_fan_sense(struct nouveau_therm *);
|
int gt215_therm_fan_sense(struct nvkm_therm *);
|
||||||
|
|
||||||
int nvd0_therm_init(struct nouveau_object *object);
|
int gf110_therm_init(struct nvkm_object *);
|
||||||
|
|
||||||
int nouveau_fanpwm_create(struct nouveau_therm *, struct dcb_gpio_func *);
|
|
||||||
int nouveau_fantog_create(struct nouveau_therm *, struct dcb_gpio_func *);
|
|
||||||
int nouveau_fannil_create(struct nouveau_therm *);
|
|
||||||
|
|
||||||
|
int nvkm_fanpwm_create(struct nvkm_therm *, struct dcb_gpio_func *);
|
||||||
|
int nvkm_fantog_create(struct nvkm_therm *, struct dcb_gpio_func *);
|
||||||
|
int nvkm_fannil_create(struct nvkm_therm *);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -21,18 +21,12 @@
|
||||||
*
|
*
|
||||||
* Authors: Martin Peres
|
* Authors: Martin Peres
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "priv.h"
|
#include "priv.h"
|
||||||
|
|
||||||
#include <core/object.h>
|
|
||||||
#include <core/device.h>
|
|
||||||
|
|
||||||
#include <subdev/bios.h>
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nouveau_therm_temp_set_defaults(struct nouveau_therm *therm)
|
nvkm_therm_temp_set_defaults(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
|
|
||||||
priv->bios_sensor.offset_constant = 0;
|
priv->bios_sensor.offset_constant = 0;
|
||||||
|
|
||||||
|
@ -51,9 +45,9 @@ nouveau_therm_temp_set_defaults(struct nouveau_therm *therm)
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nouveau_therm_temp_safety_checks(struct nouveau_therm *therm)
|
nvkm_therm_temp_safety_checks(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
struct nvbios_therm_sensor *s = &priv->bios_sensor;
|
struct nvbios_therm_sensor *s = &priv->bios_sensor;
|
||||||
|
|
||||||
/* enforce a minimum hysteresis on thresholds */
|
/* enforce a minimum hysteresis on thresholds */
|
||||||
|
@ -64,20 +58,21 @@ nouveau_therm_temp_safety_checks(struct nouveau_therm *therm)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* must be called with alarm_program_lock taken ! */
|
/* must be called with alarm_program_lock taken ! */
|
||||||
void nouveau_therm_sensor_set_threshold_state(struct nouveau_therm *therm,
|
void
|
||||||
enum nouveau_therm_thrs thrs,
|
nvkm_therm_sensor_set_threshold_state(struct nvkm_therm *therm,
|
||||||
enum nouveau_therm_thrs_state st)
|
enum nvkm_therm_thrs thrs,
|
||||||
|
enum nvkm_therm_thrs_state st)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
priv->sensor.alarm_state[thrs] = st;
|
priv->sensor.alarm_state[thrs] = st;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* must be called with alarm_program_lock taken ! */
|
/* must be called with alarm_program_lock taken ! */
|
||||||
enum nouveau_therm_thrs_state
|
enum nvkm_therm_thrs_state
|
||||||
nouveau_therm_sensor_get_threshold_state(struct nouveau_therm *therm,
|
nvkm_therm_sensor_get_threshold_state(struct nvkm_therm *therm,
|
||||||
enum nouveau_therm_thrs thrs)
|
enum nvkm_therm_thrs thrs)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
return priv->sensor.alarm_state[thrs];
|
return priv->sensor.alarm_state[thrs];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,11 +83,11 @@ nv_poweroff_work(struct work_struct *work)
|
||||||
kfree(work);
|
kfree(work);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nouveau_therm_sensor_event(struct nouveau_therm *therm,
|
void
|
||||||
enum nouveau_therm_thrs thrs,
|
nvkm_therm_sensor_event(struct nvkm_therm *therm, enum nvkm_therm_thrs thrs,
|
||||||
enum nouveau_therm_thrs_direction dir)
|
enum nvkm_therm_thrs_direction dir)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
bool active;
|
bool active;
|
||||||
const char *thresolds[] = {
|
const char *thresolds[] = {
|
||||||
"fanboost", "downclock", "critical", "shutdown"
|
"fanboost", "downclock", "critical", "shutdown"
|
||||||
|
@ -102,30 +97,30 @@ void nouveau_therm_sensor_event(struct nouveau_therm *therm,
|
||||||
if (thrs < 0 || thrs > 3)
|
if (thrs < 0 || thrs > 3)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (dir == NOUVEAU_THERM_THRS_FALLING)
|
if (dir == NVKM_THERM_THRS_FALLING)
|
||||||
nv_info(therm, "temperature (%i C) went below the '%s' threshold\n",
|
nv_info(therm, "temperature (%i C) went below the '%s' threshold\n",
|
||||||
temperature, thresolds[thrs]);
|
temperature, thresolds[thrs]);
|
||||||
else
|
else
|
||||||
nv_info(therm, "temperature (%i C) hit the '%s' threshold\n",
|
nv_info(therm, "temperature (%i C) hit the '%s' threshold\n",
|
||||||
temperature, thresolds[thrs]);
|
temperature, thresolds[thrs]);
|
||||||
|
|
||||||
active = (dir == NOUVEAU_THERM_THRS_RISING);
|
active = (dir == NVKM_THERM_THRS_RISING);
|
||||||
switch (thrs) {
|
switch (thrs) {
|
||||||
case NOUVEAU_THERM_THRS_FANBOOST:
|
case NVKM_THERM_THRS_FANBOOST:
|
||||||
if (active) {
|
if (active) {
|
||||||
nouveau_therm_fan_set(therm, true, 100);
|
nvkm_therm_fan_set(therm, true, 100);
|
||||||
nouveau_therm_fan_mode(therm, NOUVEAU_THERM_CTRL_AUTO);
|
nvkm_therm_fan_mode(therm, NVKM_THERM_CTRL_AUTO);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NOUVEAU_THERM_THRS_DOWNCLOCK:
|
case NVKM_THERM_THRS_DOWNCLOCK:
|
||||||
if (priv->emergency.downclock)
|
if (priv->emergency.downclock)
|
||||||
priv->emergency.downclock(therm, active);
|
priv->emergency.downclock(therm, active);
|
||||||
break;
|
break;
|
||||||
case NOUVEAU_THERM_THRS_CRITICAL:
|
case NVKM_THERM_THRS_CRITICAL:
|
||||||
if (priv->emergency.pause)
|
if (priv->emergency.pause)
|
||||||
priv->emergency.pause(therm, active);
|
priv->emergency.pause(therm, active);
|
||||||
break;
|
break;
|
||||||
case NOUVEAU_THERM_THRS_SHUTDOWN:
|
case NVKM_THERM_THRS_SHUTDOWN:
|
||||||
if (active) {
|
if (active) {
|
||||||
struct work_struct *work;
|
struct work_struct *work;
|
||||||
|
|
||||||
|
@ -136,7 +131,7 @@ void nouveau_therm_sensor_event(struct nouveau_therm *therm,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NOUVEAU_THERM_THRS_NR:
|
case NVKM_THERM_THRS_NR:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,53 +139,53 @@ void nouveau_therm_sensor_event(struct nouveau_therm *therm,
|
||||||
|
|
||||||
/* must be called with alarm_program_lock taken ! */
|
/* must be called with alarm_program_lock taken ! */
|
||||||
static void
|
static void
|
||||||
nouveau_therm_threshold_hyst_polling(struct nouveau_therm *therm,
|
nvkm_therm_threshold_hyst_polling(struct nvkm_therm *therm,
|
||||||
const struct nvbios_therm_threshold *thrs,
|
const struct nvbios_therm_threshold *thrs,
|
||||||
enum nouveau_therm_thrs thrs_name)
|
enum nvkm_therm_thrs thrs_name)
|
||||||
{
|
{
|
||||||
enum nouveau_therm_thrs_direction direction;
|
enum nvkm_therm_thrs_direction direction;
|
||||||
enum nouveau_therm_thrs_state prev_state, new_state;
|
enum nvkm_therm_thrs_state prev_state, new_state;
|
||||||
int temp = therm->temp_get(therm);
|
int temp = therm->temp_get(therm);
|
||||||
|
|
||||||
prev_state = nouveau_therm_sensor_get_threshold_state(therm, thrs_name);
|
prev_state = nvkm_therm_sensor_get_threshold_state(therm, thrs_name);
|
||||||
|
|
||||||
if (temp >= thrs->temp && prev_state == NOUVEAU_THERM_THRS_LOWER) {
|
if (temp >= thrs->temp && prev_state == NVKM_THERM_THRS_LOWER) {
|
||||||
direction = NOUVEAU_THERM_THRS_RISING;
|
direction = NVKM_THERM_THRS_RISING;
|
||||||
new_state = NOUVEAU_THERM_THRS_HIGHER;
|
new_state = NVKM_THERM_THRS_HIGHER;
|
||||||
} else if (temp <= thrs->temp - thrs->hysteresis &&
|
} else if (temp <= thrs->temp - thrs->hysteresis &&
|
||||||
prev_state == NOUVEAU_THERM_THRS_HIGHER) {
|
prev_state == NVKM_THERM_THRS_HIGHER) {
|
||||||
direction = NOUVEAU_THERM_THRS_FALLING;
|
direction = NVKM_THERM_THRS_FALLING;
|
||||||
new_state = NOUVEAU_THERM_THRS_LOWER;
|
new_state = NVKM_THERM_THRS_LOWER;
|
||||||
} else
|
} else
|
||||||
return; /* nothing to do */
|
return; /* nothing to do */
|
||||||
|
|
||||||
nouveau_therm_sensor_set_threshold_state(therm, thrs_name, new_state);
|
nvkm_therm_sensor_set_threshold_state(therm, thrs_name, new_state);
|
||||||
nouveau_therm_sensor_event(therm, thrs_name, direction);
|
nvkm_therm_sensor_event(therm, thrs_name, direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
alarm_timer_callback(struct nouveau_alarm *alarm)
|
alarm_timer_callback(struct nvkm_alarm *alarm)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv =
|
struct nvkm_therm_priv *priv =
|
||||||
container_of(alarm, struct nouveau_therm_priv, sensor.therm_poll_alarm);
|
container_of(alarm, struct nvkm_therm_priv, sensor.therm_poll_alarm);
|
||||||
struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
|
struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
|
||||||
struct nouveau_timer *ptimer = nouveau_timer(priv);
|
struct nvkm_timer *ptimer = nvkm_timer(priv);
|
||||||
struct nouveau_therm *therm = &priv->base;
|
struct nvkm_therm *therm = &priv->base;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
spin_lock_irqsave(&priv->sensor.alarm_program_lock, flags);
|
spin_lock_irqsave(&priv->sensor.alarm_program_lock, flags);
|
||||||
|
|
||||||
nouveau_therm_threshold_hyst_polling(therm, &sensor->thrs_fan_boost,
|
nvkm_therm_threshold_hyst_polling(therm, &sensor->thrs_fan_boost,
|
||||||
NOUVEAU_THERM_THRS_FANBOOST);
|
NVKM_THERM_THRS_FANBOOST);
|
||||||
|
|
||||||
nouveau_therm_threshold_hyst_polling(therm, &sensor->thrs_down_clock,
|
nvkm_therm_threshold_hyst_polling(therm, &sensor->thrs_down_clock,
|
||||||
NOUVEAU_THERM_THRS_DOWNCLOCK);
|
NVKM_THERM_THRS_DOWNCLOCK);
|
||||||
|
|
||||||
nouveau_therm_threshold_hyst_polling(therm, &sensor->thrs_critical,
|
nvkm_therm_threshold_hyst_polling(therm, &sensor->thrs_critical,
|
||||||
NOUVEAU_THERM_THRS_CRITICAL);
|
NVKM_THERM_THRS_CRITICAL);
|
||||||
|
|
||||||
nouveau_therm_threshold_hyst_polling(therm, &sensor->thrs_shutdown,
|
nvkm_therm_threshold_hyst_polling(therm, &sensor->thrs_shutdown,
|
||||||
NOUVEAU_THERM_THRS_SHUTDOWN);
|
NVKM_THERM_THRS_SHUTDOWN);
|
||||||
|
|
||||||
spin_unlock_irqrestore(&priv->sensor.alarm_program_lock, flags);
|
spin_unlock_irqrestore(&priv->sensor.alarm_program_lock, flags);
|
||||||
|
|
||||||
|
@ -200,9 +195,9 @@ alarm_timer_callback(struct nouveau_alarm *alarm)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nouveau_therm_program_alarms_polling(struct nouveau_therm *therm)
|
nvkm_therm_program_alarms_polling(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
|
struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
|
||||||
|
|
||||||
nv_debug(therm,
|
nv_debug(therm,
|
||||||
|
@ -217,18 +212,18 @@ nouveau_therm_program_alarms_polling(struct nouveau_therm *therm)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_therm_sensor_init(struct nouveau_therm *therm)
|
nvkm_therm_sensor_init(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
priv->sensor.program_alarms(therm);
|
priv->sensor.program_alarms(therm);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_therm_sensor_fini(struct nouveau_therm *therm, bool suspend)
|
nvkm_therm_sensor_fini(struct nvkm_therm *therm, bool suspend)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
struct nouveau_timer *ptimer = nouveau_timer(therm);
|
struct nvkm_timer *ptimer = nvkm_timer(therm);
|
||||||
|
|
||||||
if (suspend)
|
if (suspend)
|
||||||
ptimer->alarm_cancel(ptimer, &priv->sensor.therm_poll_alarm);
|
ptimer->alarm_cancel(ptimer, &priv->sensor.therm_poll_alarm);
|
||||||
|
@ -236,7 +231,7 @@ nouveau_therm_sensor_fini(struct nouveau_therm *therm, bool suspend)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nouveau_therm_sensor_preinit(struct nouveau_therm *therm)
|
nvkm_therm_sensor_preinit(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
const char *sensor_avail = "yes";
|
const char *sensor_avail = "yes";
|
||||||
|
|
||||||
|
@ -247,18 +242,18 @@ nouveau_therm_sensor_preinit(struct nouveau_therm *therm)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_therm_sensor_ctor(struct nouveau_therm *therm)
|
nvkm_therm_sensor_ctor(struct nvkm_therm *therm)
|
||||||
{
|
{
|
||||||
struct nouveau_therm_priv *priv = (void *)therm;
|
struct nvkm_therm_priv *priv = (void *)therm;
|
||||||
struct nouveau_bios *bios = nouveau_bios(therm);
|
struct nvkm_bios *bios = nvkm_bios(therm);
|
||||||
|
|
||||||
nouveau_alarm_init(&priv->sensor.therm_poll_alarm, alarm_timer_callback);
|
nvkm_alarm_init(&priv->sensor.therm_poll_alarm, alarm_timer_callback);
|
||||||
|
|
||||||
nouveau_therm_temp_set_defaults(therm);
|
nvkm_therm_temp_set_defaults(therm);
|
||||||
if (nvbios_therm_sensor_parse(bios, NVBIOS_THERM_DOMAIN_CORE,
|
if (nvbios_therm_sensor_parse(bios, NVBIOS_THERM_DOMAIN_CORE,
|
||||||
&priv->bios_sensor))
|
&priv->bios_sensor))
|
||||||
nv_error(therm, "nvbios_therm_sensor_parse failed\n");
|
nv_error(therm, "nvbios_therm_sensor_parse failed\n");
|
||||||
nouveau_therm_temp_safety_checks(therm);
|
nvkm_therm_temp_safety_checks(therm);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue