aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarol Herbst <karolherbst@gmail.com>2016-07-17 14:02:33 -0400
committerBen Skeggs <bskeggs@redhat.com>2016-10-12 03:29:26 -0400
commita3c950f2ac2c56f2c40bfacd779a72e4f3dc7cd2 (patch)
tree6ec22aca69b9f1b57c7ca4e0d31b13be305e3889
parent5c3b16ee1db65d2fc86b58e36f51b22862923d8c (diff)
drm/nouveau/volt: Add implementation for gf100
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>
-rw-r--r--drivers/gpu/drm/nouveau/include/nvkm/subdev/volt.h1
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/device/base.c17
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/volt/Kbuild1
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/volt/gf100.c44
4 files changed, 55 insertions, 8 deletions
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/volt.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/volt.h
index 441f6e7079d2..bc8e9c9dcf16 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/volt.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/volt.h
@@ -34,6 +34,7 @@ int nvkm_volt_set_id(struct nvkm_volt *, u8 id, u8 min_id, u8 temp,
34 int condition); 34 int condition);
35 35
36int nv40_volt_new(struct nvkm_device *, int, struct nvkm_volt **); 36int nv40_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
37int gf100_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
37int gk104_volt_new(struct nvkm_device *, int, struct nvkm_volt **); 38int gk104_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
38int gk20a_volt_new(struct nvkm_device *, int, struct nvkm_volt **); 39int gk20a_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
39int gm20b_volt_new(struct nvkm_device *, int, struct nvkm_volt **); 40int gm20b_volt_new(struct nvkm_device *, int, struct nvkm_volt **);
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
index 7218a067a6c5..53d171729353 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
@@ -1357,7 +1357,7 @@ nvc0_chipset = {
1357 .pmu = gf100_pmu_new, 1357 .pmu = gf100_pmu_new,
1358 .therm = gt215_therm_new, 1358 .therm = gt215_therm_new,
1359 .timer = nv41_timer_new, 1359 .timer = nv41_timer_new,
1360 .volt = nv40_volt_new, 1360 .volt = gf100_volt_new,
1361 .ce[0] = gf100_ce_new, 1361 .ce[0] = gf100_ce_new,
1362 .ce[1] = gf100_ce_new, 1362 .ce[1] = gf100_ce_new,
1363 .disp = gt215_disp_new, 1363 .disp = gt215_disp_new,
@@ -1394,7 +1394,7 @@ nvc1_chipset = {
1394 .pmu = gf100_pmu_new, 1394 .pmu = gf100_pmu_new,
1395 .therm = gt215_therm_new, 1395 .therm = gt215_therm_new,
1396 .timer = nv41_timer_new, 1396 .timer = nv41_timer_new,
1397 .volt = nv40_volt_new, 1397 .volt = gf100_volt_new,
1398 .ce[0] = gf100_ce_new, 1398 .ce[0] = gf100_ce_new,
1399 .disp = gt215_disp_new, 1399 .disp = gt215_disp_new,
1400 .dma = gf100_dma_new, 1400 .dma = gf100_dma_new,
@@ -1430,7 +1430,7 @@ nvc3_chipset = {
1430 .pmu = gf100_pmu_new, 1430 .pmu = gf100_pmu_new,
1431 .therm = gt215_therm_new, 1431 .therm = gt215_therm_new,
1432 .timer = nv41_timer_new, 1432 .timer = nv41_timer_new,
1433 .volt = nv40_volt_new, 1433 .volt = gf100_volt_new,
1434 .ce[0] = gf100_ce_new, 1434 .ce[0] = gf100_ce_new,
1435 .disp = gt215_disp_new, 1435 .disp = gt215_disp_new,
1436 .dma = gf100_dma_new, 1436 .dma = gf100_dma_new,
@@ -1466,7 +1466,7 @@ nvc4_chipset = {
1466 .pmu = gf100_pmu_new, 1466 .pmu = gf100_pmu_new,
1467 .therm = gt215_therm_new, 1467 .therm = gt215_therm_new,
1468 .timer = nv41_timer_new, 1468 .timer = nv41_timer_new,
1469 .volt = nv40_volt_new, 1469 .volt = gf100_volt_new,
1470 .ce[0] = gf100_ce_new, 1470 .ce[0] = gf100_ce_new,
1471 .ce[1] = gf100_ce_new, 1471 .ce[1] = gf100_ce_new,
1472 .disp = gt215_disp_new, 1472 .disp = gt215_disp_new,
@@ -1503,7 +1503,7 @@ nvc8_chipset = {
1503 .pmu = gf100_pmu_new, 1503 .pmu = gf100_pmu_new,
1504 .therm = gt215_therm_new, 1504 .therm = gt215_therm_new,
1505 .timer = nv41_timer_new, 1505 .timer = nv41_timer_new,
1506 .volt = nv40_volt_new, 1506 .volt = gf100_volt_new,
1507 .ce[0] = gf100_ce_new, 1507 .ce[0] = gf100_ce_new,
1508 .ce[1] = gf100_ce_new, 1508 .ce[1] = gf100_ce_new,
1509 .disp = gt215_disp_new, 1509 .disp = gt215_disp_new,
@@ -1540,7 +1540,7 @@ nvce_chipset = {
1540 .pmu = gf100_pmu_new, 1540 .pmu = gf100_pmu_new,
1541 .therm = gt215_therm_new, 1541 .therm = gt215_therm_new,
1542 .timer = nv41_timer_new, 1542 .timer = nv41_timer_new,
1543 .volt = nv40_volt_new, 1543 .volt = gf100_volt_new,
1544 .ce[0] = gf100_ce_new, 1544 .ce[0] = gf100_ce_new,
1545 .ce[1] = gf100_ce_new, 1545 .ce[1] = gf100_ce_new,
1546 .disp = gt215_disp_new, 1546 .disp = gt215_disp_new,
@@ -1577,7 +1577,7 @@ nvcf_chipset = {
1577 .pmu = gf100_pmu_new, 1577 .pmu = gf100_pmu_new,
1578 .therm = gt215_therm_new, 1578 .therm = gt215_therm_new,
1579 .timer = nv41_timer_new, 1579 .timer = nv41_timer_new,
1580 .volt = nv40_volt_new, 1580 .volt = gf100_volt_new,
1581 .ce[0] = gf100_ce_new, 1581 .ce[0] = gf100_ce_new,
1582 .disp = gt215_disp_new, 1582 .disp = gt215_disp_new,
1583 .dma = gf100_dma_new, 1583 .dma = gf100_dma_new,
@@ -1612,6 +1612,7 @@ nvd7_chipset = {
1612 .pci = gf106_pci_new, 1612 .pci = gf106_pci_new,
1613 .therm = gf119_therm_new, 1613 .therm = gf119_therm_new,
1614 .timer = nv41_timer_new, 1614 .timer = nv41_timer_new,
1615 .volt = gf100_volt_new,
1615 .ce[0] = gf100_ce_new, 1616 .ce[0] = gf100_ce_new,
1616 .disp = gf119_disp_new, 1617 .disp = gf119_disp_new,
1617 .dma = gf119_dma_new, 1618 .dma = gf119_dma_new,
@@ -1647,7 +1648,7 @@ nvd9_chipset = {
1647 .pmu = gf119_pmu_new, 1648 .pmu = gf119_pmu_new,
1648 .therm = gf119_therm_new, 1649 .therm = gf119_therm_new,
1649 .timer = nv41_timer_new, 1650 .timer = nv41_timer_new,
1650 .volt = nv40_volt_new, 1651 .volt = gf100_volt_new,
1651 .ce[0] = gf100_ce_new, 1652 .ce[0] = gf100_ce_new,
1652 .disp = gf119_disp_new, 1653 .disp = gf119_disp_new,
1653 .dma = gf119_dma_new, 1654 .dma = gf119_dma_new,
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/Kbuild
index c34076223b7b..bcd179ba11d0 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/Kbuild
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/Kbuild
@@ -1,6 +1,7 @@
1nvkm-y += nvkm/subdev/volt/base.o 1nvkm-y += nvkm/subdev/volt/base.o
2nvkm-y += nvkm/subdev/volt/gpio.o 2nvkm-y += nvkm/subdev/volt/gpio.o
3nvkm-y += nvkm/subdev/volt/nv40.o 3nvkm-y += nvkm/subdev/volt/nv40.o
4nvkm-y += nvkm/subdev/volt/gf100.o
4nvkm-y += nvkm/subdev/volt/gk104.o 5nvkm-y += nvkm/subdev/volt/gk104.o
5nvkm-y += nvkm/subdev/volt/gk20a.o 6nvkm-y += nvkm/subdev/volt/gk20a.o
6nvkm-y += nvkm/subdev/volt/gm20b.o 7nvkm-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
index 000000000000..c21100fda47e
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gf100.c
@@ -0,0 +1,44 @@
1/*
2 * Copyright 2016 Karol Herbst
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Karol Herbst
23 */
24#include "priv.h"
25
26static const struct nvkm_volt_func
27gf100_volt = {
28 .vid_get = nvkm_voltgpio_get,
29 .vid_set = nvkm_voltgpio_set,
30};
31
32int
33gf100_volt_new(struct nvkm_device *device, int index, struct nvkm_volt **pvolt)
34{
35 struct nvkm_volt *volt;
36 int ret;
37
38 ret = nvkm_volt_new_(&gf100_volt, device, index, &volt);
39 *pvolt = volt;
40 if (ret)
41 return ret;
42
43 return nvkm_voltgpio_init(volt);
44}