提交 29871b21 编写于 作者: T Thierry Reding

drm/tegra: hdmi: Restore DPMS

In order to restore DPMS with atomic mode-setting, move all code from
the ->mode_set() callback into ->enable(). At the same time, rename the
->prepare() callback to ->disable() to use the names preferred by atomic
mode-setting. This simplifies the calling sequence and will allow DPMS
code to use runtime PM in subsequent patches.
Signed-off-by: NThierry Reding <treding@nvidia.com>
上级 32c3dee1
...@@ -772,13 +772,8 @@ static bool tegra_output_is_hdmi(struct tegra_output *output) ...@@ -772,13 +772,8 @@ static bool tegra_output_is_hdmi(struct tegra_output *output)
return drm_detect_hdmi_monitor(edid); return drm_detect_hdmi_monitor(edid);
} }
static void tegra_hdmi_connector_dpms(struct drm_connector *connector,
int mode)
{
}
static const struct drm_connector_funcs tegra_hdmi_connector_funcs = { static const struct drm_connector_funcs tegra_hdmi_connector_funcs = {
.dpms = tegra_hdmi_connector_dpms, .dpms = drm_atomic_helper_connector_dpms,
.reset = drm_atomic_helper_connector_reset, .reset = drm_atomic_helper_connector_reset,
.detect = tegra_output_connector_detect, .detect = tegra_output_connector_detect,
.fill_modes = drm_helper_probe_single_connector_modes, .fill_modes = drm_helper_probe_single_connector_modes,
...@@ -818,22 +813,27 @@ static const struct drm_encoder_funcs tegra_hdmi_encoder_funcs = { ...@@ -818,22 +813,27 @@ static const struct drm_encoder_funcs tegra_hdmi_encoder_funcs = {
.destroy = tegra_output_encoder_destroy, .destroy = tegra_output_encoder_destroy,
}; };
static void tegra_hdmi_encoder_dpms(struct drm_encoder *encoder, int mode) static void tegra_hdmi_encoder_disable(struct drm_encoder *encoder)
{ {
} struct tegra_dc *dc = to_tegra_dc(encoder->crtc);
u32 value;
static void tegra_hdmi_encoder_prepare(struct drm_encoder *encoder) /*
{ * 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 &= ~HDMI_ENABLE;
tegra_dc_writel(dc, value, DC_DISP_DISP_WIN_OPTIONS);
static void tegra_hdmi_encoder_commit(struct drm_encoder *encoder) tegra_dc_commit(dc);
{ }
} }
static void tegra_hdmi_encoder_mode_set(struct drm_encoder *encoder, static void tegra_hdmi_encoder_enable(struct drm_encoder *encoder)
struct drm_display_mode *mode,
struct drm_display_mode *adjusted)
{ {
struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode;
unsigned int h_sync_width, h_front_porch, h_back_porch, i, rekey; unsigned int h_sync_width, h_front_porch, h_back_porch, i, rekey;
struct tegra_output *output = encoder_to_output(encoder); struct tegra_output *output = encoder_to_output(encoder);
struct tegra_dc *dc = to_tegra_dc(encoder->crtc); struct tegra_dc *dc = to_tegra_dc(encoder->crtc);
...@@ -1035,24 +1035,6 @@ static void tegra_hdmi_encoder_mode_set(struct drm_encoder *encoder, ...@@ -1035,24 +1035,6 @@ static void tegra_hdmi_encoder_mode_set(struct drm_encoder *encoder,
/* TODO: add HDCP support */ /* TODO: add HDCP support */
} }
static void tegra_hdmi_encoder_disable(struct drm_encoder *encoder)
{
struct tegra_dc *dc = to_tegra_dc(encoder->crtc);
u32 value;
/*
* 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 &= ~HDMI_ENABLE;
tegra_dc_writel(dc, value, DC_DISP_DISP_WIN_OPTIONS);
tegra_dc_commit(dc);
}
}
static int static int
tegra_hdmi_encoder_atomic_check(struct drm_encoder *encoder, tegra_hdmi_encoder_atomic_check(struct drm_encoder *encoder,
struct drm_crtc_state *crtc_state, struct drm_crtc_state *crtc_state,
...@@ -1075,11 +1057,8 @@ tegra_hdmi_encoder_atomic_check(struct drm_encoder *encoder, ...@@ -1075,11 +1057,8 @@ tegra_hdmi_encoder_atomic_check(struct drm_encoder *encoder,
} }
static const struct drm_encoder_helper_funcs tegra_hdmi_encoder_helper_funcs = { static const struct drm_encoder_helper_funcs tegra_hdmi_encoder_helper_funcs = {
.dpms = tegra_hdmi_encoder_dpms,
.prepare = tegra_hdmi_encoder_prepare,
.commit = tegra_hdmi_encoder_commit,
.mode_set = tegra_hdmi_encoder_mode_set,
.disable = tegra_hdmi_encoder_disable, .disable = tegra_hdmi_encoder_disable,
.enable = tegra_hdmi_encoder_enable,
.atomic_check = tegra_hdmi_encoder_atomic_check, .atomic_check = tegra_hdmi_encoder_atomic_check,
}; };
...@@ -1087,11 +1066,16 @@ static int tegra_hdmi_show_regs(struct seq_file *s, void *data) ...@@ -1087,11 +1066,16 @@ static int tegra_hdmi_show_regs(struct seq_file *s, void *data)
{ {
struct drm_info_node *node = s->private; struct drm_info_node *node = s->private;
struct tegra_hdmi *hdmi = node->info_ent->data; struct tegra_hdmi *hdmi = node->info_ent->data;
int err; struct drm_crtc *crtc = hdmi->output.encoder.crtc;
struct drm_device *drm = node->minor->dev;
int err = 0;
err = clk_prepare_enable(hdmi->clk); drm_modeset_lock_all(drm);
if (err)
return err; if (!crtc || !crtc->state->active) {
err = -EBUSY;
goto unlock;
}
#define DUMP_REG(name) \ #define DUMP_REG(name) \
seq_printf(s, "%-56s %#05x %08x\n", #name, name, \ seq_printf(s, "%-56s %#05x %08x\n", #name, name, \
...@@ -1258,9 +1242,9 @@ static int tegra_hdmi_show_regs(struct seq_file *s, void *data) ...@@ -1258,9 +1242,9 @@ static int tegra_hdmi_show_regs(struct seq_file *s, void *data)
#undef DUMP_REG #undef DUMP_REG
clk_disable_unprepare(hdmi->clk); unlock:
drm_modeset_unlock_all(drm);
return 0; return err;
} }
static struct drm_info_list debugfs_files[] = { static struct drm_info_list debugfs_files[] = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册