drm/amd/display: add query HPD interface.
authorChiawen Huang <chiawen.huang@amd.com>
Wed, 5 Sep 2018 12:34:57 +0000 (20:34 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Sep 2018 20:47:56 +0000 (15:47 -0500)
[Why]
current dc_link_detect function is not only detection but also update some link data.

[How]
added a pure get HPD state function.

Signed-off-by: Chiawen Huang <chiawen.huang@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_link.c
drivers/gpu/drm/amd/display/dc/dc_link.h

index 9d8dc2c1ca65eff829ad42dc0dc7cefe18bb35a1..bd58dbae7d3e0b1c8c7b2a82311bb2de2f02b8ec 100644 (file)
@@ -890,6 +890,24 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason)
        return true;
 }
 
+bool dc_link_get_hpd_state(struct dc_link *dc_link)
+{
+       struct gpio *hpd_pin;
+       uint32_t state;
+
+       hpd_pin = get_hpd_gpio(dc_link->ctx->dc_bios,
+                                       dc_link->link_id, dc_link->ctx->gpio_service);
+       if (hpd_pin == NULL)
+               ASSERT(false);
+
+       dal_gpio_open(hpd_pin, GPIO_MODE_INTERRUPT);
+       dal_gpio_get_value(hpd_pin, &state);
+       dal_gpio_close(hpd_pin);
+       dal_gpio_destroy_irq(&hpd_pin);
+
+       return state;
+}
+
 static enum hpd_source_id get_hpd_line(
                struct dc_link *link)
 {
index d43cefbc43d3b195c40ad6f6829eadeaeb96daee..438fb35d87b81da0e57285e3915f009346948970 100644 (file)
@@ -167,6 +167,7 @@ enum dc_detect_reason {
 };
 
 bool dc_link_detect(struct dc_link *dc_link, enum dc_detect_reason reason);
+bool dc_link_get_hpd_state(struct dc_link *dc_link);
 
 /* Notify DC about DP RX Interrupt (aka Short Pulse Interrupt).
  * Return: