Skip to content

Commit

Permalink
drm/nouveau/therm: namespace + nvidia gpu names (no binary change)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ben Skeggs committed Jan 22, 2015
1 parent 21b1379 commit e140461
Show file tree
Hide file tree
Showing 20 changed files with 639 additions and 685 deletions.
116 changes: 56 additions & 60 deletions drivers/gpu/drm/nouveau/include/nvkm/subdev/therm.h
Original file line number Diff line number Diff line change
@@ -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
44 changes: 22 additions & 22 deletions drivers/gpu/drm/nouveau/nouveau_hwmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand All @@ -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,
Expand All @@ -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;
Expand All @@ -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,
Expand All @@ -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;
}
Expand All @@ -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,
Expand All @@ -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;
Expand All @@ -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,
Expand All @@ -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;
}
Expand All @@ -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,
Expand All @@ -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;
Expand All @@ -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,
Expand All @@ -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;
}
Expand All @@ -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,
Expand All @@ -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;
Expand Down Expand Up @@ -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;

Expand All @@ -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
Expand Down Expand Up @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand Down
Loading

0 comments on commit e140461

Please sign in to comment.