Replace drm_detect_hdmi_monitor() with drm_display_info.is_hdmi
Subsystems (9)
cover Replace drm_detect_hdmi_monitor() with drm_display_info.is_hdmi
Hi everyone,
After implementing a similar change in the VC4 driver [1], as suggested by Laurent in the ToDo list [2], I noticed that a similar pattern is used in the Exynos, Rockchip, STI and sun4i drivers.
This patchset replaces drm_detect_hdmi_monitor() with is_hdmi in the mentioned drivers.
Best wishes,
José Expósito
[1] https://lore.kernel.org/dri-devel/[email protected]/T/
[2] https://docs.kernel.org/gpu/todo.html#replace-drm-detect-hdmi-monitor-with-drm-display-info-is-hdmi
José Expósito (5):
drm/exynos: hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi drm/rockchip: inno_hdmi: Replace drm_detect_hdmi_monitor() with
is_hdmi
drm/rockchip: rk3066_hdmi: Replace drm_detect_hdmi_monitor() with
is_hdmi
drm/sti/sti_hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi drm/sun4i: hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi
drivers/gpu/drm/exynos/exynos_hdmi.c | 15 +++++++++------ drivers/gpu/drm/rockchip/inno_hdmi.c | 8 ++++---- drivers/gpu/drm/rockchip/rk3066_hdmi.c | 6 +++--- drivers/gpu/drm/sti/sti_hdmi.c | 7 ++++--- drivers/gpu/drm/sti/sti_hdmi.h | 2 -- drivers/gpu/drm/sun4i/sun4i_hdmi.h | 1 - drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 6 +++--- 7 files changed, 23 insertions(+), 22 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/5 drm/exynos: 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 hdmi_context.dvi_mode as it is no longer necessary.
--- drivers/gpu/drm/exynos/exynos_hdmi.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/gpu/drm/exynos/exynos_hdmi.c +9 -6
@@ -119,7 +119,6 @@ struct hdmi_context {struct device *dev;struct drm_device *drm_dev;struct drm_connector connector; -bool dvi_mode;struct delayed_work hotplug_work;struct cec_notifier *notifier;const struct hdmi_driver_data *drv_data;
@@ -811,11 +810,12 @@ static int hdmi_audio_infoframe_apply(struct hdmi_context *hdata)static void hdmi_reg_infoframes (struct hdmi_context *hdata) {struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; +struct drm_display_info *display = &hdata->connector.display_info;union hdmi_infoframe frm;u8 buf[25 ];int ret; -if (hdata->dvi_mode) { +if (!display->is_hdmi) {hdmi_reg_writeb (hdata,HDMI_AVI_CON ,HDMI_AVI_CON_DO_NOT_TRANSMIT ); hdmi_reg_writeb(hdata, HDMI_VSI_CON,
@@ -893,9 +893,9 @@ static int hdmi_get_modes(struct drm_connector *connector)if (!edid)return -ENODEV ; - hdata->dvi_mode = !drm_detect_hdmi_monitor (edid);DRM_DEV_DEBUG_KMS (hdata->dev,"%s : width[%d] x height[%d]\n" , - (hdata->dvi_mode ?"dvi monitor" :"hdmi monitor" ), + (connector->display_info.is_hdmi ?"hdmi monitor" : +"dvi monitor" ), edid->width_cm, edid->height_cm);drm_connector_update_edid_property (connector, edid);
@@ -1118,9 +1118,10 @@ static void hdmi_audio_config(struct hdmi_context *hdata)static void hdmi_audio_control (struct hdmi_context *hdata) { +struct drm_display_info *display = &hdata->connector.display_info;bool enable = !hdata->audio.mute; -if (hdata->dvi_mode) +if (!display->is_hdmi)return ; hdmi_reg_writeb(hdata, HDMI_AUI_CON, enable ?
@@ -1143,6 +1144,8 @@ static void hdmi_start(struct hdmi_context *hdata, bool start)static void hdmi_conf_init (struct hdmi_context *hdata) { +struct drm_display_info *display = &hdata->connector.display_info; +/* disable HPD interrupts from HDMI IP block, use GPIO instead */ hdmi_reg_writemask (hdata,HDMI_INTC_CON ,0 ,HDMI_INTC_EN_GLOBAL |HDMI_INTC_EN_HPD_PLUG |HDMI_INTC_EN_HPD_UNPLUG );
@@ -1155,7 +1158,7 @@ static void hdmi_conf_init(struct hdmi_context *hdata)/* disable bluescreen */ hdmi_reg_writemask (hdata,HDMI_CON_0 ,0 ,HDMI_BLUE_SCR_EN ); -if (hdata->dvi_mode) { +if (!display->is_hdmi) {hdmi_reg_writemask (hdata,HDMI_MODE_SEL ,HDMI_MODE_DVI_EN ,HDMI_MODE_MASK ); hdmi_reg_writeb(hdata, HDMI_CON_2,
Signature · 1 line
2.25.1
PATCH 2/5 drm/rockchip: inno_hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi
In reply to José ExpósitoOnce 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 hdmi_data_info.sink_is_hdmi as it is no longer necessary.
--- drivers/gpu/drm/rockchip/inno_hdmi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/rockchip/inno_hdmi.c +4 -4
@@ -30,7 +30,6 @@struct hdmi_data_info {int vic; -bool sink_is_hdmi;bool sink_has_audio;unsigned int enc_in_format;unsigned int enc_out_format;
@@ -433,6 +432,8 @@ static int inno_hdmi_config_video_timing(struct inno_hdmi *hdmi,static int inno_hdmi_setup (struct inno_hdmi *hdmi,struct drm_display_mode *mode) { +struct drm_display_info *display = &hdmi->connector.display_info; + hdmi->hdmi_data.vic =drm_match_cea_mode (mode); hdmi->hdmi_data.enc_in_format =HDMI_COLORSPACE_RGB ;
@@ -452,13 +453,13 @@ static int inno_hdmi_setup(struct inno_hdmi *hdmi,/* Set HDMI Mode */ hdmi_writeb (hdmi,HDMI_HDCP_CTRL , -v_HDMI_DVI (hdmi->hdmi_data.sink_is_hdmi)); +v_HDMI_DVI (display->is_hdmi));inno_hdmi_config_video_timing (hdmi, mode);inno_hdmi_config_video_csc (hdmi); -if (hdmi->hdmi_data.sink_is_hdmi) { +if (display->is_hdmi) {inno_hdmi_config_video_avi (hdmi, mode);inno_hdmi_config_video_vsi (hdmi, mode); }
@@ -553,7 +554,6 @@ static int inno_hdmi_connector_get_modes(struct drm_connector *connector) edid =drm_get_edid (connector, hdmi->ddc);if (edid) { - hdmi->hdmi_data.sink_is_hdmi =drm_detect_hdmi_monitor (edid); hdmi->hdmi_data.sink_has_audio =drm_detect_monitor_audio (edid);drm_connector_update_edid_property (connector, edid); ret =drm_add_edid_modes (connector, edid);
Signature · 1 line
2.25.1
PATCH 3/5 drm/rockchip: rk3066_hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi
In reply to José ExpósitoOnce 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 hdmi_data_info.sink_is_hdmi as it is no longer necessary.
--- drivers/gpu/drm/rockchip/rk3066_hdmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/rockchip/rk3066_hdmi.c +3 -3
@@ -22,7 +22,6 @@struct hdmi_data_info {int vic;/* The CEA Video ID (VIC) of the current drm display mode. */ -bool sink_is_hdmi;unsigned int enc_out_format;unsigned int colorimetry; };
@@ -317,6 +316,8 @@ static void rk3066_hdmi_config_phy(struct rk3066_hdmi *hdmi)static int rk3066_hdmi_setup (struct rk3066_hdmi *hdmi,struct drm_display_mode *mode) { +struct drm_display_info *display = &hdmi->connector.display_info; + hdmi->hdmi_data.vic =drm_match_cea_mode (mode); hdmi->hdmi_data.enc_out_format =HDMI_COLORSPACE_RGB ;
@@ -349,7 +350,7 @@ static int rk3066_hdmi_setup(struct rk3066_hdmi *hdmi,rk3066_hdmi_config_video_timing (hdmi, mode); -if (hdmi->hdmi_data.sink_is_hdmi) { +if (display->is_hdmi) {hdmi_modb (hdmi,HDMI_HDCP_CTRL ,HDMI_VIDEO_MODE_MASK ,HDMI_VIDEO_MODE_HDMI );rk3066_hdmi_config_avi (hdmi, mode);
@@ -472,7 +473,6 @@ static int rk3066_hdmi_connector_get_modes(struct drm_connector *connector) edid =drm_get_edid (connector, hdmi->ddc);if (edid) { - hdmi->hdmi_data.sink_is_hdmi =drm_detect_hdmi_monitor (edid);drm_connector_update_edid_property (connector, edid); ret =drm_add_edid_modes (connector, edid);kfree (edid);
Signature · 1 line
2.25.1
PATCH 4/5 drm/sti/sti_hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi
In reply to José ExpósitoOnce 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 sti_hdmi.hdmi_monitor as it is no longer necessary.
--- drivers/gpu/drm/sti/sti_hdmi.c | 7 ++++--- drivers/gpu/drm/sti/sti_hdmi.h | 2 -- 2 files changed, 4 insertions(+), 5 deletions(-)
drivers/gpu/drm/sti/sti_hdmi.c +4 -3
@@ -266,6 +266,7 @@ static void hdmi_active_area(struct sti_hdmi *hdmi)static void hdmi_config (struct sti_hdmi *hdmi) {u32 conf; +struct drm_display_info *display = &hdmi->drm_connector->display_info;DRM_DEBUG_DRIVER ("\n" );
@@ -274,7 +275,7 @@ static void hdmi_config(struct sti_hdmi *hdmi)/* Select encryption type and the framing mode */ conf |=HDMI_CFG_ESS_NOT_OESS ; -if (hdmi->hdmi_monitor) +if (display->is_hdmi) conf |=HDMI_CFG_HDMI_NOT_DVI ;/* Set Hsync polarity */
@@ -984,9 +985,9 @@ static int sti_hdmi_connector_get_modes(struct drm_connector *connector)if (!edid) goto fail; - hdmi->hdmi_monitor =drm_detect_hdmi_monitor (edid);DRM_DEBUG_KMS ("%s : %dx%d cm\n" , - (hdmi->hdmi_monitor ?"hdmi monitor" :"dvi monitor" ), + (connector->display_info.is_hdmi ?"hdmi monitor" : +"dvi monitor" ), edid->width_cm, edid->height_cm);cec_notifier_set_phys_addr_from_edid (hdmi->notifier, edid);
drivers/gpu/drm/sti/sti_hdmi.h +0 -2
@@ -57,7 +57,6 @@ struct hdmi_audio_params {* @reset: reset control of the hdmi phy * @ddc_adapt: i2c ddc adapter * @colorspace: current colorspace selected -* @hdmi_monitor: true if HDMI monitor detected else DVI monitor assumed * @audio_pdev: ASoC hdmi-codec platform device * @audio: hdmi audio parameters. * @drm_connector: hdmi connector
@@ -83,7 +82,6 @@ struct sti_hdmi {struct reset_control *reset;struct i2c_adapter *ddc_adapt;enum hdmi_colorspace colorspace; -bool hdmi_monitor;struct platform_device *audio_pdev;struct hdmi_audio_params audio;struct drm_connector *drm_connector;
Signature · 1 line
2.25.1
PATCH 5/5 drm/sun4i: hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi
In reply to José ExpósitoOnce 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.
--- drivers/gpu/drm/sun4i/sun4i_hdmi.h | 1 - drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/sun4i/sun4i_hdmi.h +0 -1
@@ -285,7 +285,6 @@ struct sun4i_hdmi {struct sun4i_drv *drv; -bool hdmi_monitor;struct cec_adapter *cec_adap;const struct sun4i_hdmi_variant *variant;
drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +3 -3
@@ -99,6 +99,7 @@ static void sun4i_hdmi_enable(struct drm_encoder *encoder) {struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode;struct sun4i_hdmi *hdmi =drm_encoder_to_sun4i_hdmi (encoder); +struct drm_display_info *display = &hdmi->connector.display_info;u32 val =0 ;DRM_DEBUG_DRIVER ("Enabling the HDMI Output\n" );
@@ -111,7 +112,7 @@ static void sun4i_hdmi_enable(struct drm_encoder *encoder)writel (val, hdmi->base +SUN4I_HDMI_PKT_CTRL_REG (0 )); val =SUN4I_HDMI_VID_CTRL_ENABLE ; -if (hdmi->hdmi_monitor) +if (display->is_hdmi) val |=SUN4I_HDMI_VID_CTRL_HDMI_MODE ;writel (val, hdmi->base +SUN4I_HDMI_VID_CTRL_REG );
@@ -215,9 +216,8 @@ static int sun4i_hdmi_get_modes(struct drm_connector *connector)if (!edid)return 0 ; - hdmi->hdmi_monitor =drm_detect_hdmi_monitor (edid);DRM_DEBUG_DRIVER ("Monitor is %s monitor\n" , - hdmi->hdmi_monitor ?"an HDMI" :"a DVI" ); + connector->display_info.is_hdmi ?"an HDMI" :"a DVI" );drm_connector_update_edid_property (connector, edid);cec_s_phys_addr_from_edid (hdmi->cec_adap, edid);
Signature · 1 line
2.25.1
Maxime Ripard
AppliedRe: (subset) [PATCH 5/5] drm/sun4i: hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi
Quoted 11 lines · José Expósito
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.[...]
Applied to drm/drm-misc (drm-misc-next).
Thanks!
Maxime
Re: (subset) [PATCH 0/5] Replace drm_detect_hdmi_monitor() with drm_display_info.is_hdmi
In reply to José ExpósitoQuoted 8 lines · José Expósito
After implementing a similar change in the VC4 driver [1], as suggested by Laurent in the ToDo list [2], I noticed that a similar pattern is used in the Exynos, Rockchip, STI and sun4i drivers.
This patchset replaces
drm_detect_hdmi_monitor()withis_hdmiin the mentioned drivers.[...]
Applied, thanks!
[2/5] drm/rockchip: inno_hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi
commit: d449222dd533ca83a3a2f88aafe06fdd8d589280
[3/5] drm/rockchip: rk3066_hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi
commit: d2eabdb64474c2101953859601794f1ea08ec1d9Best regards,
Signature · 1 line
Heiko Stuebner <[email protected]>