diff options
author | Thierry Reding <treding@nvidia.com> | 2015-07-29 10:04:44 -0400 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2015-08-13 07:49:23 -0400 |
commit | 171e2e6dd912dac625e085919f0822cd94c04ff0 (patch) | |
tree | 86b5c55cb94fc537e8281e46a84f2e1d0ba1799d /drivers/gpu/drm/tegra/dsi.c | |
parent | 29871b21c48c7b13adbd056755d923394ff6110b (diff) |
drm/tegra: dsi: 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
to use runtime PM in subsequent patches.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm/tegra/dsi.c')
-rw-r--r-- | drivers/gpu/drm/tegra/dsi.c | 110 |
1 files changed, 51 insertions, 59 deletions
diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c index eced05f09edc..f0a138ef68ce 100644 --- a/drivers/gpu/drm/tegra/dsi.c +++ b/drivers/gpu/drm/tegra/dsi.c | |||
@@ -119,6 +119,16 @@ static int tegra_dsi_show_regs(struct seq_file *s, void *data) | |||
119 | { | 119 | { |
120 | struct drm_info_node *node = s->private; | 120 | struct drm_info_node *node = s->private; |
121 | struct tegra_dsi *dsi = node->info_ent->data; | 121 | struct tegra_dsi *dsi = node->info_ent->data; |
122 | struct drm_crtc *crtc = dsi->output.encoder.crtc; | ||
123 | struct drm_device *drm = node->minor->dev; | ||
124 | int err = 0; | ||
125 | |||
126 | drm_modeset_lock_all(drm); | ||
127 | |||
128 | if (!crtc || !crtc->state->active) { | ||
129 | err = -EBUSY; | ||
130 | goto unlock; | ||
131 | } | ||
122 | 132 | ||
123 | #define DUMP_REG(name) \ | 133 | #define DUMP_REG(name) \ |
124 | seq_printf(s, "%-32s %#05x %08x\n", #name, name, \ | 134 | 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) | |||
208 | 218 | ||
209 | #undef DUMP_REG | 219 | #undef DUMP_REG |
210 | 220 | ||
211 | return 0; | 221 | unlock: |
222 | drm_modeset_unlock_all(drm); | ||
223 | return err; | ||
212 | } | 224 | } |
213 | 225 | ||
214 | static struct drm_info_list debugfs_files[] = { | 226 | static struct drm_info_list debugfs_files[] = { |
@@ -731,10 +743,6 @@ static void tegra_dsi_soft_reset(struct tegra_dsi *dsi) | |||
731 | tegra_dsi_soft_reset(dsi->slave); | 743 | tegra_dsi_soft_reset(dsi->slave); |
732 | } | 744 | } |
733 | 745 | ||
734 | static void tegra_dsi_connector_dpms(struct drm_connector *connector, int mode) | ||
735 | { | ||
736 | } | ||
737 | |||
738 | static void tegra_dsi_connector_reset(struct drm_connector *connector) | 746 | static void tegra_dsi_connector_reset(struct drm_connector *connector) |
739 | { | 747 | { |
740 | struct tegra_dsi_state *state; | 748 | struct tegra_dsi_state *state; |
@@ -761,7 +769,7 @@ tegra_dsi_connector_duplicate_state(struct drm_connector *connector) | |||
761 | } | 769 | } |
762 | 770 | ||
763 | static const struct drm_connector_funcs tegra_dsi_connector_funcs = { | 771 | static const struct drm_connector_funcs tegra_dsi_connector_funcs = { |
764 | .dpms = tegra_dsi_connector_dpms, | 772 | .dpms = drm_atomic_helper_connector_dpms, |
765 | .reset = tegra_dsi_connector_reset, | 773 | .reset = tegra_dsi_connector_reset, |
766 | .detect = tegra_output_connector_detect, | 774 | .detect = tegra_output_connector_detect, |
767 | .fill_modes = drm_helper_probe_single_connector_modes, | 775 | .fill_modes = drm_helper_probe_single_connector_modes, |
@@ -787,22 +795,48 @@ static const struct drm_encoder_funcs tegra_dsi_encoder_funcs = { | |||
787 | .destroy = tegra_output_encoder_destroy, | 795 | .destroy = tegra_output_encoder_destroy, |
788 | }; | 796 | }; |
789 | 797 | ||
790 | static void tegra_dsi_encoder_dpms(struct drm_encoder *encoder, int mode) | 798 | static void tegra_dsi_encoder_disable(struct drm_encoder *encoder) |
791 | { | 799 | { |
792 | } | 800 | struct tegra_output *output = encoder_to_output(encoder); |
801 | struct tegra_dc *dc = to_tegra_dc(encoder->crtc); | ||
802 | struct tegra_dsi *dsi = to_dsi(output); | ||
803 | u32 value; | ||
804 | int err; | ||
793 | 805 | ||
794 | static void tegra_dsi_encoder_prepare(struct drm_encoder *encoder) | 806 | if (output->panel) |
795 | { | 807 | drm_panel_disable(output->panel); |
796 | } | ||
797 | 808 | ||
798 | static void tegra_dsi_encoder_commit(struct drm_encoder *encoder) | 809 | tegra_dsi_video_disable(dsi); |
799 | { | 810 | |
811 | /* | ||
812 | * The following accesses registers of the display controller, so make | ||
813 | * sure it's only executed when the output is attached to one. | ||
814 | */ | ||
815 | if (dc) { | ||
816 | value = tegra_dc_readl(dc, DC_DISP_DISP_WIN_OPTIONS); | ||
817 | value &= ~DSI_ENABLE; | ||
818 | tegra_dc_writel(dc, value, DC_DISP_DISP_WIN_OPTIONS); | ||
819 | |||
820 | tegra_dc_commit(dc); | ||
821 | } | ||
822 | |||
823 | err = tegra_dsi_wait_idle(dsi, 100); | ||
824 | if (err < 0) | ||
825 | dev_dbg(dsi->dev, "failed to idle DSI: %d\n", err); | ||
826 | |||
827 | tegra_dsi_soft_reset(dsi); | ||
828 | |||
829 | if (output->panel) | ||
830 | drm_panel_unprepare(output->panel); | ||
831 | |||
832 | tegra_dsi_disable(dsi); | ||
833 | |||
834 | return; | ||
800 | } | 835 | } |
801 | 836 | ||
802 | static void tegra_dsi_encoder_mode_set(struct drm_encoder *encoder, | 837 | static void tegra_dsi_encoder_enable(struct drm_encoder *encoder) |
803 | struct drm_display_mode *mode, | ||
804 | struct drm_display_mode *adjusted) | ||
805 | { | 838 | { |
839 | struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; | ||
806 | struct tegra_output *output = encoder_to_output(encoder); | 840 | struct tegra_output *output = encoder_to_output(encoder); |
807 | struct tegra_dc *dc = to_tegra_dc(encoder->crtc); | 841 | struct tegra_dc *dc = to_tegra_dc(encoder->crtc); |
808 | struct tegra_dsi *dsi = to_dsi(output); | 842 | struct tegra_dsi *dsi = to_dsi(output); |
@@ -840,45 +874,6 @@ static void tegra_dsi_encoder_mode_set(struct drm_encoder *encoder, | |||
840 | return; | 874 | return; |
841 | } | 875 | } |
842 | 876 | ||
843 | static void tegra_dsi_encoder_disable(struct drm_encoder *encoder) | ||
844 | { | ||
845 | struct tegra_output *output = encoder_to_output(encoder); | ||
846 | struct tegra_dc *dc = to_tegra_dc(encoder->crtc); | ||
847 | struct tegra_dsi *dsi = to_dsi(output); | ||
848 | u32 value; | ||
849 | int err; | ||
850 | |||
851 | if (output->panel) | ||
852 | drm_panel_disable(output->panel); | ||
853 | |||
854 | tegra_dsi_video_disable(dsi); | ||
855 | |||
856 | /* | ||
857 | * The following accesses registers of the display controller, so make | ||
858 | * sure it's only executed when the output is attached to one. | ||
859 | */ | ||
860 | if (dc) { | ||
861 | value = tegra_dc_readl(dc, DC_DISP_DISP_WIN_OPTIONS); | ||
862 | value &= ~DSI_ENABLE; | ||
863 | tegra_dc_writel(dc, value, DC_DISP_DISP_WIN_OPTIONS); | ||
864 | |||
865 | tegra_dc_commit(dc); | ||
866 | } | ||
867 | |||
868 | err = tegra_dsi_wait_idle(dsi, 100); | ||
869 | if (err < 0) | ||
870 | dev_dbg(dsi->dev, "failed to idle DSI: %d\n", err); | ||
871 | |||
872 | tegra_dsi_soft_reset(dsi); | ||
873 | |||
874 | if (output->panel) | ||
875 | drm_panel_unprepare(output->panel); | ||
876 | |||
877 | tegra_dsi_disable(dsi); | ||
878 | |||
879 | return; | ||
880 | } | ||
881 | |||
882 | static int | 877 | static int |
883 | tegra_dsi_encoder_atomic_check(struct drm_encoder *encoder, | 878 | tegra_dsi_encoder_atomic_check(struct drm_encoder *encoder, |
884 | struct drm_crtc_state *crtc_state, | 879 | struct drm_crtc_state *crtc_state, |
@@ -961,11 +956,8 @@ tegra_dsi_encoder_atomic_check(struct drm_encoder *encoder, | |||
961 | } | 956 | } |
962 | 957 | ||
963 | static const struct drm_encoder_helper_funcs tegra_dsi_encoder_helper_funcs = { | 958 | static const struct drm_encoder_helper_funcs tegra_dsi_encoder_helper_funcs = { |
964 | .dpms = tegra_dsi_encoder_dpms, | ||
965 | .prepare = tegra_dsi_encoder_prepare, | ||
966 | .commit = tegra_dsi_encoder_commit, | ||
967 | .mode_set = tegra_dsi_encoder_mode_set, | ||
968 | .disable = tegra_dsi_encoder_disable, | 959 | .disable = tegra_dsi_encoder_disable, |
960 | .enable = tegra_dsi_encoder_enable, | ||
969 | .atomic_check = tegra_dsi_encoder_atomic_check, | 961 | .atomic_check = tegra_dsi_encoder_atomic_check, |
970 | }; | 962 | }; |
971 | 963 | ||