]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amd/display: add a quirk to enable eDP0 on DP1
authorYilin Chen <Yilin.Chen@amd.com>
Fri, 7 Feb 2025 20:26:19 +0000 (15:26 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 25 Feb 2025 17:27:57 +0000 (12:27 -0500)
[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
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index 5ddd21466e22f28b523d47372423919b346116e6..9d9645a2d18effaeb86c4e69cb5e73d2ba0d2703 100644 (file)
@@ -1618,75 +1618,130 @@ static bool dm_should_disable_stutter(struct pci_dev *pdev)
        return false;
 }
 
-static const struct dmi_system_id hpd_disconnect_quirk_table[] = {
+struct amdgpu_dm_quirks {
+       bool aux_hpd_discon;
+       bool support_edp0_on_dp1;
+};
+
+static struct amdgpu_dm_quirks quirk_entries = {
+       .aux_hpd_discon = false,
+       .support_edp0_on_dp1 = false
+};
+
+static int edp0_on_dp1_callback(const struct dmi_system_id *id)
+{
+       quirk_entries.support_edp0_on_dp1 = true;
+       return 0;
+}
+
+static int aux_hpd_discon_callback(const struct dmi_system_id *id)
+{
+       quirk_entries.aux_hpd_discon = true;
+       return 0;
+}
+
+static const struct dmi_system_id dmi_quirk_table[] = {
        {
+               .callback = aux_hpd_discon_callback,
                .matches = {
                        DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
                        DMI_MATCH(DMI_PRODUCT_NAME, "Precision 3660"),
                },
        },
        {
+               .callback = aux_hpd_discon_callback,
                .matches = {
                        DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
                        DMI_MATCH(DMI_PRODUCT_NAME, "Precision 3260"),
                },
        },
        {
+               .callback = aux_hpd_discon_callback,
                .matches = {
                        DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
                        DMI_MATCH(DMI_PRODUCT_NAME, "Precision 3460"),
                },
        },
        {
+               .callback = aux_hpd_discon_callback,
                .matches = {
                        DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
                        DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex Tower Plus 7010"),
                },
        },
        {
+               .callback = aux_hpd_discon_callback,
                .matches = {
                        DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
                        DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex Tower 7010"),
                },
        },
        {
+               .callback = aux_hpd_discon_callback,
                .matches = {
                        DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
                        DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex SFF Plus 7010"),
                },
        },
        {
+               .callback = aux_hpd_discon_callback,
                .matches = {
                        DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
                        DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex SFF 7010"),
                },
        },
        {
+               .callback = aux_hpd_discon_callback,
                .matches = {
                        DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
                        DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex Micro Plus 7010"),
                },
        },
        {
+               .callback = aux_hpd_discon_callback,
                .matches = {
                        DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
                        DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex Micro 7010"),
                },
        },
+       {
+               .callback = edp0_on_dp1_callback,
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "HP Elite mt645 G8 Mobile Thin Client"),
+               },
+       },
+       {
+               .callback = edp0_on_dp1_callback,
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook 665 16 inch G11 Notebook PC"),
+               },
+       },
        {}
        /* TODO: refactor this from a fixed table to a dynamic option */
 };
 
-static void retrieve_dmi_info(struct amdgpu_display_manager *dm)
+static void retrieve_dmi_info(struct amdgpu_display_manager *dm, struct dc_init_data *init_data)
 {
-       const struct dmi_system_id *dmi_id;
+       int dmi_id;
+       struct drm_device *dev = dm->ddev;
 
        dm->aux_hpd_discon_quirk = false;
+       init_data->flags.support_edp0_on_dp1 = false;
+
+       dmi_id = dmi_check_system(dmi_quirk_table);
 
-       dmi_id = dmi_first_match(hpd_disconnect_quirk_table);
-       if (dmi_id) {
+       if (!dmi_id)
+               return;
+
+       if (quirk_entries.aux_hpd_discon) {
                dm->aux_hpd_discon_quirk = true;
-               DRM_INFO("aux_hpd_discon_quirk attached\n");
+               drm_info(dev, "aux_hpd_discon_quirk attached\n");
+       }
+       if (quirk_entries.support_edp0_on_dp1) {
+               init_data->flags.support_edp0_on_dp1 = true;
+               drm_info(dev, "aux_hpd_discon_quirk attached\n");
        }
 }
 
@@ -1994,7 +2049,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
        if (amdgpu_ip_version(adev, DCE_HWIP, 0) >= IP_VERSION(3, 0, 0))
                init_data.num_virtual_links = 1;
 
-       retrieve_dmi_info(&adev->dm);
+       retrieve_dmi_info(&adev->dm, &init_data);
 
        if (adev->dm.bb_from_dmub)
                init_data.bb_from_dmub = adev->dm.bb_from_dmub;