[PATCH 5/7] drm/nouveau/pci: add nvkm_pcie_get_speed
Karol Herbst
kherbst at redhat.com
Wed Aug 14 21:31:16 UTC 2019
v2: fixed compilation error
Signed-off-by: Karol Herbst <kherbst at redhat.com>
Reviewed-by: Lyude Paul <lyude at redhat.com>
CC: Alex Hung <alex.hung at canonical.com>
CC: Rafael J. Wysocki <rafael.j.wysocki at intel.com>
CC: Dave Airlie <airlied at redhat.com>
CC: Lyude Paul <lyude at redhat.com>
CC: Ben Skeggs <bskeggs at redhat.com>
---
drivers/gpu/drm/nouveau/include/nvkm/subdev/pci.h | 1 +
drivers/gpu/drm/nouveau/nvkm/subdev/pci/pcie.c | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/pci.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/pci.h
index 4803a4fad4a2..b29101e485f9 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/pci.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/pci.h
@@ -53,4 +53,5 @@ int gp100_pci_new(struct nvkm_device *, int, struct nvkm_pci **);
/* pcie functions */
int nvkm_pcie_set_link(struct nvkm_pci *, enum nvkm_pcie_speed, u8 width);
+enum nvkm_pcie_speed nvkm_pcie_get_speed(struct nvkm_pci *);
#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/pcie.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/pcie.c
index d71e5db5028a..03be24930c0e 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/pcie.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/pcie.c
@@ -163,3 +163,11 @@ nvkm_pcie_set_link(struct nvkm_pci *pci, enum nvkm_pcie_speed speed, u8 width)
return ret;
}
+
+enum nvkm_pcie_speed
+nvkm_pcie_get_speed(struct nvkm_pci *pci)
+{
+ if (!pci || !pci_is_pcie(pci->pdev) || !pci->func->pcie.cur_speed)
+ return -ENODEV;
+ return pci->func->pcie.cur_speed(pci);
+}
--
2.21.0
More information about the dri-devel
mailing list