Skip to content

Commit

Permalink
Merge pull request #2 from Razor246/ps4-5.1.0
Browse files Browse the repository at this point in the history
Ps4 5.1.0
  • Loading branch information
Razor246 authored May 12, 2019
2 parents 5e3af20 + d559296 commit 13f384d
Show file tree
Hide file tree
Showing 9 changed files with 2,428 additions and 42 deletions.
1,092 changes: 1,085 additions & 7 deletions drivers/gpu/drm/drm_irq.c

Large diffs are not rendered by default.

57 changes: 56 additions & 1 deletion drivers/gpu/drm/drm_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ int drm_irq_by_busid(struct drm_device *dev, void *data,
if (WARN_ON(!dev->pdev))
return -EINVAL;

root = dev->pdev->bus->self;

if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
return -EOPNOTSUPP;

Expand Down Expand Up @@ -324,9 +326,60 @@ int drm_legacy_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
}
return 0;
}
EXPORT_SYMBOL(drm_legacy_pci_init);

int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *mask)
{
struct pci_dev *root;
u32 lnkcap, lnkcap2;

*mask = 0;
if (!dev->pdev)
if (!dev->pdev || pci_is_root_bus(dev->pdev->bus))
return -EINVAL;

root = dev->pdev->bus->self;
/* we've been informed via and serverworks don't make the cut */
if (root->vendor == PCI_VENDOR_ID_VIA ||
root->vendor == PCI_VENDOR_ID_SERVERWORKS)
return -EINVAL;
pcie_capability_read_dword(root, PCI_EXP_LNKCAP, &lnkcap);
pcie_capability_read_dword(root, PCI_EXP_LNKCAP2, &lnkcap2);
if (lnkcap2) { /* PCIe r3.0-compliant */
if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_2_5GB)
*mask |= DRM_PCIE_SPEED_25;
if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_5_0GB)
*mask |= DRM_PCIE_SPEED_50;
if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_8_0GB)
*mask |= DRM_PCIE_SPEED_80;
} else { /* pre-r3.0 */
if (lnkcap & PCI_EXP_LNKCAP_SLS_2_5GB)
*mask |= DRM_PCIE_SPEED_25;
if (lnkcap & PCI_EXP_LNKCAP_SLS_5_0GB)
*mask |= (DRM_PCIE_SPEED_25 | DRM_PCIE_SPEED_50);
}
DRM_INFO("probing gen 2 caps for device %x:%x = %x/%x\n", root->vendor, root->device, lnkcap, lnkcap2);
return 0;
}
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_legacy_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
{
return -1;
}

void drm_pci_agp_destroy(struct drm_device *dev) {}

Expand All @@ -337,6 +390,8 @@ int drm_irq_by_busid(struct drm_device *dev, void *data,
}
#endif

EXPORT_SYMBOL(drm_legacy_pci_init);

/**
* drm_legacy_pci_exit - unregister shadow-attach legacy DRM driver
* @driver: DRM device driver
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/radeon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \

radeon-$(CONFIG_MMU_NOTIFIER) += radeon_mn.o

radeon-$(CONFIG_X86_PS4) += ps4_bridge.o

# add async DMA block
radeon-y += \
r600_dma.o \
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/radeon/atombios_dp.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ static int radeon_dp_get_dp_link_config(struct drm_connector *connector,
}
} else {
for (i = 0; i < ARRAY_SIZE(link_rates) && link_rates[i] <= max_link_rate; i++) {
for (lane_num = 1; lane_num <= max_lane_num; lane_num <<= 1) {
for (lane_num = 4; lane_num <= max_lane_num; lane_num <<= 1) {
max_pix_clock = (lane_num * link_rates[i] * 8) / bpp;
if (max_pix_clock >= pix_clock) {
*dp_lanes = lane_num;
Expand Down
3 changes: 2 additions & 1 deletion drivers/gpu/drm/radeon/atombios_encoders.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,8 @@ atombios_get_encoder_mode(struct drm_encoder *encoder)
if (radeon_encoder->is_mst_encoder || radeon_encoder->offset)
return ATOM_ENCODER_MODE_DP_MST;
/* dp bridges are always DP */
if (radeon_encoder_get_dp_bridge_encoder_id(encoder) != ENCODER_OBJECT_ID_NONE)
if if (radeon_encoder_get_dp_bridge_encoder_id(encoder) != ENCODER_OBJECT_ID_NONE ||
rdev->family == CHIP_LIVERPOOL)
return ATOM_ENCODER_MODE_DP;

/* DVO is always DVO */
Expand Down
Loading

0 comments on commit 13f384d

Please sign in to comment.