drm/nouveau/volt: Add implementation for gf100
authorKarol Herbst <karolherbst@gmail.com>
Sun, 17 Jul 2016 18:02:33 +0000 (20:02 +0200)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 12 Oct 2016 07:29:26 +0000 (17:29 +1000)
Since gf100 we need a speedo value for calculating the voltage. The readout
will be added in a later patch.

Signed-off-by: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/include/nvkm/subdev/volt.h
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/volt/Kbuild
drivers/gpu/drm/nouveau/nvkm/subdev/volt/gf100.c [new file with mode: 0644]

index 441f6e7079d2d63e11f605e67faefa8316b958be..bc8e9c9dcf168218356592896348bf0cf6dda522 100644 (file)
@@ -34,6 +34,7 @@ int nvkm_volt_set_id(struct nvkm_volt *, u8 id, u8 min_id, u8 temp,
                     int condition);
 
 int nv40_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
+int gf100_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
 int gk104_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
 int gk20a_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
 int gm20b_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
index 7218a067a6c5e85764f1f330cb05b10c7e50132c..53d171729353a1f5686e37597a7c61e690129382 100644 (file)
@@ -1357,7 +1357,7 @@ nvc0_chipset = {
        .pmu = gf100_pmu_new,
        .therm = gt215_therm_new,
        .timer = nv41_timer_new,
-       .volt = nv40_volt_new,
+       .volt = gf100_volt_new,
        .ce[0] = gf100_ce_new,
        .ce[1] = gf100_ce_new,
        .disp = gt215_disp_new,
@@ -1394,7 +1394,7 @@ nvc1_chipset = {
        .pmu = gf100_pmu_new,
        .therm = gt215_therm_new,
        .timer = nv41_timer_new,
-       .volt = nv40_volt_new,
+       .volt = gf100_volt_new,
        .ce[0] = gf100_ce_new,
        .disp = gt215_disp_new,
        .dma = gf100_dma_new,
@@ -1430,7 +1430,7 @@ nvc3_chipset = {
        .pmu = gf100_pmu_new,
        .therm = gt215_therm_new,
        .timer = nv41_timer_new,
-       .volt = nv40_volt_new,
+       .volt = gf100_volt_new,
        .ce[0] = gf100_ce_new,
        .disp = gt215_disp_new,
        .dma = gf100_dma_new,
@@ -1466,7 +1466,7 @@ nvc4_chipset = {
        .pmu = gf100_pmu_new,
        .therm = gt215_therm_new,
        .timer = nv41_timer_new,
-       .volt = nv40_volt_new,
+       .volt = gf100_volt_new,
        .ce[0] = gf100_ce_new,
        .ce[1] = gf100_ce_new,
        .disp = gt215_disp_new,
@@ -1503,7 +1503,7 @@ nvc8_chipset = {
        .pmu = gf100_pmu_new,
        .therm = gt215_therm_new,
        .timer = nv41_timer_new,
-       .volt = nv40_volt_new,
+       .volt = gf100_volt_new,
        .ce[0] = gf100_ce_new,
        .ce[1] = gf100_ce_new,
        .disp = gt215_disp_new,
@@ -1540,7 +1540,7 @@ nvce_chipset = {
        .pmu = gf100_pmu_new,
        .therm = gt215_therm_new,
        .timer = nv41_timer_new,
-       .volt = nv40_volt_new,
+       .volt = gf100_volt_new,
        .ce[0] = gf100_ce_new,
        .ce[1] = gf100_ce_new,
        .disp = gt215_disp_new,
@@ -1577,7 +1577,7 @@ nvcf_chipset = {
        .pmu = gf100_pmu_new,
        .therm = gt215_therm_new,
        .timer = nv41_timer_new,
-       .volt = nv40_volt_new,
+       .volt = gf100_volt_new,
        .ce[0] = gf100_ce_new,
        .disp = gt215_disp_new,
        .dma = gf100_dma_new,
@@ -1612,6 +1612,7 @@ nvd7_chipset = {
        .pci = gf106_pci_new,
        .therm = gf119_therm_new,
        .timer = nv41_timer_new,
+       .volt = gf100_volt_new,
        .ce[0] = gf100_ce_new,
        .disp = gf119_disp_new,
        .dma = gf119_dma_new,
@@ -1647,7 +1648,7 @@ nvd9_chipset = {
        .pmu = gf119_pmu_new,
        .therm = gf119_therm_new,
        .timer = nv41_timer_new,
-       .volt = nv40_volt_new,
+       .volt = gf100_volt_new,
        .ce[0] = gf100_ce_new,
        .disp = gf119_disp_new,
        .dma = gf119_dma_new,
index c34076223b7b23e5a3d952dc94ca4dda7370978a..bcd179ba11d0d2cd11fa40ef1c7559843a8a1881 100644 (file)
@@ -1,6 +1,7 @@
 nvkm-y += nvkm/subdev/volt/base.o
 nvkm-y += nvkm/subdev/volt/gpio.o
 nvkm-y += nvkm/subdev/volt/nv40.o
+nvkm-y += nvkm/subdev/volt/gf100.o
 nvkm-y += nvkm/subdev/volt/gk104.o
 nvkm-y += nvkm/subdev/volt/gk20a.o
 nvkm-y += nvkm/subdev/volt/gm20b.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gf100.c
new file mode 100644 (file)
index 0000000..c21100f
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2016 Karol Herbst
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Karol Herbst
+ */
+#include "priv.h"
+
+static const struct nvkm_volt_func
+gf100_volt = {
+       .vid_get = nvkm_voltgpio_get,
+       .vid_set = nvkm_voltgpio_set,
+};
+
+int
+gf100_volt_new(struct nvkm_device *device, int index, struct nvkm_volt **pvolt)
+{
+       struct nvkm_volt *volt;
+       int ret;
+
+       ret = nvkm_volt_new_(&gf100_volt, device, index, &volt);
+       *pvolt = volt;
+       if (ret)
+               return ret;
+
+       return nvkm_voltgpio_init(volt);
+}