[Nouveau] [PATCH v4 18/37] volt: add speedo

Karol Herbst nouveau at karolherbst.de
Mon Apr 18 19:13:52 UTC 2016


Signed-off-by: Karol Herbst <nouveau at karolherbst.de>
---
 bin/nv_cmp_volt.c                      |  2 +-
 drm/nouveau/include/nvkm/subdev/volt.h |  2 ++
 drm/nouveau/nvkm/subdev/volt/base.c    | 12 ++++++++++++
 drm/nouveau/nvkm/subdev/volt/priv.h    |  1 +
 4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/bin/nv_cmp_volt.c b/bin/nv_cmp_volt.c
index 34147b9..e61056c 100644
--- a/bin/nv_cmp_volt.c
+++ b/bin/nv_cmp_volt.c
@@ -53,7 +53,7 @@ main(int argc, char **argv)
 
 	ret = u_device("lib", argv[0], "error", true, true,
                        (1ULL << NVKM_SUBDEV_CLK) |
-//                       (1ULL << NVKM_SUBDEV_FUSE) |
+                       (1ULL << NVKM_SUBDEV_FUSE) |
                        (1ULL << NVKM_SUBDEV_GPIO) |
 //                       (1ULL << NVKM_SUBDEV_I2C) |
                        (1ULL << NVKM_SUBDEV_PCI) |
diff --git a/drm/nouveau/include/nvkm/subdev/volt.h b/drm/nouveau/include/nvkm/subdev/volt.h
index f223577..4cb0292 100644
--- a/drm/nouveau/include/nvkm/subdev/volt.h
+++ b/drm/nouveau/include/nvkm/subdev/volt.h
@@ -20,6 +20,8 @@ struct nvkm_volt {
 	u8 max0_id;
 	u8 max1_id;
 	u8 max2_id;
+
+	int speedo;
 };
 
 int nvkm_volt_map(struct nvkm_volt *volt, u8 id, u8 temperature);
diff --git a/drm/nouveau/nvkm/subdev/volt/base.c b/drm/nouveau/nvkm/subdev/volt/base.c
index 028c6e2..cecfac6 100644
--- a/drm/nouveau/nvkm/subdev/volt/base.c
+++ b/drm/nouveau/nvkm/subdev/volt/base.c
@@ -201,6 +201,14 @@ nvkm_volt_parse_bios(struct nvkm_bios *bios, struct nvkm_volt *volt)
 }
 
 static int
+nvkm_volt_speedo_read(struct nvkm_volt *volt)
+{
+	if (volt->func->speedo_read)
+		return volt->func->speedo_read(volt);
+	return -EINVAL;
+}
+
+static int
 nvkm_volt_init(struct nvkm_subdev *subdev)
 {
 	struct nvkm_volt *volt = nvkm_volt(subdev);
@@ -262,6 +270,10 @@ nvkm_volt_ctor(const struct nvkm_volt_func *func, struct nvkm_device *device,
 				   volt->vid[i].vid, volt->vid[i].uv);
 		}
 	}
+
+	volt->speedo = nvkm_volt_speedo_read(volt);
+	if (volt->speedo > 0)
+		nvkm_debug(&volt->subdev, "speedo %x\n", volt->speedo);
 }
 
 int
diff --git a/drm/nouveau/nvkm/subdev/volt/priv.h b/drm/nouveau/nvkm/subdev/volt/priv.h
index d5140d9..9b34e9f 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 (*speedo_read)(struct nvkm_volt *);
 };
 
 int nvkm_voltgpio_init(struct nvkm_volt *);
-- 
2.8.1



More information about the Nouveau mailing list