drm/nouveau/therm: namespace + nvidia gpu names (no binary change)
authorBen Skeggs <bskeggs@redhat.com>
Wed, 14 Jan 2015 05:11:48 +0000 (15:11 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 22 Jan 2015 02:17:58 +0000 (12:17 +1000)
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>
23 files changed:
drivers/gpu/drm/nouveau/include/nvkm/subdev/therm.h
drivers/gpu/drm/nouveau/nouveau_hwmon.c
drivers/gpu/drm/nouveau/nvkm/engine/device/nv50.c
drivers/gpu/drm/nouveau/nvkm/engine/device/nvc0.c
drivers/gpu/drm/nouveau/nvkm/engine/device/nve0.c
drivers/gpu/drm/nouveau/nvkm/subdev/therm/Kbuild
drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/therm/fan.c
drivers/gpu/drm/nouveau/nvkm/subdev/therm/fannil.c
drivers/gpu/drm/nouveau/nvkm/subdev/therm/fanpwm.c
drivers/gpu/drm/nouveau/nvkm/subdev/therm/fantog.c
drivers/gpu/drm/nouveau/nvkm/subdev/therm/g84.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/subdev/therm/gf110.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/subdev/therm/gm107.c
drivers/gpu/drm/nouveau/nvkm/subdev/therm/gt215.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/subdev/therm/ic.c
drivers/gpu/drm/nouveau/nvkm/subdev/therm/nv40.c
drivers/gpu/drm/nouveau/nvkm/subdev/therm/nv50.c
drivers/gpu/drm/nouveau/nvkm/subdev/therm/nv84.c [deleted file]
drivers/gpu/drm/nouveau/nvkm/subdev/therm/nva3.c [deleted file]
drivers/gpu/drm/nouveau/nvkm/subdev/therm/nvd0.c [deleted file]
drivers/gpu/drm/nouveau/nvkm/subdev/therm/priv.h
drivers/gpu/drm/nouveau/nvkm/subdev/therm/temp.c

index 42f9574a06c988e82466f4e63b80a4ee3a0de9c6..6662829b6db1a6e0459c082baa2e5a49ed01876b 100644 (file)
@@ -1,83 +1,79 @@
-#ifndef __NOUVEAU_THERM_H__
-#define __NOUVEAU_THERM_H__
-
-#include <core/device.h>
+#ifndef __NVKM_THERM_H__
+#define __NVKM_THERM_H__
 #include <core/subdev.h>
 
-enum nouveau_therm_fan_mode {
-       NOUVEAU_THERM_CTRL_NONE = 0,
-       NOUVEAU_THERM_CTRL_MANUAL = 1,
-       NOUVEAU_THERM_CTRL_AUTO = 2,
+enum nvkm_therm_fan_mode {
+       NVKM_THERM_CTRL_NONE = 0,
+       NVKM_THERM_CTRL_MANUAL = 1,
+       NVKM_THERM_CTRL_AUTO = 2,
 };
 
-enum nouveau_therm_attr_type {
-       NOUVEAU_THERM_ATTR_FAN_MIN_DUTY = 0,
-       NOUVEAU_THERM_ATTR_FAN_MAX_DUTY = 1,
-       NOUVEAU_THERM_ATTR_FAN_MODE = 2,
+enum nvkm_therm_attr_type {
+       NVKM_THERM_ATTR_FAN_MIN_DUTY = 0,
+       NVKM_THERM_ATTR_FAN_MAX_DUTY = 1,
+       NVKM_THERM_ATTR_FAN_MODE = 2,
 
-       NOUVEAU_THERM_ATTR_THRS_FAN_BOOST = 10,
-       NOUVEAU_THERM_ATTR_THRS_FAN_BOOST_HYST = 11,
-       NOUVEAU_THERM_ATTR_THRS_DOWN_CLK = 12,
-       NOUVEAU_THERM_ATTR_THRS_DOWN_CLK_HYST = 13,
-       NOUVEAU_THERM_ATTR_THRS_CRITICAL = 14,
-       NOUVEAU_THERM_ATTR_THRS_CRITICAL_HYST = 15,
-       NOUVEAU_THERM_ATTR_THRS_SHUTDOWN = 16,
-       NOUVEAU_THERM_ATTR_THRS_SHUTDOWN_HYST = 17,
+       NVKM_THERM_ATTR_THRS_FAN_BOOST = 10,
+       NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST = 11,
+       NVKM_THERM_ATTR_THRS_DOWN_CLK = 12,
+       NVKM_THERM_ATTR_THRS_DOWN_CLK_HYST = 13,
+       NVKM_THERM_ATTR_THRS_CRITICAL = 14,
+       NVKM_THERM_ATTR_THRS_CRITICAL_HYST = 15,
+       NVKM_THERM_ATTR_THRS_SHUTDOWN = 16,
+       NVKM_THERM_ATTR_THRS_SHUTDOWN_HYST = 17,
 };
 
-struct nouveau_therm {
-       struct nouveau_subdev base;
+struct nvkm_therm {
+       struct nvkm_subdev base;
 
-       int (*pwm_ctrl)(struct nouveau_therm *, int line, bool);
-       int (*pwm_get)(struct nouveau_therm *, int line, u32 *, u32 *);
-       int (*pwm_set)(struct nouveau_therm *, int line, u32, u32);
-       int (*pwm_clock)(struct nouveau_therm *, int line);
+       int (*pwm_ctrl)(struct nvkm_therm *, int line, bool);
+       int (*pwm_get)(struct nvkm_therm *, int line, u32 *, u32 *);
+       int (*pwm_set)(struct nvkm_therm *, int line, u32, u32);
+       int (*pwm_clock)(struct nvkm_therm *, int line);
 
-       int (*fan_get)(struct nouveau_therm *);
-       int (*fan_set)(struct nouveau_therm *, int);
-       int (*fan_sense)(struct nouveau_therm *);
+       int (*fan_get)(struct nvkm_therm *);
+       int (*fan_set)(struct nvkm_therm *, int);
+       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_set)(struct nouveau_therm *,
-                       enum nouveau_therm_attr_type, int);
+       int (*attr_get)(struct nvkm_therm *, enum nvkm_therm_attr_type);
+       int (*attr_set)(struct nvkm_therm *, enum nvkm_therm_attr_type, int);
 };
 
-static inline struct nouveau_therm *
-nouveau_therm(void *obj)
+static inline struct nvkm_therm *
+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)                                          \
-       nouveau_therm_create_((p), (e), (o), sizeof(**d), (void **)d)
-#define nouveau_therm_destroy(p) ({                                            \
-       struct nouveau_therm *therm = (p);                                     \
-        _nouveau_therm_dtor(nv_object(therm));                                 \
+#define nvkm_therm_create(p,e,o,d)                                          \
+       nvkm_therm_create_((p), (e), (o), sizeof(**d), (void **)d)
+#define nvkm_therm_destroy(p) ({                                            \
+       struct nvkm_therm *therm = (p);                                     \
+        _nvkm_therm_dtor(nv_object(therm));                                 \
 })
-#define nouveau_therm_init(p) ({                                               \
-       struct nouveau_therm *therm = (p);                                     \
-        _nouveau_therm_init(nv_object(therm));                                 \
+#define nvkm_therm_init(p) ({                                               \
+       struct nvkm_therm *therm = (p);                                     \
+        _nvkm_therm_init(nv_object(therm));                                 \
 })
-#define nouveau_therm_fini(p,s) ({                                             \
-       struct nouveau_therm *therm = (p);                                     \
-        _nouveau_therm_init(nv_object(therm), (s));                            \
+#define nvkm_therm_fini(p,s) ({                                             \
+       struct nvkm_therm *therm = (p);                                     \
+        _nvkm_therm_init(nv_object(therm), (s));                            \
 })
 
-int  nouveau_therm_create_(struct nouveau_object *, struct nouveau_object *,
-                          struct nouveau_oclass *, int, void **);
-void _nouveau_therm_dtor(struct nouveau_object *);
-int  _nouveau_therm_init(struct nouveau_object *);
-int  _nouveau_therm_fini(struct nouveau_object *, bool);
-
-int  nouveau_therm_cstate(struct nouveau_therm *, int, int);
+int  nvkm_therm_create_(struct nvkm_object *, struct nvkm_object *,
+                          struct nvkm_oclass *, int, void **);
+void _nvkm_therm_dtor(struct nvkm_object *);
+int  _nvkm_therm_init(struct nvkm_object *);
+int  _nvkm_therm_fini(struct nvkm_object *, bool);
 
-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;
+int  nvkm_therm_cstate(struct nvkm_therm *, int, int);
 
+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
index e63c15112f2e54197e5ba56f2bd3124461a02841..b5c445e02bfc3604e51ebd0528d0cfb9da1ea780 100644 (file)
@@ -69,7 +69,7 @@ nouveau_hwmon_temp1_auto_point1_temp(struct device *d,
        struct nouveau_therm *therm = nvxx_therm(&drm->device);
 
        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
 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)
                return count;
 
-       therm->attr_set(therm, NOUVEAU_THERM_ATTR_THRS_FAN_BOOST,
+       therm->attr_set(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST,
                        value / 1000);
 
        return count;
@@ -102,7 +102,7 @@ nouveau_hwmon_temp1_auto_point1_temp_hyst(struct device *d,
        struct nouveau_therm *therm = nvxx_therm(&drm->device);
 
        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
 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)
                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);
 
        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);
 
        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
 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)
                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;
 }
@@ -165,7 +165,7 @@ nouveau_hwmon_max_temp_hyst(struct device *d, struct device_attribute *a,
        struct nouveau_therm *therm = nvxx_therm(&drm->device);
 
        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
 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)
                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);
 
        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);
 
        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
 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)
                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;
 }
@@ -230,7 +230,7 @@ nouveau_hwmon_critical_temp_hyst(struct device *d, struct device_attribute *a,
        struct nouveau_therm *therm = nvxx_therm(&drm->device);
 
        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
 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)
                return count;
 
-       therm->attr_set(therm, NOUVEAU_THERM_ATTR_THRS_CRITICAL_HYST,
+       therm->attr_set(therm, NVKM_THERM_ATTR_THRS_CRITICAL_HYST,
                        value / 1000);
 
        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);
 
        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
 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)
                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;
 }
@@ -296,7 +296,7 @@ nouveau_hwmon_emergency_temp_hyst(struct device *d, struct device_attribute *a,
        struct nouveau_therm *therm = nvxx_therm(&drm->device);
 
        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
 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)
                return count;
 
-       therm->attr_set(therm, NOUVEAU_THERM_ATTR_THRS_SHUTDOWN_HYST,
+       therm->attr_set(therm, NVKM_THERM_ATTR_THRS_SHUTDOWN_HYST,
                        value / 1000);
 
        return count;
@@ -362,7 +362,7 @@ nouveau_hwmon_get_pwm1_enable(struct device *d,
        struct nouveau_therm *therm = nvxx_therm(&drm->device);
        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)
                return ret;
 
@@ -383,7 +383,7 @@ nouveau_hwmon_set_pwm1_enable(struct device *d, struct device_attribute *a,
        if (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)
                return ret;
        else
@@ -441,7 +441,7 @@ nouveau_hwmon_get_pwm1_min(struct device *d,
        struct nouveau_therm *therm = nvxx_therm(&drm->device);
        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)
                return ret;
 
@@ -461,7 +461,7 @@ nouveau_hwmon_set_pwm1_min(struct device *d, struct device_attribute *a,
        if (kstrtol(buf, 10, &value) == -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)
                return ret;
 
@@ -481,7 +481,7 @@ nouveau_hwmon_get_pwm1_max(struct device *d,
        struct nouveau_therm *therm = nvxx_therm(&drm->device);
        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)
                return ret;
 
@@ -501,7 +501,7 @@ nouveau_hwmon_set_pwm1_max(struct device *d, struct device_attribute *a,
        if (kstrtol(buf, 10, &value) == -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)
                return ret;
 
index 9394962e6c7f9e649aeddd3c555546ecf4f49cbd..f1f041fdb080bee096cfbbaf9d2d07ba1c0d7719 100644 (file)
@@ -94,7 +94,7 @@ nv50_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_I2C    ] =  nv50_i2c_oclass;
                device->oclass[NVDEV_SUBDEV_FUSE   ] =  &nv50_fuse_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_DEVINIT] =  g84_devinit_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_FUSE   ] =  &nv50_fuse_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_DEVINIT] =  g84_devinit_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_FUSE   ] =  &nv50_fuse_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_DEVINIT] =  g84_devinit_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_FUSE   ] =  &nv50_fuse_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_DEVINIT] =  g84_devinit_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_FUSE   ] =  &nv50_fuse_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_DEVINIT] =  g84_devinit_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_FUSE   ] =  &nv50_fuse_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_DEVINIT] =  g98_devinit_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_FUSE   ] =  &nv50_fuse_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_DEVINIT] =  g84_devinit_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_FUSE   ] =  &nv50_fuse_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_DEVINIT] =  g98_devinit_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_FUSE   ] =  &nv50_fuse_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_DEVINIT] =  g98_devinit_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_FUSE   ] =  &nv50_fuse_oclass;
                device->oclass[NVDEV_SUBDEV_CLK    ] = &gt215_clk_oclass;
-               device->oclass[NVDEV_SUBDEV_THERM  ] = &nva3_therm_oclass;
+               device->oclass[NVDEV_SUBDEV_THERM  ] = &gt215_therm_oclass;
                device->oclass[NVDEV_SUBDEV_MXM    ] = &nv50_mxm_oclass;
                device->oclass[NVDEV_SUBDEV_DEVINIT] =  gt215_devinit_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_FUSE   ] =  &nv50_fuse_oclass;
                device->oclass[NVDEV_SUBDEV_CLK    ] = &gt215_clk_oclass;
-               device->oclass[NVDEV_SUBDEV_THERM  ] = &nva3_therm_oclass;
+               device->oclass[NVDEV_SUBDEV_THERM  ] = &gt215_therm_oclass;
                device->oclass[NVDEV_SUBDEV_MXM    ] = &nv50_mxm_oclass;
                device->oclass[NVDEV_SUBDEV_DEVINIT] =  gt215_devinit_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_FUSE   ] =  &nv50_fuse_oclass;
                device->oclass[NVDEV_SUBDEV_CLK    ] = &gt215_clk_oclass;
-               device->oclass[NVDEV_SUBDEV_THERM  ] = &nva3_therm_oclass;
+               device->oclass[NVDEV_SUBDEV_THERM  ] = &gt215_therm_oclass;
                device->oclass[NVDEV_SUBDEV_MXM    ] = &nv50_mxm_oclass;
                device->oclass[NVDEV_SUBDEV_DEVINIT] =  gt215_devinit_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_FUSE   ] =  &nv50_fuse_oclass;
                device->oclass[NVDEV_SUBDEV_CLK    ] = &gt215_clk_oclass;
-               device->oclass[NVDEV_SUBDEV_THERM  ] = &nva3_therm_oclass;
+               device->oclass[NVDEV_SUBDEV_THERM  ] = &gt215_therm_oclass;
                device->oclass[NVDEV_SUBDEV_MXM    ] = &nv50_mxm_oclass;
                device->oclass[NVDEV_SUBDEV_DEVINIT] =  mcp89_devinit_oclass;
                device->oclass[NVDEV_SUBDEV_MC     ] =  g98_mc_oclass;
index 90f3fcc47c5565af9b68ebdaa4d92636ae544e6f..a4859a541aea6ee0cd1e9a23e8a10e2fe7c0e36f 100644 (file)
@@ -66,7 +66,7 @@ nvc0_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_I2C    ] =  g94_i2c_oclass;
                device->oclass[NVDEV_SUBDEV_FUSE   ] = &gf100_fuse_oclass;
                device->oclass[NVDEV_SUBDEV_CLK    ] = &gf100_clk_oclass;
-               device->oclass[NVDEV_SUBDEV_THERM  ] = &nva3_therm_oclass;
+               device->oclass[NVDEV_SUBDEV_THERM  ] = &gt215_therm_oclass;
                device->oclass[NVDEV_SUBDEV_MXM    ] = &nv50_mxm_oclass;
                device->oclass[NVDEV_SUBDEV_DEVINIT] =  gf100_devinit_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_FUSE   ] = &gf100_fuse_oclass;
                device->oclass[NVDEV_SUBDEV_CLK    ] = &gf100_clk_oclass;
-               device->oclass[NVDEV_SUBDEV_THERM  ] = &nva3_therm_oclass;
+               device->oclass[NVDEV_SUBDEV_THERM  ] = &gt215_therm_oclass;
                device->oclass[NVDEV_SUBDEV_MXM    ] = &nv50_mxm_oclass;
                device->oclass[NVDEV_SUBDEV_DEVINIT] =  gf100_devinit_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_FUSE   ] = &gf100_fuse_oclass;
                device->oclass[NVDEV_SUBDEV_CLK    ] = &gf100_clk_oclass;
-               device->oclass[NVDEV_SUBDEV_THERM  ] = &nva3_therm_oclass;
+               device->oclass[NVDEV_SUBDEV_THERM  ] = &gt215_therm_oclass;
                device->oclass[NVDEV_SUBDEV_MXM    ] = &nv50_mxm_oclass;
                device->oclass[NVDEV_SUBDEV_DEVINIT] =  gf100_devinit_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_FUSE   ] = &gf100_fuse_oclass;
                device->oclass[NVDEV_SUBDEV_CLK    ] = &gf100_clk_oclass;
-               device->oclass[NVDEV_SUBDEV_THERM  ] = &nva3_therm_oclass;
+               device->oclass[NVDEV_SUBDEV_THERM  ] = &gt215_therm_oclass;
                device->oclass[NVDEV_SUBDEV_MXM    ] = &nv50_mxm_oclass;
                device->oclass[NVDEV_SUBDEV_DEVINIT] =  gf100_devinit_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_FUSE   ] = &gf100_fuse_oclass;
                device->oclass[NVDEV_SUBDEV_CLK    ] = &gf100_clk_oclass;
-               device->oclass[NVDEV_SUBDEV_THERM  ] = &nva3_therm_oclass;
+               device->oclass[NVDEV_SUBDEV_THERM  ] = &gt215_therm_oclass;
                device->oclass[NVDEV_SUBDEV_MXM    ] = &nv50_mxm_oclass;
                device->oclass[NVDEV_SUBDEV_DEVINIT] =  gf100_devinit_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_FUSE   ] = &gf100_fuse_oclass;
                device->oclass[NVDEV_SUBDEV_CLK    ] = &gf100_clk_oclass;
-               device->oclass[NVDEV_SUBDEV_THERM  ] = &nva3_therm_oclass;
+               device->oclass[NVDEV_SUBDEV_THERM  ] = &gt215_therm_oclass;
                device->oclass[NVDEV_SUBDEV_MXM    ] = &nv50_mxm_oclass;
                device->oclass[NVDEV_SUBDEV_DEVINIT] =  gf100_devinit_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_FUSE   ] = &gf100_fuse_oclass;
                device->oclass[NVDEV_SUBDEV_CLK    ] = &gf100_clk_oclass;
-               device->oclass[NVDEV_SUBDEV_THERM  ] = &nva3_therm_oclass;
+               device->oclass[NVDEV_SUBDEV_THERM  ] = &gt215_therm_oclass;
                device->oclass[NVDEV_SUBDEV_MXM    ] = &nv50_mxm_oclass;
                device->oclass[NVDEV_SUBDEV_DEVINIT] =  gf100_devinit_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_FUSE   ] = &gf100_fuse_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_DEVINIT] =  gf100_devinit_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_FUSE   ] = &gf100_fuse_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_DEVINIT] =  gf100_devinit_oclass;
                device->oclass[NVDEV_SUBDEV_MC     ] =  gf106_mc_oclass;
index 6b6e54828efbe513288b65d79b4634e419dd7a65..962a810d2b83ad81d28765c2ee83b18923ed486c 100644 (file)
@@ -66,7 +66,7 @@ nve0_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_I2C    ] =  gk104_i2c_oclass;
                device->oclass[NVDEV_SUBDEV_FUSE   ] = &gf100_fuse_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_DEVINIT] =  gf100_devinit_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_FUSE   ] = &gf100_fuse_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_DEVINIT] =  gf100_devinit_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_FUSE   ] = &gf100_fuse_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_DEVINIT] =  gf100_devinit_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_FUSE   ] = &gf100_fuse_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_DEVINIT] =  gf100_devinit_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_FUSE   ] = &gf100_fuse_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_DEVINIT] =  gf100_devinit_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_FUSE   ] = &gf100_fuse_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_DEVINIT] =  gf100_devinit_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_FUSE   ] = &gf100_fuse_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_DEVINIT] =  gf100_devinit_oclass;
                device->oclass[NVDEV_SUBDEV_MC     ] =  gk20a_mc_oclass;
index 9ac82070944a085a0933ceb66443b120a3054b93..5837cf1292d93eb8678f43d24da5feff5fb03f6d 100644 (file)
@@ -7,7 +7,7 @@ nvkm-y += nvkm/subdev/therm/ic.o
 nvkm-y += nvkm/subdev/therm/temp.o
 nvkm-y += nvkm/subdev/therm/nv40.o
 nvkm-y += nvkm/subdev/therm/nv50.o
-nvkm-y += nvkm/subdev/therm/nv84.o
-nvkm-y += nvkm/subdev/therm/nva3.o
-nvkm-y += nvkm/subdev/therm/nvd0.o
+nvkm-y += nvkm/subdev/therm/g84.o
+nvkm-y += nvkm/subdev/therm/gt215.o
+nvkm-y += nvkm/subdev/therm/gf110.o
 nvkm-y += nvkm/subdev/therm/gm107.o
index 67ad8ea468a9e7cdb50d6f6bbe581723463bf429..ec327cb64a0da679dc836d5fc7f6be3b37c261ee 100644 (file)
  *
  * Authors: Martin Peres
  */
+#include "priv.h"
 
-#include <core/object.h>
 #include <core/device.h>
 
-#include <subdev/bios.h>
-
-#include "priv.h"
-
 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,
                                       *cur_trip = NULL,
                                       *last_trip = priv->last_trip;
@@ -63,9 +59,9 @@ nouveau_therm_update_trip(struct nouveau_therm *therm)
 }
 
 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_max_temp = priv->fan->bios.linear_max_temp;
        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 /= (linear_max_temp - linear_min_temp);
        duty += priv->fan->bios.min_duty;
-
        return duty;
 }
 
 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 nouveau_therm_priv *priv = (void *)therm;
+       struct nvkm_timer *ptimer = nvkm_timer(therm);
+       struct nvkm_therm_priv *priv = (void *)therm;
        unsigned long flags;
        bool immd = true;
        bool poll = true;
@@ -102,20 +97,20 @@ nouveau_therm_update(struct nouveau_therm *therm, int mode)
        priv->mode = mode;
 
        switch (mode) {
-       case NOUVEAU_THERM_CTRL_MANUAL:
+       case NVKM_THERM_CTRL_MANUAL:
                ptimer->alarm_cancel(ptimer, &priv->alarm);
-               duty = nouveau_therm_fan_get(therm);
+               duty = nvkm_therm_fan_get(therm);
                if (duty < 0)
                        duty = 100;
                poll = false;
                break;
-       case NOUVEAU_THERM_CTRL_AUTO:
+       case NVKM_THERM_CTRL_AUTO:
                switch(priv->fan->bios.fan_mode) {
                case NVBIOS_THERM_FAN_TRIP:
-                       duty = nouveau_therm_update_trip(therm);
+                       duty = nvkm_therm_update_trip(therm);
                        break;
                case NVBIOS_THERM_FAN_LINEAR:
-                       duty = nouveau_therm_update_linear(therm);
+                       duty = nvkm_therm_update_linear(therm);
                        break;
                case NVBIOS_THERM_FAN_OTHER:
                        if (priv->cstate)
@@ -125,7 +120,7 @@ nouveau_therm_update(struct nouveau_therm *therm, int mode)
                }
                immd = false;
                break;
-       case NOUVEAU_THERM_CTRL_NONE:
+       case NVKM_THERM_CTRL_NONE:
        default:
                ptimer->alarm_cancel(ptimer, &priv->alarm);
                poll = false;
@@ -137,36 +132,36 @@ nouveau_therm_update(struct nouveau_therm *therm, int mode)
 
        if (duty >= 0) {
                nv_debug(therm, "FAN target request: %d%%\n", duty);
-               nouveau_therm_fan_set(therm, immd, duty);
+               nvkm_therm_fan_set(therm, immd, duty);
        }
 }
 
 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) ||
                    (dir > 0 && fan > priv->cstate)) {
                nv_debug(ptherm, "default fan speed -> %d%%\n", fan);
                priv->cstate = fan;
-               nouveau_therm_update(ptherm, -1);
+               nvkm_therm_update(ptherm, -1);
        }
        return 0;
 }
 
 static void
-nouveau_therm_alarm(struct nouveau_alarm *alarm)
+nvkm_therm_alarm(struct nvkm_alarm *alarm)
 {
-       struct nouveau_therm_priv *priv =
-              container_of(alarm, struct nouveau_therm_priv, alarm);
-       nouveau_therm_update(&priv->base, -1);
+       struct nvkm_therm_priv *priv =
+              container_of(alarm, struct nvkm_therm_priv, alarm);
+       nvkm_therm_update(&priv->base, -1);
 }
 
 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 nouveau_device *device = nv_device(therm);
+       struct nvkm_therm_priv *priv = (void *)therm;
+       struct nvkm_device *device = nv_device(therm);
        static const char *name[] = {
                "disabled",
                "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 */
        if ((mode >= ARRAY_SIZE(name)) ||
-           (mode != NOUVEAU_THERM_CTRL_NONE && device->card_type >= NV_C0 &&
-            !nouveau_subdev(device, NVDEV_SUBDEV_PMU)))
+           (mode != NVKM_THERM_CTRL_NONE && device->card_type >= NV_C0 &&
+            !nvkm_subdev(device, NVDEV_SUBDEV_PMU)))
                return -EINVAL;
 
        /* do not allow automatic fan management if the thermal sensor is
         * 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;
 
        if (priv->mode == mode)
                return 0;
 
        nv_info(therm, "fan management: %s\n", name[mode]);
-       nouveau_therm_update(therm, mode);
+       nvkm_therm_update(therm, mode);
        return 0;
 }
 
 int
-nouveau_therm_attr_get(struct nouveau_therm *therm,
-                      enum nouveau_therm_attr_type type)
+nvkm_therm_attr_get(struct nvkm_therm *therm,
+                      enum nvkm_therm_attr_type type)
 {
-       struct nouveau_therm_priv *priv = (void *)therm;
+       struct nvkm_therm_priv *priv = (void *)therm;
 
        switch (type) {
-       case NOUVEAU_THERM_ATTR_FAN_MIN_DUTY:
+       case NVKM_THERM_ATTR_FAN_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;
-       case NOUVEAU_THERM_ATTR_FAN_MODE:
+       case NVKM_THERM_ATTR_FAN_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;
-       case NOUVEAU_THERM_ATTR_THRS_FAN_BOOST_HYST:
+       case NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST:
                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;
-       case NOUVEAU_THERM_ATTR_THRS_DOWN_CLK_HYST:
+       case NVKM_THERM_ATTR_THRS_DOWN_CLK_HYST:
                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;
-       case NOUVEAU_THERM_ATTR_THRS_CRITICAL_HYST:
+       case NVKM_THERM_ATTR_THRS_CRITICAL_HYST:
                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;
-       case NOUVEAU_THERM_ATTR_THRS_SHUTDOWN_HYST:
+       case NVKM_THERM_ATTR_THRS_SHUTDOWN_HYST:
                return priv->bios_sensor.thrs_shutdown.hysteresis;
        }
 
@@ -227,57 +222,57 @@ nouveau_therm_attr_get(struct nouveau_therm *therm,
 }
 
 int
-nouveau_therm_attr_set(struct nouveau_therm *therm,
-                      enum nouveau_therm_attr_type type, int value)
+nvkm_therm_attr_set(struct nvkm_therm *therm,
+                   enum nvkm_therm_attr_type type, int value)
 {
-       struct nouveau_therm_priv *priv = (void *)therm;
+       struct nvkm_therm_priv *priv = (void *)therm;
 
        switch (type) {
-       case NOUVEAU_THERM_ATTR_FAN_MIN_DUTY:
+       case NVKM_THERM_ATTR_FAN_MIN_DUTY:
                if (value < 0)
                        value = 0;
                if (value > priv->fan->bios.max_duty)
                        value = priv->fan->bios.max_duty;
                priv->fan->bios.min_duty = value;
                return 0;
-       case NOUVEAU_THERM_ATTR_FAN_MAX_DUTY:
+       case NVKM_THERM_ATTR_FAN_MAX_DUTY:
                if (value < 0)
                        value = 0;
                if (value < priv->fan->bios.min_duty)
                        value = priv->fan->bios.min_duty;
                priv->fan->bios.max_duty = value;
                return 0;
-       case NOUVEAU_THERM_ATTR_FAN_MODE:
-               return nouveau_therm_fan_mode(therm, value);
-       case NOUVEAU_THERM_ATTR_THRS_FAN_BOOST:
+       case NVKM_THERM_ATTR_FAN_MODE:
+               return nvkm_therm_fan_mode(therm, value);
+       case NVKM_THERM_ATTR_THRS_FAN_BOOST:
                priv->bios_sensor.thrs_fan_boost.temp = value;
                priv->sensor.program_alarms(therm);
                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->sensor.program_alarms(therm);
                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->sensor.program_alarms(therm);
                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->sensor.program_alarms(therm);
                return 0;
-       case NOUVEAU_THERM_ATTR_THRS_CRITICAL:
+       case NVKM_THERM_ATTR_THRS_CRITICAL:
                priv->bios_sensor.thrs_critical.temp = value;
                priv->sensor.program_alarms(therm);
                return 0;
-       case NOUVEAU_THERM_ATTR_THRS_CRITICAL_HYST:
+       case NVKM_THERM_ATTR_THRS_CRITICAL_HYST:
                priv->bios_sensor.thrs_critical.hysteresis = value;
                priv->sensor.program_alarms(therm);
                return 0;
-       case NOUVEAU_THERM_ATTR_THRS_SHUTDOWN:
+       case NVKM_THERM_ATTR_THRS_SHUTDOWN:
                priv->bios_sensor.thrs_shutdown.temp = value;
                priv->sensor.program_alarms(therm);
                return 0;
-       case NOUVEAU_THERM_ATTR_THRS_SHUTDOWN_HYST:
+       case NVKM_THERM_ATTR_THRS_SHUTDOWN_HYST:
                priv->bios_sensor.thrs_shutdown.hysteresis = value;
                priv->sensor.program_alarms(therm);
                return 0;
@@ -287,88 +282,86 @@ nouveau_therm_attr_set(struct nouveau_therm *therm,
 }
 
 int
-_nouveau_therm_init(struct nouveau_object *object)
+_nvkm_therm_init(struct nvkm_object *object)
 {
-       struct nouveau_therm *therm = (void *)object;
-       struct nouveau_therm_priv *priv = (void *)therm;
+       struct nvkm_therm *therm = (void *)object;
+       struct nvkm_therm_priv *priv = (void *)therm;
        int ret;
 
-       ret = nouveau_subdev_init(&therm->base);
+       ret = nvkm_subdev_init(&therm->base);
        if (ret)
                return ret;
 
        if (priv->suspend >= 0) {
                /* restore the pwm value only when on manual or auto mode */
                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);
-       nouveau_therm_fan_init(therm);
+       nvkm_therm_sensor_init(therm);
+       nvkm_therm_fan_init(therm);
        return 0;
 }
 
 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 nouveau_therm_priv *priv = (void *)therm;
+       struct nvkm_therm *therm = (void *)object;
+       struct nvkm_therm_priv *priv = (void *)therm;
 
-       nouveau_therm_fan_fini(therm, suspend);
-       nouveau_therm_sensor_fini(therm, suspend);
+       nvkm_therm_fan_fini(therm, suspend);
+       nvkm_therm_sensor_fini(therm, suspend);
        if (suspend) {
                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
-nouveau_therm_create_(struct nouveau_object *parent,
-                     struct nouveau_object *engine,
-                     struct nouveau_oclass *oclass,
-                     int length, void **pobject)
+nvkm_therm_create_(struct nvkm_object *parent, struct nvkm_object *engine,
+                  struct nvkm_oclass *oclass, int length, void **pobject)
 {
-       struct nouveau_therm_priv *priv;
+       struct nvkm_therm_priv *priv;
        int ret;
 
-       ret = nouveau_subdev_create_(parent, engine, oclass, 0, "PTHERM",
-                                    "therm", length, pobject);
+       ret = nvkm_subdev_create_(parent, engine, oclass, 0, "PTHERM",
+                                 "therm", length, pobject);
        priv = *pobject;
        if (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->sensor.alarm_program_lock);
 
-       priv->base.fan_get = nouveau_therm_fan_user_get;
-       priv->base.fan_set = nouveau_therm_fan_user_set;
-       priv->base.fan_sense = nouveau_therm_fan_sense;
-       priv->base.attr_get = nouveau_therm_attr_get;
-       priv->base.attr_set = nouveau_therm_attr_set;
+       priv->base.fan_get = nvkm_therm_fan_user_get;
+       priv->base.fan_set = nvkm_therm_fan_user_set;
+       priv->base.fan_sense = nvkm_therm_fan_sense;
+       priv->base.attr_get = nvkm_therm_attr_get;
+       priv->base.attr_set = nvkm_therm_attr_set;
        priv->mode = priv->suspend = -1; /* undefined */
        return 0;
 }
 
 int
-nouveau_therm_preinit(struct nouveau_therm *therm)
+nvkm_therm_preinit(struct nvkm_therm *therm)
 {
-       nouveau_therm_sensor_ctor(therm);
-       nouveau_therm_ic_ctor(therm);
-       nouveau_therm_fan_ctor(therm);
+       nvkm_therm_sensor_ctor(therm);
+       nvkm_therm_ic_ctor(therm);
+       nvkm_therm_fan_ctor(therm);
 
-       nouveau_therm_fan_mode(therm, NOUVEAU_THERM_CTRL_AUTO);
-       nouveau_therm_sensor_preinit(therm);
+       nvkm_therm_fan_mode(therm, NVKM_THERM_CTRL_AUTO);
+       nvkm_therm_sensor_preinit(therm);
        return 0;
 }
 
 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);
-       nouveau_subdev_destroy(&priv->base.base);
+       nvkm_subdev_destroy(&priv->base.base);
 }
index 3656d605168fce2295d86f64d5eff0da2bc5dede..434fa745ca40f420d24273fcd0e2e3e391c75cc7 100644 (file)
  * Authors: Ben Skeggs
  *         Martin Peres
  */
-
 #include "priv.h"
 
-#include <core/object.h>
-#include <core/device.h>
-
+#include <subdev/bios/fan.h>
 #include <subdev/gpio.h>
 #include <subdev/timer.h>
 
-#include <subdev/bios/fan.h>
-
 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 nouveau_therm_priv *priv = (void *)therm;
-       struct nouveau_timer *ptimer = nouveau_timer(priv);
+       struct nvkm_therm *therm = fan->parent;
+       struct nvkm_therm_priv *priv = (void *)therm;
+       struct nvkm_timer *ptimer = nvkm_timer(priv);
        unsigned long flags;
        int ret = 0;
        int duty;
@@ -107,32 +102,32 @@ nouveau_fan_update(struct nouveau_fan *fan, bool immediate, int target)
 }
 
 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);
-       nouveau_fan_update(fan, false, -1);
+       struct nvkm_fan *fan = container_of(alarm, struct nvkm_fan, alarm);
+       nvkm_fan_update(fan, false, -1);
 }
 
 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);
 }
 
 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;
-       return nouveau_fan_update(priv->fan, immediate, percent);
+       struct nvkm_therm_priv *priv = (void *)therm;
+       return nvkm_fan_update(priv->fan, immediate, percent);
 }
 
 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 nouveau_timer *ptimer = nouveau_timer(therm);
-       struct nouveau_gpio *gpio = nouveau_gpio(therm);
+       struct nvkm_therm_priv *priv = (void *)therm;
+       struct nvkm_timer *ptimer = nvkm_timer(therm);
+       struct nvkm_gpio *gpio = nvkm_gpio(therm);
        u32 cycles, cur, prev;
        u64 start, end, tach;
 
@@ -168,26 +163,26 @@ nouveau_therm_fan_sense(struct nouveau_therm *therm)
 }
 
 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
-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 nouveau_therm_fan_set(therm, true, percent);
+       return nvkm_therm_fan_set(therm, true, percent);
 }
 
 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.min_duty = 0;
@@ -199,9 +194,9 @@ nouveau_therm_fan_set_defaults(struct nouveau_therm *therm)
 }
 
 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)
                priv->fan->bios.min_duty = 100;
@@ -213,16 +208,16 @@ nouveau_therm_fan_safety_checks(struct nouveau_therm *therm)
 }
 
 int
-nouveau_therm_fan_init(struct nouveau_therm *therm)
+nvkm_therm_fan_init(struct nvkm_therm *therm)
 {
        return 0;
 }
 
 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 nouveau_timer *ptimer = nouveau_timer(therm);
+       struct nvkm_therm_priv *priv = (void *)therm;
+       struct nvkm_timer *ptimer = nvkm_timer(therm);
 
        if (suspend)
                ptimer->alarm_cancel(ptimer, &priv->fan->alarm);
@@ -230,11 +225,11 @@ nouveau_therm_fan_fini(struct nouveau_therm *therm, bool suspend)
 }
 
 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 nouveau_gpio *gpio = nouveau_gpio(therm);
-       struct nouveau_bios *bios = nouveau_bios(therm);
+       struct nvkm_therm_priv *priv = (void *)therm;
+       struct nvkm_gpio *gpio = nvkm_gpio(therm);
+       struct nvkm_bios *bios = nvkm_bios(therm);
        struct dcb_gpio_func func;
        int ret;
 
@@ -246,15 +241,15 @@ nouveau_therm_fan_ctor(struct nouveau_therm *therm)
                        nv_debug(therm, "GPIO_FAN is in input mode\n");
                        ret = -EINVAL;
                } else {
-                       ret = nouveau_fanpwm_create(therm, &func);
+                       ret = nvkm_fanpwm_create(therm, &func);
                        if (ret != 0)
-                               ret = nouveau_fantog_create(therm, &func);
+                               ret = nvkm_fantog_create(therm, &func);
                }
        }
 
        /* no controllable fan found, create a dummy fan module */
        if (ret != 0) {
-               ret = nouveau_fannil_create(therm);
+               ret = nvkm_fannil_create(therm);
                if (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);
 
        /* 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 */
        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 */
        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);
 
        /* other random init... */
-       nouveau_therm_fan_set_defaults(therm);
+       nvkm_therm_fan_set_defaults(therm);
        nvbios_perf_fan_parse(bios, &priv->fan->perf);
        if (!nvbios_fan_parse(bios, &priv->fan->bios)) {
                nv_debug(therm, "parsing the fan table failed\n");
                if (nvbios_therm_fan_parse(bios, &priv->fan->bios))
                        nv_error(therm, "parsing both fan tables failed\n");
        }
-       nouveau_therm_fan_safety_checks(therm);
+       nvkm_therm_fan_safety_checks(therm);
        return 0;
 }
index b78c182e1d51fb7124ed566dde8b998bd8f3f728..534e5970ec9c6992bd3c820b884b59117705051f 100644 (file)
  *
  * Authors: Ben Skeggs
  */
-
 #include "priv.h"
 
 static int
-nouveau_fannil_get(struct nouveau_therm *therm)
+nvkm_fannil_get(struct nvkm_therm *therm)
 {
        return -ENODEV;
 }
 
 static int
-nouveau_fannil_set(struct nouveau_therm *therm, int percent)
+nvkm_fannil_set(struct nvkm_therm *therm, int percent)
 {
        return -ENODEV;
 }
 
 int
-nouveau_fannil_create(struct nouveau_therm *therm)
+nvkm_fannil_create(struct nvkm_therm *therm)
 {
-       struct nouveau_therm_priv *tpriv = (void *)therm;
-       struct nouveau_fan *priv;
+       struct nvkm_therm_priv *tpriv = (void *)therm;
+       struct nvkm_fan *priv;
 
        priv = kzalloc(sizeof(*priv), GFP_KERNEL);
        tpriv->fan = priv;
@@ -48,7 +47,7 @@ nouveau_fannil_create(struct nouveau_therm *therm)
                return -ENOMEM;
 
        priv->type = "none / external";
-       priv->get = nouveau_fannil_get;
-       priv->set = nouveau_fannil_set;
+       priv->get = nvkm_fannil_get;
+       priv->set = nvkm_fannil_set;
        return 0;
 }
index c629d7f2a6a44025224e4123c5273b4705a2cf68..3cf4192a33af93157c1ff817a25cd5dd01d67727 100644 (file)
  * Authors: Ben Skeggs
  *         Martin Peres
  */
+#include "priv.h"
 
 #include <core/option.h>
-#include <subdev/gpio.h>
 #include <subdev/bios.h>
 #include <subdev/bios/fan.h>
+#include <subdev/gpio.h>
 
-#include "priv.h"
-
-struct nouveau_fanpwm_priv {
-       struct nouveau_fan base;
+struct nvkm_fanpwm_priv {
+       struct nvkm_fan base;
        struct dcb_gpio_func func;
 };
 
 static int
-nouveau_fanpwm_get(struct nouveau_therm *therm)
+nvkm_fanpwm_get(struct nvkm_therm *therm)
 {
-       struct nouveau_therm_priv *tpriv = (void *)therm;
-       struct nouveau_fanpwm_priv *priv = (void *)tpriv->fan;
-       struct nouveau_gpio *gpio = nouveau_gpio(therm);
+       struct nvkm_therm_priv *tpriv = (void *)therm;
+       struct nvkm_fanpwm_priv *priv = (void *)tpriv->fan;
+       struct nvkm_gpio *gpio = nvkm_gpio(therm);
        int card_type = nv_device(therm)->card_type;
        u32 divs, duty;
        int ret;
@@ -57,10 +56,10 @@ nouveau_fanpwm_get(struct nouveau_therm *therm)
 }
 
 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 nouveau_fanpwm_priv *priv = (void *)tpriv->fan;
+       struct nvkm_therm_priv *tpriv = (void *)therm;
+       struct nvkm_fanpwm_priv *priv = (void *)tpriv->fan;
        int card_type = nv_device(therm)->card_type;
        u32 divs, duty;
        int ret;
@@ -84,18 +83,18 @@ nouveau_fanpwm_set(struct nouveau_therm *therm, int percent)
 }
 
 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 nouveau_therm_priv *tpriv = (void *)therm;
-       struct nouveau_bios *bios = nouveau_bios(therm);
-       struct nouveau_fanpwm_priv *priv;
+       struct nvkm_device *device = nv_device(therm);
+       struct nvkm_therm_priv *tpriv = (void *)therm;
+       struct nvkm_bios *bios = nvkm_bios(therm);
+       struct nvkm_fanpwm_priv *priv;
        struct nvbios_therm_fan fan;
        u32 divs, duty;
 
        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_get(therm, func->line, &divs, &duty) == -ENODEV)
                return -ENODEV;
@@ -106,8 +105,8 @@ nouveau_fanpwm_create(struct nouveau_therm *therm, struct dcb_gpio_func *func)
                return -ENOMEM;
 
        priv->base.type = "PWM";
-       priv->base.get = nouveau_fanpwm_get;
-       priv->base.set = nouveau_fanpwm_set;
+       priv->base.get = nvkm_fanpwm_get;
+       priv->base.set = nvkm_fanpwm_set;
        priv->func = *func;
        return 0;
 }
index f69dab11f720110a4af35229db663e41f58623cd..4ce041e813713cf8a04b565b0641bf3d209701c3 100644 (file)
  *
  * Authors: Martin Peres
  */
-
 #include "priv.h"
 
-#include <core/object.h>
-#include <core/device.h>
-
 #include <subdev/gpio.h>
 #include <subdev/timer.h>
 
-struct nouveau_fantog_priv {
-       struct nouveau_fan base;
-       struct nouveau_alarm alarm;
+struct nvkm_fantog_priv {
+       struct nvkm_fan base;
+       struct nvkm_alarm alarm;
        spinlock_t lock;
        u32 period_us;
        u32 percent;
@@ -40,11 +36,11 @@ struct nouveau_fantog_priv {
 };
 
 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 nouveau_timer *ptimer = nouveau_timer(tpriv);
-       struct nouveau_gpio *gpio = nouveau_gpio(tpriv);
+       struct nvkm_therm_priv *tpriv = (void *)priv->base.parent;
+       struct nvkm_timer *ptimer = nvkm_timer(tpriv);
+       struct nvkm_gpio *gpio = nvkm_gpio(tpriv);
        unsigned long flags;
        int duty;
 
@@ -66,37 +62,37 @@ nouveau_fantog_update(struct nouveau_fantog_priv *priv, int percent)
 }
 
 static void
-nouveau_fantog_alarm(struct nouveau_alarm *alarm)
+nvkm_fantog_alarm(struct nvkm_alarm *alarm)
 {
-       struct nouveau_fantog_priv *priv =
-              container_of(alarm, struct nouveau_fantog_priv, alarm);
-       nouveau_fantog_update(priv, -1);
+       struct nvkm_fantog_priv *priv =
+              container_of(alarm, struct nvkm_fantog_priv, alarm);
+       nvkm_fantog_update(priv, -1);
 }
 
 static int
-nouveau_fantog_get(struct nouveau_therm *therm)
+nvkm_fantog_get(struct nvkm_therm *therm)
 {
-       struct nouveau_therm_priv *tpriv = (void *)therm;
-       struct nouveau_fantog_priv *priv = (void *)tpriv->fan;
+       struct nvkm_therm_priv *tpriv = (void *)therm;
+       struct nvkm_fantog_priv *priv = (void *)tpriv->fan;
        return priv->percent;
 }
 
 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 nouveau_fantog_priv *priv = (void *)tpriv->fan;
+       struct nvkm_therm_priv *tpriv = (void *)therm;
+       struct nvkm_fantog_priv *priv = (void *)tpriv->fan;
        if (therm->pwm_ctrl)
                therm->pwm_ctrl(therm, priv->func.line, false);
-       nouveau_fantog_update(priv, percent);
+       nvkm_fantog_update(priv, percent);
        return 0;
 }
 
 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 nouveau_fantog_priv *priv;
+       struct nvkm_therm_priv *tpriv = (void *)therm;
+       struct nvkm_fantog_priv *priv;
        int ret;
 
        if (therm->pwm_ctrl) {
@@ -111,9 +107,9 @@ nouveau_fantog_create(struct nouveau_therm *therm, struct dcb_gpio_func *func)
                return -ENOMEM;
 
        priv->base.type = "toggle";
-       priv->base.get = nouveau_fantog_get;
-       priv->base.set = nouveau_fantog_set;
-       nouveau_alarm_init(&priv->alarm, nouveau_fantog_alarm);
+       priv->base.get = nvkm_fantog_get;
+       priv->base.set = nvkm_fantog_set;
+       nvkm_alarm_init(&priv->alarm, nvkm_fantog_alarm);
        priv->period_us = 100000; /* 10Hz */
        priv->percent = 100;
        priv->func = *func;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/g84.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/g84.c
new file mode 100644 (file)
index 0000000..85b5d0c
--- /dev/null
@@ -0,0 +1,266 @@
+/*
+ * Copyright 2012 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Ben Skeggs
+ *         Martin Peres
+ */
+#include "priv.h"
+
+#include <subdev/fuse.h>
+
+struct g84_therm_priv {
+       struct nvkm_therm_priv base;
+};
+
+int
+g84_temp_get(struct nvkm_therm *therm)
+{
+       struct nvkm_fuse *fuse = nvkm_fuse(therm);
+
+       if (nv_ro32(fuse, 0x1a8) == 1)
+               return nv_rd32(therm, 0x20400);
+       else
+               return -ENODEV;
+}
+
+void
+g84_sensor_setup(struct nvkm_therm *therm)
+{
+       struct nvkm_fuse *fuse = nvkm_fuse(therm);
+
+       /* enable temperature reading for cards with insane defaults */
+       if (nv_ro32(fuse, 0x1a8) == 1) {
+               nv_mask(therm, 0x20008, 0x80008000, 0x80000000);
+               nv_mask(therm, 0x2000c, 0x80000003, 0x00000000);
+               mdelay(20); /* wait for the temperature to stabilize */
+       }
+}
+
+static void
+g84_therm_program_alarms(struct nvkm_therm *therm)
+{
+       struct nvkm_therm_priv *priv = (void *)therm;
+       struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
+       unsigned long flags;
+
+       spin_lock_irqsave(&priv->sensor.alarm_program_lock, flags);
+
+       /* enable RISING and FALLING IRQs for shutdown, THRS 0, 1, 2 and 4 */
+       nv_wr32(therm, 0x20000, 0x000003ff);
+
+       /* shutdown: The computer should be shutdown when reached */
+       nv_wr32(therm, 0x20484, sensor->thrs_shutdown.hysteresis);
+       nv_wr32(therm, 0x20480, sensor->thrs_shutdown.temp);
+
+       /* THRS_1 : fan boost*/
+       nv_wr32(therm, 0x204c4, sensor->thrs_fan_boost.temp);
+
+       /* THRS_2 : critical */
+       nv_wr32(therm, 0x204c0, sensor->thrs_critical.temp);
+
+       /* THRS_4 : down clock */
+       nv_wr32(therm, 0x20414, sensor->thrs_down_clock.temp);
+       spin_unlock_irqrestore(&priv->sensor.alarm_program_lock, flags);
+
+       nv_debug(therm,
+                "Programmed thresholds [ %d(%d), %d(%d), %d(%d), %d(%d) ]\n",
+                sensor->thrs_fan_boost.temp, sensor->thrs_fan_boost.hysteresis,
+                sensor->thrs_down_clock.temp,
+                sensor->thrs_down_clock.hysteresis,
+                sensor->thrs_critical.temp, sensor->thrs_critical.hysteresis,
+                sensor->thrs_shutdown.temp, sensor->thrs_shutdown.hysteresis);
+
+}
+
+/* must be called with alarm_program_lock taken ! */
+static void
+g84_therm_threshold_hyst_emulation(struct nvkm_therm *therm,
+                                  uint32_t thrs_reg, u8 status_bit,
+                                  const struct nvbios_therm_threshold *thrs,
+                                  enum nvkm_therm_thrs thrs_name)
+{
+       enum nvkm_therm_thrs_direction direction;
+       enum nvkm_therm_thrs_state prev_state, new_state;
+       int temp, cur;
+
+       prev_state = nvkm_therm_sensor_get_threshold_state(therm, thrs_name);
+       temp = nv_rd32(therm, thrs_reg);
+
+       /* program the next threshold */
+       if (temp == thrs->temp) {
+               nv_wr32(therm, thrs_reg, thrs->temp - thrs->hysteresis);
+               new_state = NVKM_THERM_THRS_HIGHER;
+       } else {
+               nv_wr32(therm, thrs_reg, thrs->temp);
+               new_state = NVKM_THERM_THRS_LOWER;
+       }
+
+       /* fix the state (in case someone reprogrammed the alarms) */
+       cur = therm->temp_get(therm);
+       if (new_state == NVKM_THERM_THRS_LOWER && cur > thrs->temp)
+               new_state = NVKM_THERM_THRS_HIGHER;
+       else if (new_state == NVKM_THERM_THRS_HIGHER &&
+               cur < thrs->temp - thrs->hysteresis)
+               new_state = NVKM_THERM_THRS_LOWER;
+       nvkm_therm_sensor_set_threshold_state(therm, thrs_name, new_state);
+
+       /* find the direction */
+       if (prev_state < new_state)
+               direction = NVKM_THERM_THRS_RISING;
+       else if (prev_state > new_state)
+               direction = NVKM_THERM_THRS_FALLING;
+       else
+               return;
+
+       /* advertise a change in direction */
+       nvkm_therm_sensor_event(therm, thrs_name, direction);
+}
+
+static void
+g84_therm_intr(struct nvkm_subdev *subdev)
+{
+       struct nvkm_therm *therm = nvkm_therm(subdev);
+       struct nvkm_therm_priv *priv = (void *)therm;
+       struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
+       unsigned long flags;
+       uint32_t intr;
+
+       spin_lock_irqsave(&priv->sensor.alarm_program_lock, flags);
+
+       intr = nv_rd32(therm, 0x20100) & 0x3ff;
+
+       /* THRS_4: downclock */
+       if (intr & 0x002) {
+               g84_therm_threshold_hyst_emulation(therm, 0x20414, 24,
+                                                  &sensor->thrs_down_clock,
+                                                  NVKM_THERM_THRS_DOWNCLOCK);
+               intr &= ~0x002;
+       }
+
+       /* shutdown */
+       if (intr & 0x004) {
+               g84_therm_threshold_hyst_emulation(therm, 0x20480, 20,
+                                                  &sensor->thrs_shutdown,
+                                                  NVKM_THERM_THRS_SHUTDOWN);
+               intr &= ~0x004;
+       }
+
+       /* THRS_1 : fan boost */
+       if (intr & 0x008) {
+               g84_therm_threshold_hyst_emulation(therm, 0x204c4, 21,
+                                                  &sensor->thrs_fan_boost,
+                                                  NVKM_THERM_THRS_FANBOOST);
+               intr &= ~0x008;
+       }
+
+       /* THRS_2 : critical */
+       if (intr & 0x010) {
+               g84_therm_threshold_hyst_emulation(therm, 0x204c0, 22,
+                                                  &sensor->thrs_critical,
+                                                  NVKM_THERM_THRS_CRITICAL);
+               intr &= ~0x010;
+       }
+
+       if (intr)
+               nv_error(therm, "unhandled intr 0x%08x\n", intr);
+
+       /* ACK everything */
+       nv_wr32(therm, 0x20100, 0xffffffff);
+       nv_wr32(therm, 0x1100, 0x10000); /* PBUS */
+
+       spin_unlock_irqrestore(&priv->sensor.alarm_program_lock, flags);
+}
+
+static int
+g84_therm_init(struct nvkm_object *object)
+{
+       struct g84_therm_priv *priv = (void *)object;
+       int ret;
+
+       ret = nvkm_therm_init(&priv->base.base);
+       if (ret)
+               return ret;
+
+       g84_sensor_setup(&priv->base.base);
+       return 0;
+}
+
+static int
+g84_therm_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
+              struct nvkm_oclass *oclass, void *data, u32 size,
+              struct nvkm_object **pobject)
+{
+       struct g84_therm_priv *priv;
+       int ret;
+
+       ret = nvkm_therm_create(parent, engine, oclass, &priv);
+       *pobject = nv_object(priv);
+       if (ret)
+               return ret;
+
+       priv->base.base.pwm_ctrl = nv50_fan_pwm_ctrl;
+       priv->base.base.pwm_get = nv50_fan_pwm_get;
+       priv->base.base.pwm_set = nv50_fan_pwm_set;
+       priv->base.base.pwm_clock = nv50_fan_pwm_clock;
+       priv->base.base.temp_get = g84_temp_get;
+       priv->base.sensor.program_alarms = g84_therm_program_alarms;
+       nv_subdev(priv)->intr = g84_therm_intr;
+
+       /* init the thresholds */
+       nvkm_therm_sensor_set_threshold_state(&priv->base.base,
+                                             NVKM_THERM_THRS_SHUTDOWN,
+                                             NVKM_THERM_THRS_LOWER);
+       nvkm_therm_sensor_set_threshold_state(&priv->base.base,
+                                             NVKM_THERM_THRS_FANBOOST,
+                                             NVKM_THERM_THRS_LOWER);
+       nvkm_therm_sensor_set_threshold_state(&priv->base.base,
+                                             NVKM_THERM_THRS_CRITICAL,
+                                             NVKM_THERM_THRS_LOWER);
+       nvkm_therm_sensor_set_threshold_state(&priv->base.base,
+                                             NVKM_THERM_THRS_DOWNCLOCK,
+                                             NVKM_THERM_THRS_LOWER);
+
+       return nvkm_therm_preinit(&priv->base.base);
+}
+
+int
+g84_therm_fini(struct nvkm_object *object, bool suspend)
+{
+       /* Disable PTherm IRQs */
+       nv_wr32(object, 0x20000, 0x00000000);
+
+       /* ACK all PTherm IRQs */
+       nv_wr32(object, 0x20100, 0xffffffff);
+       nv_wr32(object, 0x1100, 0x10000); /* PBUS */
+
+       return _nvkm_therm_fini(object, suspend);
+}
+
+struct nvkm_oclass
+g84_therm_oclass = {
+       .handle = NV_SUBDEV(THERM, 0x84),
+       .ofuncs = &(struct nvkm_ofuncs) {
+               .ctor = g84_therm_ctor,
+               .dtor = _nvkm_therm_dtor,
+               .init = g84_therm_init,
+               .fini = g84_therm_fini,
+       },
+};
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gf110.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gf110.c
new file mode 100644 (file)
index 0000000..0540e68
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+ * Copyright 2012 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Ben Skeggs
+ */
+#include "priv.h"
+
+struct gf110_therm_priv {
+       struct nvkm_therm_priv base;
+};
+
+static int
+pwm_info(struct nvkm_therm *therm, int line)
+{
+       u32 gpio = nv_rd32(therm, 0x00d610 + (line * 0x04));
+
+       switch (gpio & 0x000000c0) {
+       case 0x00000000: /* normal mode, possibly pwm forced off by us */
+       case 0x00000040: /* nvio special */
+               switch (gpio & 0x0000001f) {
+               case 0x00: return 2;
+               case 0x19: return 1;
+               case 0x1c: return 0;
+               case 0x1e: return 2;
+               default:
+                       break;
+               }
+       default:
+               break;
+       }
+
+       nv_error(therm, "GPIO %d unknown PWM: 0x%08x\n", line, gpio);
+       return -ENODEV;
+}
+
+static int
+gf110_fan_pwm_ctrl(struct nvkm_therm *therm, int line, bool enable)
+{
+       u32 data = enable ? 0x00000040 : 0x00000000;
+       int indx = pwm_info(therm, line);
+       if (indx < 0)
+               return indx;
+       else if (indx < 2)
+               nv_mask(therm, 0x00d610 + (line * 0x04), 0x000000c0, data);
+       /* nothing to do for indx == 2, it seems hardwired to PTHERM */
+       return 0;
+}
+
+static int
+gf110_fan_pwm_get(struct nvkm_therm *therm, int line, u32 *divs, u32 *duty)
+{
+       int indx = pwm_info(therm, line);
+       if (indx < 0)
+               return indx;
+       else if (indx < 2) {
+               if (nv_rd32(therm, 0x00d610 + (line * 0x04)) & 0x00000040) {
+                       *divs = nv_rd32(therm, 0x00e114 + (indx * 8));
+                       *duty = nv_rd32(therm, 0x00e118 + (indx * 8));
+                       return 0;
+               }
+       } else if (indx == 2) {
+               *divs = nv_rd32(therm, 0x0200d8) & 0x1fff;
+               *duty = nv_rd32(therm, 0x0200dc) & 0x1fff;
+               return 0;
+       }
+
+       return -EINVAL;
+}
+
+static int
+gf110_fan_pwm_set(struct nvkm_therm *therm, int line, u32 divs, u32 duty)
+{
+       int indx = pwm_info(therm, line);
+       if (indx < 0)
+               return indx;
+       else if (indx < 2) {
+               nv_wr32(therm, 0x00e114 + (indx * 8), divs);
+               nv_wr32(therm, 0x00e118 + (indx * 8), duty | 0x80000000);
+       } else if (indx == 2) {
+               nv_mask(therm, 0x0200d8, 0x1fff, divs); /* keep the high bits */
+               nv_wr32(therm, 0x0200dc, duty | 0x40000000);
+       }
+       return 0;
+}
+
+static int
+gf110_fan_pwm_clock(struct nvkm_therm *therm, int line)
+{
+       int indx = pwm_info(therm, line);
+       if (indx < 0)
+               return 0;
+       else if (indx < 2)
+               return (nv_device(therm)->crystal * 1000) / 20;
+       else
+               return nv_device(therm)->crystal * 1000 / 10;
+}
+
+int
+gf110_therm_init(struct nvkm_object *object)
+{
+       struct gf110_therm_priv *priv = (void *)object;
+       int ret;
+
+       ret = nvkm_therm_init(&priv->base.base);
+       if (ret)
+               return ret;
+
+       /* enable fan tach, count revolutions per-second */
+       nv_mask(priv, 0x00e720, 0x00000003, 0x00000002);
+       if (priv->base.fan->tach.func != DCB_GPIO_UNUSED) {
+               nv_mask(priv, 0x00d79c, 0x000000ff, priv->base.fan->tach.line);
+               nv_wr32(priv, 0x00e724, nv_device(priv)->crystal * 1000);
+               nv_mask(priv, 0x00e720, 0x00000001, 0x00000001);
+       }
+       nv_mask(priv, 0x00e720, 0x00000002, 0x00000000);
+
+       return 0;
+}
+
+static int
+gf110_therm_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
+                struct nvkm_oclass *oclass, void *data, u32 size,
+                struct nvkm_object **pobject)
+{
+       struct gf110_therm_priv *priv;
+       int ret;
+
+       ret = nvkm_therm_create(parent, engine, oclass, &priv);
+       *pobject = nv_object(priv);
+       if (ret)
+               return ret;
+
+       g84_sensor_setup(&priv->base.base);
+
+       priv->base.base.pwm_ctrl = gf110_fan_pwm_ctrl;
+       priv->base.base.pwm_get = gf110_fan_pwm_get;
+       priv->base.base.pwm_set = gf110_fan_pwm_set;
+       priv->base.base.pwm_clock = gf110_fan_pwm_clock;
+       priv->base.base.temp_get = g84_temp_get;
+       priv->base.base.fan_sense = gt215_therm_fan_sense;
+       priv->base.sensor.program_alarms = nvkm_therm_program_alarms_polling;
+       return nvkm_therm_preinit(&priv->base.base);
+}
+
+struct nvkm_oclass
+gf110_therm_oclass = {
+       .handle = NV_SUBDEV(THERM, 0xd0),
+       .ofuncs = &(struct nvkm_ofuncs) {
+               .ctor = gf110_therm_ctor,
+               .dtor = _nvkm_therm_dtor,
+               .init = gf110_therm_init,
+               .fini = g84_therm_fini,
+       },
+};
index 668cf3322285a95897848fd971fb6d0414557863..c1f3cf3618378b3441ea3caab3d920522204305c 100644 (file)
  *
  * Authors: Martin Peres
  */
-
 #include "priv.h"
 
 struct gm107_therm_priv {
-       struct nouveau_therm_priv base;
+       struct nvkm_therm_priv base;
 };
 
 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 */
        return 0;
 }
 
 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;
        *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
-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_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
-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;
 }
 
 static int
-gm107_therm_ctor(struct nouveau_object *parent,
-               struct nouveau_object *engine,
-               struct nouveau_oclass *oclass, void *data, u32 size,
-               struct nouveau_object **pobject)
+gm107_therm_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
+                struct nvkm_oclass *oclass, void *data, u32 size,
+                struct nvkm_object **pobject)
 {
        struct gm107_therm_priv *priv;
        int ret;
 
-       ret = nouveau_therm_create(parent, engine, oclass, &priv);
+       ret = nvkm_therm_create(parent, engine, oclass, &priv);
        *pobject = nv_object(priv);
        if (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_set = gm107_fan_pwm_set;
        priv->base.base.pwm_clock = gm107_fan_pwm_clock;
-       priv->base.base.temp_get = nv84_temp_get;
-       priv->base.base.fan_sense = nva3_therm_fan_sense;
-       priv->base.sensor.program_alarms = nouveau_therm_program_alarms_polling;
-       return nouveau_therm_preinit(&priv->base.base);
+       priv->base.base.temp_get = g84_temp_get;
+       priv->base.base.fan_sense = gt215_therm_fan_sense;
+       priv->base.sensor.program_alarms = nvkm_therm_program_alarms_polling;
+       return nvkm_therm_preinit(&priv->base.base);
 }
 
-struct nouveau_oclass
+struct nvkm_oclass
 gm107_therm_oclass = {
        .handle = NV_SUBDEV(THERM, 0x117),
-       .ofuncs = &(struct nouveau_ofuncs) {
+       .ofuncs = &(struct nvkm_ofuncs) {
                .ctor = gm107_therm_ctor,
-               .dtor = _nouveau_therm_dtor,
-               .init = nvd0_therm_init,
-               .fini = nv84_therm_fini,
+               .dtor = _nvkm_therm_dtor,
+               .init = gf110_therm_init,
+               .fini = g84_therm_fini,
        },
 };
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gt215.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gt215.c
new file mode 100644 (file)
index 0000000..b7fa471
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2012 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Ben Skeggs
+ */
+#include "priv.h"
+
+#include <subdev/gpio.h>
+
+struct gt215_therm_priv {
+       struct nvkm_therm_priv base;
+};
+
+int
+gt215_therm_fan_sense(struct nvkm_therm *therm)
+{
+       u32 tach = nv_rd32(therm, 0x00e728) & 0x0000ffff;
+       u32 ctrl = nv_rd32(therm, 0x00e720);
+       if (ctrl & 0x00000001)
+               return tach * 60 / 2;
+       return -ENODEV;
+}
+
+static int
+gt215_therm_init(struct nvkm_object *object)
+{
+       struct gt215_therm_priv *priv = (void *)object;
+       struct dcb_gpio_func *tach = &priv->base.fan->tach;
+       int ret;
+
+       ret = nvkm_therm_init(&priv->base.base);
+       if (ret)
+               return ret;
+
+       g84_sensor_setup(&priv->base.base);
+
+       /* enable fan tach, count revolutions per-second */
+       nv_mask(priv, 0x00e720, 0x00000003, 0x00000002);
+       if (tach->func != DCB_GPIO_UNUSED) {
+               nv_wr32(priv, 0x00e724, nv_device(priv)->crystal * 1000);
+               nv_mask(priv, 0x00e720, 0x001f0000, tach->line << 16);
+               nv_mask(priv, 0x00e720, 0x00000001, 0x00000001);
+       }
+       nv_mask(priv, 0x00e720, 0x00000002, 0x00000000);
+
+       return 0;
+}
+
+static int
+gt215_therm_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
+                struct nvkm_oclass *oclass, void *data, u32 size,
+                struct nvkm_object **pobject)
+{
+       struct gt215_therm_priv *priv;
+       int ret;
+
+       ret = nvkm_therm_create(parent, engine, oclass, &priv);
+       *pobject = nv_object(priv);
+       if (ret)
+               return ret;
+
+       priv->base.base.pwm_ctrl = nv50_fan_pwm_ctrl;
+       priv->base.base.pwm_get = nv50_fan_pwm_get;
+       priv->base.base.pwm_set = nv50_fan_pwm_set;
+       priv->base.base.pwm_clock = nv50_fan_pwm_clock;
+       priv->base.base.temp_get = g84_temp_get;
+       priv->base.base.fan_sense = gt215_therm_fan_sense;
+       priv->base.sensor.program_alarms = nvkm_therm_program_alarms_polling;
+       return nvkm_therm_preinit(&priv->base.base);
+}
+
+struct nvkm_oclass
+gt215_therm_oclass = {
+       .handle = NV_SUBDEV(THERM, 0xa3),
+       .ofuncs = &(struct nvkm_ofuncs) {
+               .ctor = gt215_therm_ctor,
+               .dtor = _nvkm_therm_dtor,
+               .init = gt215_therm_init,
+               .fini = g84_therm_fini,
+       },
+};
index ca9ad9fd47be35b0fa491e301c95f0b1fda053ff..09fc4605e8531135afed9eb12ebce407da022e98 100644 (file)
  *
  * Authors: Martin Peres
  */
-
 #include "priv.h"
 
-#include <subdev/i2c.h>
 #include <subdev/bios/extdev.h>
+#include <subdev/i2c.h>
 
 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 nouveau_therm_priv *priv = data;
+       struct nvkm_therm_priv *priv = data;
        struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
        struct i2c_client *client;
 
@@ -52,11 +51,10 @@ probe_monitoring_device(struct nouveau_i2c_port *i2c,
                "temp offset %+i C)\n",
                info->type, info->addr, sensor->offset_constant);
        priv->ic = client;
-
        return true;
 }
 
-static struct nouveau_i2c_board_info
+static struct nvkm_i2c_board_info
 nv_board_infos[] = {
        { { I2C_BOARD_INFO("w83l785ts", 0x2d) }, 0 },
        { { I2C_BOARD_INFO("w83781d", 0x2d) }, 0  },
@@ -82,15 +80,15 @@ nv_board_infos[] = {
 };
 
 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 nouveau_bios *bios = nouveau_bios(therm);
-       struct nouveau_i2c *i2c = nouveau_i2c(therm);
+       struct nvkm_therm_priv *priv = (void *)therm;
+       struct nvkm_bios *bios = nvkm_bios(therm);
+       struct nvkm_i2c *i2c = nvkm_i2c(therm);
        struct nvbios_extdev_func 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},
                  { }
                };
@@ -102,7 +100,7 @@ nouveau_therm_ic_ctor(struct nouveau_therm *therm)
        }
 
        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 },
                  { }
                };
index 002e51b3af9358aa64880868ee6abe2493adfafd..20f65fd7679aed24ee76db6a3c8104001389231d 100644 (file)
  * Authors: Ben Skeggs
  *         Martin Peres
  */
-
 #include "priv.h"
 
 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 };
 
 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) {
        case 0x43:
@@ -58,7 +57,7 @@ nv40_sensor_style(struct nouveau_therm *therm)
 }
 
 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);
 
@@ -77,9 +76,9 @@ nv40_sensor_setup(struct nouveau_therm *therm)
 }
 
 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;
        enum nv40_sensor_style style = nv40_sensor_style(therm);
        int core_temp;
@@ -110,7 +109,7 @@ nv40_temp_get(struct nouveau_therm *therm)
 }
 
 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;
        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
-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) {
                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
-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) {
                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
-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);
 
        /* traitement */
@@ -180,15 +179,15 @@ nv40_therm_intr(struct nouveau_subdev *subdev)
 }
 
 static int
-nv40_therm_ctor(struct nouveau_object *parent,
-               struct nouveau_object *engine,
-               struct nouveau_oclass *oclass, void *data, u32 size,
-               struct nouveau_object **pobject)
+nv40_therm_ctor(struct nvkm_object *parent,
+               struct nvkm_object *engine,
+               struct nvkm_oclass *oclass, void *data, u32 size,
+               struct nvkm_object **pobject)
 {
        struct nv40_therm_priv *priv;
        int ret;
 
-       ret = nouveau_therm_create(parent, engine, oclass, &priv);
+       ret = nvkm_therm_create(parent, engine, oclass, &priv);
        *pobject = nv_object(priv);
        if (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_set = nv40_fan_pwm_set;
        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;
-       return nouveau_therm_preinit(&priv->base.base);
+       return nvkm_therm_preinit(&priv->base.base);
 }
 
 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);
 
-       return _nouveau_therm_init(object);
+       return _nvkm_therm_init(object);
 }
 
-struct nouveau_oclass
+struct nvkm_oclass
 nv40_therm_oclass = {
        .handle = NV_SUBDEV(THERM, 0x40),
-       .ofuncs = &(struct nouveau_ofuncs) {
+       .ofuncs = &(struct nvkm_ofuncs) {
                .ctor = nv40_therm_ctor,
-               .dtor = _nouveau_therm_dtor,
+               .dtor = _nvkm_therm_dtor,
                .init = nv40_therm_init,
-               .fini = _nouveau_therm_fini,
+               .fini = _nvkm_therm_fini,
        },
 };
index 321db927d638c91a82141373fd8ff6af9a7be262..489dcf355d3464c340f07546e42ae5972ca41994 100644 (file)
  * Authors: Ben Skeggs
  *         Martin Peres
  */
-
 #include "priv.h"
 
 struct nv50_therm_priv {
-       struct nouveau_therm_priv base;
+       struct nvkm_therm_priv base;
 };
 
 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) {
                *ctrl = 0x00e100;
@@ -55,7 +54,7 @@ pwm_info(struct nouveau_therm *therm, int *line, int *ctrl, int *indx)
 }
 
 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;
        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
-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);
        if (ret)
@@ -81,7 +80,7 @@ nv50_fan_pwm_get(struct nouveau_therm *therm, int line, u32 *divs, u32 *duty)
 }
 
 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);
        if (ret)
@@ -93,7 +92,7 @@ nv50_fan_pwm_set(struct nouveau_therm *therm, int line, u32 divs, u32 duty)
 }
 
 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 crystal = nv_device(therm)->crystal;
@@ -119,16 +118,16 @@ nv50_fan_pwm_clock(struct nouveau_therm *therm, int line)
 }
 
 static void
-nv50_sensor_setup(struct nouveau_therm *therm)
+nv50_sensor_setup(struct nvkm_therm *therm)
 {
        nv_mask(therm, 0x20010, 0x40000000, 0x0);
        mdelay(20); /* wait for the temperature to stabilize */
 }
 
 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;
        int core_temp;
 
@@ -151,15 +150,15 @@ nv50_temp_get(struct nouveau_therm *therm)
 }
 
 static int
-nv50_therm_ctor(struct nouveau_object *parent,
-               struct nouveau_object *engine,
-               struct nouveau_oclass *oclass, void *data, u32 size,
-               struct nouveau_object **pobject)
+nv50_therm_ctor(struct nvkm_object *parent,
+               struct nvkm_object *engine,
+               struct nvkm_oclass *oclass, void *data, u32 size,
+               struct nvkm_object **pobject)
 {
        struct nv50_therm_priv *priv;
        int ret;
 
-       ret = nouveau_therm_create(parent, engine, oclass, &priv);
+       ret = nvkm_therm_create(parent, engine, oclass, &priv);
        *pobject = nv_object(priv);
        if (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_clock = nv50_fan_pwm_clock;
        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;
 
-       return nouveau_therm_preinit(&priv->base.base);
+       return nvkm_therm_preinit(&priv->base.base);
 }
 
 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);
 
-       return _nouveau_therm_init(object);
+       return _nvkm_therm_init(object);
 }
 
-struct nouveau_oclass
+struct nvkm_oclass
 nv50_therm_oclass = {
        .handle = NV_SUBDEV(THERM, 0x50),
-       .ofuncs = &(struct nouveau_ofuncs) {
+       .ofuncs = &(struct nvkm_ofuncs) {
                .ctor = nv50_therm_ctor,
-               .dtor = _nouveau_therm_dtor,
+               .dtor = _nvkm_therm_dtor,
                .init = nv50_therm_init,
-               .fini = _nouveau_therm_fini,
+               .fini = _nvkm_therm_fini,
        },
 };
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/nv84.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/nv84.c
deleted file mode 100644 (file)
index 14e2e09..0000000
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Copyright 2012 Red Hat Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors: Ben Skeggs
- *         Martin Peres
- */
-
-#include "priv.h"
-#include <subdev/fuse.h>
-
-struct nv84_therm_priv {
-       struct nouveau_therm_priv base;
-};
-
-int
-nv84_temp_get(struct nouveau_therm *therm)
-{
-       struct nouveau_fuse *fuse = nouveau_fuse(therm);
-
-       if (nv_ro32(fuse, 0x1a8) == 1)
-               return nv_rd32(therm, 0x20400);
-       else
-               return -ENODEV;
-}
-
-void
-nv84_sensor_setup(struct nouveau_therm *therm)
-{
-       struct nouveau_fuse *fuse = nouveau_fuse(therm);
-
-       /* enable temperature reading for cards with insane defaults */
-       if (nv_ro32(fuse, 0x1a8) == 1) {
-               nv_mask(therm, 0x20008, 0x80008000, 0x80000000);
-               nv_mask(therm, 0x2000c, 0x80000003, 0x00000000);
-               mdelay(20); /* wait for the temperature to stabilize */
-       }
-}
-
-static void
-nv84_therm_program_alarms(struct nouveau_therm *therm)
-{
-       struct nouveau_therm_priv *priv = (void *)therm;
-       struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
-       unsigned long flags;
-
-       spin_lock_irqsave(&priv->sensor.alarm_program_lock, flags);
-
-       /* enable RISING and FALLING IRQs for shutdown, THRS 0, 1, 2 and 4 */
-       nv_wr32(therm, 0x20000, 0x000003ff);
-
-       /* shutdown: The computer should be shutdown when reached */
-       nv_wr32(therm, 0x20484, sensor->thrs_shutdown.hysteresis);
-       nv_wr32(therm, 0x20480, sensor->thrs_shutdown.temp);
-
-       /* THRS_1 : fan boost*/
-       nv_wr32(therm, 0x204c4, sensor->thrs_fan_boost.temp);
-
-       /* THRS_2 : critical */
-       nv_wr32(therm, 0x204c0, sensor->thrs_critical.temp);
-
-       /* THRS_4 : down clock */
-       nv_wr32(therm, 0x20414, sensor->thrs_down_clock.temp);
-       spin_unlock_irqrestore(&priv->sensor.alarm_program_lock, flags);
-
-       nv_debug(therm,
-                "Programmed thresholds [ %d(%d), %d(%d), %d(%d), %d(%d) ]\n",
-                sensor->thrs_fan_boost.temp, sensor->thrs_fan_boost.hysteresis,
-                sensor->thrs_down_clock.temp,
-                sensor->thrs_down_clock.hysteresis,
-                sensor->thrs_critical.temp, sensor->thrs_critical.hysteresis,
-                sensor->thrs_shutdown.temp, sensor->thrs_shutdown.hysteresis);
-
-}
-
-/* must be called with alarm_program_lock taken ! */
-static void
-nv84_therm_threshold_hyst_emulation(struct nouveau_therm *therm,
-                                  uint32_t thrs_reg, u8 status_bit,
-                                  const struct nvbios_therm_threshold *thrs,
-                                  enum nouveau_therm_thrs thrs_name)
-{
-       enum nouveau_therm_thrs_direction direction;
-       enum nouveau_therm_thrs_state prev_state, new_state;
-       int temp, cur;
-
-       prev_state = nouveau_therm_sensor_get_threshold_state(therm, thrs_name);
-       temp = nv_rd32(therm, thrs_reg);
-
-       /* program the next threshold */
-       if (temp == thrs->temp) {
-               nv_wr32(therm, thrs_reg, thrs->temp - thrs->hysteresis);
-               new_state = NOUVEAU_THERM_THRS_HIGHER;
-       } else {
-               nv_wr32(therm, thrs_reg, thrs->temp);
-               new_state = NOUVEAU_THERM_THRS_LOWER;
-       }
-
-       /* fix the state (in case someone reprogrammed the alarms) */
-       cur = therm->temp_get(therm);
-       if (new_state == NOUVEAU_THERM_THRS_LOWER && cur > thrs->temp)
-               new_state = NOUVEAU_THERM_THRS_HIGHER;
-       else if (new_state == NOUVEAU_THERM_THRS_HIGHER &&
-               cur < thrs->temp - thrs->hysteresis)
-               new_state = NOUVEAU_THERM_THRS_LOWER;
-       nouveau_therm_sensor_set_threshold_state(therm, thrs_name, new_state);
-
-       /* find the direction */
-       if (prev_state < new_state)
-               direction = NOUVEAU_THERM_THRS_RISING;
-       else if (prev_state > new_state)
-               direction = NOUVEAU_THERM_THRS_FALLING;
-       else
-               return;
-
-       /* advertise a change in direction */
-       nouveau_therm_sensor_event(therm, thrs_name, direction);
-}
-
-static void
-nv84_therm_intr(struct nouveau_subdev *subdev)
-{
-       struct nouveau_therm *therm = nouveau_therm(subdev);
-       struct nouveau_therm_priv *priv = (void *)therm;
-       struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
-       unsigned long flags;
-       uint32_t intr;
-
-       spin_lock_irqsave(&priv->sensor.alarm_program_lock, flags);
-
-       intr = nv_rd32(therm, 0x20100) & 0x3ff;
-
-       /* THRS_4: downclock */
-       if (intr & 0x002) {
-               nv84_therm_threshold_hyst_emulation(therm, 0x20414, 24,
-                                                 &sensor->thrs_down_clock,
-                                                 NOUVEAU_THERM_THRS_DOWNCLOCK);
-               intr &= ~0x002;
-       }
-
-       /* shutdown */
-       if (intr & 0x004) {
-               nv84_therm_threshold_hyst_emulation(therm, 0x20480, 20,
-                                                  &sensor->thrs_shutdown,
-                                                  NOUVEAU_THERM_THRS_SHUTDOWN);
-               intr &= ~0x004;
-       }
-
-       /* THRS_1 : fan boost */
-       if (intr & 0x008) {
-               nv84_therm_threshold_hyst_emulation(therm, 0x204c4, 21,
-                                                  &sensor->thrs_fan_boost,
-                                                  NOUVEAU_THERM_THRS_FANBOOST);
-               intr &= ~0x008;
-       }
-
-       /* THRS_2 : critical */
-       if (intr & 0x010) {
-               nv84_therm_threshold_hyst_emulation(therm, 0x204c0, 22,
-                                                  &sensor->thrs_critical,
-                                                  NOUVEAU_THERM_THRS_CRITICAL);
-               intr &= ~0x010;
-       }
-
-       if (intr)
-               nv_error(therm, "unhandled intr 0x%08x\n", intr);
-
-       /* ACK everything */
-       nv_wr32(therm, 0x20100, 0xffffffff);
-       nv_wr32(therm, 0x1100, 0x10000); /* PBUS */
-
-       spin_unlock_irqrestore(&priv->sensor.alarm_program_lock, flags);
-}
-
-static int
-nv84_therm_init(struct nouveau_object *object)
-{
-       struct nv84_therm_priv *priv = (void *)object;
-       int ret;
-
-       ret = nouveau_therm_init(&priv->base.base);
-       if (ret)
-               return ret;
-
-       nv84_sensor_setup(&priv->base.base);
-
-       return 0;
-}
-
-static int
-nv84_therm_ctor(struct nouveau_object *parent,
-               struct nouveau_object *engine,
-               struct nouveau_oclass *oclass, void *data, u32 size,
-               struct nouveau_object **pobject)
-{
-       struct nv84_therm_priv *priv;
-       int ret;
-
-       ret = nouveau_therm_create(parent, engine, oclass, &priv);
-       *pobject = nv_object(priv);
-       if (ret)
-               return ret;
-
-       priv->base.base.pwm_ctrl = nv50_fan_pwm_ctrl;
-       priv->base.base.pwm_get = nv50_fan_pwm_get;
-       priv->base.base.pwm_set = nv50_fan_pwm_set;
-       priv->base.base.pwm_clock = nv50_fan_pwm_clock;
-       priv->base.base.temp_get = nv84_temp_get;
-       priv->base.sensor.program_alarms = nv84_therm_program_alarms;
-       nv_subdev(priv)->intr = nv84_therm_intr;
-
-       /* init the thresholds */
-       nouveau_therm_sensor_set_threshold_state(&priv->base.base,
-                                                NOUVEAU_THERM_THRS_SHUTDOWN,
-                                                NOUVEAU_THERM_THRS_LOWER);
-       nouveau_therm_sensor_set_threshold_state(&priv->base.base,
-                                                NOUVEAU_THERM_THRS_FANBOOST,
-                                                NOUVEAU_THERM_THRS_LOWER);
-       nouveau_therm_sensor_set_threshold_state(&priv->base.base,
-                                                NOUVEAU_THERM_THRS_CRITICAL,
-                                                NOUVEAU_THERM_THRS_LOWER);
-       nouveau_therm_sensor_set_threshold_state(&priv->base.base,
-                                                NOUVEAU_THERM_THRS_DOWNCLOCK,
-                                                NOUVEAU_THERM_THRS_LOWER);
-
-       return nouveau_therm_preinit(&priv->base.base);
-}
-
-int
-nv84_therm_fini(struct nouveau_object *object, bool suspend)
-{
-       /* Disable PTherm IRQs */
-       nv_wr32(object, 0x20000, 0x00000000);
-
-       /* ACK all PTherm IRQs */
-       nv_wr32(object, 0x20100, 0xffffffff);
-       nv_wr32(object, 0x1100, 0x10000); /* PBUS */
-
-       return _nouveau_therm_fini(object, suspend);
-}
-
-struct nouveau_oclass
-nv84_therm_oclass = {
-       .handle = NV_SUBDEV(THERM, 0x84),
-       .ofuncs = &(struct nouveau_ofuncs) {
-               .ctor = nv84_therm_ctor,
-               .dtor = _nouveau_therm_dtor,
-               .init = nv84_therm_init,
-               .fini = nv84_therm_fini,
-       },
-};
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/nva3.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/nva3.c
deleted file mode 100644 (file)
index 7893357..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright 2012 Red Hat Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors: Ben Skeggs
- */
-
-#include <subdev/gpio.h>
-
-#include "priv.h"
-
-struct nva3_therm_priv {
-       struct nouveau_therm_priv base;
-};
-
-int
-nva3_therm_fan_sense(struct nouveau_therm *therm)
-{
-       u32 tach = nv_rd32(therm, 0x00e728) & 0x0000ffff;
-       u32 ctrl = nv_rd32(therm, 0x00e720);
-       if (ctrl & 0x00000001)
-               return tach * 60 / 2;
-       return -ENODEV;
-}
-
-static int
-nva3_therm_init(struct nouveau_object *object)
-{
-       struct nva3_therm_priv *priv = (void *)object;
-       struct dcb_gpio_func *tach = &priv->base.fan->tach;
-       int ret;
-
-       ret = nouveau_therm_init(&priv->base.base);
-       if (ret)
-               return ret;
-
-       nv84_sensor_setup(&priv->base.base);
-
-       /* enable fan tach, count revolutions per-second */
-       nv_mask(priv, 0x00e720, 0x00000003, 0x00000002);
-       if (tach->func != DCB_GPIO_UNUSED) {
-               nv_wr32(priv, 0x00e724, nv_device(priv)->crystal * 1000);
-               nv_mask(priv, 0x00e720, 0x001f0000, tach->line << 16);
-               nv_mask(priv, 0x00e720, 0x00000001, 0x00000001);
-       }
-       nv_mask(priv, 0x00e720, 0x00000002, 0x00000000);
-
-       return 0;
-}
-
-static int
-nva3_therm_ctor(struct nouveau_object *parent,
-               struct nouveau_object *engine,
-               struct nouveau_oclass *oclass, void *data, u32 size,
-               struct nouveau_object **pobject)
-{
-       struct nva3_therm_priv *priv;
-       int ret;
-
-       ret = nouveau_therm_create(parent, engine, oclass, &priv);
-       *pobject = nv_object(priv);
-       if (ret)
-               return ret;
-
-       priv->base.base.pwm_ctrl = nv50_fan_pwm_ctrl;
-       priv->base.base.pwm_get = nv50_fan_pwm_get;
-       priv->base.base.pwm_set = nv50_fan_pwm_set;
-       priv->base.base.pwm_clock = nv50_fan_pwm_clock;
-       priv->base.base.temp_get = nv84_temp_get;
-       priv->base.base.fan_sense = nva3_therm_fan_sense;
-       priv->base.sensor.program_alarms = nouveau_therm_program_alarms_polling;
-       return nouveau_therm_preinit(&priv->base.base);
-}
-
-struct nouveau_oclass
-nva3_therm_oclass = {
-       .handle = NV_SUBDEV(THERM, 0xa3),
-       .ofuncs = &(struct nouveau_ofuncs) {
-               .ctor = nva3_therm_ctor,
-               .dtor = _nouveau_therm_dtor,
-               .init = nva3_therm_init,
-               .fini = nv84_therm_fini,
-       },
-};
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/nvd0.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/nvd0.c
deleted file mode 100644 (file)
index b70f7cc..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright 2012 Red Hat Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors: Ben Skeggs
- */
-
-#include "priv.h"
-
-struct nvd0_therm_priv {
-       struct nouveau_therm_priv base;
-};
-
-static int
-pwm_info(struct nouveau_therm *therm, int line)
-{
-       u32 gpio = nv_rd32(therm, 0x00d610 + (line * 0x04));
-
-       switch (gpio & 0x000000c0) {
-       case 0x00000000: /* normal mode, possibly pwm forced off by us */
-       case 0x00000040: /* nvio special */
-               switch (gpio & 0x0000001f) {
-               case 0x00: return 2;
-               case 0x19: return 1;
-               case 0x1c: return 0;
-               case 0x1e: return 2;
-               default:
-                       break;
-               }
-       default:
-               break;
-       }
-
-       nv_error(therm, "GPIO %d unknown PWM: 0x%08x\n", line, gpio);
-       return -ENODEV;
-}
-
-static int
-nvd0_fan_pwm_ctrl(struct nouveau_therm *therm, int line, bool enable)
-{
-       u32 data = enable ? 0x00000040 : 0x00000000;
-       int indx = pwm_info(therm, line);
-       if (indx < 0)
-               return indx;
-       else if (indx < 2)
-               nv_mask(therm, 0x00d610 + (line * 0x04), 0x000000c0, data);
-       /* nothing to do for indx == 2, it seems hardwired to PTHERM */
-       return 0;
-}
-
-static int
-nvd0_fan_pwm_get(struct nouveau_therm *therm, int line, u32 *divs, u32 *duty)
-{
-       int indx = pwm_info(therm, line);
-       if (indx < 0)
-               return indx;
-       else if (indx < 2) {
-               if (nv_rd32(therm, 0x00d610 + (line * 0x04)) & 0x00000040) {
-                       *divs = nv_rd32(therm, 0x00e114 + (indx * 8));
-                       *duty = nv_rd32(therm, 0x00e118 + (indx * 8));
-                       return 0;
-               }
-       } else if (indx == 2) {
-               *divs = nv_rd32(therm, 0x0200d8) & 0x1fff;
-               *duty = nv_rd32(therm, 0x0200dc) & 0x1fff;
-               return 0;
-       }
-
-       return -EINVAL;
-}
-
-static int
-nvd0_fan_pwm_set(struct nouveau_therm *therm, int line, u32 divs, u32 duty)
-{
-       int indx = pwm_info(therm, line);
-       if (indx < 0)
-               return indx;
-       else if (indx < 2) {
-               nv_wr32(therm, 0x00e114 + (indx * 8), divs);
-               nv_wr32(therm, 0x00e118 + (indx * 8), duty | 0x80000000);
-       } else if (indx == 2) {
-               nv_mask(therm, 0x0200d8, 0x1fff, divs); /* keep the high bits */
-               nv_wr32(therm, 0x0200dc, duty | 0x40000000);
-       }
-       return 0;
-}
-
-static int
-nvd0_fan_pwm_clock(struct nouveau_therm *therm, int line)
-{
-       int indx = pwm_info(therm, line);
-       if (indx < 0)
-               return 0;
-       else if (indx < 2)
-               return (nv_device(therm)->crystal * 1000) / 20;
-       else
-               return nv_device(therm)->crystal * 1000 / 10;
-}
-
-int
-nvd0_therm_init(struct nouveau_object *object)
-{
-       struct nvd0_therm_priv *priv = (void *)object;
-       int ret;
-
-       ret = nouveau_therm_init(&priv->base.base);
-       if (ret)
-               return ret;
-
-       /* enable fan tach, count revolutions per-second */
-       nv_mask(priv, 0x00e720, 0x00000003, 0x00000002);
-       if (priv->base.fan->tach.func != DCB_GPIO_UNUSED) {
-               nv_mask(priv, 0x00d79c, 0x000000ff, priv->base.fan->tach.line);
-               nv_wr32(priv, 0x00e724, nv_device(priv)->crystal * 1000);
-               nv_mask(priv, 0x00e720, 0x00000001, 0x00000001);
-       }
-       nv_mask(priv, 0x00e720, 0x00000002, 0x00000000);
-
-       return 0;
-}
-
-static int
-nvd0_therm_ctor(struct nouveau_object *parent,
-               struct nouveau_object *engine,
-               struct nouveau_oclass *oclass, void *data, u32 size,
-               struct nouveau_object **pobject)
-{
-       struct nvd0_therm_priv *priv;
-       int ret;
-
-       ret = nouveau_therm_create(parent, engine, oclass, &priv);
-       *pobject = nv_object(priv);
-       if (ret)
-               return ret;
-
-       nv84_sensor_setup(&priv->base.base);
-
-       priv->base.base.pwm_ctrl = nvd0_fan_pwm_ctrl;
-       priv->base.base.pwm_get = nvd0_fan_pwm_get;
-       priv->base.base.pwm_set = nvd0_fan_pwm_set;
-       priv->base.base.pwm_clock = nvd0_fan_pwm_clock;
-       priv->base.base.temp_get = nv84_temp_get;
-       priv->base.base.fan_sense = nva3_therm_fan_sense;
-       priv->base.sensor.program_alarms = nouveau_therm_program_alarms_polling;
-       return nouveau_therm_preinit(&priv->base.base);
-}
-
-struct nouveau_oclass
-nvd0_therm_oclass = {
-       .handle = NV_SUBDEV(THERM, 0xd0),
-       .ofuncs = &(struct nouveau_ofuncs) {
-               .ctor = nvd0_therm_ctor,
-               .dtor = _nouveau_therm_dtor,
-               .init = nvd0_therm_init,
-               .fini = nv84_therm_fini,
-       },
-};
index 8db6308187933b68335008a4bfea63421ec71925..916a149efe6e21e440393b1e1575188491985983 100644 (file)
@@ -1,6 +1,5 @@
 #ifndef __NVTHERM_PRIV_H__
 #define __NVTHERM_PRIV_H__
-
 /*
  * Copyright 2012 The Nouveau community
  *
@@ -24,9 +23,7 @@
  *
  * Authors: Martin Peres
  */
-
 #include <subdev/therm.h>
-
 #include <subdev/bios.h>
 #include <subdev/bios/extdev.h>
 #include <subdev/bios/gpio.h>
 #include <subdev/bios/therm.h>
 #include <subdev/timer.h>
 
-struct nouveau_fan {
-       struct nouveau_therm *parent;
+struct nvkm_fan {
+       struct nvkm_therm *parent;
        const char *type;
 
        struct nvbios_therm_fan bios;
        struct nvbios_perf_fan perf;
 
-       struct nouveau_alarm alarm;
+       struct nvkm_alarm alarm;
        spinlock_t lock;
        int percent;
 
-       int (*get)(struct nouveau_therm *therm);
-       int (*set)(struct nouveau_therm *therm, int percent);
+       int (*get)(struct nvkm_therm *);
+       int (*set)(struct nvkm_therm *, int percent);
 
        struct dcb_gpio_func tach;
 };
 
-enum nouveau_therm_thrs_direction {
-       NOUVEAU_THERM_THRS_FALLING = 0,
-       NOUVEAU_THERM_THRS_RISING = 1
+enum nvkm_therm_thrs_direction {
+       NVKM_THERM_THRS_FALLING = 0,
+       NVKM_THERM_THRS_RISING = 1
 };
 
-enum nouveau_therm_thrs_state {
-       NOUVEAU_THERM_THRS_LOWER = 0,
-       NOUVEAU_THERM_THRS_HIGHER = 1
+enum nvkm_therm_thrs_state {
+       NVKM_THERM_THRS_LOWER = 0,
+       NVKM_THERM_THRS_HIGHER = 1
 };
 
-enum nouveau_therm_thrs {
-       NOUVEAU_THERM_THRS_FANBOOST = 0,
-       NOUVEAU_THERM_THRS_DOWNCLOCK = 1,
-       NOUVEAU_THERM_THRS_CRITICAL = 2,
-       NOUVEAU_THERM_THRS_SHUTDOWN = 3,
-       NOUVEAU_THERM_THRS_NR
+enum nvkm_therm_thrs {
+       NVKM_THERM_THRS_FANBOOST = 0,
+       NVKM_THERM_THRS_DOWNCLOCK = 1,
+       NVKM_THERM_THRS_CRITICAL = 2,
+       NVKM_THERM_THRS_SHUTDOWN = 3,
+       NVKM_THERM_THRS_NR
 };
 
-struct nouveau_therm_priv {
-       struct nouveau_therm base;
+struct nvkm_therm_priv {
+       struct nvkm_therm base;
 
        /* automatic thermal management */
-       struct nouveau_alarm alarm;
+       struct nvkm_alarm alarm;
        spinlock_t lock;
        struct nvbios_therm_trip_point *last_trip;
        int mode;
@@ -84,77 +81,73 @@ struct nouveau_therm_priv {
        struct nvbios_therm_sensor bios_sensor;
 
        /* fan priv */
-       struct nouveau_fan *fan;
+       struct nvkm_fan *fan;
 
        /* alarms priv */
        struct {
                spinlock_t alarm_program_lock;
-               struct nouveau_alarm therm_poll_alarm;
-               enum nouveau_therm_thrs_state alarm_state[NOUVEAU_THERM_THRS_NR];
-               void (*program_alarms)(struct nouveau_therm *);
+               struct nvkm_alarm therm_poll_alarm;
+               enum nvkm_therm_thrs_state alarm_state[NVKM_THERM_THRS_NR];
+               void (*program_alarms)(struct nvkm_therm *);
        } sensor;
 
        /* what should be done if the card overheats */
        struct {
-               void (*downclock)(struct nouveau_therm *, bool active);
-               void (*pause)(struct nouveau_therm *, bool active);
+               void (*downclock)(struct nvkm_therm *, bool active);
+               void (*pause)(struct nvkm_therm *, bool active);
        } emergency;
 
        /* ic */
        struct i2c_client *ic;
 };
 
-int nouveau_therm_fan_mode(struct nouveau_therm *therm, int mode);
-int nouveau_therm_attr_get(struct nouveau_therm *therm,
-                      enum nouveau_therm_attr_type type);
-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);
-
-int nouveau_therm_sensor_ctor(struct nouveau_therm *therm);
-
-int nouveau_therm_fan_ctor(struct nouveau_therm *therm);
-int nouveau_therm_fan_init(struct nouveau_therm *therm);
-int nouveau_therm_fan_fini(struct nouveau_therm *therm, bool suspend);
-int nouveau_therm_fan_get(struct nouveau_therm *therm);
-int nouveau_therm_fan_set(struct nouveau_therm *therm, bool now, int percent);
-int nouveau_therm_fan_user_get(struct nouveau_therm *therm);
-int nouveau_therm_fan_user_set(struct nouveau_therm *therm, int percent);
-
-int nouveau_therm_fan_sense(struct nouveau_therm *therm);
-
-int nouveau_therm_preinit(struct nouveau_therm *);
-
-int nouveau_therm_sensor_init(struct nouveau_therm *therm);
-int nouveau_therm_sensor_fini(struct nouveau_therm *therm, bool suspend);
-void nouveau_therm_sensor_preinit(struct nouveau_therm *);
-void nouveau_therm_sensor_set_threshold_state(struct nouveau_therm *therm,
-                                            enum nouveau_therm_thrs thrs,
-                                            enum nouveau_therm_thrs_state st);
-enum nouveau_therm_thrs_state
-nouveau_therm_sensor_get_threshold_state(struct nouveau_therm *therm,
-                                        enum nouveau_therm_thrs thrs);
-void nouveau_therm_sensor_event(struct nouveau_therm *therm,
-                               enum nouveau_therm_thrs thrs,
-                               enum nouveau_therm_thrs_direction dir);
-void nouveau_therm_program_alarms_polling(struct nouveau_therm *therm);
-
-void nv40_therm_intr(struct nouveau_subdev *);
-int nv50_fan_pwm_ctrl(struct nouveau_therm *, int, bool);
-int nv50_fan_pwm_get(struct nouveau_therm *, int, u32 *, u32 *);
-int nv50_fan_pwm_set(struct nouveau_therm *, int, u32, u32);
-int nv50_fan_pwm_clock(struct nouveau_therm *, int);
-int nv84_temp_get(struct nouveau_therm *therm);
-void nv84_sensor_setup(struct nouveau_therm *therm);
-int nv84_therm_fini(struct nouveau_object *object, bool suspend);
-
-int nva3_therm_fan_sense(struct nouveau_therm *);
-
-int nvd0_therm_init(struct nouveau_object *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_therm_fan_mode(struct nvkm_therm *, int mode);
+int nvkm_therm_attr_get(struct nvkm_therm *, enum nvkm_therm_attr_type);
+int nvkm_therm_attr_set(struct nvkm_therm *, enum nvkm_therm_attr_type, int);
+
+void nvkm_therm_ic_ctor(struct nvkm_therm *);
+
+int nvkm_therm_sensor_ctor(struct nvkm_therm *);
+
+int nvkm_therm_fan_ctor(struct nvkm_therm *);
+int nvkm_therm_fan_init(struct nvkm_therm *);
+int nvkm_therm_fan_fini(struct nvkm_therm *, bool suspend);
+int nvkm_therm_fan_get(struct nvkm_therm *);
+int nvkm_therm_fan_set(struct nvkm_therm *, bool now, int percent);
+int nvkm_therm_fan_user_get(struct nvkm_therm *);
+int nvkm_therm_fan_user_set(struct nvkm_therm *, int percent);
+
+int nvkm_therm_fan_sense(struct nvkm_therm *);
+
+int nvkm_therm_preinit(struct nvkm_therm *);
+
+int  nvkm_therm_sensor_init(struct nvkm_therm *);
+int  nvkm_therm_sensor_fini(struct nvkm_therm *, bool suspend);
+void nvkm_therm_sensor_preinit(struct nvkm_therm *);
+void nvkm_therm_sensor_set_threshold_state(struct nvkm_therm *,
+                                          enum nvkm_therm_thrs,
+                                          enum nvkm_therm_thrs_state);
+enum nvkm_therm_thrs_state
+nvkm_therm_sensor_get_threshold_state(struct nvkm_therm *,
+                                     enum nvkm_therm_thrs);
+void nvkm_therm_sensor_event(struct nvkm_therm *, enum nvkm_therm_thrs,
+                            enum nvkm_therm_thrs_direction);
+void nvkm_therm_program_alarms_polling(struct nvkm_therm *);
+
+void nv40_therm_intr(struct nvkm_subdev *);
+int  nv50_fan_pwm_ctrl(struct nvkm_therm *, int, bool);
+int  nv50_fan_pwm_get(struct nvkm_therm *, int, u32 *, u32 *);
+int  nv50_fan_pwm_set(struct nvkm_therm *, int, u32, u32);
+int  nv50_fan_pwm_clock(struct nvkm_therm *, int);
+int  g84_temp_get(struct nvkm_therm *);
+void g84_sensor_setup(struct nvkm_therm *);
+int  g84_therm_fini(struct nvkm_object *, bool suspend);
+
+int gt215_therm_fan_sense(struct nvkm_therm *);
+
+int gf110_therm_init(struct nvkm_object *);
+
+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
index 6212537b90c5bc85e0ebfa8d9cf008f30ab2d233..aa13744f3854bc2ec769386e657742e87595d128 100644 (file)
  *
  * Authors: Martin Peres
  */
-
 #include "priv.h"
 
-#include <core/object.h>
-#include <core/device.h>
-
-#include <subdev/bios.h>
-
 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;
 
@@ -51,9 +45,9 @@ nouveau_therm_temp_set_defaults(struct nouveau_therm *therm)
 
 
 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;
 
        /* 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 ! */
-void nouveau_therm_sensor_set_threshold_state(struct nouveau_therm *therm,
-                                            enum nouveau_therm_thrs thrs,
-                                            enum nouveau_therm_thrs_state st)
+void
+nvkm_therm_sensor_set_threshold_state(struct nvkm_therm *therm,
+                                     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;
 }
 
 /* must be called with alarm_program_lock taken ! */
-enum nouveau_therm_thrs_state
-nouveau_therm_sensor_get_threshold_state(struct nouveau_therm *therm,
-                                        enum nouveau_therm_thrs thrs)
+enum nvkm_therm_thrs_state
+nvkm_therm_sensor_get_threshold_state(struct nvkm_therm *therm,
+                                     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];
 }
 
@@ -88,11 +83,11 @@ nv_poweroff_work(struct work_struct *work)
        kfree(work);
 }
 
-void nouveau_therm_sensor_event(struct nouveau_therm *therm,
-                               enum nouveau_therm_thrs thrs,
-                               enum nouveau_therm_thrs_direction dir)
+void
+nvkm_therm_sensor_event(struct nvkm_therm *therm, enum nvkm_therm_thrs thrs,
+                       enum nvkm_therm_thrs_direction dir)
 {
-       struct nouveau_therm_priv *priv = (void *)therm;
+       struct nvkm_therm_priv *priv = (void *)therm;
        bool active;
        const char *thresolds[] = {
                "fanboost", "downclock", "critical", "shutdown"
@@ -102,30 +97,30 @@ void nouveau_therm_sensor_event(struct nouveau_therm *therm,
        if (thrs < 0 || thrs > 3)
                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",
                        temperature, thresolds[thrs]);
        else
                nv_info(therm, "temperature (%i C) hit the '%s' threshold\n",
                        temperature, thresolds[thrs]);
 
-       active = (dir == NOUVEAU_THERM_THRS_RISING);
+       active = (dir == NVKM_THERM_THRS_RISING);
        switch (thrs) {
-       case NOUVEAU_THERM_THRS_FANBOOST:
+       case NVKM_THERM_THRS_FANBOOST:
                if (active) {
-                       nouveau_therm_fan_set(therm, true, 100);
-                       nouveau_therm_fan_mode(therm, NOUVEAU_THERM_CTRL_AUTO);
+                       nvkm_therm_fan_set(therm, true, 100);
+                       nvkm_therm_fan_mode(therm, NVKM_THERM_CTRL_AUTO);
                }
                break;
-       case NOUVEAU_THERM_THRS_DOWNCLOCK:
+       case NVKM_THERM_THRS_DOWNCLOCK:
                if (priv->emergency.downclock)
                        priv->emergency.downclock(therm, active);
                break;
-       case NOUVEAU_THERM_THRS_CRITICAL:
+       case NVKM_THERM_THRS_CRITICAL:
                if (priv->emergency.pause)
                        priv->emergency.pause(therm, active);
                break;
-       case NOUVEAU_THERM_THRS_SHUTDOWN:
+       case NVKM_THERM_THRS_SHUTDOWN:
                if (active) {
                        struct work_struct *work;
 
@@ -136,7 +131,7 @@ void nouveau_therm_sensor_event(struct nouveau_therm *therm,
                        }
                }
                break;
-       case NOUVEAU_THERM_THRS_NR:
+       case NVKM_THERM_THRS_NR:
                break;
        }
 
@@ -144,53 +139,53 @@ void nouveau_therm_sensor_event(struct nouveau_therm *therm,
 
 /* must be called with alarm_program_lock taken ! */
 static void
-nouveau_therm_threshold_hyst_polling(struct nouveau_therm *therm,
-                                  const struct nvbios_therm_threshold *thrs,
-                                  enum nouveau_therm_thrs thrs_name)
+nvkm_therm_threshold_hyst_polling(struct nvkm_therm *therm,
+                                 const struct nvbios_therm_threshold *thrs,
+                                 enum nvkm_therm_thrs thrs_name)
 {
-       enum nouveau_therm_thrs_direction direction;
-       enum nouveau_therm_thrs_state prev_state, new_state;
+       enum nvkm_therm_thrs_direction direction;
+       enum nvkm_therm_thrs_state prev_state, new_state;
        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) {
-               direction = NOUVEAU_THERM_THRS_RISING;
-               new_state = NOUVEAU_THERM_THRS_HIGHER;
+       if (temp >= thrs->temp && prev_state == NVKM_THERM_THRS_LOWER) {
+               direction = NVKM_THERM_THRS_RISING;
+               new_state = NVKM_THERM_THRS_HIGHER;
        } else if (temp <= thrs->temp - thrs->hysteresis &&
-                       prev_state == NOUVEAU_THERM_THRS_HIGHER) {
-               direction = NOUVEAU_THERM_THRS_FALLING;
-               new_state = NOUVEAU_THERM_THRS_LOWER;
+                       prev_state == NVKM_THERM_THRS_HIGHER) {
+               direction = NVKM_THERM_THRS_FALLING;
+               new_state = NVKM_THERM_THRS_LOWER;
        } else
                return; /* nothing to do */
 
-       nouveau_therm_sensor_set_threshold_state(therm, thrs_name, new_state);
-       nouveau_therm_sensor_event(therm, thrs_name, direction);
+       nvkm_therm_sensor_set_threshold_state(therm, thrs_name, new_state);
+       nvkm_therm_sensor_event(therm, thrs_name, direction);
 }
 
 static void
-alarm_timer_callback(struct nouveau_alarm *alarm)
+alarm_timer_callback(struct nvkm_alarm *alarm)
 {
-       struct nouveau_therm_priv *priv =
-       container_of(alarm, struct nouveau_therm_priv, sensor.therm_poll_alarm);
+       struct nvkm_therm_priv *priv =
+       container_of(alarm, struct nvkm_therm_priv, sensor.therm_poll_alarm);
        struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
-       struct nouveau_timer *ptimer = nouveau_timer(priv);
-       struct nouveau_therm *therm = &priv->base;
+       struct nvkm_timer *ptimer = nvkm_timer(priv);
+       struct nvkm_therm *therm = &priv->base;
        unsigned long flags;
 
        spin_lock_irqsave(&priv->sensor.alarm_program_lock, flags);
 
-       nouveau_therm_threshold_hyst_polling(therm, &sensor->thrs_fan_boost,
-                                            NOUVEAU_THERM_THRS_FANBOOST);
+       nvkm_therm_threshold_hyst_polling(therm, &sensor->thrs_fan_boost,
+                                         NVKM_THERM_THRS_FANBOOST);
 
-       nouveau_therm_threshold_hyst_polling(therm, &sensor->thrs_down_clock,
-                                            NOUVEAU_THERM_THRS_DOWNCLOCK);
+       nvkm_therm_threshold_hyst_polling(therm, &sensor->thrs_down_clock,
+                                         NVKM_THERM_THRS_DOWNCLOCK);
 
-       nouveau_therm_threshold_hyst_polling(therm, &sensor->thrs_critical,
-                                            NOUVEAU_THERM_THRS_CRITICAL);
+       nvkm_therm_threshold_hyst_polling(therm, &sensor->thrs_critical,
+                                         NVKM_THERM_THRS_CRITICAL);
 
-       nouveau_therm_threshold_hyst_polling(therm, &sensor->thrs_shutdown,
-                                            NOUVEAU_THERM_THRS_SHUTDOWN);
+       nvkm_therm_threshold_hyst_polling(therm, &sensor->thrs_shutdown,
+                                         NVKM_THERM_THRS_SHUTDOWN);
 
        spin_unlock_irqrestore(&priv->sensor.alarm_program_lock, flags);
 
@@ -200,9 +195,9 @@ alarm_timer_callback(struct nouveau_alarm *alarm)
 }
 
 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;
 
        nv_debug(therm,
@@ -217,18 +212,18 @@ nouveau_therm_program_alarms_polling(struct nouveau_therm *therm)
 }
 
 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);
        return 0;
 }
 
 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 nouveau_timer *ptimer = nouveau_timer(therm);
+       struct nvkm_therm_priv *priv = (void *)therm;
+       struct nvkm_timer *ptimer = nvkm_timer(therm);
 
        if (suspend)
                ptimer->alarm_cancel(ptimer, &priv->sensor.therm_poll_alarm);
@@ -236,7 +231,7 @@ nouveau_therm_sensor_fini(struct nouveau_therm *therm, bool suspend)
 }
 
 void
-nouveau_therm_sensor_preinit(struct nouveau_therm *therm)
+nvkm_therm_sensor_preinit(struct nvkm_therm *therm)
 {
        const char *sensor_avail = "yes";
 
@@ -247,18 +242,18 @@ nouveau_therm_sensor_preinit(struct nouveau_therm *therm)
 }
 
 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 nouveau_bios *bios = nouveau_bios(therm);
+       struct nvkm_therm_priv *priv = (void *)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,
                                      &priv->bios_sensor))
                nv_error(therm, "nvbios_therm_sensor_parse failed\n");
-       nouveau_therm_temp_safety_checks(therm);
+       nvkm_therm_temp_safety_checks(therm);
 
        return 0;
 }