From: Ben Skeggs <[email protected]>

- disable GPIO completely when GSP-RM detected

Signed-off-by: Ben Skeggs <[email protected]>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/gpio/ga102.c | 5 +++++
 drivers/gpu/drm/nouveau/nvkm/subdev/gpio/gk104.c | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gpio/ga102.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/gpio/ga102.c
index 4a96f926b66d..4dbffae21ddc 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gpio/ga102.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gpio/ga102.c
@@ -21,6 +21,8 @@
  */
 #include "priv.h"
 
+#include <subdev/gsp.h>
+
 static void
 ga102_gpio_reset(struct nvkm_gpio *gpio, u8 match)
 {
@@ -115,5 +117,8 @@ int
 ga102_gpio_new(struct nvkm_device *device, enum nvkm_subdev_type type, int 
inst,
               struct nvkm_gpio **pgpio)
 {
+       if (nvkm_gsp_rm(device->gsp))
+               return -ENODEV;
+
        return nvkm_gpio_new_(&ga102_gpio, device, type, inst, pgpio);
 }
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gpio/gk104.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/gpio/gk104.c
index c0e4cdb45520..5f7063d5579b 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gpio/gk104.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gpio/gk104.c
@@ -23,6 +23,8 @@
  */
 #include "priv.h"
 
+#include <subdev/gsp.h>
+
 static void
 gk104_gpio_intr_stat(struct nvkm_gpio *gpio, u32 *hi, u32 *lo)
 {
@@ -71,5 +73,8 @@ int
 gk104_gpio_new(struct nvkm_device *device, enum nvkm_subdev_type type, int 
inst,
               struct nvkm_gpio **pgpio)
 {
+       if (nvkm_gsp_rm(device->gsp))
+               return -ENODEV;
+
        return nvkm_gpio_new_(&gk104_gpio, device, type, inst, pgpio);
 }
-- 
2.41.0

Reply via email to