summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drm/nouveau/include/nvkm/subdev/volt.h1
-rw-r--r--drm/nouveau/nvkm/subdev/volt/base.c10
2 files changed, 11 insertions, 0 deletions
diff --git a/drm/nouveau/include/nvkm/subdev/volt.h b/drm/nouveau/include/nvkm/subdev/volt.h
index e3d7243fb..ed9fb9704 100644
--- a/drm/nouveau/include/nvkm/subdev/volt.h
+++ b/drm/nouveau/include/nvkm/subdev/volt.h
@@ -15,6 +15,7 @@ struct nvkm_volt {
int (*vid_set)(struct nvkm_volt *, u8 vid);
int (*set)(struct nvkm_volt *, u32 uv);
int (*set_id)(struct nvkm_volt *, u8 id, int condition);
+ int (*get_voltage_by_id)(struct nvkm_volt *, u8 vid);
u8 vid_mask;
u8 vid_nr;
diff --git a/drm/nouveau/nvkm/subdev/volt/base.c b/drm/nouveau/nvkm/subdev/volt/base.c
index 39f15803f..69f0e3ce2 100644
--- a/drm/nouveau/nvkm/subdev/volt/base.c
+++ b/drm/nouveau/nvkm/subdev/volt/base.c
@@ -44,6 +44,15 @@ nvkm_volt_get(struct nvkm_volt *volt)
}
static int
+nvkm_volt_get_voltage_by_id(struct nvkm_volt *volt, u8 id)
+{
+ if (id >= volt->vid_nr)
+ return -EINVAL;
+
+ return volt->vid[id].uv;
+}
+
+static int
nvkm_volt_set(struct nvkm_volt *volt, u32 uv)
{
if (volt->vid_set) {
@@ -179,6 +188,7 @@ nvkm_volt_create_(struct nvkm_object *parent, struct nvkm_object *engine,
volt->get = nvkm_volt_get;
volt->set = nvkm_volt_set;
volt->set_id = nvkm_volt_set_id;
+ volt->get_voltage_by_id = nvkm_volt_get_voltage_by_id;
/* Assuming the non-bios device should build the voltage table later */
if (bios)