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]>
Signed-off-by: Jonas Karlman <[email protected]>
---
v4: Collect r-b tag
v3: New patch
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 30 +++++++++++++----------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c 
b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index fc4f255c2a2f..0b56ad7316e3 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 drm_connector *connector,
+                               enum drm_connector_status status)
+{
+       struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, 
connector);
+       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)
 {
@@ -2483,20 +2498,9 @@ dw_hdmi_connector_detect(struct drm_connector 
*connector, bool force)
 
 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;
+       dw_hdmi_connector_status_update(connector, connector->status);
 
-       drm_edid = dw_hdmi_edid_read(hdmi, connector);
-
-       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