summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-12-08 16:26:46 (GMT)
committerThierry Reding <treding@nvidia.com>2015-01-27 09:14:54 (GMT)
commit82f1511c35643575e6f28013a3bb348e35676491 (patch)
tree64a9585ca3c1a7c7f6e74c6bee5afcbf615184b0
parenta9825a6e27a81dac1641ef13fae8b480d7d11d5f (diff)
downloadlinux-82f1511c35643575e6f28013a3bb348e35676491.tar.xz
drm/tegra: sor: Implement ->atomic_check()
The implementation of the ->atomic_check() callback precomputes all parameters to check if the given configuration can be applied. If so the precomputed values are stored in the atomic state object for the encoder and applied during modeset. In that way the modeset no longer needs to perform any checking but simply program values into registers. Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r--drivers/gpu/drm/tegra/sor.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 2793e75..7463ea0 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -1320,6 +1320,27 @@ unlock:
mutex_unlock(&sor->lock);
}
+static int
+tegra_sor_encoder_atomic_check(struct drm_encoder *encoder,
+ struct drm_crtc_state *crtc_state,
+ struct drm_connector_state *conn_state)
+{
+ struct tegra_output *output = encoder_to_output(encoder);
+ struct tegra_dc *dc = to_tegra_dc(conn_state->crtc);
+ unsigned long pclk = crtc_state->mode.clock * 1000;
+ struct tegra_sor *sor = to_sor(output);
+ int err;
+
+ err = tegra_dc_state_setup_clock(dc, crtc_state, sor->clk_parent,
+ pclk, 0);
+ if (err < 0) {
+ dev_err(output->dev, "failed to setup CRTC state: %d\n", err);
+ return err;
+ }
+
+ return 0;
+}
+
static const struct drm_encoder_helper_funcs tegra_sor_encoder_helper_funcs = {
.dpms = tegra_sor_encoder_dpms,
.mode_fixup = tegra_sor_encoder_mode_fixup,
@@ -1327,6 +1348,7 @@ static const struct drm_encoder_helper_funcs tegra_sor_encoder_helper_funcs = {
.commit = tegra_sor_encoder_commit,
.mode_set = tegra_sor_encoder_mode_set,
.disable = tegra_sor_encoder_disable,
+ .atomic_check = tegra_sor_encoder_atomic_check,
};
static int tegra_sor_init(struct host1x_client *client)