drm/amd/display: Make GPIO HPD path conditional
authorRoman Li <Roman.Li@amd.com>
Fri, 23 Jan 2026 22:00:06 +0000 (17:00 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 12 Feb 2026 20:12:59 +0000 (15:12 -0500)
[Why]
Avoid unnecessary GPIO configuration attempts on dcn that doesn't
support it.

[How]
Conditionally use GPIO HPD detection or rely on hw encoder path.

Reviewed-by: Charlene Liu <charlene.liu@amd.com>
Signed-off-by: Roman Li <Roman.Li@amd.com>
Signed-off-by: Tom Chung <chiahsuan.chung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/link/link_factory.c
drivers/gpu/drm/amd/display/dc/link/protocols/link_hpd.c

index 5fbcf04..6f4c3c7 100644 (file)
@@ -564,9 +564,11 @@ static bool construct_phy(struct dc_link *link,
        enc_init_data.analog_engine = find_analog_engine(link, &enc_init_data.analog_encoder);
        enc_init_data.encoder = link_encoder;
        enc_init_data.analog_engine = link_analog_engine;
-       enc_init_data.hpd_gpio = link_get_hpd_gpio(link->ctx->dc_bios, link->link_id,
-                                     link->ctx->gpio_service);
-
+       if (link->ctx->dce_version <= DCN_VERSION_4_01)
+               enc_init_data.hpd_gpio = link_get_hpd_gpio(link->ctx->dc_bios, link->link_id,
+                                             link->ctx->gpio_service);
+       else
+               enc_init_data.hpd_gpio = NULL;
        if (enc_init_data.hpd_gpio) {
                dal_gpio_open(enc_init_data.hpd_gpio, GPIO_MODE_INTERRUPT);
                dal_gpio_unlock_pin(enc_init_data.hpd_gpio);
index 29f3a03..b157d05 100644 (file)
@@ -136,8 +136,13 @@ enum hpd_source_id get_hpd_line(struct dc_link *link)
 
                hpd_id = HPD_SOURCEID_UNKNOWN;
 
-       hpd = link_get_hpd_gpio(link->ctx->dc_bios, link->link_id,
-                          link->ctx->gpio_service);
+       /* Use GPIO path where supported, otherwise use hardware encoder path */
+       if (link->ctx && link->ctx->dce_version <= DCN_VERSION_4_01) {
+               hpd = link_get_hpd_gpio(link->ctx->dc_bios, link->link_id,
+                                  link->ctx->gpio_service);
+       } else {
+               hpd = NULL;
+       }
 
        if (hpd) {
                switch (dal_irq_get_source(hpd)) {