Move connector EDID update and CEC phys addr handling to a helper
function as a preparation before moving EDID refresh from get_modes
funcs to detect/force funcs.

Reviewed-by: Nicolas Frattaroli <[email protected]>
Tested-by: Diederik de Haas <[email protected]>  # Rock64, RockPro64, 
Quartz64-B
Signed-off-by: Jonas Karlman <[email protected]>
---
v7: No change
v6: Pass struct dw_hdmi as a parameter, to allow calls from bridge funcs,
    Collect t-b tag
v5: No change
v4: Collect r-b tag
v3: New patch
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 27 ++++++++++++++---------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c 
b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index 0dd4c823c60a..a056e147731b 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -2466,6 +2466,21 @@ static const struct drm_edid *dw_hdmi_edid_read(struct 
dw_hdmi *hdmi,
  * DRM Connector Operations
  */
 
+static void
+dw_hdmi_connector_status_update(struct dw_hdmi *hdmi,
+                               struct drm_connector *connector,
+                               enum drm_connector_status status)
+{
+       const struct drm_edid *drm_edid;
+
+       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);
+}
+
 static enum drm_connector_status
 dw_hdmi_connector_detect(struct drm_connector *connector, bool force)
 {
@@ -2485,18 +2500,10 @@ static int dw_hdmi_connector_get_modes(struct 
drm_connector *connector)
 {
        struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi,
                                             connector);
-       const struct drm_edid *drm_edid;
-       int ret;
 
-       drm_edid = dw_hdmi_edid_read(hdmi, connector);
+       dw_hdmi_connector_status_update(hdmi, connector, connector->status);
 
-       drm_edid_connector_update(connector, drm_edid);
-       cec_notifier_set_phys_addr(hdmi->cec_notifier,
-                                  
connector->display_info.source_physical_address);
-       ret = drm_edid_connector_add_modes(connector);
-       drm_edid_free(drm_edid);
-
-       return ret;
+       return drm_edid_connector_add_modes(connector);
 }
 
 static int dw_hdmi_connector_atomic_check(struct drm_connector *connector,
-- 
2.54.0

Reply via email to