diff options
author | Vince Hsu <vinceh@nvidia.com> | 2015-04-23 17:26:12 +0800 |
---|---|---|
committer | Alexandre Courbot <acourbot@nvidia.com> | 2015-11-11 18:52:49 +0900 |
commit | a8398dcb584cd0fa421b771c732f3c7ecfd8a7e0 (patch) | |
tree | 34ed9631c35646bfe4563c2ce41132436c3b42c5 | |
parent | 1cc40561f525d112e83466e8a131bd232067206b (diff) | |
download | nouveau-a8398dcb584cd0fa421b771c732f3c7ecfd8a7e0.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.h | 1 | ||||
-rw-r--r-- | drm/nouveau/nvkm/subdev/volt/base.c | 9 | ||||
-rw-r--r-- | drm/nouveau/nvkm/subdev/volt/priv.h | 1 |
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 *); |