aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-12-08 10:32:47 -0500
committerThierry Reding <treding@nvidia.com>2015-01-27 04:14:58 -0500
commit666cb873328b5075eb511662858bab02d084ff64 (patch)
tree022b213d4e97a05efe37b1b5dcef1e0656a972e7
parent8f604f8c4dd2d5383f567856450ba12764061c12 (diff)
drm/tegra: dc: Unify enabling the display controller
Previously output drivers would enable continuous display mode and power up the display controller at various points during the initialization. This is suboptimal because it accesses display controller registers in output drivers and duplicates a bit of code. Move this code into the display controller driver and enable the display controller as the final step of the ->mode_set_nofb() implementation. Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r--drivers/gpu/drm/tegra/dc.c12
-rw-r--r--drivers/gpu/drm/tegra/dsi.c10
-rw-r--r--drivers/gpu/drm/tegra/hdmi.c10
-rw-r--r--drivers/gpu/drm/tegra/rgb.c11
-rw-r--r--drivers/gpu/drm/tegra/sor.c25
5 files changed, 16 insertions, 52 deletions
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 0cceabd11798..3aaa84ae2681 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -1236,6 +1236,18 @@ static void tegra_crtc_mode_set_nofb(struct drm_crtc *crtc)
1236 value &= ~INTERLACE_ENABLE; 1236 value &= ~INTERLACE_ENABLE;
1237 tegra_dc_writel(dc, value, DC_DISP_INTERLACE_CONTROL); 1237 tegra_dc_writel(dc, value, DC_DISP_INTERLACE_CONTROL);
1238 } 1238 }
1239
1240 value = tegra_dc_readl(dc, DC_CMD_DISPLAY_COMMAND);
1241 value &= ~DISP_CTRL_MODE_MASK;
1242 value |= DISP_CTRL_MODE_C_DISPLAY;
1243 tegra_dc_writel(dc, value, DC_CMD_DISPLAY_COMMAND);
1244
1245 value = tegra_dc_readl(dc, DC_CMD_DISPLAY_POWER_CONTROL);
1246 value |= PW0_ENABLE | PW1_ENABLE | PW2_ENABLE | PW3_ENABLE |
1247 PW4_ENABLE | PM0_ENABLE | PM1_ENABLE;
1248 tegra_dc_writel(dc, value, DC_CMD_DISPLAY_POWER_CONTROL);
1249
1250 tegra_dc_commit(dc);
1239} 1251}
1240 1252
1241static void tegra_crtc_prepare(struct drm_crtc *crtc) 1253static void tegra_crtc_prepare(struct drm_crtc *crtc)
diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
index 6875885a2dca..ed970f622903 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -824,16 +824,6 @@ static void tegra_dsi_encoder_mode_set(struct drm_encoder *encoder,
824 value |= DSI_ENABLE; 824 value |= DSI_ENABLE;
825 tegra_dc_writel(dc, value, DC_DISP_DISP_WIN_OPTIONS); 825 tegra_dc_writel(dc, value, DC_DISP_DISP_WIN_OPTIONS);
826 826
827 value = tegra_dc_readl(dc, DC_CMD_DISPLAY_COMMAND);
828 value &= ~DISP_CTRL_MODE_MASK;
829 value |= DISP_CTRL_MODE_C_DISPLAY;
830 tegra_dc_writel(dc, value, DC_CMD_DISPLAY_COMMAND);
831
832 value = tegra_dc_readl(dc, DC_CMD_DISPLAY_POWER_CONTROL);
833 value |= PW0_ENABLE | PW1_ENABLE | PW2_ENABLE | PW3_ENABLE |
834 PW4_ENABLE | PM0_ENABLE | PM1_ENABLE;
835 tegra_dc_writel(dc, value, DC_CMD_DISPLAY_POWER_CONTROL);
836
837 tegra_dc_commit(dc); 827 tegra_dc_commit(dc);
838 828
839 /* enable DSI controller */ 829 /* enable DSI controller */
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
index 07771956cc94..7e06657ae58b 100644
--- a/drivers/gpu/drm/tegra/hdmi.c
+++ b/drivers/gpu/drm/tegra/hdmi.c
@@ -1022,16 +1022,6 @@ static void tegra_hdmi_encoder_mode_set(struct drm_encoder *encoder,
1022 value |= HDMI_ENABLE; 1022 value |= HDMI_ENABLE;
1023 tegra_dc_writel(dc, value, DC_DISP_DISP_WIN_OPTIONS); 1023 tegra_dc_writel(dc, value, DC_DISP_DISP_WIN_OPTIONS);
1024 1024
1025 value = tegra_dc_readl(dc, DC_CMD_DISPLAY_COMMAND);
1026 value &= ~DISP_CTRL_MODE_MASK;
1027 value |= DISP_CTRL_MODE_C_DISPLAY;
1028 tegra_dc_writel(dc, value, DC_CMD_DISPLAY_COMMAND);
1029
1030 value = tegra_dc_readl(dc, DC_CMD_DISPLAY_POWER_CONTROL);
1031 value |= PW0_ENABLE | PW1_ENABLE | PW2_ENABLE | PW3_ENABLE |
1032 PW4_ENABLE | PM0_ENABLE | PM1_ENABLE;
1033 tegra_dc_writel(dc, value, DC_CMD_DISPLAY_POWER_CONTROL);
1034
1035 tegra_dc_commit(dc); 1025 tegra_dc_commit(dc);
1036 1026
1037 /* TODO: add HDCP support */ 1027 /* TODO: add HDCP support */
diff --git a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c
index 0c8b458b2364..7cd833f5b5b5 100644
--- a/drivers/gpu/drm/tegra/rgb.c
+++ b/drivers/gpu/drm/tegra/rgb.c
@@ -168,16 +168,6 @@ static void tegra_rgb_encoder_mode_set(struct drm_encoder *encoder,
168 value = SC0_H_QUALIFIER_NONE | SC1_H_QUALIFIER_NONE; 168 value = SC0_H_QUALIFIER_NONE | SC1_H_QUALIFIER_NONE;
169 tegra_dc_writel(rgb->dc, value, DC_DISP_SHIFT_CLOCK_OPTIONS); 169 tegra_dc_writel(rgb->dc, value, DC_DISP_SHIFT_CLOCK_OPTIONS);
170 170
171 value = tegra_dc_readl(rgb->dc, DC_CMD_DISPLAY_COMMAND);
172 value &= ~DISP_CTRL_MODE_MASK;
173 value |= DISP_CTRL_MODE_C_DISPLAY;
174 tegra_dc_writel(rgb->dc, value, DC_CMD_DISPLAY_COMMAND);
175
176 value = tegra_dc_readl(rgb->dc, DC_CMD_DISPLAY_POWER_CONTROL);
177 value |= PW0_ENABLE | PW1_ENABLE | PW2_ENABLE | PW3_ENABLE |
178 PW4_ENABLE | PM0_ENABLE | PM1_ENABLE;
179 tegra_dc_writel(rgb->dc, value, DC_CMD_DISPLAY_POWER_CONTROL);
180
181 tegra_dc_commit(rgb->dc); 171 tegra_dc_commit(rgb->dc);
182 172
183 if (output->panel) 173 if (output->panel)
@@ -193,6 +183,7 @@ static void tegra_rgb_encoder_disable(struct drm_encoder *encoder)
193 drm_panel_disable(output->panel); 183 drm_panel_disable(output->panel);
194 184
195 tegra_dc_write_regs(rgb->dc, rgb_disable, ARRAY_SIZE(rgb_disable)); 185 tegra_dc_write_regs(rgb->dc, rgb_disable, ARRAY_SIZE(rgb_disable));
186 tegra_dc_commit(rgb->dc);
196 187
197 if (output->panel) 188 if (output->panel)
198 drm_panel_unprepare(output->panel); 189 drm_panel_unprepare(output->panel);
diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index e813df71e30c..2afe478ded3b 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -261,17 +261,8 @@ static int tegra_sor_attach(struct tegra_sor *sor)
261 261
262static int tegra_sor_wakeup(struct tegra_sor *sor) 262static int tegra_sor_wakeup(struct tegra_sor *sor)
263{ 263{
264 struct tegra_dc *dc = to_tegra_dc(sor->output.encoder.crtc);
265 unsigned long value, timeout; 264 unsigned long value, timeout;
266 265
267 /* enable display controller outputs */
268 value = tegra_dc_readl(dc, DC_CMD_DISPLAY_POWER_CONTROL);
269 value |= PW0_ENABLE | PW1_ENABLE | PW2_ENABLE | PW3_ENABLE |
270 PW4_ENABLE | PM0_ENABLE | PM1_ENABLE;
271 tegra_dc_writel(dc, value, DC_CMD_DISPLAY_POWER_CONTROL);
272
273 tegra_dc_commit(dc);
274
275 timeout = jiffies + msecs_to_jiffies(250); 266 timeout = jiffies + msecs_to_jiffies(250);
276 267
277 /* wait for head to wake up */ 268 /* wait for head to wake up */
@@ -1112,18 +1103,6 @@ static void tegra_sor_encoder_mode_set(struct drm_encoder *encoder,
1112 goto unlock; 1103 goto unlock;
1113 } 1104 }
1114 1105
1115 /* start display controller in continuous mode */
1116 value = tegra_dc_readl(dc, DC_CMD_STATE_ACCESS);
1117 value |= WRITE_MUX;
1118 tegra_dc_writel(dc, value, DC_CMD_STATE_ACCESS);
1119
1120 tegra_dc_writel(dc, VSYNC_H_POSITION(1), DC_DISP_DISP_TIMING_OPTIONS);
1121 tegra_dc_writel(dc, DISP_CTRL_MODE_C_DISPLAY, DC_CMD_DISPLAY_COMMAND);
1122
1123 value = tegra_dc_readl(dc, DC_CMD_STATE_ACCESS);
1124 value &= ~WRITE_MUX;
1125 tegra_dc_writel(dc, value, DC_CMD_STATE_ACCESS);
1126
1127 /* 1106 /*
1128 * configure panel (24bpp, vsync-, hsync-, DP-A protocol, complete 1107 * configure panel (24bpp, vsync-, hsync-, DP-A protocol, complete
1129 * raster, associate with display controller) 1108 * raster, associate with display controller)
@@ -1198,11 +1177,13 @@ static void tegra_sor_encoder_mode_set(struct drm_encoder *encoder,
1198 goto unlock; 1177 goto unlock;
1199 } 1178 }
1200 1179
1180 tegra_sor_update(sor);
1181
1201 value = tegra_dc_readl(dc, DC_DISP_DISP_WIN_OPTIONS); 1182 value = tegra_dc_readl(dc, DC_DISP_DISP_WIN_OPTIONS);
1202 value |= SOR_ENABLE; 1183 value |= SOR_ENABLE;
1203 tegra_dc_writel(dc, value, DC_DISP_DISP_WIN_OPTIONS); 1184 tegra_dc_writel(dc, value, DC_DISP_DISP_WIN_OPTIONS);
1204 1185
1205 tegra_sor_update(sor); 1186 tegra_dc_commit(dc);
1206 1187
1207 err = tegra_sor_attach(sor); 1188 err = tegra_sor_attach(sor);
1208 if (err < 0) { 1189 if (err < 0) {