Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/sun4i: hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi

Once EDID is parsed, the monitor HDMI support information is available
through drm_display_info.is_hdmi.

This driver calls drm_detect_hdmi_monitor() to receive the same
information and stores its own cached value, which is less efficient.

Avoid calling drm_detect_hdmi_monitor() and use drm_display_info.is_hdmi
instead and also remove sun4i_hdmi.hdmi_monitor as it is no longer
necessary.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20220421170725.903361-6-jose.exposito89@gmail.com

authored by

José Expósito and committed by
Maxime Ripard
57ae18fb 0e48711f

+3 -4
-1
drivers/gpu/drm/sun4i/sun4i_hdmi.h
··· 285 285 286 286 struct sun4i_drv *drv; 287 287 288 - bool hdmi_monitor; 289 288 struct cec_adapter *cec_adap; 290 289 291 290 const struct sun4i_hdmi_variant *variant;
+3 -3
drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
··· 99 99 { 100 100 struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; 101 101 struct sun4i_hdmi *hdmi = drm_encoder_to_sun4i_hdmi(encoder); 102 + struct drm_display_info *display = &hdmi->connector.display_info; 102 103 u32 val = 0; 103 104 104 105 DRM_DEBUG_DRIVER("Enabling the HDMI Output\n"); ··· 112 111 writel(val, hdmi->base + SUN4I_HDMI_PKT_CTRL_REG(0)); 113 112 114 113 val = SUN4I_HDMI_VID_CTRL_ENABLE; 115 - if (hdmi->hdmi_monitor) 114 + if (display->is_hdmi) 116 115 val |= SUN4I_HDMI_VID_CTRL_HDMI_MODE; 117 116 118 117 writel(val, hdmi->base + SUN4I_HDMI_VID_CTRL_REG); ··· 216 215 if (!edid) 217 216 return 0; 218 217 219 - hdmi->hdmi_monitor = drm_detect_hdmi_monitor(edid); 220 218 DRM_DEBUG_DRIVER("Monitor is %s monitor\n", 221 - hdmi->hdmi_monitor ? "an HDMI" : "a DVI"); 219 + connector->display_info.is_hdmi ? "an HDMI" : "a DVI"); 222 220 223 221 drm_connector_update_edid_property(connector, edid); 224 222 cec_s_phys_addr_from_edid(hdmi->cec_adap, edid);