Skip to contentSkip to conversation

drm/nouveau/therm: initial implementation of new gp1xx temperature sensor

RFC PATCH Superseded Rhys Kidd 3 participants 5 messages Aug 31, 2017 – Sep 5, 2017 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

Rhys Kidd

author
#0 lore raw

RFC PATCH 1/1 drm/nouveau/therm: initial implementation of new gp1xx temperature sensor

---
 .../gpu/drm/nouveau/include/nvkm/subdev/therm.h    |  1 +
 drivers/gpu/drm/nouveau/nvkm/engine/device/base.c  |  6 +++
 drivers/gpu/drm/nouveau/nvkm/subdev/therm/Kbuild   |  1 +
 drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c   |  3 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c  | 57 ++++++++++++++++++++++
 5 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c
drivers/gpu/drm/nouveau/include/nvkm/subdev/therm.h +1 -0
index b268b96faece..adf14731ea15 100644
@@ -96,4 +96,5 @@ int g84_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
 int gt215_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
 int gf119_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
 int gm107_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
+int gp100_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
 #endif
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +6 -0
index 7bdc7a5ae723..a6221b0996bf 100644
@@ -2166,6 +2166,7 @@ nv130_chipset = {
 	.ltc = gp100_ltc_new,
 	.mc = gp100_mc_new,
 	.mmu = gf100_mmu_new,
+	.therm = gp100_therm_new,
 	.secboot = gm200_secboot_new,
 	.pci = gp100_pci_new,
 	.pmu = gp100_pmu_new,
@@ -2200,6 +2201,7 @@ nv132_chipset = {
 	.ltc = gp100_ltc_new,
 	.mc = gp100_mc_new,
 	.mmu = gf100_mmu_new,
+	.therm = gp100_therm_new,
 	.secboot = gp102_secboot_new,
 	.pci = gp100_pci_new,
 	.pmu = gp102_pmu_new,
@@ -2234,6 +2236,7 @@ nv134_chipset = {
 	.ltc = gp100_ltc_new,
 	.mc = gp100_mc_new,
 	.mmu = gf100_mmu_new,
+	.therm = gp100_therm_new,
 	.secboot = gp102_secboot_new,
 	.pci = gp100_pci_new,
 	.pmu = gp102_pmu_new,
@@ -2268,6 +2271,7 @@ nv136_chipset = {
 	.ltc = gp100_ltc_new,
 	.mc = gp100_mc_new,
 	.mmu = gf100_mmu_new,
+	.therm = gp100_therm_new,
 	.secboot = gp102_secboot_new,
 	.pci = gp100_pci_new,
 	.pmu = gp102_pmu_new,
@@ -2302,6 +2306,7 @@ nv137_chipset = {
 	.ltc = gp100_ltc_new,
 	.mc = gp100_mc_new,
 	.mmu = gf100_mmu_new,
+	.therm = gp100_therm_new,
 	.secboot = gp102_secboot_new,
 	.pci = gp100_pci_new,
 	.pmu = gp102_pmu_new,
@@ -2332,6 +2337,7 @@ nv13b_chipset = {
 	.ltc = gp100_ltc_new,
 	.mc = gp10b_mc_new,
 	.mmu = gf100_mmu_new,
+	.therm = gp100_therm_new,
 	.secboot = gp10b_secboot_new,
 	.pmu = gm20b_pmu_new,
 	.timer = gk20a_timer_new,
drivers/gpu/drm/nouveau/nvkm/subdev/therm/Kbuild +1 -0
index 135758ba3e28..3ef1b396a946 100644
@@ -11,3 +11,4 @@ nvkm-y += nvkm/subdev/therm/g84.o
 nvkm-y += nvkm/subdev/therm/gt215.o
 nvkm-y += nvkm/subdev/therm/gf119.o
 nvkm-y += nvkm/subdev/therm/gm107.o
+nvkm-y += nvkm/subdev/therm/gp100.o
drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c +2 -1
index 952a7cb0a59a..f27fc6d0d4c6 100644
@@ -341,7 +341,8 @@ nvkm_therm_init(struct nvkm_subdev *subdev)
 {
 	struct nvkm_therm *therm = nvkm_therm(subdev);
 
-	therm->func->init(therm);
+	if (therm->func->init)
+		therm->func->init(therm);
 
 	if (therm->suspend >= 0) {
 		/* restore the pwm value only when on manual or auto mode */
drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c new file +57 -0

58 lines not on this page · raw message

Signature · 6 lines
2.11.0

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): 20170831025509.4837-1-rhyskidd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw
Quoted 57 lines · Rhys Kidd
---
 .../gpu/drm/nouveau/include/nvkm/subdev/therm.h    |  1 +
 drivers/gpu/drm/nouveau/nvkm/engine/device/base.c  |  6 +++
 drivers/gpu/drm/nouveau/nvkm/subdev/therm/Kbuild   |  1 +
 drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c   |  3 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c  | 57 ++++++++++++++++++++++
 5 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c
drivers/gpu/drm/nouveau/include/nvkm/subdev/therm.h +1 -0
index b268b96faece..adf14731ea15 100644
@@ -96,4 +96,5 @@ int g84_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
 int gt215_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
 int gf119_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
 int gm107_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
+int gp100_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
 #endif
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +4 -0
index 7bdc7a5ae723..a6221b0996bf 100644
@@ -2166,6 +2166,7 @@ nv130_chipset = {
        .ltc = gp100_ltc_new,
        .mc = gp100_mc_new,
        .mmu = gf100_mmu_new,
+       .therm = gp100_therm_new,
        .secboot = gm200_secboot_new,
        .pci = gp100_pci_new,
        .pmu = gp100_pmu_new,
@@ -2200,6 +2201,7 @@ nv132_chipset = {
        .ltc = gp100_ltc_new,
        .mc = gp100_mc_new,
        .mmu = gf100_mmu_new,
+       .therm = gp100_therm_new,
        .secboot = gp102_secboot_new,
        .pci = gp100_pci_new,
        .pmu = gp102_pmu_new,
@@ -2234,6 +2236,7 @@ nv134_chipset = {
        .ltc = gp100_ltc_new,
        .mc = gp100_mc_new,
        .mmu = gf100_mmu_new,
+       .therm = gp100_therm_new,
        .secboot = gp102_secboot_new,
        .pci = gp100_pci_new,
        .pmu = gp102_pmu_new,
@@ -2268,6 +2271,7 @@ nv136_chipset = {
        .ltc = gp100_ltc_new,
        .mc = gp100_mc_new,
        .mmu = gf100_mmu_new,
+       .therm = gp100_therm_new,
        .secboot = gp102_secboot_new,
        .pci = gp100_pci_new,
        .pmu = gp102_pmu_new,

drivers/gpu/drm/nouveau/nvkm/engine/device/base.c nv137_chipset = { · line 2312

Quoted 7 lines
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +1 -0
@@ -2302,6 +2306,7 @@ nv137_chipset = {
        .ltc = gp100_ltc_new,
        .mc = gp100_mc_new,
        .mmu = gf100_mmu_new,
+       .therm = gp100_therm_new,
        .secboot = gp102_secboot_new,
        .pci = gp100_pci_new,
        .pmu = gp102_pmu_new,

Why not add it to nv138_chipset?

drivers/gpu/drm/nouveau/nvkm/engine/device/base.c nv13b_chipset = { · line 2340

Quoted 5 lines
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +1 -0
@@ -2332,6 +2337,7 @@ nv13b_chipset = {
        .ltc = gp100_ltc_new,
        .mc = gp10b_mc_new,
        .mmu = gf100_mmu_new,
+       .therm = gp100_therm_new,

GK20A and GM20B both don't have therm. I'm guessing this shouldn't either.

Quoted 53 lines
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +0 -0
        .secboot = gp10b_secboot_new,
        .pmu = gm20b_pmu_new,
        .timer = gk20a_timer_new,
drivers/gpu/drm/nouveau/nvkm/subdev/therm/Kbuild +1 -0
index 135758ba3e28..3ef1b396a946 100644
@@ -11,3 +11,4 @@ nvkm-y += nvkm/subdev/therm/g84.o
 nvkm-y += nvkm/subdev/therm/gt215.o
 nvkm-y += nvkm/subdev/therm/gf119.o
 nvkm-y += nvkm/subdev/therm/gm107.o
+nvkm-y += nvkm/subdev/therm/gp100.o
drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c +2 -1
index 952a7cb0a59a..f27fc6d0d4c6 100644
@@ -341,7 +341,8 @@ nvkm_therm_init(struct nvkm_subdev *subdev)
 {
        struct nvkm_therm *therm = nvkm_therm(subdev);
 
-       therm->func->init(therm);
+       if (therm->func->init)
+               therm->func->init(therm);
 
        if (therm->suspend >= 0) {
                /* restore the pwm value only when on manual or auto mode */
drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c new file +21 -0
new file mode 100644
index 000000000000..b83d4af8c8bb
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2017 Rhys Kidd
+ *
+ * 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.
+ *

drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c line 31

Quoted 10 lines
drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c new file +10 -0
+ * Authors: Rhys Kidd
+ */
+#include "priv.h"
+
+static int
+gp100_temp_get(struct nvkm_therm *therm)
+{
+       struct nvkm_device *device = therm->subdev.device;
+       struct nvkm_subdev *subdev = &therm->subdev;
+       u32 tsensor = nvkm_rd32(device, 0x20460);

0x020460 (registers are 24-bit values... this isn't done uniformly, but it's good practice)

drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c line 36

Quoted 5 lines
drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c new file +5 -0
+       u32 status  = (tsensor & 0x60000000) >> 29;
+       u32 t_f24_8 = (tsensor & 0x0001fff8);
+
+       /* device SHADOWed */
+       if (status & 0x00000002)

if (tsensor & 0x40000000)

drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c line 37

Quoted 1 line
drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c new file +1 -0
+               nvkm_error(subdev, "Reading temperature from SHADOWed sensor\n");

Is this really worth doing for *every* read? Maybe nvkm_info or nvkm_debug? (What's the significance of this?)

drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c line 40

Quoted 3 lines
drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c new file +3 -0
+
+       /* device valid */
+       if (status & 0x00000001)

if (tsensor & 0x20000000)

drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c line 41

Quoted 1 line
drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c new file +1 -0
+               return t_f24_8 / 256;

aka >> 8

Quoted 7 lines
drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c new file +7 -0
+       else
+               return -ENODEV;
+}
+
+static const struct nvkm_therm_func
+gp100_therm = {
+       .temp_get = gp100_temp_get,

drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c line 57

Quoted 10 lines
drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c new file +9 -0
+       .program_alarms = nvkm_therm_program_alarms_polling,
+};
+
+int
+gp100_therm_new(struct nvkm_device *device, int index,
+               struct nvkm_therm **ptherm)
+{
+       return nvkm_therm_new_(&gp100_therm, device, index, ptherm);
+}
\ No newline at end of file

Please fix this.

Quoted 7 lines

--
2.11.0

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

#3 lore raw
In reply to a message not in the archive
Quoted 124 lines · Rhys Kidd
---
 .../gpu/drm/nouveau/include/nvkm/subdev/therm.h    |  1 +
 drivers/gpu/drm/nouveau/nvkm/engine/device/base.c  |  6 +++
 drivers/gpu/drm/nouveau/nvkm/subdev/therm/Kbuild   |  1 +
 drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c   |  3 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c  | 57 ++++++++++++++++++++++
 5 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c
drivers/gpu/drm/nouveau/include/nvkm/subdev/therm.h +1 -0
index b268b96faece..adf14731ea15 100644
@@ -96,4 +96,5 @@ int g84_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
 int gt215_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
 int gf119_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
 int gm107_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
+int gp100_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
 #endif
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +6 -0
index 7bdc7a5ae723..a6221b0996bf 100644
@@ -2166,6 +2166,7 @@ nv130_chipset = {
        .ltc = gp100_ltc_new,
        .mc = gp100_mc_new,
        .mmu = gf100_mmu_new,
+       .therm = gp100_therm_new,
        .secboot = gm200_secboot_new,
        .pci = gp100_pci_new,
        .pmu = gp100_pmu_new,
@@ -2200,6 +2201,7 @@ nv132_chipset = {
        .ltc = gp100_ltc_new,
        .mc = gp100_mc_new,
        .mmu = gf100_mmu_new,
+       .therm = gp100_therm_new,
        .secboot = gp102_secboot_new,
        .pci = gp100_pci_new,
        .pmu = gp102_pmu_new,
@@ -2234,6 +2236,7 @@ nv134_chipset = {
        .ltc = gp100_ltc_new,
        .mc = gp100_mc_new,
        .mmu = gf100_mmu_new,
+       .therm = gp100_therm_new,
        .secboot = gp102_secboot_new,
        .pci = gp100_pci_new,
        .pmu = gp102_pmu_new,
@@ -2268,6 +2271,7 @@ nv136_chipset = {
        .ltc = gp100_ltc_new,
        .mc = gp100_mc_new,
        .mmu = gf100_mmu_new,
+       .therm = gp100_therm_new,
        .secboot = gp102_secboot_new,
        .pci = gp100_pci_new,
        .pmu = gp102_pmu_new,
@@ -2302,6 +2306,7 @@ nv137_chipset = {
        .ltc = gp100_ltc_new,
        .mc = gp100_mc_new,
        .mmu = gf100_mmu_new,
+       .therm = gp100_therm_new,
        .secboot = gp102_secboot_new,
        .pci = gp100_pci_new,
        .pmu = gp102_pmu_new,
@@ -2332,6 +2337,7 @@ nv13b_chipset = {
        .ltc = gp100_ltc_new,
        .mc = gp10b_mc_new,
        .mmu = gf100_mmu_new,
+       .therm = gp100_therm_new,
        .secboot = gp10b_secboot_new,
        .pmu = gm20b_pmu_new,
        .timer = gk20a_timer_new,
drivers/gpu/drm/nouveau/nvkm/subdev/therm/Kbuild +1 -0
index 135758ba3e28..3ef1b396a946 100644
@@ -11,3 +11,4 @@ nvkm-y += nvkm/subdev/therm/g84.o
 nvkm-y += nvkm/subdev/therm/gt215.o
 nvkm-y += nvkm/subdev/therm/gf119.o
 nvkm-y += nvkm/subdev/therm/gm107.o
+nvkm-y += nvkm/subdev/therm/gp100.o
drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c +2 -1
index 952a7cb0a59a..f27fc6d0d4c6 100644
@@ -341,7 +341,8 @@ nvkm_therm_init(struct nvkm_subdev *subdev)
 {
        struct nvkm_therm *therm = nvkm_therm(subdev);
 
-       therm->func->init(therm);
+       if (therm->func->init)
+               therm->func->init(therm);
 
        if (therm->suspend >= 0) {
                /* restore the pwm value only when on manual or auto mode */
drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c new file +23 -0
new file mode 100644
index 000000000000..b83d4af8c8bb
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2017 Rhys Kidd
+ *
+ * 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: Rhys Kidd
+ */

drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c line 33

Quoted 10 lines
drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c new file +10 -0
+#include "priv.h"
+
+static int
+gp100_temp_get(struct nvkm_therm *therm)
+{
+       struct nvkm_device *device = therm->subdev.device;
+       struct nvkm_subdev *subdev = &therm->subdev;
+       u32 tsensor = nvkm_rd32(device, 0x20460);
+       u32 status  = (tsensor & 0x60000000) >> 29;
+       u32 t_f24_8 = (tsensor & 0x0001fff8);

please use a better variable name than "t_f24_8"

Quoted 28 lines
drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c new file +24 -1
+
+       /* device SHADOWed */
+       if (status & 0x00000002)
+               nvkm_error(subdev, "Reading temperature from SHADOWed sensor\n");
+
+       /* device valid */
+       if (status & 0x00000001)
+               return t_f24_8 / 256;
+       else
+               return -ENODEV;
+}
+
+static const struct nvkm_therm_func
+gp100_therm = {
+       .temp_get = gp100_temp_get,
+       .program_alarms = nvkm_therm_program_alarms_polling,
+};
+
+int
+gp100_therm_new(struct nvkm_device *device, int index,
+               struct nvkm_therm **ptherm)
+{
+       return nvkm_therm_new_(&gp100_therm, device, index, ptherm);
+}
\ No newline at end of file
--

2.11.0

Quoted 4 lines

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

author
#4 lore raw

PATCH v2 1/1 drm/nouveau/therm: initial implementation of new gp1xx temperature sensor

In reply to a message not in the archive

v2:
- add nv138 and drop nv13b chipsets (Ilia Mirkin)
- refactor out status variable and instead mask tsensor (Ilia Mirkin)
- switch SHADOWed state message away from nvkm_error() (Ilia Mirkin)
- rename internal temperature variable (Karol Herbst)

---
 .../gpu/drm/nouveau/include/nvkm/subdev/therm.h    |  1 +
 drivers/gpu/drm/nouveau/nvkm/engine/device/base.c  |  6 +++
 drivers/gpu/drm/nouveau/nvkm/subdev/therm/Kbuild   |  1 +
 drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c   |  3 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c  | 56 ++++++++++++++++++++++
 5 files changed, 66 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c
drivers/gpu/drm/nouveau/include/nvkm/subdev/therm.h +1 -0
index 1bfd93b85575..9841f076da2e 100644
@@ -97,4 +97,5 @@ int gt215_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
 int gf119_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
 int gm107_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
 int gm200_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
+int gp100_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
 #endif
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +6 -0
index e096a5d9c292..28fd4fa98635 100644
@@ -2169,6 +2169,7 @@ nv130_chipset = {
 	.ltc = gp100_ltc_new,
 	.mc = gp100_mc_new,
 	.mmu = gf100_mmu_new,
+	.therm = gp100_therm_new,
 	.secboot = gm200_secboot_new,
 	.pci = gp100_pci_new,
 	.pmu = gp100_pmu_new,
@@ -2203,6 +2204,7 @@ nv132_chipset = {
 	.ltc = gp100_ltc_new,
 	.mc = gp100_mc_new,
 	.mmu = gf100_mmu_new,
+	.therm = gp100_therm_new,
 	.secboot = gp102_secboot_new,
 	.pci = gp100_pci_new,
 	.pmu = gp102_pmu_new,
@@ -2237,6 +2239,7 @@ nv134_chipset = {
 	.ltc = gp100_ltc_new,
 	.mc = gp100_mc_new,
 	.mmu = gf100_mmu_new,
+	.therm = gp100_therm_new,
 	.secboot = gp102_secboot_new,
 	.pci = gp100_pci_new,
 	.pmu = gp102_pmu_new,
@@ -2271,6 +2274,7 @@ nv136_chipset = {
 	.ltc = gp100_ltc_new,
 	.mc = gp100_mc_new,
 	.mmu = gf100_mmu_new,
+	.therm = gp100_therm_new,
 	.secboot = gp102_secboot_new,
 	.pci = gp100_pci_new,
 	.pmu = gp102_pmu_new,
@@ -2305,6 +2309,7 @@ nv137_chipset = {
 	.ltc = gp100_ltc_new,
 	.mc = gp100_mc_new,
 	.mmu = gf100_mmu_new,
+	.therm = gp100_therm_new,
 	.secboot = gp102_secboot_new,
 	.pci = gp100_pci_new,
 	.pmu = gp102_pmu_new,
@@ -2339,6 +2344,7 @@ nv138_chipset = {
 	.ltc = gp100_ltc_new,
 	.mc = gp100_mc_new,
 	.mmu = gf100_mmu_new,
+	.therm = gp100_therm_new,
 	.pci = gp100_pci_new,
 	.pmu = gp102_pmu_new,
 	.timer = gk20a_timer_new,
drivers/gpu/drm/nouveau/nvkm/subdev/therm/Kbuild +1 -0
index 2bafcc1d1818..7ba56b12badd 100644
@@ -12,3 +12,4 @@ nvkm-y += nvkm/subdev/therm/gt215.o
 nvkm-y += nvkm/subdev/therm/gf119.o
 nvkm-y += nvkm/subdev/therm/gm107.o
 nvkm-y += nvkm/subdev/therm/gm200.o
+nvkm-y += nvkm/subdev/therm/gp100.o
drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c +2 -1
index 952a7cb0a59a..f27fc6d0d4c6 100644
@@ -341,7 +341,8 @@ nvkm_therm_init(struct nvkm_subdev *subdev)
 {
 	struct nvkm_therm *therm = nvkm_therm(subdev);
 
-	therm->func->init(therm);
+	if (therm->func->init)
+		therm->func->init(therm);
 
 	if (therm->suspend >= 0) {
 		/* restore the pwm value only when on manual or auto mode */
drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c new file +56 -0

56 lines not on this page · raw message

Signature · 6 lines
2.11.0

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): 20170901013753.6854-1-rhyskidd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

author
#6 lore raw

PATCH v3 1/1 drm/nouveau/therm: initial implementation of new gp1xx temperature sensor

v2:
- add nv138 and drop nv13b chipsets (Ilia Mirkin)
- refactor out status variable and instead mask tsensor (Ilia Mirkin)
- switch SHADOWed state message away from nvkm_error() (Ilia Mirkin)
- rename internal temperature variable (Karol Herbst)

v3:
- use nvkm_trace() for SHADOWed state message (Ben Skeggs)

---
 .../gpu/drm/nouveau/include/nvkm/subdev/therm.h    |  1 +
 drivers/gpu/drm/nouveau/nvkm/engine/device/base.c  |  6 +++
 drivers/gpu/drm/nouveau/nvkm/subdev/therm/Kbuild   |  1 +
 drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c   |  3 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c  | 56 ++++++++++++++++++++++
 5 files changed, 66 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c
drivers/gpu/drm/nouveau/include/nvkm/subdev/therm.h +1 -0
index 1bfd93b85575..9841f076da2e 100644
@@ -97,4 +97,5 @@ int gt215_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
 int gf119_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
 int gm107_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
 int gm200_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
+int gp100_therm_new(struct nvkm_device *, int, struct nvkm_therm **);
 #endif
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +6 -0
index e096a5d9c292..28fd4fa98635 100644
@@ -2169,6 +2169,7 @@ nv130_chipset = {
 	.ltc = gp100_ltc_new,
 	.mc = gp100_mc_new,
 	.mmu = gf100_mmu_new,
+	.therm = gp100_therm_new,
 	.secboot = gm200_secboot_new,
 	.pci = gp100_pci_new,
 	.pmu = gp100_pmu_new,
@@ -2203,6 +2204,7 @@ nv132_chipset = {
 	.ltc = gp100_ltc_new,
 	.mc = gp100_mc_new,
 	.mmu = gf100_mmu_new,
+	.therm = gp100_therm_new,
 	.secboot = gp102_secboot_new,
 	.pci = gp100_pci_new,
 	.pmu = gp102_pmu_new,
@@ -2237,6 +2239,7 @@ nv134_chipset = {
 	.ltc = gp100_ltc_new,
 	.mc = gp100_mc_new,
 	.mmu = gf100_mmu_new,
+	.therm = gp100_therm_new,
 	.secboot = gp102_secboot_new,
 	.pci = gp100_pci_new,
 	.pmu = gp102_pmu_new,
@@ -2271,6 +2274,7 @@ nv136_chipset = {
 	.ltc = gp100_ltc_new,
 	.mc = gp100_mc_new,
 	.mmu = gf100_mmu_new,
+	.therm = gp100_therm_new,
 	.secboot = gp102_secboot_new,
 	.pci = gp100_pci_new,
 	.pmu = gp102_pmu_new,
@@ -2305,6 +2309,7 @@ nv137_chipset = {
 	.ltc = gp100_ltc_new,
 	.mc = gp100_mc_new,
 	.mmu = gf100_mmu_new,
+	.therm = gp100_therm_new,
 	.secboot = gp102_secboot_new,
 	.pci = gp100_pci_new,
 	.pmu = gp102_pmu_new,
@@ -2339,6 +2344,7 @@ nv138_chipset = {
 	.ltc = gp100_ltc_new,
 	.mc = gp100_mc_new,
 	.mmu = gf100_mmu_new,
+	.therm = gp100_therm_new,
 	.pci = gp100_pci_new,
 	.pmu = gp102_pmu_new,
 	.timer = gk20a_timer_new,
drivers/gpu/drm/nouveau/nvkm/subdev/therm/Kbuild +1 -0
index 2bafcc1d1818..7ba56b12badd 100644
@@ -12,3 +12,4 @@ nvkm-y += nvkm/subdev/therm/gt215.o
 nvkm-y += nvkm/subdev/therm/gf119.o
 nvkm-y += nvkm/subdev/therm/gm107.o
 nvkm-y += nvkm/subdev/therm/gm200.o
+nvkm-y += nvkm/subdev/therm/gp100.o
drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c +2 -1
index 952a7cb0a59a..f27fc6d0d4c6 100644
@@ -341,7 +341,8 @@ nvkm_therm_init(struct nvkm_subdev *subdev)
 {
 	struct nvkm_therm *therm = nvkm_therm(subdev);
 
-	therm->func->init(therm);
+	if (therm->func->init)
+		therm->func->init(therm);
 
 	if (therm->suspend >= 0) {
 		/* restore the pwm value only when on manual or auto mode */
drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c new file +56 -0

56 lines not on this page · raw message

Signature · 6 lines
2.11.0

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau