Update connector EDID and CEC phys addr from detect and force funcs to ensure that userspace always have access to latest read EDID after a sink use a HPD low voltage pulse to indicate that EDID has changed.
With EDID being updated in detect and force funcs, there should no longer be a need to re-read EDID in get_modes funcs, so drop it. This change make the dw-hdmi connector work more closely like the bridge connector does with a hdmi bridge. Reviewed-by: Nicolas Frattaroli <[email protected]> Signed-off-by: Jonas Karlman <[email protected]> --- v4: Move last_connector_result assign in force ops to this patch, Collect r-b tag v3: Reworked 'Update EDID during hotplug processing' patch --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 25 ++++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 0b56ad7316e3..47616c11fcd7 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2473,33 +2473,36 @@ dw_hdmi_connector_status_update(struct drm_connector *connector, struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, connector); const struct drm_edid *drm_edid; + if (status == connector_status_disconnected) { + drm_edid_connector_update(connector, NULL); + cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); + return; + } + drm_edid = dw_hdmi_edid_read(hdmi, connector); drm_edid_connector_update(connector, drm_edid); drm_edid_free(drm_edid); - cec_notifier_set_phys_addr(hdmi->cec_notifier, - connector->display_info.source_physical_address); + if (status == connector_status_connected) + cec_notifier_set_phys_addr(hdmi->cec_notifier, + connector->display_info.source_physical_address); } static enum drm_connector_status dw_hdmi_connector_detect(struct drm_connector *connector, bool force) { - struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, - connector); + struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, connector); enum drm_connector_status status; status = dw_hdmi_detect(hdmi); - if (status == connector_status_disconnected) - cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); + dw_hdmi_connector_status_update(connector, status); return status; } static int dw_hdmi_connector_get_modes(struct drm_connector *connector) { - dw_hdmi_connector_status_update(connector, connector->status); - return drm_edid_connector_add_modes(connector); } @@ -2529,13 +2532,15 @@ static int dw_hdmi_connector_atomic_check(struct drm_connector *connector, static void dw_hdmi_connector_force(struct drm_connector *connector) { - struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, - connector); + struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, connector); mutex_lock(&hdmi->mutex); hdmi->force = connector->force; + hdmi->last_connector_result = connector->status; dw_hdmi_update_phy_mask(hdmi); mutex_unlock(&hdmi->mutex); + + dw_hdmi_connector_status_update(connector, connector->status); } static const struct drm_connector_funcs dw_hdmi_connector_funcs = { -- 2.54.0
