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 16:44:02 +0000 (11:44 -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>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index e3df652bb74e9fb1d9fc31e35048e25c04e8182e..b27fa9738cacb0ab9ca197126569a26295f06c32 100644 (file)
@@ -1625,75 +1625,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");
        }
 }
 
@@ -2002,7 +2057,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;