提交 60d8edd4 编写于 作者: A Alex Deucher

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: NJammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 16881da6
......@@ -410,6 +410,26 @@ int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *mask)
}
EXPORT_SYMBOL(drm_pcie_get_speed_cap_mask);
int drm_pcie_get_max_link_width(struct drm_device *dev, u32 *mlw)
{
struct pci_dev *root;
u32 lnkcap;
*mlw = 0;
if (!dev->pdev)
return -EINVAL;
root = dev->pdev->bus->self;
pcie_capability_read_dword(root, PCI_EXP_LNKCAP, &lnkcap);
*mlw = (lnkcap & PCI_EXP_LNKCAP_MLW) >> 4;
DRM_INFO("probing mlw for device %x:%x = %x\n", root->vendor, root->device, lnkcap);
return 0;
}
EXPORT_SYMBOL(drm_pcie_get_max_link_width);
#else
int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
......
......@@ -1098,6 +1098,7 @@ static inline int drm_pci_set_busid(struct drm_device *dev,
#define DRM_PCIE_SPEED_80 4
extern int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *speed_mask);
extern int drm_pcie_get_max_link_width(struct drm_device *dev, u32 *mlw);
/* platform section */
extern int drm_platform_init(struct drm_driver *driver, struct platform_device *platform_device);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册