drm/nouveau/volt: switch to subdev printk macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
Ben Skeggs 2015-08-20 14:54:12 +10:00
parent 9d7b9d9f11
commit 185eda3339
3 changed files with 22 additions and 15 deletions

View File

@ -46,12 +46,13 @@ nvkm_volt_get(struct nvkm_volt *volt)
static int
nvkm_volt_set(struct nvkm_volt *volt, u32 uv)
{
struct nvkm_subdev *subdev = &volt->subdev;
if (volt->vid_set) {
int i, ret = -EINVAL;
for (i = 0; i < volt->vid_nr; i++) {
if (volt->vid[i].uv == uv) {
ret = volt->vid_set(volt, volt->vid[i].vid);
nv_debug(volt, "set %duv: %d\n", uv, ret);
nvkm_debug(subdev, "set %duv: %d\n", uv, ret);
break;
}
}
@ -138,6 +139,7 @@ int
_nvkm_volt_init(struct nvkm_object *object)
{
struct nvkm_volt *volt = (void *)object;
struct nvkm_subdev *subdev = &volt->subdev;
int ret;
ret = nvkm_subdev_init(&volt->subdev);
@ -147,11 +149,11 @@ _nvkm_volt_init(struct nvkm_object *object)
ret = volt->get(volt);
if (ret < 0) {
if (ret != -ENODEV)
nv_debug(volt, "current voltage unknown\n");
nvkm_debug(subdev, "current voltage unknown\n");
return 0;
}
nv_info(volt, "GPU voltage: %duv\n", ret);
nvkm_debug(subdev, "current voltage: %duv\n", ret);
return 0;
}
@ -166,7 +168,8 @@ int
nvkm_volt_create_(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_oclass *oclass, int length, void **pobject)
{
struct nvkm_bios *bios = nvkm_bios(parent);
struct nvkm_device *device = (void *)parent;
struct nvkm_bios *bios = device->bios;
struct nvkm_volt *volt;
int ret, i;
@ -186,8 +189,8 @@ nvkm_volt_create_(struct nvkm_object *parent, struct nvkm_object *engine,
if (volt->vid_nr) {
for (i = 0; i < volt->vid_nr; i++) {
nv_debug(volt, "VID %02x: %duv\n",
volt->vid[i].vid, volt->vid[i].uv);
nvkm_debug(&volt->subdev, "VID %02x: %duv\n",
volt->vid[i].vid, volt->vid[i].uv);
}
/*XXX: this is an assumption.. there probably exists boards

View File

@ -119,8 +119,9 @@ static int
gk20a_volt_vid_set(struct nvkm_volt *obj, u8 vid)
{
struct gk20a_volt *volt = container_of(obj, typeof(*volt), base);
struct nvkm_subdev *subdev = &volt->base.subdev;
nv_debug(volt, "set voltage as %duv\n", volt->base.vid[vid].uv);
nvkm_debug(subdev, "set voltage as %duv\n", volt->base.vid[vid].uv);
return regulator_set_voltage(volt->vdd, volt->base.vid[vid].uv, 1200000);
}
@ -128,12 +129,13 @@ static int
gk20a_volt_set_id(struct nvkm_volt *obj, u8 id, int condition)
{
struct gk20a_volt *volt = container_of(obj, typeof(*volt), base);
struct nvkm_subdev *subdev = &volt->base.subdev;
int prev_uv = regulator_get_voltage(volt->vdd);
int target_uv = volt->base.vid[id].uv;
int ret;
nv_debug(volt, "prev=%d, target=%d, condition=%d\n",
prev_uv, target_uv, condition);
nvkm_debug(subdev, "prev=%d, target=%d, condition=%d\n",
prev_uv, target_uv, condition);
if (!condition ||
(condition < 0 && target_uv < prev_uv) ||
(condition > 0 && target_uv > prev_uv)) {
@ -162,7 +164,7 @@ gk20a_volt_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
plat = nv_device_to_platform(nv_device(parent));
uv = regulator_get_voltage(plat->gpu->vdd);
nv_info(volt, "The default voltage is %duV\n", uv);
nvkm_info(&volt->base.subdev, "The default voltage is %duV\n", uv);
volt->vdd = plat->gpu->vdd;
volt->base.vid_get = gk20a_volt_vid_get;
@ -170,14 +172,15 @@ gk20a_volt_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
volt->base.set_id = gk20a_volt_set_id;
volt->base.vid_nr = ARRAY_SIZE(gk20a_cvb_coef);
nv_debug(volt, "%s - vid_nr = %d\n", __func__, volt->base.vid_nr);
nvkm_debug(&volt->base.subdev, "%s - vid_nr = %d\n", __func__,
volt->base.vid_nr);
for (i = 0; i < volt->base.vid_nr; i++) {
volt->base.vid[i].vid = i;
volt->base.vid[i].uv =
gk20a_volt_calc_voltage(&gk20a_cvb_coef[i],
plat->gpu_speedo);
nv_debug(volt, "%2d: vid=%d, uv=%d\n", i,
volt->base.vid[i].vid, volt->base.vid[i].uv);
nvkm_debug(&volt->base.subdev, "%2d: vid=%d, uv=%d\n", i,
volt->base.vid[i].vid, volt->base.vid[i].uv);
}
return 0;

View File

@ -70,7 +70,8 @@ nvkm_voltgpio_set(struct nvkm_volt *volt, u8 vid)
int
nvkm_voltgpio_init(struct nvkm_volt *volt)
{
struct nvkm_gpio *gpio = nvkm_gpio(volt);
struct nvkm_subdev *subdev = &volt->subdev;
struct nvkm_gpio *gpio = subdev->device->gpio;
struct dcb_gpio_func func;
int i;
@ -86,7 +87,7 @@ nvkm_voltgpio_init(struct nvkm_volt *volt)
if (ret) {
if (ret != -ENOENT)
return ret;
nv_debug(volt, "VID bit %d has no GPIO\n", i);
nvkm_debug(subdev, "VID bit %d has no GPIO\n", i);
volt->vid_mask &= ~(1 << i);
}
}