Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: add a quirk to enable eDP0 on DP1

[why]
some board designs have eDP0 connected to DP1, need a way to enable
support_edp0_on_dp1 flag, otherwise edp related features cannot work

[how]
do a dmi check during dm initialization to identify systems that
require support_edp0_on_dp1. Optimize quirk table with callback
functions to set quirk entries, retrieve_dmi_info can set quirks
according to quirk entries

Cc: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: Yilin Chen <Yilin.Chen@amd.com>
Signed-off-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit f6d17270d18a6a6753fff046330483d43f8405e4)
Cc: stable@vger.kernel.org

authored by

Yilin Chen and committed by
Alex Deucher
b5f7242e e8863f8b

+62 -7
+62 -7
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 1618 1618 return false; 1619 1619 } 1620 1620 1621 - static const struct dmi_system_id hpd_disconnect_quirk_table[] = { 1621 + struct amdgpu_dm_quirks { 1622 + bool aux_hpd_discon; 1623 + bool support_edp0_on_dp1; 1624 + }; 1625 + 1626 + static struct amdgpu_dm_quirks quirk_entries = { 1627 + .aux_hpd_discon = false, 1628 + .support_edp0_on_dp1 = false 1629 + }; 1630 + 1631 + static int edp0_on_dp1_callback(const struct dmi_system_id *id) 1632 + { 1633 + quirk_entries.support_edp0_on_dp1 = true; 1634 + return 0; 1635 + } 1636 + 1637 + static int aux_hpd_discon_callback(const struct dmi_system_id *id) 1638 + { 1639 + quirk_entries.aux_hpd_discon = true; 1640 + return 0; 1641 + } 1642 + 1643 + static const struct dmi_system_id dmi_quirk_table[] = { 1622 1644 { 1645 + .callback = aux_hpd_discon_callback, 1623 1646 .matches = { 1624 1647 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 1625 1648 DMI_MATCH(DMI_PRODUCT_NAME, "Precision 3660"), 1626 1649 }, 1627 1650 }, 1628 1651 { 1652 + .callback = aux_hpd_discon_callback, 1629 1653 .matches = { 1630 1654 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 1631 1655 DMI_MATCH(DMI_PRODUCT_NAME, "Precision 3260"), 1632 1656 }, 1633 1657 }, 1634 1658 { 1659 + .callback = aux_hpd_discon_callback, 1635 1660 .matches = { 1636 1661 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 1637 1662 DMI_MATCH(DMI_PRODUCT_NAME, "Precision 3460"), 1638 1663 }, 1639 1664 }, 1640 1665 { 1666 + .callback = aux_hpd_discon_callback, 1641 1667 .matches = { 1642 1668 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 1643 1669 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex Tower Plus 7010"), 1644 1670 }, 1645 1671 }, 1646 1672 { 1673 + .callback = aux_hpd_discon_callback, 1647 1674 .matches = { 1648 1675 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 1649 1676 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex Tower 7010"), 1650 1677 }, 1651 1678 }, 1652 1679 { 1680 + .callback = aux_hpd_discon_callback, 1653 1681 .matches = { 1654 1682 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 1655 1683 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex SFF Plus 7010"), 1656 1684 }, 1657 1685 }, 1658 1686 { 1687 + .callback = aux_hpd_discon_callback, 1659 1688 .matches = { 1660 1689 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 1661 1690 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex SFF 7010"), 1662 1691 }, 1663 1692 }, 1664 1693 { 1694 + .callback = aux_hpd_discon_callback, 1665 1695 .matches = { 1666 1696 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 1667 1697 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex Micro Plus 7010"), 1668 1698 }, 1669 1699 }, 1670 1700 { 1701 + .callback = aux_hpd_discon_callback, 1671 1702 .matches = { 1672 1703 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 1673 1704 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex Micro 7010"), 1705 + }, 1706 + }, 1707 + { 1708 + .callback = edp0_on_dp1_callback, 1709 + .matches = { 1710 + DMI_MATCH(DMI_SYS_VENDOR, "HP"), 1711 + DMI_MATCH(DMI_PRODUCT_NAME, "HP Elite mt645 G8 Mobile Thin Client"), 1712 + }, 1713 + }, 1714 + { 1715 + .callback = edp0_on_dp1_callback, 1716 + .matches = { 1717 + DMI_MATCH(DMI_SYS_VENDOR, "HP"), 1718 + DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook 665 16 inch G11 Notebook PC"), 1674 1719 }, 1675 1720 }, 1676 1721 {} 1677 1722 /* TODO: refactor this from a fixed table to a dynamic option */ 1678 1723 }; 1679 1724 1680 - static void retrieve_dmi_info(struct amdgpu_display_manager *dm) 1725 + static void retrieve_dmi_info(struct amdgpu_display_manager *dm, struct dc_init_data *init_data) 1681 1726 { 1682 - const struct dmi_system_id *dmi_id; 1727 + int dmi_id; 1728 + struct drm_device *dev = dm->ddev; 1683 1729 1684 1730 dm->aux_hpd_discon_quirk = false; 1731 + init_data->flags.support_edp0_on_dp1 = false; 1685 1732 1686 - dmi_id = dmi_first_match(hpd_disconnect_quirk_table); 1687 - if (dmi_id) { 1733 + dmi_id = dmi_check_system(dmi_quirk_table); 1734 + 1735 + if (!dmi_id) 1736 + return; 1737 + 1738 + if (quirk_entries.aux_hpd_discon) { 1688 1739 dm->aux_hpd_discon_quirk = true; 1689 - DRM_INFO("aux_hpd_discon_quirk attached\n"); 1740 + drm_info(dev, "aux_hpd_discon_quirk attached\n"); 1741 + } 1742 + if (quirk_entries.support_edp0_on_dp1) { 1743 + init_data->flags.support_edp0_on_dp1 = true; 1744 + drm_info(dev, "aux_hpd_discon_quirk attached\n"); 1690 1745 } 1691 1746 } 1692 1747 ··· 2049 1994 if (amdgpu_ip_version(adev, DCE_HWIP, 0) >= IP_VERSION(3, 0, 0)) 2050 1995 init_data.num_virtual_links = 1; 2051 1996 2052 - retrieve_dmi_info(&adev->dm); 1997 + retrieve_dmi_info(&adev->dm, &init_data); 2053 1998 2054 1999 if (adev->dm.bb_from_dmub) 2055 2000 init_data.bb_from_dmub = adev->dm.bb_from_dmub;