drm: bridge: dw-hdmi: Fix the issue of EXTCON_DISP_HDMI state error

First, echo off > sys/class/drm/card0-HDMI-A-1/status, the EXTCON_DISP_HDMI state is 0.
Then, echo detect > sys/class/drm/card0-HDMI-A-1/status, the EXTCON_DISP_HDMI state still is 0.
As a result, HDMI has no sound.

Signed-off-by: Shunqing Chen <csq@rock-chips.com>
Change-Id: I6d7904cb75fec21899389dbaba8acbd266dac7cd
This commit is contained in:
Shunqing Chen
2020-10-15 09:30:23 +08:00
committed by Tao Huang
parent 3e0ba08f66
commit f6800c8bd6

View File

@@ -373,8 +373,6 @@ static void repo_hpd_event(struct work_struct *p_work)
ktime_get());
#endif
}
extcon_set_state_sync(hdmi->extcon, EXTCON_DISP_HDMI, hdmi->hpd_state);
}
static bool check_hdmi_irq(struct dw_hdmi *hdmi, int intr_stat,
@@ -2621,6 +2619,7 @@ dw_hdmi_connector_detect(struct drm_connector *connector, bool force)
{
struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi,
connector);
int connect_status;
mutex_lock(&hdmi->mutex);
hdmi->force = DRM_FORCE_UNSPECIFIED;
@@ -2628,7 +2627,13 @@ dw_hdmi_connector_detect(struct drm_connector *connector, bool force)
dw_hdmi_update_phy_mask(hdmi);
mutex_unlock(&hdmi->mutex);
return hdmi->phy.ops->read_hpd(hdmi, hdmi->phy.data);
connect_status = hdmi->phy.ops->read_hpd(hdmi, hdmi->phy.data);
if (connect_status == connector_status_connected)
extcon_set_state_sync(hdmi->extcon, EXTCON_DISP_HDMI, true);
else
extcon_set_state_sync(hdmi->extcon, EXTCON_DISP_HDMI, false);
return connect_status;
}
static int
@@ -2817,11 +2822,11 @@ static void dw_hdmi_connector_force(struct drm_connector *connector)
mutex_lock(&hdmi->mutex);
if (!hdmi->disabled && hdmi->force != connector->force) {
if (connector->force == DRM_FORCE_OFF)
if (hdmi->force != connector->force) {
if (!hdmi->disabled && connector->force == DRM_FORCE_OFF)
extcon_set_state_sync(hdmi->extcon, EXTCON_DISP_HDMI,
false);
else if (connector->force == DRM_FORCE_ON)
else if (hdmi->disabled && connector->force == DRM_FORCE_ON)
extcon_set_state_sync(hdmi->extcon, EXTCON_DISP_HDMI,
true);
}