Commit 185eda33 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/volt: switch to subdev printk macros

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 9d7b9d9f
...@@ -46,12 +46,13 @@ nvkm_volt_get(struct nvkm_volt *volt) ...@@ -46,12 +46,13 @@ nvkm_volt_get(struct nvkm_volt *volt)
static int static int
nvkm_volt_set(struct nvkm_volt *volt, u32 uv) nvkm_volt_set(struct nvkm_volt *volt, u32 uv)
{ {
struct nvkm_subdev *subdev = &volt->subdev;
if (volt->vid_set) { if (volt->vid_set) {
int i, ret = -EINVAL; int i, ret = -EINVAL;
for (i = 0; i < volt->vid_nr; i++) { for (i = 0; i < volt->vid_nr; i++) {
if (volt->vid[i].uv == uv) { if (volt->vid[i].uv == uv) {
ret = volt->vid_set(volt, volt->vid[i].vid); 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; break;
} }
} }
...@@ -138,6 +139,7 @@ int ...@@ -138,6 +139,7 @@ int
_nvkm_volt_init(struct nvkm_object *object) _nvkm_volt_init(struct nvkm_object *object)
{ {
struct nvkm_volt *volt = (void *)object; struct nvkm_volt *volt = (void *)object;
struct nvkm_subdev *subdev = &volt->subdev;
int ret; int ret;
ret = nvkm_subdev_init(&volt->subdev); ret = nvkm_subdev_init(&volt->subdev);
...@@ -147,11 +149,11 @@ _nvkm_volt_init(struct nvkm_object *object) ...@@ -147,11 +149,11 @@ _nvkm_volt_init(struct nvkm_object *object)
ret = volt->get(volt); ret = volt->get(volt);
if (ret < 0) { if (ret < 0) {
if (ret != -ENODEV) if (ret != -ENODEV)
nv_debug(volt, "current voltage unknown\n"); nvkm_debug(subdev, "current voltage unknown\n");
return 0; return 0;
} }
nv_info(volt, "GPU voltage: %duv\n", ret); nvkm_debug(subdev, "current voltage: %duv\n", ret);
return 0; return 0;
} }
...@@ -166,7 +168,8 @@ int ...@@ -166,7 +168,8 @@ int
nvkm_volt_create_(struct nvkm_object *parent, struct nvkm_object *engine, nvkm_volt_create_(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_oclass *oclass, int length, void **pobject) 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; struct nvkm_volt *volt;
int ret, i; int ret, i;
...@@ -186,8 +189,8 @@ nvkm_volt_create_(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -186,8 +189,8 @@ nvkm_volt_create_(struct nvkm_object *parent, struct nvkm_object *engine,
if (volt->vid_nr) { if (volt->vid_nr) {
for (i = 0; i < volt->vid_nr; i++) { for (i = 0; i < volt->vid_nr; i++) {
nv_debug(volt, "VID %02x: %duv\n", nvkm_debug(&volt->subdev, "VID %02x: %duv\n",
volt->vid[i].vid, volt->vid[i].uv); volt->vid[i].vid, volt->vid[i].uv);
} }
/*XXX: this is an assumption.. there probably exists boards /*XXX: this is an assumption.. there probably exists boards
......
...@@ -119,8 +119,9 @@ static int ...@@ -119,8 +119,9 @@ static int
gk20a_volt_vid_set(struct nvkm_volt *obj, u8 vid) gk20a_volt_vid_set(struct nvkm_volt *obj, u8 vid)
{ {
struct gk20a_volt *volt = container_of(obj, typeof(*volt), base); 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); return regulator_set_voltage(volt->vdd, volt->base.vid[vid].uv, 1200000);
} }
...@@ -128,12 +129,13 @@ static int ...@@ -128,12 +129,13 @@ static int
gk20a_volt_set_id(struct nvkm_volt *obj, u8 id, int condition) gk20a_volt_set_id(struct nvkm_volt *obj, u8 id, int condition)
{ {
struct gk20a_volt *volt = container_of(obj, typeof(*volt), base); 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 prev_uv = regulator_get_voltage(volt->vdd);
int target_uv = volt->base.vid[id].uv; int target_uv = volt->base.vid[id].uv;
int ret; int ret;
nv_debug(volt, "prev=%d, target=%d, condition=%d\n", nvkm_debug(subdev, "prev=%d, target=%d, condition=%d\n",
prev_uv, target_uv, condition); prev_uv, target_uv, condition);
if (!condition || if (!condition ||
(condition < 0 && target_uv < prev_uv) || (condition < 0 && target_uv < prev_uv) ||
(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, ...@@ -162,7 +164,7 @@ gk20a_volt_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
plat = nv_device_to_platform(nv_device(parent)); plat = nv_device_to_platform(nv_device(parent));
uv = regulator_get_voltage(plat->gpu->vdd); 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->vdd = plat->gpu->vdd;
volt->base.vid_get = gk20a_volt_vid_get; volt->base.vid_get = gk20a_volt_vid_get;
...@@ -170,14 +172,15 @@ gk20a_volt_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -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.set_id = gk20a_volt_set_id;
volt->base.vid_nr = ARRAY_SIZE(gk20a_cvb_coef); 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++) { for (i = 0; i < volt->base.vid_nr; i++) {
volt->base.vid[i].vid = i; volt->base.vid[i].vid = i;
volt->base.vid[i].uv = volt->base.vid[i].uv =
gk20a_volt_calc_voltage(&gk20a_cvb_coef[i], gk20a_volt_calc_voltage(&gk20a_cvb_coef[i],
plat->gpu_speedo); plat->gpu_speedo);
nv_debug(volt, "%2d: vid=%d, uv=%d\n", i, nvkm_debug(&volt->base.subdev, "%2d: vid=%d, uv=%d\n", i,
volt->base.vid[i].vid, volt->base.vid[i].uv); volt->base.vid[i].vid, volt->base.vid[i].uv);
} }
return 0; return 0;
......
...@@ -70,7 +70,8 @@ nvkm_voltgpio_set(struct nvkm_volt *volt, u8 vid) ...@@ -70,7 +70,8 @@ nvkm_voltgpio_set(struct nvkm_volt *volt, u8 vid)
int int
nvkm_voltgpio_init(struct nvkm_volt *volt) 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; struct dcb_gpio_func func;
int i; int i;
...@@ -86,7 +87,7 @@ nvkm_voltgpio_init(struct nvkm_volt *volt) ...@@ -86,7 +87,7 @@ nvkm_voltgpio_init(struct nvkm_volt *volt)
if (ret) { if (ret) {
if (ret != -ENOENT) if (ret != -ENOENT)
return ret; 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); volt->vid_mask &= ~(1 << i);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment