|
@@ -119,6 +119,16 @@ static int tegra_dsi_show_regs(struct seq_file *s, void *data)
|
|
|
{
|
|
|
struct drm_info_node *node = s->private;
|
|
|
struct tegra_dsi *dsi = node->info_ent->data;
|
|
|
+ struct drm_crtc *crtc = dsi->output.encoder.crtc;
|
|
|
+ struct drm_device *drm = node->minor->dev;
|
|
|
+ int err = 0;
|
|
|
+
|
|
|
+ drm_modeset_lock_all(drm);
|
|
|
+
|
|
|
+ if (!crtc || !crtc->state->active) {
|
|
|
+ err = -EBUSY;
|
|
|
+ goto unlock;
|
|
|
+ }
|
|
|
|
|
|
#define DUMP_REG(name) \
|
|
|
seq_printf(s, "%-32s %#05x %08x\n", #name, name, \
|
|
@@ -208,7 +218,9 @@ static int tegra_dsi_show_regs(struct seq_file *s, void *data)
|
|
|
|
|
|
#undef DUMP_REG
|
|
|
|
|
|
- return 0;
|
|
|
+unlock:
|
|
|
+ drm_modeset_unlock_all(drm);
|
|
|
+ return err;
|
|
|
}
|
|
|
|
|
|
static struct drm_info_list debugfs_files[] = {
|
|
@@ -731,10 +743,6 @@ static void tegra_dsi_soft_reset(struct tegra_dsi *dsi)
|
|
|
tegra_dsi_soft_reset(dsi->slave);
|
|
|
}
|
|
|
|
|
|
-static void tegra_dsi_connector_dpms(struct drm_connector *connector, int mode)
|
|
|
-{
|
|
|
-}
|
|
|
-
|
|
|
static void tegra_dsi_connector_reset(struct drm_connector *connector)
|
|
|
{
|
|
|
struct tegra_dsi_state *state;
|
|
@@ -761,7 +769,7 @@ tegra_dsi_connector_duplicate_state(struct drm_connector *connector)
|
|
|
}
|
|
|
|
|
|
static const struct drm_connector_funcs tegra_dsi_connector_funcs = {
|
|
|
- .dpms = tegra_dsi_connector_dpms,
|
|
|
+ .dpms = drm_atomic_helper_connector_dpms,
|
|
|
.reset = tegra_dsi_connector_reset,
|
|
|
.detect = tegra_output_connector_detect,
|
|
|
.fill_modes = drm_helper_probe_single_connector_modes,
|
|
@@ -787,22 +795,48 @@ static const struct drm_encoder_funcs tegra_dsi_encoder_funcs = {
|
|
|
.destroy = tegra_output_encoder_destroy,
|
|
|
};
|
|
|
|
|
|
-static void tegra_dsi_encoder_dpms(struct drm_encoder *encoder, int mode)
|
|
|
+static void tegra_dsi_encoder_disable(struct drm_encoder *encoder)
|
|
|
{
|
|
|
-}
|
|
|
+ struct tegra_output *output = encoder_to_output(encoder);
|
|
|
+ struct tegra_dc *dc = to_tegra_dc(encoder->crtc);
|
|
|
+ struct tegra_dsi *dsi = to_dsi(output);
|
|
|
+ u32 value;
|
|
|
+ int err;
|
|
|
|
|
|
-static void tegra_dsi_encoder_prepare(struct drm_encoder *encoder)
|
|
|
-{
|
|
|
-}
|
|
|
+ if (output->panel)
|
|
|
+ drm_panel_disable(output->panel);
|
|
|
|
|
|
-static void tegra_dsi_encoder_commit(struct drm_encoder *encoder)
|
|
|
-{
|
|
|
+ tegra_dsi_video_disable(dsi);
|
|
|
+
|
|
|
+ /*
|
|
|
+ * The following accesses registers of the display controller, so make
|
|
|
+ * sure it's only executed when the output is attached to one.
|
|
|
+ */
|
|
|
+ if (dc) {
|
|
|
+ value = tegra_dc_readl(dc, DC_DISP_DISP_WIN_OPTIONS);
|
|
|
+ value &= ~DSI_ENABLE;
|
|
|
+ tegra_dc_writel(dc, value, DC_DISP_DISP_WIN_OPTIONS);
|
|
|
+
|
|
|
+ tegra_dc_commit(dc);
|
|
|
+ }
|
|
|
+
|
|
|
+ err = tegra_dsi_wait_idle(dsi, 100);
|
|
|
+ if (err < 0)
|
|
|
+ dev_dbg(dsi->dev, "failed to idle DSI: %d\n", err);
|
|
|
+
|
|
|
+ tegra_dsi_soft_reset(dsi);
|
|
|
+
|
|
|
+ if (output->panel)
|
|
|
+ drm_panel_unprepare(output->panel);
|
|
|
+
|
|
|
+ tegra_dsi_disable(dsi);
|
|
|
+
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
-static void tegra_dsi_encoder_mode_set(struct drm_encoder *encoder,
|
|
|
- struct drm_display_mode *mode,
|
|
|
- struct drm_display_mode *adjusted)
|
|
|
+static void tegra_dsi_encoder_enable(struct drm_encoder *encoder)
|
|
|
{
|
|
|
+ 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 tegra_dsi *dsi = to_dsi(output);
|
|
@@ -840,45 +874,6 @@ static void tegra_dsi_encoder_mode_set(struct drm_encoder *encoder,
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-static void tegra_dsi_encoder_disable(struct drm_encoder *encoder)
|
|
|
-{
|
|
|
- struct tegra_output *output = encoder_to_output(encoder);
|
|
|
- struct tegra_dc *dc = to_tegra_dc(encoder->crtc);
|
|
|
- struct tegra_dsi *dsi = to_dsi(output);
|
|
|
- u32 value;
|
|
|
- int err;
|
|
|
-
|
|
|
- if (output->panel)
|
|
|
- drm_panel_disable(output->panel);
|
|
|
-
|
|
|
- tegra_dsi_video_disable(dsi);
|
|
|
-
|
|
|
- /*
|
|
|
- * The following accesses registers of the display controller, so make
|
|
|
- * sure it's only executed when the output is attached to one.
|
|
|
- */
|
|
|
- if (dc) {
|
|
|
- value = tegra_dc_readl(dc, DC_DISP_DISP_WIN_OPTIONS);
|
|
|
- value &= ~DSI_ENABLE;
|
|
|
- tegra_dc_writel(dc, value, DC_DISP_DISP_WIN_OPTIONS);
|
|
|
-
|
|
|
- tegra_dc_commit(dc);
|
|
|
- }
|
|
|
-
|
|
|
- err = tegra_dsi_wait_idle(dsi, 100);
|
|
|
- if (err < 0)
|
|
|
- dev_dbg(dsi->dev, "failed to idle DSI: %d\n", err);
|
|
|
-
|
|
|
- tegra_dsi_soft_reset(dsi);
|
|
|
-
|
|
|
- if (output->panel)
|
|
|
- drm_panel_unprepare(output->panel);
|
|
|
-
|
|
|
- tegra_dsi_disable(dsi);
|
|
|
-
|
|
|
- return;
|
|
|
-}
|
|
|
-
|
|
|
static int
|
|
|
tegra_dsi_encoder_atomic_check(struct drm_encoder *encoder,
|
|
|
struct drm_crtc_state *crtc_state,
|
|
@@ -961,11 +956,8 @@ tegra_dsi_encoder_atomic_check(struct drm_encoder *encoder,
|
|
|
}
|
|
|
|
|
|
static const struct drm_encoder_helper_funcs tegra_dsi_encoder_helper_funcs = {
|
|
|
- .dpms = tegra_dsi_encoder_dpms,
|
|
|
- .prepare = tegra_dsi_encoder_prepare,
|
|
|
- .commit = tegra_dsi_encoder_commit,
|
|
|
- .mode_set = tegra_dsi_encoder_mode_set,
|
|
|
.disable = tegra_dsi_encoder_disable,
|
|
|
+ .enable = tegra_dsi_encoder_enable,
|
|
|
.atomic_check = tegra_dsi_encoder_atomic_check,
|
|
|
};
|
|
|
|