diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2015-11-11 23:14:39 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-12-21 16:42:31 -0500 |
commit | 60d8edd415e9da63599c7601707ca78ad74a927e (patch) | |
tree | ba49fa9df13bde6909bda2a16ba1157bd2e6b995 /drivers/gpu/drm | |
parent | 16881da6c0b9db5fca95b96b0f02720e94c92629 (diff) |
drm: add drm_pcie_get_max_link_width helper (v2)
Add a helper to get the max link width of the port.
Similar to the helper to get the max link speed.
v2: fix typo in commit message
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/drm_pci.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c index fcd2a86acd2c..a1fff1179a97 100644 --- a/drivers/gpu/drm/drm_pci.c +++ b/drivers/gpu/drm/drm_pci.c | |||
@@ -410,6 +410,26 @@ int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *mask) | |||
410 | } | 410 | } |
411 | EXPORT_SYMBOL(drm_pcie_get_speed_cap_mask); | 411 | EXPORT_SYMBOL(drm_pcie_get_speed_cap_mask); |
412 | 412 | ||
413 | int drm_pcie_get_max_link_width(struct drm_device *dev, u32 *mlw) | ||
414 | { | ||
415 | struct pci_dev *root; | ||
416 | u32 lnkcap; | ||
417 | |||
418 | *mlw = 0; | ||
419 | if (!dev->pdev) | ||
420 | return -EINVAL; | ||
421 | |||
422 | root = dev->pdev->bus->self; | ||
423 | |||
424 | pcie_capability_read_dword(root, PCI_EXP_LNKCAP, &lnkcap); | ||
425 | |||
426 | *mlw = (lnkcap & PCI_EXP_LNKCAP_MLW) >> 4; | ||
427 | |||
428 | DRM_INFO("probing mlw for device %x:%x = %x\n", root->vendor, root->device, lnkcap); | ||
429 | return 0; | ||
430 | } | ||
431 | EXPORT_SYMBOL(drm_pcie_get_max_link_width); | ||
432 | |||
413 | #else | 433 | #else |
414 | 434 | ||
415 | int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver) | 435 | int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver) |