drm/nouveau/volt: namespace + nvidia gpu names (no binary change)

The namespace of NVKM is being changed to nvkm_ instead of nouveau_,
which will be used for the DRM part of the driver.  This is being
done in order to make it very clear as to what part of the driver a
given symbol belongs to, and as a minor step towards splitting the
DRM driver out to be able to stand on its own (for virt).

Because there's already a large amount of churn here anyway, this is
as good a time as any to also switch to NVIDIA's device and chipset
naming to ease collaboration with them.

A comparison of objdump disassemblies proves no code changes.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
Ben Skeggs 2015-01-14 15:13:36 +10:00
parent 9e79a85343
commit de3aaa6651
6 changed files with 100 additions and 108 deletions

View File

@ -1,22 +1,20 @@
#ifndef __NOUVEAU_VOLT_H__ #ifndef __NVKM_VOLT_H__
#define __NOUVEAU_VOLT_H__ #define __NVKM_VOLT_H__
#include <core/subdev.h> #include <core/subdev.h>
#include <core/device.h>
struct nouveau_voltage { struct nvkm_voltage {
u32 uv; u32 uv;
u8 id; u8 id;
}; };
struct nouveau_volt { struct nvkm_volt {
struct nouveau_subdev base; struct nvkm_subdev base;
int (*vid_get)(struct nouveau_volt *); int (*vid_get)(struct nvkm_volt *);
int (*get)(struct nouveau_volt *); int (*get)(struct nvkm_volt *);
int (*vid_set)(struct nouveau_volt *, u8 vid); int (*vid_set)(struct nvkm_volt *, u8 vid);
int (*set)(struct nouveau_volt *, u32 uv); int (*set)(struct nvkm_volt *, u32 uv);
int (*set_id)(struct nouveau_volt *, u8 id, int condition); int (*set_id)(struct nvkm_volt *, u8 id, int condition);
u8 vid_mask; u8 vid_mask;
u8 vid_nr; u8 vid_nr;
@ -26,36 +24,35 @@ struct nouveau_volt {
} vid[256]; } vid[256];
}; };
static inline struct nouveau_volt * static inline struct nvkm_volt *
nouveau_volt(void *obj) nvkm_volt(void *obj)
{ {
return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_VOLT); return (void *)nvkm_subdev(obj, NVDEV_SUBDEV_VOLT);
} }
#define nouveau_volt_create(p, e, o, d) \ #define nvkm_volt_create(p, e, o, d) \
nouveau_volt_create_((p), (e), (o), sizeof(**d), (void **)d) nvkm_volt_create_((p), (e), (o), sizeof(**d), (void **)d)
#define nouveau_volt_destroy(p) ({ \ #define nvkm_volt_destroy(p) ({ \
struct nouveau_volt *v = (p); \ struct nvkm_volt *v = (p); \
_nouveau_volt_dtor(nv_object(v)); \ _nvkm_volt_dtor(nv_object(v)); \
}) })
#define nouveau_volt_init(p) ({ \ #define nvkm_volt_init(p) ({ \
struct nouveau_volt *v = (p); \ struct nvkm_volt *v = (p); \
_nouveau_volt_init(nv_object(v)); \ _nvkm_volt_init(nv_object(v)); \
}) })
#define nouveau_volt_fini(p,s) \ #define nvkm_volt_fini(p,s) \
nouveau_subdev_fini((p), (s)) nvkm_subdev_fini((p), (s))
int nouveau_volt_create_(struct nouveau_object *, struct nouveau_object *, int nvkm_volt_create_(struct nvkm_object *, struct nvkm_object *,
struct nouveau_oclass *, int, void **); struct nvkm_oclass *, int, void **);
void _nouveau_volt_dtor(struct nouveau_object *); void _nvkm_volt_dtor(struct nvkm_object *);
int _nouveau_volt_init(struct nouveau_object *); int _nvkm_volt_init(struct nvkm_object *);
#define _nouveau_volt_fini _nouveau_subdev_fini #define _nvkm_volt_fini _nvkm_subdev_fini
extern struct nouveau_oclass nv40_volt_oclass; extern struct nvkm_oclass nv40_volt_oclass;
extern struct nouveau_oclass gk20a_volt_oclass; extern struct nvkm_oclass gk20a_volt_oclass;
int nouveau_voltgpio_init(struct nouveau_volt *);
int nouveau_voltgpio_get(struct nouveau_volt *);
int nouveau_voltgpio_set(struct nouveau_volt *, u8);
int nvkm_voltgpio_init(struct nvkm_volt *);
int nvkm_voltgpio_get(struct nvkm_volt *);
int nvkm_voltgpio_set(struct nvkm_volt *, u8);
#endif #endif

View File

@ -30,6 +30,7 @@
#include <subdev/therm.h> #include <subdev/therm.h>
#include <subdev/volt.h> #include <subdev/volt.h>
#include <core/device.h>
#include <core/option.h> #include <core/option.h>
/****************************************************************************** /******************************************************************************

View File

@ -21,15 +21,13 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include <subdev/volt.h> #include <subdev/volt.h>
#include <subdev/bios.h> #include <subdev/bios.h>
#include <subdev/bios/vmap.h> #include <subdev/bios/vmap.h>
#include <subdev/bios/volt.h> #include <subdev/bios/volt.h>
static int static int
nouveau_volt_get(struct nouveau_volt *volt) nvkm_volt_get(struct nvkm_volt *volt)
{ {
if (volt->vid_get) { if (volt->vid_get) {
int ret = volt->vid_get(volt), i; int ret = volt->vid_get(volt), i;
@ -46,7 +44,7 @@ nouveau_volt_get(struct nouveau_volt *volt)
} }
static int static int
nouveau_volt_set(struct nouveau_volt *volt, u32 uv) nvkm_volt_set(struct nvkm_volt *volt, u32 uv)
{ {
if (volt->vid_set) { if (volt->vid_set) {
int i, ret = -EINVAL; int i, ret = -EINVAL;
@ -63,9 +61,9 @@ nouveau_volt_set(struct nouveau_volt *volt, u32 uv)
} }
static int static int
nouveau_volt_map(struct nouveau_volt *volt, u8 id) nvkm_volt_map(struct nvkm_volt *volt, u8 id)
{ {
struct nouveau_bios *bios = nouveau_bios(volt); struct nvkm_bios *bios = nvkm_bios(volt);
struct nvbios_vmap_entry info; struct nvbios_vmap_entry info;
u8 ver, len; u8 ver, len;
u16 vmap; u16 vmap;
@ -73,7 +71,7 @@ nouveau_volt_map(struct nouveau_volt *volt, u8 id)
vmap = nvbios_vmap_entry_parse(bios, id, &ver, &len, &info); vmap = nvbios_vmap_entry_parse(bios, id, &ver, &len, &info);
if (vmap) { if (vmap) {
if (info.link != 0xff) { if (info.link != 0xff) {
int ret = nouveau_volt_map(volt, info.link); int ret = nvkm_volt_map(volt, info.link);
if (ret < 0) if (ret < 0)
return ret; return ret;
info.min += ret; info.min += ret;
@ -85,15 +83,15 @@ nouveau_volt_map(struct nouveau_volt *volt, u8 id)
} }
static int static int
nouveau_volt_set_id(struct nouveau_volt *volt, u8 id, int condition) nvkm_volt_set_id(struct nvkm_volt *volt, u8 id, int condition)
{ {
int ret = nouveau_volt_map(volt, id); int ret = nvkm_volt_map(volt, id);
if (ret >= 0) { if (ret >= 0) {
int prev = nouveau_volt_get(volt); int prev = nvkm_volt_get(volt);
if (!condition || prev < 0 || if (!condition || prev < 0 ||
(condition < 0 && ret < prev) || (condition < 0 && ret < prev) ||
(condition > 0 && ret > prev)) { (condition > 0 && ret > prev)) {
ret = nouveau_volt_set(volt, ret); ret = nvkm_volt_set(volt, ret);
} else { } else {
ret = 0; ret = 0;
} }
@ -101,8 +99,8 @@ nouveau_volt_set_id(struct nouveau_volt *volt, u8 id, int condition)
return ret; return ret;
} }
static void nouveau_volt_parse_bios(struct nouveau_bios *bios, static void
struct nouveau_volt *volt) nvkm_volt_parse_bios(struct nvkm_bios *bios, struct nvkm_volt *volt)
{ {
struct nvbios_volt_entry ivid; struct nvbios_volt_entry ivid;
struct nvbios_volt info; struct nvbios_volt info;
@ -125,7 +123,7 @@ static void nouveau_volt_parse_bios(struct nouveau_bios *bios,
} else if (data && info.vidmask) { } else if (data && info.vidmask) {
for (i = 0; i < cnt; i++) { for (i = 0; i < cnt; i++) {
data = nvbios_volt_entry_parse(bios, i, &ver, &hdr, data = nvbios_volt_entry_parse(bios, i, &ver, &hdr,
&ivid); &ivid);
if (data) { if (data) {
volt->vid[volt->vid_nr].uv = ivid.voltage; volt->vid[volt->vid_nr].uv = ivid.voltage;
volt->vid[volt->vid_nr].vid = ivid.vid; volt->vid[volt->vid_nr].vid = ivid.vid;
@ -137,12 +135,12 @@ static void nouveau_volt_parse_bios(struct nouveau_bios *bios,
} }
int int
_nouveau_volt_init(struct nouveau_object *object) _nvkm_volt_init(struct nvkm_object *object)
{ {
struct nouveau_volt *volt = (void *)object; struct nvkm_volt *volt = (void *)object;
int ret; int ret;
ret = nouveau_subdev_init(&volt->base); ret = nvkm_subdev_init(&volt->base);
if (ret) if (ret)
return ret; return ret;
@ -158,34 +156,33 @@ _nouveau_volt_init(struct nouveau_object *object)
} }
void void
_nouveau_volt_dtor(struct nouveau_object *object) _nvkm_volt_dtor(struct nvkm_object *object)
{ {
struct nouveau_volt *volt = (void *)object; struct nvkm_volt *volt = (void *)object;
nouveau_subdev_destroy(&volt->base); nvkm_subdev_destroy(&volt->base);
} }
int int
nouveau_volt_create_(struct nouveau_object *parent, nvkm_volt_create_(struct nvkm_object *parent, struct nvkm_object *engine,
struct nouveau_object *engine, struct nvkm_oclass *oclass, int length, void **pobject)
struct nouveau_oclass *oclass, int length, void **pobject)
{ {
struct nouveau_bios *bios = nouveau_bios(parent); struct nvkm_bios *bios = nvkm_bios(parent);
struct nouveau_volt *volt; struct nvkm_volt *volt;
int ret, i; int ret, i;
ret = nouveau_subdev_create_(parent, engine, oclass, 0, "VOLT", ret = nvkm_subdev_create_(parent, engine, oclass, 0, "VOLT",
"voltage", length, pobject); "voltage", length, pobject);
volt = *pobject; volt = *pobject;
if (ret) if (ret)
return ret; return ret;
volt->get = nouveau_volt_get; volt->get = nvkm_volt_get;
volt->set = nouveau_volt_set; volt->set = nvkm_volt_set;
volt->set_id = nouveau_volt_set_id; volt->set_id = nvkm_volt_set_id;
/* Assuming the non-bios device should build the voltage table later */ /* Assuming the non-bios device should build the voltage table later */
if (bios) if (bios)
nouveau_volt_parse_bios(bios, volt); nvkm_volt_parse_bios(bios, volt);
if (volt->vid_nr) { if (volt->vid_nr) {
for (i = 0; i < volt->vid_nr; i++) { for (i = 0; i < volt->vid_nr; i++) {
@ -196,10 +193,10 @@ nouveau_volt_create_(struct nouveau_object *parent,
/*XXX: this is an assumption.. there probably exists boards /*XXX: this is an assumption.. there probably exists boards
* out there with i2c-connected voltage controllers too.. * out there with i2c-connected voltage controllers too..
*/ */
ret = nouveau_voltgpio_init(volt); ret = nvkm_voltgpio_init(volt);
if (ret == 0) { if (ret == 0) {
volt->vid_get = nouveau_voltgpio_get; volt->vid_get = nvkm_voltgpio_get;
volt->vid_set = nouveau_voltgpio_set; volt->vid_set = nvkm_voltgpio_set;
} }
} }

View File

@ -19,11 +19,10 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
*/ */
#include <subdev/volt.h>
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <nouveau_platform.h> #include <nouveau_platform.h>
#endif #endif
#include <subdev/volt.h>
struct cvb_coef { struct cvb_coef {
int c0; int c0;
@ -35,7 +34,7 @@ struct cvb_coef {
}; };
struct gk20a_volt_priv { struct gk20a_volt_priv {
struct nouveau_volt base; struct nvkm_volt base;
struct regulator *vdd; struct regulator *vdd;
}; };
@ -62,8 +61,7 @@ const struct cvb_coef gk20a_cvb_coef[] = {
* cvb_mv = ((c2 * speedo / s_scale + c1) * speedo / s_scale + c0) * cvb_mv = ((c2 * speedo / s_scale + c1) * speedo / s_scale + c0)
*/ */
static inline int static inline int
gk20a_volt_get_cvb_voltage(int speedo, int s_scale, gk20a_volt_get_cvb_voltage(int speedo, int s_scale, const struct cvb_coef *coef)
const struct cvb_coef *coef)
{ {
int mv; int mv;
@ -79,7 +77,7 @@ gk20a_volt_get_cvb_voltage(int speedo, int s_scale,
*/ */
static inline int static inline int
gk20a_volt_get_cvb_t_voltage(int speedo, int temp, int s_scale, int t_scale, gk20a_volt_get_cvb_t_voltage(int speedo, int temp, int s_scale, int t_scale,
const struct cvb_coef *coef) const struct cvb_coef *coef)
{ {
int cvb_mv, mv; int cvb_mv, mv;
@ -103,7 +101,7 @@ gk20a_volt_calc_voltage(const struct cvb_coef *coef, int speedo)
} }
static int static int
gk20a_volt_vid_get(struct nouveau_volt *volt) gk20a_volt_vid_get(struct nvkm_volt *volt)
{ {
struct gk20a_volt_priv *priv = (void *)volt; struct gk20a_volt_priv *priv = (void *)volt;
int i, uv; int i, uv;
@ -118,7 +116,7 @@ gk20a_volt_vid_get(struct nouveau_volt *volt)
} }
static int static int
gk20a_volt_vid_set(struct nouveau_volt *volt, u8 vid) gk20a_volt_vid_set(struct nvkm_volt *volt, u8 vid)
{ {
struct gk20a_volt_priv *priv = (void *)volt; struct gk20a_volt_priv *priv = (void *)volt;
@ -127,7 +125,7 @@ gk20a_volt_vid_set(struct nouveau_volt *volt, u8 vid)
} }
static int static int
gk20a_volt_set_id(struct nouveau_volt *volt, u8 id, int condition) gk20a_volt_set_id(struct nvkm_volt *volt, u8 id, int condition)
{ {
struct gk20a_volt_priv *priv = (void *)volt; struct gk20a_volt_priv *priv = (void *)volt;
int prev_uv = regulator_get_voltage(priv->vdd); int prev_uv = regulator_get_voltage(priv->vdd);
@ -148,16 +146,16 @@ gk20a_volt_set_id(struct nouveau_volt *volt, u8 id, int condition)
} }
static int static int
gk20a_volt_ctor(struct nouveau_object *parent, struct nouveau_object *engine, gk20a_volt_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nouveau_oclass *oclass, void *data, u32 size, struct nvkm_oclass *oclass, void *data, u32 size,
struct nouveau_object **pobject) struct nvkm_object **pobject)
{ {
struct gk20a_volt_priv *priv; struct gk20a_volt_priv *priv;
struct nouveau_volt *volt; struct nvkm_volt *volt;
struct nouveau_platform_device *plat; struct nouveau_platform_device *plat;
int i, ret, uv; int i, ret, uv;
ret = nouveau_volt_create(parent, engine, oclass, &priv); ret = nvkm_volt_create(parent, engine, oclass, &priv);
*pobject = nv_object(priv); *pobject = nv_object(priv);
if (ret) if (ret)
return ret; return ret;
@ -187,13 +185,13 @@ gk20a_volt_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
return 0; return 0;
} }
struct nouveau_oclass struct nvkm_oclass
gk20a_volt_oclass = { gk20a_volt_oclass = {
.handle = NV_SUBDEV(VOLT, 0xea), .handle = NV_SUBDEV(VOLT, 0xea),
.ofuncs = &(struct nouveau_ofuncs) { .ofuncs = &(struct nvkm_ofuncs) {
.ctor = gk20a_volt_ctor, .ctor = gk20a_volt_ctor,
.dtor = _nouveau_volt_dtor, .dtor = _nvkm_volt_dtor,
.init = _nouveau_volt_init, .init = _nvkm_volt_init,
.fini = _nouveau_volt_fini, .fini = _nvkm_volt_fini,
}, },
}; };

View File

@ -21,10 +21,10 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include <subdev/volt.h> #include <subdev/volt.h>
#include <subdev/gpio.h> #include <subdev/bios.h>
#include <subdev/bios/gpio.h> #include <subdev/bios/gpio.h>
#include <subdev/gpio.h>
static const u8 tags[] = { static const u8 tags[] = {
DCB_GPIO_VID0, DCB_GPIO_VID1, DCB_GPIO_VID2, DCB_GPIO_VID3, DCB_GPIO_VID0, DCB_GPIO_VID1, DCB_GPIO_VID2, DCB_GPIO_VID3,
@ -32,9 +32,9 @@ static const u8 tags[] = {
}; };
int int
nouveau_voltgpio_get(struct nouveau_volt *volt) nvkm_voltgpio_get(struct nvkm_volt *volt)
{ {
struct nouveau_gpio *gpio = nouveau_gpio(volt); struct nvkm_gpio *gpio = nvkm_gpio(volt);
u8 vid = 0; u8 vid = 0;
int i; int i;
@ -51,9 +51,9 @@ nouveau_voltgpio_get(struct nouveau_volt *volt)
} }
int int
nouveau_voltgpio_set(struct nouveau_volt *volt, u8 vid) nvkm_voltgpio_set(struct nvkm_volt *volt, u8 vid)
{ {
struct nouveau_gpio *gpio = nouveau_gpio(volt); struct nvkm_gpio *gpio = nvkm_gpio(volt);
int i; int i;
for (i = 0; i < ARRAY_SIZE(tags); i++, vid >>= 1) { for (i = 0; i < ARRAY_SIZE(tags); i++, vid >>= 1) {
@ -68,9 +68,9 @@ nouveau_voltgpio_set(struct nouveau_volt *volt, u8 vid)
} }
int int
nouveau_voltgpio_init(struct nouveau_volt *volt) nvkm_voltgpio_init(struct nvkm_volt *volt)
{ {
struct nouveau_gpio *gpio = nouveau_gpio(volt); struct nvkm_gpio *gpio = nvkm_gpio(volt);
struct dcb_gpio_func func; struct dcb_gpio_func func;
int i; int i;

View File

@ -21,22 +21,21 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include <subdev/volt.h> #include <subdev/volt.h>
struct nv40_volt_priv { struct nv40_volt_priv {
struct nouveau_volt base; struct nvkm_volt base;
}; };
static int static int
nv40_volt_ctor(struct nouveau_object *parent, struct nouveau_object *engine, nv40_volt_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nouveau_oclass *oclass, void *data, u32 size, struct nvkm_oclass *oclass, void *data, u32 size,
struct nouveau_object **pobject) struct nvkm_object **pobject)
{ {
struct nv40_volt_priv *priv; struct nv40_volt_priv *priv;
int ret; int ret;
ret = nouveau_volt_create(parent, engine, oclass, &priv); ret = nvkm_volt_create(parent, engine, oclass, &priv);
*pobject = nv_object(priv); *pobject = nv_object(priv);
if (ret) if (ret)
return ret; return ret;
@ -44,13 +43,13 @@ nv40_volt_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
return 0; return 0;
} }
struct nouveau_oclass struct nvkm_oclass
nv40_volt_oclass = { nv40_volt_oclass = {
.handle = NV_SUBDEV(VOLT, 0x40), .handle = NV_SUBDEV(VOLT, 0x40),
.ofuncs = &(struct nouveau_ofuncs) { .ofuncs = &(struct nvkm_ofuncs) {
.ctor = nv40_volt_ctor, .ctor = nv40_volt_ctor,
.dtor = _nouveau_volt_dtor, .dtor = _nvkm_volt_dtor,
.init = _nouveau_volt_init, .init = _nvkm_volt_init,
.fini = _nouveau_volt_fini, .fini = _nvkm_volt_fini,
}, },
}; };