summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVince Hsu <vinceh@nvidia.com>2015-04-23 17:26:12 +0800
committerAlexandre Courbot <acourbot@nvidia.com>2016-01-15 14:32:54 +0900
commitb38330a20699b99038a3068c2349608e220604cd (patch)
tree0831347010d81c2f1fe36ca1b849a8e4a8cfca03
parentdfb766410b1356b623b8d497a48f774ef616346a (diff)
downloadnouveau-b38330a20699b99038a3068c2349608e220604cd.tar.gz
drm/nouveau/volt: add function get_voltage_by_id()
We need the exact voltage value to calculate the PLL coefficients for GM20B. Signed-off-by: Vince Hsu <vinceh@nvidia.com>
-rw-r--r--drm/nouveau/include/nvkm/subdev/volt.h1
-rw-r--r--drm/nouveau/nvkm/subdev/volt/base.c9
-rw-r--r--drm/nouveau/nvkm/subdev/volt/priv.h1
3 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 b458d046d..bbb8965b0 100644
--- a/drm/nouveau/include/nvkm/subdev/volt.h
+++ b/drm/nouveau/include/nvkm/subdev/volt.h
@@ -16,6 +16,7 @@ struct nvkm_volt {
int nvkm_volt_get(struct nvkm_volt *);
int nvkm_volt_set_id(struct nvkm_volt *, u8 id, int condition);
+int nvkm_volt_get_voltage_by_id(struct nvkm_volt *volt, u8 id);
int nv40_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
int gk104_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
diff --git a/drm/nouveau/nvkm/subdev/volt/base.c b/drm/nouveau/nvkm/subdev/volt/base.c
index 50b5649ad..93cc0b461 100644
--- a/drm/nouveau/nvkm/subdev/volt/base.c
+++ b/drm/nouveau/nvkm/subdev/volt/base.c
@@ -65,6 +65,15 @@ nvkm_volt_set(struct nvkm_volt *volt, u32 uv)
return ret;
}
+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_map(struct nvkm_volt *volt, u8 id)
{
diff --git a/drm/nouveau/nvkm/subdev/volt/priv.h b/drm/nouveau/nvkm/subdev/volt/priv.h
index d5140d991..e6b0be1d0 100644
--- a/drm/nouveau/nvkm/subdev/volt/priv.h
+++ b/drm/nouveau/nvkm/subdev/volt/priv.h
@@ -14,6 +14,7 @@ struct nvkm_volt_func {
int (*vid_get)(struct nvkm_volt *);
int (*vid_set)(struct nvkm_volt *, u8 vid);
int (*set_id)(struct nvkm_volt *, u8 id, int condition);
+ int (*get_voltage_by_id)(struct nvkm_volt *, u8 vid);
};
int nvkm_voltgpio_init(struct nvkm_volt *);