This series change dw-hdmi to update CEC phys addr, EDID and ELD on HPD event, this fixes lost CEC phys addr and stale EDID/ELD when HDMI cable is unplugged/replugged or AVR is powered on/off.
Patch 1 and 2 extracts code into a dw_hdmi_connector_update_edid() helper and moves dw_hdmi_connector_detect() to be able to call this helper.
Patch 3 moves CEC phys addr invalidation from dw_hdmi_irq() to dw_hdmi_connector_detect() and ensure connector EDID property gets updated. I opted to not use cec_notifier_mutex after the move, please advise.
Patch 4 and 5 ensures ELD gets updated allowing userspace to query the latest capabilities when a AVR is powered on and EDID gets updated. This reverts a previous change to make drm_edid_to_eld() static, please advise.
Next step after this would be to add support for signaling SNDRV_CTL_EVENT_MASK_VALUE to userspace when ELD changes.
Regards, Jonas
Jonas Karlman (5): drm: dw-hdmi: extract dw_hdmi_connector_update_edid() drm: dw-hdmi: move dw_hdmi_connector_detect() drm: dw-hdmi: update CEC phys addr and EDID on HPD event Revert "drm/edid: make drm_edid_to_eld() static" drm: dw-hdmi: update ELD on HPD event
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 57 ++++++++++++++--------- drivers/gpu/drm/drm_edid.c | 5 +- include/drm/drm_edid.h | 1 + 3 files changed, 38 insertions(+), 25 deletions(-)
Extract code that updates EDID into a dw_hdmi_connector_update_edid() helper, it will be called from dw_hdmi_connector_detect().
Signed-off-by: Jonas Karlman jonas@kwiboo.se --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 521d689413c8..8ab214dc5ae7 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2171,7 +2171,8 @@ dw_hdmi_connector_detect(struct drm_connector *connector, bool force) return hdmi->phy.ops->read_hpd(hdmi, hdmi->phy.data); }
-static int dw_hdmi_connector_get_modes(struct drm_connector *connector) +static int dw_hdmi_connector_update_edid(struct drm_connector *connector, + bool add_modes) { struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, connector); @@ -2190,7 +2191,8 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector) hdmi->sink_has_audio = drm_detect_monitor_audio(edid); drm_connector_update_edid_property(connector, edid); cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier, edid); - ret = drm_add_edid_modes(connector, edid); + if (add_modes) + ret = drm_add_edid_modes(connector, edid); kfree(edid); } else { dev_dbg(hdmi->dev, "failed to get edid\n"); @@ -2199,6 +2201,11 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector) return ret; }
+static int dw_hdmi_connector_get_modes(struct drm_connector *connector) +{ + return dw_hdmi_connector_update_edid(connector, true); +} + static void dw_hdmi_connector_force(struct drm_connector *connector) { struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi,
Hi Jonas,
On 01/09/2019 18:14, Jonas Karlman wrote:
Extract code that updates EDID into a dw_hdmi_connector_update_edid() helper, it will be called from dw_hdmi_connector_detect().
Small nit, you should precise you add a bool to optionally add the modes.
Anyway: Reviewed-by: Neil Armstrong narmstrong@baylibre.com
Signed-off-by: Jonas Karlman jonas@kwiboo.se
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 521d689413c8..8ab214dc5ae7 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2171,7 +2171,8 @@ dw_hdmi_connector_detect(struct drm_connector *connector, bool force) return hdmi->phy.ops->read_hpd(hdmi, hdmi->phy.data); }
-static int dw_hdmi_connector_get_modes(struct drm_connector *connector) +static int dw_hdmi_connector_update_edid(struct drm_connector *connector,
bool add_modes)
{ struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, connector); @@ -2190,7 +2191,8 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector) hdmi->sink_has_audio = drm_detect_monitor_audio(edid); drm_connector_update_edid_property(connector, edid); cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier, edid);
ret = drm_add_edid_modes(connector, edid);
if (add_modes)
kfree(edid); } else { dev_dbg(hdmi->dev, "failed to get edid\n");ret = drm_add_edid_modes(connector, edid);
@@ -2199,6 +2201,11 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector) return ret; }
+static int dw_hdmi_connector_get_modes(struct drm_connector *connector) +{
- return dw_hdmi_connector_update_edid(connector, true);
+}
static void dw_hdmi_connector_force(struct drm_connector *connector) { struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi,
dri-devel@lists.freedesktop.org