Switch to using the atomic versions of the enable() and disable() operations.
Signed-off-by: Svyatoslav Ryhel <[email protected]> --- drivers/gpu/drm/tegra/dsi.c | 20 +++++++++++++++----- drivers/gpu/drm/tegra/hdmi.c | 20 +++++++++++++++----- drivers/gpu/drm/tegra/rgb.c | 23 +++++++++++++++++------ drivers/gpu/drm/tegra/sor.c | 18 +++++++++++++----- 4 files changed, 60 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c index a4c0c63bbe567..202aed6a6fc12 100644 --- a/drivers/gpu/drm/tegra/dsi.c +++ b/drivers/gpu/drm/tegra/dsi.c @@ -856,7 +856,8 @@ static void tegra_dsi_unprepare(struct tegra_dsi *dsi) dev_err(dsi->dev, "failed to suspend: %d\n", err); } -static void tegra_dsi_encoder_disable(struct drm_encoder *encoder) +static void tegra_dsi_encoder_disable(struct drm_encoder *encoder, + struct drm_atomic_commit *comm_state) { struct tegra_output *output = encoder_to_output(encoder); struct tegra_dc *dc = to_tegra_dc(encoder->crtc); @@ -920,16 +921,25 @@ static int tegra_dsi_prepare(struct tegra_dsi *dsi) return 0; } -static void tegra_dsi_encoder_enable(struct drm_encoder *encoder) +static void tegra_dsi_encoder_enable(struct drm_encoder *encoder, + struct drm_atomic_commit *comm_state) { - struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; struct tegra_output *output = encoder_to_output(encoder); struct tegra_dc *dc = to_tegra_dc(encoder->crtc); + struct drm_connector_state *conn_state; struct tegra_dsi *dsi = to_dsi(output); + struct drm_crtc_state *crtc_state; + struct drm_connector *connector; struct tegra_dsi_state *state; + struct drm_display_mode *mode; u32 value; int err; + connector = drm_atomic_get_new_connector_for_encoder(comm_state, encoder); + conn_state = drm_atomic_get_new_connector_state(comm_state, connector); + crtc_state = drm_atomic_get_new_crtc_state(comm_state, conn_state->crtc); + mode = &crtc_state->adjusted_mode; + err = tegra_dsi_prepare(dsi); if (err < 0) { dev_err(dsi->dev, "failed to prepare: %d\n", err); @@ -1060,8 +1070,8 @@ static const struct drm_encoder_funcs tegra_dsi_encoder_funcs = { }; static const struct drm_encoder_helper_funcs tegra_dsi_encoder_helper_funcs = { - .disable = tegra_dsi_encoder_disable, - .enable = tegra_dsi_encoder_enable, + .atomic_disable = tegra_dsi_encoder_disable, + .atomic_enable = tegra_dsi_encoder_enable, .atomic_check = tegra_dsi_encoder_atomic_check, }; diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c index c0845bb45bb15..0a2420095d061 100644 --- a/drivers/gpu/drm/tegra/hdmi.c +++ b/drivers/gpu/drm/tegra/hdmi.c @@ -1166,7 +1166,8 @@ tegra_hdmi_connector_helper_funcs = { .mode_valid = tegra_hdmi_connector_mode_valid, }; -static void tegra_hdmi_encoder_disable(struct drm_encoder *encoder) +static void tegra_hdmi_encoder_disable(struct drm_encoder *encoder, + struct drm_atomic_commit *comm_state) { struct tegra_output *output = encoder_to_output(encoder); struct tegra_dc *dc = to_tegra_dc(encoder->crtc); @@ -1209,18 +1210,27 @@ static void tegra_hdmi_encoder_disable(struct drm_encoder *encoder) dev_err(hdmi->dev, "failed to suspend: %d\n", err); } -static void tegra_hdmi_encoder_enable(struct drm_encoder *encoder) +static void tegra_hdmi_encoder_enable(struct drm_encoder *encoder, + struct drm_atomic_commit *comm_state) { - struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; unsigned int h_sync_width, h_front_porch, h_back_porch, i, rekey; struct tegra_output *output = encoder_to_output(encoder); struct tegra_dc *dc = to_tegra_dc(encoder->crtc); struct tegra_hdmi *hdmi = to_hdmi(output); + struct drm_connector_state *conn_state; + struct drm_crtc_state *crtc_state; unsigned int pulse_start, div82; + struct drm_connector *connector; + struct drm_display_mode *mode; int retries = 1000; u32 value; int err; + connector = drm_atomic_get_new_connector_for_encoder(comm_state, encoder); + conn_state = drm_atomic_get_new_connector_state(comm_state, connector); + crtc_state = drm_atomic_get_new_crtc_state(comm_state, conn_state->crtc); + mode = &crtc_state->adjusted_mode; + err = host1x_client_resume(&hdmi->client); if (err < 0) { dev_err(hdmi->dev, "failed to resume: %d\n", err); @@ -1460,8 +1470,8 @@ tegra_hdmi_encoder_atomic_check(struct drm_encoder *encoder, } static const struct drm_encoder_helper_funcs tegra_hdmi_encoder_helper_funcs = { - .disable = tegra_hdmi_encoder_disable, - .enable = tegra_hdmi_encoder_enable, + .atomic_disable = tegra_hdmi_encoder_disable, + .atomic_enable = tegra_hdmi_encoder_enable, .atomic_check = tegra_hdmi_encoder_atomic_check, }; diff --git a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c index 01475995d9cc8..7dea0cac61233 100644 --- a/drivers/gpu/drm/tegra/rgb.c +++ b/drivers/gpu/drm/tegra/rgb.c @@ -90,7 +90,8 @@ static void tegra_dc_write_regs(struct tegra_dc *dc, tegra_dc_writel(dc, table[i].value, table[i].offset); } -static void tegra_rgb_encoder_disable(struct drm_encoder *encoder) +static void tegra_rgb_encoder_disable(struct drm_encoder *encoder, + struct drm_atomic_commit *state) { struct tegra_output *output = encoder_to_output(encoder); struct tegra_rgb *rgb = to_rgb(output); @@ -99,12 +100,22 @@ static void tegra_rgb_encoder_disable(struct drm_encoder *encoder) tegra_dc_commit(rgb->dc); } -static void tegra_rgb_encoder_enable(struct drm_encoder *encoder) +static void tegra_rgb_encoder_enable(struct drm_encoder *encoder, + struct drm_atomic_commit *state) { - struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; struct tegra_output *output = encoder_to_output(encoder); struct tegra_rgb *rgb = to_rgb(output); - u32 value; + struct drm_connector_state *conn_state; + struct drm_crtc_state *crtc_state; + struct drm_connector *connector; + struct drm_display_mode *mode; + u32 bus_flags, value; + + /* Get mode flags */ + connector = drm_atomic_get_new_connector_for_encoder(state, encoder); + conn_state = drm_atomic_get_new_connector_state(state, connector); + crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc); + mode = &crtc_state->adjusted_mode; tegra_dc_write_regs(rgb->dc, rgb_enable, ARRAY_SIZE(rgb_enable)); @@ -201,8 +212,8 @@ static const struct drm_encoder_funcs tegra_rgb_encoder_funcs = { }; static const struct drm_encoder_helper_funcs tegra_rgb_encoder_helper_funcs = { - .disable = tegra_rgb_encoder_disable, - .enable = tegra_rgb_encoder_enable, + .atomic_disable = tegra_rgb_encoder_disable, + .atomic_enable = tegra_rgb_encoder_enable, .atomic_check = tegra_rgb_encoder_atomic_check, }; diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index ab81e412e05f1..85cd5c8cbef4e 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -2206,7 +2206,8 @@ static void tegra_sor_hdmi_scdc_start(struct tegra_sor *sor) } } -static void tegra_sor_hdmi_disable(struct drm_encoder *encoder) +static void tegra_sor_hdmi_disable(struct drm_encoder *encoder, + struct drm_atomic_commit *comm_state) { struct tegra_output *output = encoder_to_output(encoder); struct tegra_dc *dc = to_tegra_dc(encoder->crtc); @@ -2247,13 +2248,17 @@ static void tegra_sor_hdmi_disable(struct drm_encoder *encoder) host1x_client_suspend(&sor->client); } -static void tegra_sor_hdmi_enable(struct drm_encoder *encoder) +static void tegra_sor_hdmi_enable(struct drm_encoder *encoder, + struct drm_atomic_commit *comm_state) { struct tegra_output *output = encoder_to_output(encoder); unsigned int h_ref_to_sync = 1, pulse_start, max_ac; struct tegra_dc *dc = to_tegra_dc(encoder->crtc); struct tegra_sor_hdmi_settings *settings; + struct drm_connector_state *conn_state; struct tegra_sor *sor = to_sor(output); + struct drm_crtc_state *crtc_state; + struct drm_connector *connector; struct tegra_sor_state *state; struct drm_display_mode *mode; unsigned long rate, pclk; @@ -2262,7 +2267,10 @@ static void tegra_sor_hdmi_enable(struct drm_encoder *encoder) int err; state = to_sor_state(output->connector.state); - mode = &encoder->crtc->state->adjusted_mode; + connector = drm_atomic_get_new_connector_for_encoder(comm_state, encoder); + conn_state = drm_atomic_get_new_connector_state(comm_state, connector); + crtc_state = drm_atomic_get_new_crtc_state(comm_state, conn_state->crtc); + mode = &crtc_state->adjusted_mode; pclk = mode->clock * 1000; err = host1x_client_resume(&sor->client); @@ -2660,8 +2668,8 @@ static void tegra_sor_hdmi_enable(struct drm_encoder *encoder) } static const struct drm_encoder_helper_funcs tegra_sor_hdmi_helpers = { - .disable = tegra_sor_hdmi_disable, - .enable = tegra_sor_hdmi_enable, + .atomic_disable = tegra_sor_hdmi_disable, + .atomic_enable = tegra_sor_hdmi_enable, .atomic_check = tegra_sor_encoder_atomic_check, }; -- 2.53.0
