drm/amd/display: Serialize is_dp_sink_present
authorHarry Wentland <harry.wentland@amd.com>
Tue, 29 May 2018 17:11:55 +0000 (13:11 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 13 Jul 2018 19:48:21 +0000 (14:48 -0500)
Access to GPIO needs to be serialized. Aux transactions are already
serialized in DRM but we also need to serialize access to the GPIO pin
for purposes of DP dongle detection.

Call is_dp_sink_present through DM so we can lock correctly. This
follows the same pattern used for DPCD transactions.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
drivers/gpu/drm/amd/display/dc/core/dc_link.c
drivers/gpu/drm/amd/display/dc/dc_link.h
drivers/gpu/drm/amd/display/dc/dm_helpers.h

index b19dc4cfc0301661a3aa1db6b2f822a6fd6887ca..7b51b8fde3fe372e9a25fadfa1f79d1e00616cce 100644 (file)
@@ -454,6 +454,22 @@ bool dm_helpers_submit_i2c(
        return result;
 }
 
+bool dm_helpers_is_dp_sink_present(struct dc_link *link)
+{
+       bool dp_sink_present;
+       struct amdgpu_dm_connector *aconnector = link->priv;
+
+       if (!aconnector) {
+               BUG_ON("Failed to found connector for link!");
+               return true;
+       }
+
+       mutex_lock(&aconnector->dm_dp_aux.aux.hw_mutex);
+       dp_sink_present = dc_link_is_dp_sink_present(link);
+       mutex_unlock(&aconnector->dm_dp_aux.aux.hw_mutex);
+       return dp_sink_present;
+}
+
 enum dc_edid_status dm_helpers_read_local_edid(
                struct dc_context *ctx,
                struct dc_link *link,
index a4180ba63d824cddf38eb16007ab83883decbd15..fe29a398b70399c2b52213fcc36d69e9b85751a0 100644 (file)
@@ -313,7 +313,7 @@ static enum signal_type get_basic_signal_type(
  * @brief
  * Check whether there is a dongle on DP connector
  */
-static bool is_dp_sink_present(struct dc_link *link)
+bool dc_link_is_dp_sink_present(struct dc_link *link)
 {
        enum gpio_result gpio_result;
        uint32_t clock_pin = 0;
@@ -406,7 +406,7 @@ static enum signal_type link_detect_sink(
                         * we assume signal is DVI; it could be corrected
                         * to HDMI after dongle detection
                         */
-                       if (!is_dp_sink_present(link))
+                       if (!dm_helpers_is_dp_sink_present(link))
                                result = SIGNAL_TYPE_DVI_SINGLE_LINK;
                }
        }
index 83eea42452b5105d1c9894d746c680fddca78665..eda4a5d3ff1c7974e4e8fc57d7c6f80407b2ae08 100644 (file)
@@ -210,6 +210,8 @@ bool dc_link_dp_set_test_pattern(
 
 void dc_link_enable_hpd_filter(struct dc_link *link, bool enable);
 
+bool dc_link_is_dp_sink_present(struct dc_link *link);
+
 /*
  * DPCD access interfaces
  */
index 034369fbb9e2cb5e5f0eb95931fb7b9e9ddafdfb..7e6b9f5b890616d0d10a899133289b1e1c31aa4b 100644 (file)
@@ -103,6 +103,9 @@ bool dm_helpers_submit_i2c(
                const struct dc_link *link,
                struct i2c_command *cmd);
 
+bool dm_helpers_is_dp_sink_present(
+               struct dc_link *link);
+
 enum dc_edid_status dm_helpers_read_local_edid(
                struct dc_context *ctx,
                struct dc_link *link,