From: Robin Chen <robin.c...@amd.com>

[Why]
This is the fix for the defect of commit 11ec7d8f2263
("drm/amd/display: Allow individual control of eDP hotplug support").

[How]
To revise the default eDP hotplug setting and use the enum to git rid
of the magic number for different options.

Fixes: 11ec7d8f2263 ("drm/amd/display: Allow individual control of eDP hotplug 
support")

Cc: sta...@vger.kernel.org
Cc: Mario Limonciello <mario.limoncie...@amd.com>
Reviewed-by: Wenjing Liu <wenjing....@amd.com>
Acked-by: Qingqing Zhuo <qingqing.z...@amd.com>
Signed-off-by: Robin Chen <robin.c...@amd.com>
---
 drivers/gpu/drm/amd/display/dc/dc_types.h          | 7 +++++++
 drivers/gpu/drm/amd/display/dc/link/link_factory.c | 9 +++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dc_types.h 
b/drivers/gpu/drm/amd/display/dc/dc_types.h
index 4b47fa00610b..45ab48fe5d00 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_types.h
+++ b/drivers/gpu/drm/amd/display/dc/dc_types.h
@@ -1080,4 +1080,11 @@ struct dc_dpia_bw_alloc {
 };
 
 #define MAX_SINKS_PER_LINK 4
+
+enum dc_hpd_enable_select {
+       HPD_EN_FOR_ALL_EDP = 0,
+       HPD_EN_FOR_PRIMARY_EDP_ONLY,
+       HPD_EN_FOR_SECONDARY_EDP_ONLY,
+};
+
 #endif /* DC_TYPES_H_ */
diff --git a/drivers/gpu/drm/amd/display/dc/link/link_factory.c 
b/drivers/gpu/drm/amd/display/dc/link/link_factory.c
index 995032a341b3..3951d48118c4 100644
--- a/drivers/gpu/drm/amd/display/dc/link/link_factory.c
+++ b/drivers/gpu/drm/amd/display/dc/link/link_factory.c
@@ -528,14 +528,18 @@ static bool construct_phy(struct dc_link *link,
                                link->irq_source_hpd = DC_IRQ_SOURCE_INVALID;
 
                        switch (link->dc->config.allow_edp_hotplug_detection) {
-                       case 1: // only the 1st eDP handles hotplug
+                       case HPD_EN_FOR_ALL_EDP:
+                               link->irq_source_hpd_rx =
+                                               
dal_irq_get_rx_source(link->hpd_gpio);
+                               break;
+                       case HPD_EN_FOR_PRIMARY_EDP_ONLY:
                                if (link->link_index == 0)
                                        link->irq_source_hpd_rx =
                                                
dal_irq_get_rx_source(link->hpd_gpio);
                                else
                                        link->irq_source_hpd = 
DC_IRQ_SOURCE_INVALID;
                                break;
-                       case 2: // only the 2nd eDP handles hotplug
+                       case HPD_EN_FOR_SECONDARY_EDP_ONLY:
                                if (link->link_index == 1)
                                        link->irq_source_hpd_rx =
                                                
dal_irq_get_rx_source(link->hpd_gpio);
@@ -543,6 +547,7 @@ static bool construct_phy(struct dc_link *link,
                                        link->irq_source_hpd = 
DC_IRQ_SOURCE_INVALID;
                                break;
                        default:
+                               link->irq_source_hpd = DC_IRQ_SOURCE_INVALID;
                                break;
                        }
                }
-- 
2.34.1

Reply via email to