aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/intelfb/intelfbhw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/intelfb/intelfbhw.c')
-rw-r--r--drivers/video/intelfb/intelfbhw.c48
1 files changed, 30 insertions, 18 deletions
diff --git a/drivers/video/intelfb/intelfbhw.c b/drivers/video/intelfb/intelfbhw.c
index 0689f97c5238..38065cf94ac4 100644
--- a/drivers/video/intelfb/intelfbhw.c
+++ b/drivers/video/intelfb/intelfbhw.c
@@ -24,7 +24,6 @@
24#include <linux/errno.h> 24#include <linux/errno.h>
25#include <linux/string.h> 25#include <linux/string.h>
26#include <linux/mm.h> 26#include <linux/mm.h>
27#include <linux/slab.h>
28#include <linux/delay.h> 27#include <linux/delay.h>
29#include <linux/fb.h> 28#include <linux/fb.h>
30#include <linux/ioport.h> 29#include <linux/ioport.h>
@@ -469,6 +468,32 @@ void intelfbhw_do_blank(int blank, struct fb_info *info)
469} 468}
470 469
471 470
471/* Check which pipe is connected to an active display plane. */
472int intelfbhw_active_pipe(const struct intelfb_hwstate *hw)
473{
474 int pipe = -1;
475
476 /* keep old default behaviour - prefer PIPE_A */
477 if (hw->disp_b_ctrl & DISPPLANE_PLANE_ENABLE) {
478 pipe = (hw->disp_b_ctrl >> DISPPLANE_SEL_PIPE_SHIFT);
479 pipe &= PIPE_MASK;
480 if (unlikely(pipe == PIPE_A))
481 return PIPE_A;
482 }
483 if (hw->disp_a_ctrl & DISPPLANE_PLANE_ENABLE) {
484 pipe = (hw->disp_a_ctrl >> DISPPLANE_SEL_PIPE_SHIFT);
485 pipe &= PIPE_MASK;
486 if (likely(pipe == PIPE_A))
487 return PIPE_A;
488 }
489 /* Impossible that no pipe is selected - return PIPE_A */
490 WARN_ON(pipe == -1);
491 if (unlikely(pipe == -1))
492 pipe = PIPE_A;
493
494 return pipe;
495}
496
472void intelfbhw_setcolreg(struct intelfb_info *dinfo, unsigned regno, 497void intelfbhw_setcolreg(struct intelfb_info *dinfo, unsigned regno,
473 unsigned red, unsigned green, unsigned blue, 498 unsigned red, unsigned green, unsigned blue,
474 unsigned transp) 499 unsigned transp)
@@ -1019,7 +1044,7 @@ int intelfbhw_mode_to_hw(struct intelfb_info *dinfo,
1019 struct intelfb_hwstate *hw, 1044 struct intelfb_hwstate *hw,
1020 struct fb_var_screeninfo *var) 1045 struct fb_var_screeninfo *var)
1021{ 1046{
1022 int pipe = PIPE_A; 1047 int pipe = intelfbhw_active_pipe(hw);
1023 u32 *dpll, *fp0, *fp1; 1048 u32 *dpll, *fp0, *fp1;
1024 u32 m1, m2, n, p1, p2, clock_target, clock; 1049 u32 m1, m2, n, p1, p2, clock_target, clock;
1025 u32 hsync_start, hsync_end, hblank_start, hblank_end, htotal, hactive; 1050 u32 hsync_start, hsync_end, hblank_start, hblank_end, htotal, hactive;
@@ -1033,12 +1058,6 @@ int intelfbhw_mode_to_hw(struct intelfb_info *dinfo,
1033 /* Disable VGA */ 1058 /* Disable VGA */
1034 hw->vgacntrl |= VGA_DISABLE; 1059 hw->vgacntrl |= VGA_DISABLE;
1035 1060
1036 /* Check whether pipe A or pipe B is enabled. */
1037 if (hw->pipe_a_conf & PIPECONF_ENABLE)
1038 pipe = PIPE_A;
1039 else if (hw->pipe_b_conf & PIPECONF_ENABLE)
1040 pipe = PIPE_B;
1041
1042 /* Set which pipe's registers will be set. */ 1061 /* Set which pipe's registers will be set. */
1043 if (pipe == PIPE_B) { 1062 if (pipe == PIPE_B) {
1044 dpll = &hw->dpll_b; 1063 dpll = &hw->dpll_b;
@@ -1262,7 +1281,6 @@ int intelfbhw_mode_to_hw(struct intelfb_info *dinfo,
1262int intelfbhw_program_mode(struct intelfb_info *dinfo, 1281int intelfbhw_program_mode(struct intelfb_info *dinfo,
1263 const struct intelfb_hwstate *hw, int blank) 1282 const struct intelfb_hwstate *hw, int blank)
1264{ 1283{
1265 int pipe = PIPE_A;
1266 u32 tmp; 1284 u32 tmp;
1267 const u32 *dpll, *fp0, *fp1, *pipe_conf; 1285 const u32 *dpll, *fp0, *fp1, *pipe_conf;
1268 const u32 *hs, *ht, *hb, *vs, *vt, *vb, *ss; 1286 const u32 *hs, *ht, *hb, *vs, *vt, *vb, *ss;
@@ -1272,7 +1290,7 @@ int intelfbhw_program_mode(struct intelfb_info *dinfo,
1272 u32 src_size_reg; 1290 u32 src_size_reg;
1273 u32 count, tmp_val[3]; 1291 u32 count, tmp_val[3];
1274 1292
1275 /* Assume single pipe, display plane A, analog CRT. */ 1293 /* Assume single pipe */
1276 1294
1277#if VERBOSE > 0 1295#if VERBOSE > 0
1278 DBG_MSG("intelfbhw_program_mode\n"); 1296 DBG_MSG("intelfbhw_program_mode\n");
@@ -1283,15 +1301,9 @@ int intelfbhw_program_mode(struct intelfb_info *dinfo,
1283 tmp |= VGA_DISABLE; 1301 tmp |= VGA_DISABLE;
1284 OUTREG(VGACNTRL, tmp); 1302 OUTREG(VGACNTRL, tmp);
1285 1303
1286 /* Check whether pipe A or pipe B is enabled. */ 1304 dinfo->pipe = intelfbhw_active_pipe(hw);
1287 if (hw->pipe_a_conf & PIPECONF_ENABLE)
1288 pipe = PIPE_A;
1289 else if (hw->pipe_b_conf & PIPECONF_ENABLE)
1290 pipe = PIPE_B;
1291
1292 dinfo->pipe = pipe;
1293 1305
1294 if (pipe == PIPE_B) { 1306 if (dinfo->pipe == PIPE_B) {
1295 dpll = &hw->dpll_b; 1307 dpll = &hw->dpll_b;
1296 fp0 = &hw->fpb0; 1308 fp0 = &hw->fpb0;
1297 fp1 = &hw->fpb1; 1309 fp1 = &hw->fpb1;