]>
Commit | Line | Data |
---|---|---|
39f3dcdc SLM |
1 | From 84dd24f32a12bba2d07a0b7de2f75f4f8b04a285 Mon Sep 17 00:00:00 2001 |
2 | From: Ilia Mirkin <imirkin@alum.mit.edu> | |
3 | Date: Sun, 13 Jan 2019 17:50:10 -0500 | |
4 | Subject: drm/nouveau/volt/gf117: fix speedo readout register | |
5 | ||
6 | [ Upstream commit fc782242749fa4235592854fafe1a1297583c1fb ] | |
7 | ||
8 | GF117 appears to use the same register as GK104 (but still with the | |
9 | general Fermi readout mechanism). | |
10 | ||
11 | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108980 | |
12 | Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> | |
13 | Signed-off-by: Ben Skeggs <bskeggs@redhat.com> | |
14 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
15 | --- | |
16 | .../drm/nouveau/include/nvkm/subdev/volt.h | 1 + | |
17 | .../gpu/drm/nouveau/nvkm/engine/device/base.c | 2 +- | |
18 | .../gpu/drm/nouveau/nvkm/subdev/volt/Kbuild | 1 + | |
19 | .../gpu/drm/nouveau/nvkm/subdev/volt/gf117.c | 60 +++++++++++++++++++ | |
20 | 4 files changed, 63 insertions(+), 1 deletion(-) | |
21 | create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/volt/gf117.c | |
22 | ||
23 | diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/volt.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/volt.h | |
24 | index 8a0f85f5fc1a..6a765682fbfa 100644 | |
25 | --- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/volt.h | |
26 | +++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/volt.h | |
27 | @@ -38,6 +38,7 @@ int nvkm_volt_set_id(struct nvkm_volt *, u8 id, u8 min_id, u8 temp, | |
28 | ||
29 | int nv40_volt_new(struct nvkm_device *, int, struct nvkm_volt **); | |
30 | int gf100_volt_new(struct nvkm_device *, int, struct nvkm_volt **); | |
31 | +int gf117_volt_new(struct nvkm_device *, int, struct nvkm_volt **); | |
32 | int gk104_volt_new(struct nvkm_device *, int, struct nvkm_volt **); | |
33 | int gk20a_volt_new(struct nvkm_device *, int, struct nvkm_volt **); | |
34 | int gm20b_volt_new(struct nvkm_device *, int, struct nvkm_volt **); | |
35 | diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c | |
36 | index e096a5d9c292..f8dd78e21456 100644 | |
37 | --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c | |
38 | +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c | |
39 | @@ -1612,7 +1612,7 @@ nvd7_chipset = { | |
40 | .pci = gf106_pci_new, | |
41 | .therm = gf119_therm_new, | |
42 | .timer = nv41_timer_new, | |
43 | - .volt = gf100_volt_new, | |
44 | + .volt = gf117_volt_new, | |
45 | .ce[0] = gf100_ce_new, | |
46 | .disp = gf119_disp_new, | |
47 | .dma = gf119_dma_new, | |
48 | diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/Kbuild | |
49 | index bcd179ba11d0..146adcdd316a 100644 | |
50 | --- a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/Kbuild | |
51 | +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/Kbuild | |
52 | @@ -2,6 +2,7 @@ nvkm-y += nvkm/subdev/volt/base.o | |
53 | nvkm-y += nvkm/subdev/volt/gpio.o | |
54 | nvkm-y += nvkm/subdev/volt/nv40.o | |
55 | nvkm-y += nvkm/subdev/volt/gf100.o | |
56 | +nvkm-y += nvkm/subdev/volt/gf117.o | |
57 | nvkm-y += nvkm/subdev/volt/gk104.o | |
58 | nvkm-y += nvkm/subdev/volt/gk20a.o | |
59 | nvkm-y += nvkm/subdev/volt/gm20b.o | |
60 | diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gf117.c b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gf117.c | |
61 | new file mode 100644 | |
62 | index 000000000000..547a58f0aeac | |
63 | --- /dev/null | |
64 | +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gf117.c | |
65 | @@ -0,0 +1,60 @@ | |
66 | +/* | |
67 | + * Copyright 2019 Ilia Mirkin | |
68 | + * | |
69 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
70 | + * copy of this software and associated documentation files (the "Software"), | |
71 | + * to deal in the Software without restriction, including without limitation | |
72 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
73 | + * and/or sell copies of the Software, and to permit persons to whom the | |
74 | + * Software is furnished to do so, subject to the following conditions: | |
75 | + * | |
76 | + * The above copyright notice and this permission notice shall be included in | |
77 | + * all copies or substantial portions of the Software. | |
78 | + * | |
79 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
80 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
81 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
82 | + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
83 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
84 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
85 | + * OTHER DEALINGS IN THE SOFTWARE. | |
86 | + * | |
87 | + * Authors: Ilia Mirkin | |
88 | + */ | |
89 | +#include "priv.h" | |
90 | + | |
91 | +#include <subdev/fuse.h> | |
92 | + | |
93 | +static int | |
94 | +gf117_volt_speedo_read(struct nvkm_volt *volt) | |
95 | +{ | |
96 | + struct nvkm_device *device = volt->subdev.device; | |
97 | + struct nvkm_fuse *fuse = device->fuse; | |
98 | + | |
99 | + if (!fuse) | |
100 | + return -EINVAL; | |
101 | + | |
102 | + return nvkm_fuse_read(fuse, 0x3a8); | |
103 | +} | |
104 | + | |
105 | +static const struct nvkm_volt_func | |
106 | +gf117_volt = { | |
107 | + .oneinit = gf100_volt_oneinit, | |
108 | + .vid_get = nvkm_voltgpio_get, | |
109 | + .vid_set = nvkm_voltgpio_set, | |
110 | + .speedo_read = gf117_volt_speedo_read, | |
111 | +}; | |
112 | + | |
113 | +int | |
114 | +gf117_volt_new(struct nvkm_device *device, int index, struct nvkm_volt **pvolt) | |
115 | +{ | |
116 | + struct nvkm_volt *volt; | |
117 | + int ret; | |
118 | + | |
119 | + ret = nvkm_volt_new_(&gf117_volt, device, index, &volt); | |
120 | + *pvolt = volt; | |
121 | + if (ret) | |
122 | + return ret; | |
123 | + | |
124 | + return nvkm_voltgpio_init(volt); | |
125 | +} | |
126 | -- | |
127 | 2.19.1 | |
128 |