Skip to content

Commit d309bda

Browse files
committed
drm/msm/hdmi: program HDMI timings during atomic_pre_enable
The mode_set callback is deprecated, it doesn't get the drm_bridge_state, just mode-related argumetns. Also Abhinav pointed out that HDMI timings should be programmed before setting up HDMI PHY and PLL. Rework the code to program HDMI timings at the start of atomic_pre_enable(). Reviewed-by: Maxime Ripard <[email protected]> Reviewed-by: Abhinav Kumar <[email protected]> Signed-off-by: Dmitry Baryshkov <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/639652/ Link: https://lore.kernel.org/r/[email protected]
1 parent 8ae7192 commit d309bda

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

drivers/gpu/drm/msm/hdmi/hdmi_bridge.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,28 @@ static void msm_hdmi_config_avi_infoframe(struct hdmi *hdmi)
126126
hdmi_write(hdmi, REG_HDMI_INFOFRAME_CTRL1, val);
127127
}
128128

129+
static void msm_hdmi_set_timings(struct hdmi *hdmi,
130+
const struct drm_display_mode *mode);
131+
129132
static void msm_hdmi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
130133
struct drm_atomic_state *state)
131134
{
132135
struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
133136
struct hdmi *hdmi = hdmi_bridge->hdmi;
134137
struct hdmi_phy *phy = hdmi->phy;
138+
struct drm_encoder *encoder = bridge->encoder;
139+
struct drm_connector *connector;
140+
struct drm_connector_state *conn_state;
141+
struct drm_crtc_state *crtc_state;
135142

136143
DBG("power up");
137144

145+
connector = drm_atomic_get_new_connector_for_encoder(state, encoder);
146+
conn_state = drm_atomic_get_new_connector_state(state, connector);
147+
crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
148+
149+
msm_hdmi_set_timings(hdmi, &crtc_state->adjusted_mode);
150+
138151
if (!hdmi->power_on) {
139152
msm_hdmi_phy_resource_enable(phy);
140153
msm_hdmi_power_on(bridge);
@@ -177,17 +190,12 @@ static void msm_hdmi_bridge_atomic_post_disable(struct drm_bridge *bridge,
177190
}
178191
}
179192

180-
static void msm_hdmi_bridge_mode_set(struct drm_bridge *bridge,
181-
const struct drm_display_mode *mode,
182-
const struct drm_display_mode *adjusted_mode)
193+
static void msm_hdmi_set_timings(struct hdmi *hdmi,
194+
const struct drm_display_mode *mode)
183195
{
184-
struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
185-
struct hdmi *hdmi = hdmi_bridge->hdmi;
186196
int hstart, hend, vstart, vend;
187197
uint32_t frame_ctrl;
188198

189-
mode = adjusted_mode;
190-
191199
hdmi->pixclock = mode->clock * 1000;
192200

193201
hstart = mode->htotal - mode->hsync_start;
@@ -306,7 +314,6 @@ static const struct drm_bridge_funcs msm_hdmi_bridge_funcs = {
306314
.atomic_reset = drm_atomic_helper_bridge_reset,
307315
.atomic_pre_enable = msm_hdmi_bridge_atomic_pre_enable,
308316
.atomic_post_disable = msm_hdmi_bridge_atomic_post_disable,
309-
.mode_set = msm_hdmi_bridge_mode_set,
310317
.mode_valid = msm_hdmi_bridge_mode_valid,
311318
.edid_read = msm_hdmi_bridge_edid_read,
312319
.detect = msm_hdmi_bridge_detect,

0 commit comments

Comments
 (0)