Skip to content

Commit 9ca6bc2

Browse files
committed
drm/sun4i: hdmi: Move mode_set into enable
We're not doing anything special in atomic_mode_set so we can simply merge it into atomic_enable. Acked-by: Sui Jingfeng <[email protected]> Reviewed-by: Jernej Skrabec <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent cedb7dd commit 9ca6bc2

File tree

1 file changed

+14
-24
lines changed

1 file changed

+14
-24
lines changed

drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c

+14-24
Original file line numberDiff line numberDiff line change
@@ -103,33 +103,11 @@ static void sun4i_hdmi_enable(struct drm_encoder *encoder,
103103
struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode;
104104
struct sun4i_hdmi *hdmi = drm_encoder_to_sun4i_hdmi(encoder);
105105
struct drm_display_info *display = &hdmi->connector.display_info;
106+
unsigned int x, y;
106107
u32 val = 0;
107108

108109
DRM_DEBUG_DRIVER("Enabling the HDMI Output\n");
109110

110-
clk_prepare_enable(hdmi->tmds_clk);
111-
112-
sun4i_hdmi_setup_avi_infoframes(hdmi, mode);
113-
val |= SUN4I_HDMI_PKT_CTRL_TYPE(0, SUN4I_HDMI_PKT_AVI);
114-
val |= SUN4I_HDMI_PKT_CTRL_TYPE(1, SUN4I_HDMI_PKT_END);
115-
writel(val, hdmi->base + SUN4I_HDMI_PKT_CTRL_REG(0));
116-
117-
val = SUN4I_HDMI_VID_CTRL_ENABLE;
118-
if (display->is_hdmi)
119-
val |= SUN4I_HDMI_VID_CTRL_HDMI_MODE;
120-
121-
writel(val, hdmi->base + SUN4I_HDMI_VID_CTRL_REG);
122-
}
123-
124-
static void sun4i_hdmi_mode_set(struct drm_encoder *encoder,
125-
struct drm_crtc_state *crtc_state,
126-
struct drm_connector_state *conn_state)
127-
{
128-
const struct drm_display_mode *mode = &crtc_state->mode;
129-
struct sun4i_hdmi *hdmi = drm_encoder_to_sun4i_hdmi(encoder);
130-
unsigned int x, y;
131-
u32 val;
132-
133111
clk_set_rate(hdmi->mod_clk, mode->crtc_clock * 1000);
134112
clk_set_rate(hdmi->tmds_clk, mode->crtc_clock * 1000);
135113

@@ -181,6 +159,19 @@ static void sun4i_hdmi_mode_set(struct drm_encoder *encoder,
181159
val |= SUN4I_HDMI_VID_TIMING_POL_VSYNC;
182160

183161
writel(val, hdmi->base + SUN4I_HDMI_VID_TIMING_POL_REG);
162+
163+
clk_prepare_enable(hdmi->tmds_clk);
164+
165+
sun4i_hdmi_setup_avi_infoframes(hdmi, mode);
166+
val |= SUN4I_HDMI_PKT_CTRL_TYPE(0, SUN4I_HDMI_PKT_AVI);
167+
val |= SUN4I_HDMI_PKT_CTRL_TYPE(1, SUN4I_HDMI_PKT_END);
168+
writel(val, hdmi->base + SUN4I_HDMI_PKT_CTRL_REG(0));
169+
170+
val = SUN4I_HDMI_VID_CTRL_ENABLE;
171+
if (display->is_hdmi)
172+
val |= SUN4I_HDMI_VID_CTRL_HDMI_MODE;
173+
174+
writel(val, hdmi->base + SUN4I_HDMI_VID_CTRL_REG);
184175
}
185176

186177
static enum drm_mode_status sun4i_hdmi_mode_valid(struct drm_encoder *encoder,
@@ -206,7 +197,6 @@ static const struct drm_encoder_helper_funcs sun4i_hdmi_helper_funcs = {
206197
.atomic_check = sun4i_hdmi_atomic_check,
207198
.atomic_disable = sun4i_hdmi_disable,
208199
.atomic_enable = sun4i_hdmi_enable,
209-
.atomic_mode_set = sun4i_hdmi_mode_set,
210200
.mode_valid = sun4i_hdmi_mode_valid,
211201
};
212202

0 commit comments

Comments
 (0)