mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
drm/rockchip: dw-dp: get the real hpd state
In DPTX Controller, when hpd signal is low, the hpd state will change to unplug immediately. if the low level signal is less than 2ms, the hpd state will change to plug state and trigger a hpd irq interrupt. In some case, driver will detect hpd state to get the plug/unplug info when a hpd irq is coming. A hpd irq may be regard as a unplug state. To avoid this issue, it better to wait the hpd state change to the nest state. Change-Id: I68c5bdc72128a2bc3ea990cfcb54e2ade755abc7 Signed-off-by: Zhang Yubing <yubing.zhang@rock-chips.com>
This commit is contained in:
@@ -1112,11 +1112,18 @@ static bool dw_dp_bandwidth_ok(struct dw_dp *dp,
|
||||
static bool dw_dp_detect(struct dw_dp *dp)
|
||||
{
|
||||
u32 value;
|
||||
int ret;
|
||||
|
||||
if (dp->hpd_gpio)
|
||||
return gpiod_get_value_cansleep(dp->hpd_gpio);
|
||||
|
||||
regmap_read(dp->regmap, DPTX_HPD_STATUS, &value);
|
||||
ret = regmap_read_poll_timeout(dp->regmap, DPTX_HPD_STATUS, value,
|
||||
FIELD_GET(HPD_STATE, value) != SOURCE_STATE_UNPLUG,
|
||||
100, 3000);
|
||||
if (ret) {
|
||||
dev_err(dp->dev, "get hpd status timeout\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return FIELD_GET(HPD_STATE, value) == SOURCE_STATE_PLUG;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user