diff options
author | Martin Peres <martin.peres@free.fr> | 2015-09-09 04:05:51 +0300 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-11-03 14:57:28 +1000 |
commit | 9ded822e084a5fc2b2d9b2ed636aa5fab6b9ec70 (patch) | |
tree | b063277d9b976cf2b45f3e2f78c9c2251a328777 /drm/nouveau/nvkm/subdev/volt | |
parent | e43899069738ac442cd68a9e8513b7f2e04d6267 (diff) | |
download | nouveau-9ded822e084a5fc2b2d9b2ed636aa5fab6b9ec70.tar.gz |
volt: add support for non-vid-based voltage controllers
This patch is not ideal but it definitely beats a rewrite of the current
interface and is very self-contained.
Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drm/nouveau/nvkm/subdev/volt')
-rw-r--r-- | drm/nouveau/nvkm/subdev/volt/base.c | 11 | ||||
-rw-r--r-- | drm/nouveau/nvkm/subdev/volt/priv.h | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/drm/nouveau/nvkm/subdev/volt/base.c b/drm/nouveau/nvkm/subdev/volt/base.c index 4752dbd33..50b5649ad 100644 --- a/drm/nouveau/nvkm/subdev/volt/base.c +++ b/drm/nouveau/nvkm/subdev/volt/base.c @@ -30,7 +30,12 @@ int nvkm_volt_get(struct nvkm_volt *volt) { - int ret = volt->func->vid_get(volt), i; + int ret, i; + + if (volt->func->volt_get) + return volt->func->volt_get(volt); + + ret = volt->func->vid_get(volt); if (ret >= 0) { for (i = 0; i < volt->vid_nr; i++) { if (volt->vid[i].vid == ret) @@ -46,6 +51,10 @@ nvkm_volt_set(struct nvkm_volt *volt, u32 uv) { struct nvkm_subdev *subdev = &volt->subdev; int i, ret = -EINVAL; + + if (volt->func->volt_set) + return volt->func->volt_set(volt, uv); + for (i = 0; i < volt->vid_nr; i++) { if (volt->vid[i].uv == uv) { ret = volt->func->vid_set(volt, volt->vid[i].vid); diff --git a/drm/nouveau/nvkm/subdev/volt/priv.h b/drm/nouveau/nvkm/subdev/volt/priv.h index 394f37c72..cdb3d9f80 100644 --- a/drm/nouveau/nvkm/subdev/volt/priv.h +++ b/drm/nouveau/nvkm/subdev/volt/priv.h @@ -9,6 +9,8 @@ int nvkm_volt_new_(const struct nvkm_volt_func *, struct nvkm_device *, int index, struct nvkm_volt **); struct nvkm_volt_func { + int (*volt_get)(struct nvkm_volt *); + int (*volt_set)(struct nvkm_volt *, u32 uv); int (*vid_get)(struct nvkm_volt *); int (*vid_set)(struct nvkm_volt *, u8 vid); int (*set_id)(struct nvkm_volt *, u8 id, int condition); |