Commit 1baca23a authored by Paul Hsieh's avatar Paul Hsieh Committed by Greg Kroah-Hartman

drm/amd/display: Add retry to read ddc_clock pin

[ Upstream commit bd4905a9 ]

[WHY]
On customer board, there is one pluse (1v , < 1ms) on
DDC_CLK pin when plug / unplug DP cable. Driver will read
it and config DP to HDMI/DVI dongle.

[HOW]
If there is a real dongle, DDC_CLK should be always pull high.
Try to read again to recovery this special case. Retry times = 3.
Need additional 3ms to detect DP passive dongle(3 failures)
Signed-off-by: default avatarPaul Hsieh <paul.hsieh@amd.com>
Reviewed-by: default avatarEric Yang <eric.yang2@amd.com>
Acked-by: default avatarLeo Li <sunpeng.li@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent a7560200
...@@ -324,7 +324,7 @@ bool dc_link_is_dp_sink_present(struct dc_link *link) ...@@ -324,7 +324,7 @@ bool dc_link_is_dp_sink_present(struct dc_link *link)
{ {
enum gpio_result gpio_result; enum gpio_result gpio_result;
uint32_t clock_pin = 0; uint32_t clock_pin = 0;
uint8_t retry = 0;
struct ddc *ddc; struct ddc *ddc;
enum connector_id connector_id = enum connector_id connector_id =
...@@ -353,11 +353,22 @@ bool dc_link_is_dp_sink_present(struct dc_link *link) ...@@ -353,11 +353,22 @@ bool dc_link_is_dp_sink_present(struct dc_link *link)
return present; return present;
} }
/* Read GPIO: DP sink is present if both clock and data pins are zero */ /*
/* [anaumov] in DAL2, there was no check for GPIO failure */ * Read GPIO: DP sink is present if both clock and data pins are zero
*
gpio_result = dal_gpio_get_value(ddc->pin_clock, &clock_pin); * [W/A] plug-unplug DP cable, sometimes customer board has
ASSERT(gpio_result == GPIO_RESULT_OK); * one short pulse on clk_pin(1V, < 1ms). DP will be config to HDMI/DVI
* then monitor can't br light up. Add retry 3 times
* But in real passive dongle, it need additional 3ms to detect
*/
do {
gpio_result = dal_gpio_get_value(ddc->pin_clock, &clock_pin);
ASSERT(gpio_result == GPIO_RESULT_OK);
if (clock_pin)
udelay(1000);
else
break;
} while (retry++ < 3);
present = (gpio_result == GPIO_RESULT_OK) && !clock_pin; present = (gpio_result == GPIO_RESULT_OK) && !clock_pin;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment