aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/intelfb
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2006-03-23 03:23:48 -0500
committerDave Airlie <airlied@linux.ie>2006-04-02 21:43:28 -0400
commit8b91b0b4f2d731b92f59bc82492769a09b4955a6 (patch)
treeaeb384e59229d4814733195db5836ad9ab448c17 /drivers/video/intelfb
parent8bb91f6a2d1db8031bfbb367df075f041d0cdfe2 (diff)
intelfb: fixup whitespace..
repeat after me, I must not take code from X without reformatting... Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/video/intelfb')
-rw-r--r--drivers/video/intelfb/intelfbdrv.c10
-rw-r--r--drivers/video/intelfb/intelfbhw.c66
2 files changed, 35 insertions, 41 deletions
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c
index b96001b5d947..f659ca8d1652 100644
--- a/drivers/video/intelfb/intelfbdrv.c
+++ b/drivers/video/intelfb/intelfbdrv.c
@@ -1467,7 +1467,7 @@ static int
1467intelfb_cursor(struct fb_info *info, struct fb_cursor *cursor) 1467intelfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
1468{ 1468{
1469 struct intelfb_info *dinfo = GET_DINFO(info); 1469 struct intelfb_info *dinfo = GET_DINFO(info);
1470 int ret; 1470 u32 physical;
1471#if VERBOSE > 0 1471#if VERBOSE > 0
1472 DBG_MSG("intelfb_cursor\n"); 1472 DBG_MSG("intelfb_cursor\n");
1473#endif 1473#endif
@@ -1478,12 +1478,10 @@ intelfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
1478 intelfbhw_cursor_hide(dinfo); 1478 intelfbhw_cursor_hide(dinfo);
1479 1479
1480 /* If XFree killed the cursor - restore it */ 1480 /* If XFree killed the cursor - restore it */
1481 if (dinfo->mobile || IS_I9xx(dinfo)) 1481 physical = (dinfo->mobile || IS_I9xx(dinfo)) ? dinfo->cursor.physical :
1482 ret = (INREG(CURSOR_A_BASEADDR) != dinfo->cursor.physical); 1482 (dinfo->cursor.offset << 12);
1483 else
1484 ret = (INREG(CURSOR_A_BASEADDR) != dinfo->cursor.offset << 12);
1485 1483
1486 if (ret) { 1484 if (INREG(CURSOR_A_BASEADDR) != physical) {
1487 u32 fg, bg; 1485 u32 fg, bg;
1488 1486
1489 DBG_MSG("the cursor was killed - restore it !!\n"); 1487 DBG_MSG("the cursor was killed - restore it !!\n");
diff --git a/drivers/video/intelfb/intelfbhw.c b/drivers/video/intelfb/intelfbhw.c
index 92bdde8f9b23..2537880b2420 100644
--- a/drivers/video/intelfb/intelfbhw.c
+++ b/drivers/video/intelfb/intelfbhw.c
@@ -566,7 +566,7 @@ static int calc_vclock3(int index, int m, int n, int p)
566 return 0; 566 return 0;
567 return PLL_REFCLK * m / n / p; 567 return PLL_REFCLK * m / n / p;
568} 568}
569 569
570static int calc_vclock(int index, int m1, int m2, int n, int p1, int p2) 570static int calc_vclock(int index, int m1, int m2, int n, int p1, int p2)
571{ 571{
572 switch(index) 572 switch(index)
@@ -578,7 +578,7 @@ static int calc_vclock(int index, int m1, int m2, int n, int p1, int p2)
578 ((p1)) * (p2 ? 10 : 5))); 578 ((p1)) * (p2 ? 10 : 5)));
579 case PLLS_I8xx: 579 case PLLS_I8xx:
580 default: 580 default:
581 return ((PLL_REFCLK * (5 * (m1 + 2) + (m2 + 2)) / (n + 2) / 581 return ((PLL_REFCLK * (5 * (m1 + 2) + (m2 + 2)) / (n + 2) /
582 ((p1+2) * (1 << (p2 + 1))))); 582 ((p1+2) * (1 << (p2 + 1)))));
583 } 583 }
584} 584}
@@ -608,7 +608,7 @@ intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw)
608 p2 = (hw->vga_pd >> VGAPD_0_P2_SHIFT) & DPLL_P2_MASK; 608 p2 = (hw->vga_pd >> VGAPD_0_P2_SHIFT) & DPLL_P2_MASK;
609 printk(" VGA0: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n", 609 printk(" VGA0: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n",
610 m1, m2, n, p1, p2); 610 m1, m2, n, p1, p2);
611 printk(" VGA0: clock is %d\n", 611 printk(" VGA0: clock is %d\n",
612 calc_vclock(index, m1, m2, n, p1, p2)); 612 calc_vclock(index, m1, m2, n, p1, p2));
613 613
614 n = (hw->vga1_divisor >> FP_N_DIVISOR_SHIFT) & FP_DIVISOR_MASK; 614 n = (hw->vga1_divisor >> FP_N_DIVISOR_SHIFT) & FP_DIVISOR_MASK;
@@ -740,7 +740,7 @@ intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw)
740 for (i = 0; i < 8; i++) 740 for (i = 0; i < 8; i++)
741 printk(" FENCE%d 0x%08x\n", i, 741 printk(" FENCE%d 0x%08x\n", i,
742 hw->fence[i]); 742 hw->fence[i]);
743 743
744 printk(" INSTPM 0x%08x\n", hw->instpm); 744 printk(" INSTPM 0x%08x\n", hw->instpm);
745 printk(" MEM_MODE 0x%08x\n", hw->mem_mode); 745 printk(" MEM_MODE 0x%08x\n", hw->mem_mode);
746 printk(" FW_BLC_0 0x%08x\n", hw->fw_blc_0); 746 printk(" FW_BLC_0 0x%08x\n", hw->fw_blc_0);
@@ -750,7 +750,7 @@ intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw)
750#endif 750#endif
751} 751}
752 752
753 753
754 754
755/* Split the M parameter into M1 and M2. */ 755/* Split the M parameter into M1 and M2. */
756static int 756static int
@@ -759,18 +759,15 @@ splitm(int index, unsigned int m, unsigned int *retm1, unsigned int *retm2)
759 int m1, m2; 759 int m1, m2;
760 int testm; 760 int testm;
761 /* no point optimising too much - brute force m */ 761 /* no point optimising too much - brute force m */
762 for (m1 = plls[index].min_m1; m1 < plls[index].max_m1+1; m1++) 762 for (m1 = plls[index].min_m1; m1 < plls[index].max_m1+1; m1++) {
763 { 763 for (m2 = plls[index].min_m2; m2 < plls[index].max_m2+1; m2++) {
764 for (m2 = plls[index].min_m2; m2 < plls[index].max_m2+1; m2++) 764 testm = ( 5 * ( m1 + 2 )) + (m2 + 2);
765 { 765 if (testm == m) {
766 testm = ( 5 * ( m1 + 2 )) + (m2 + 2); 766 *retm1 = (unsigned int)m1;
767 if (testm == m) 767 *retm2 = (unsigned int)m2;
768 { 768 return 0;
769 *retm1 = (unsigned int)m1; 769 }
770 *retm2 = (unsigned int)m2; 770 }
771 return 0;
772 }
773 }
774 } 771 }
775 return 1; 772 return 1;
776} 773}
@@ -781,8 +778,7 @@ splitp(int index, unsigned int p, unsigned int *retp1, unsigned int *retp2)
781{ 778{
782 int p1, p2; 779 int p1, p2;
783 780
784 if (index == PLLS_I9xx) 781 if (index == PLLS_I9xx) {
785 {
786 switch (p) { 782 switch (p) {
787 case 10: 783 case 10:
788 p1 = 2; 784 p1 = 2;
@@ -803,8 +799,7 @@ splitp(int index, unsigned int p, unsigned int *retp1, unsigned int *retp2)
803 return 0; 799 return 0;
804 } 800 }
805 801
806 if (index == PLLS_I8xx) 802 if (index == PLLS_I8xx) {
807 {
808 if (p % 4 == 0) 803 if (p % 4 == 0)
809 p2 = 1; 804 p2 = 1;
810 else 805 else
@@ -814,7 +809,9 @@ splitp(int index, unsigned int p, unsigned int *retp1, unsigned int *retp2)
814 p2 = 0; 809 p2 = 0;
815 p1 = (p / (1 << (p2 + 1))) - 2; 810 p1 = (p / (1 << (p2 + 1))) - 2;
816 } 811 }
817 if (p1 < plls[index].min_p1 || p1 > plls[index].max_p1 || (p1 + 2) * (1 << (p2 + 1)) != p) { 812 if (p1 < plls[index].min_p1 ||
813 p1 > plls[index].max_p1 ||
814 (p1 + 2) * (1 << (p2 + 1)) != p) {
818 return 1; 815 return 1;
819 } else { 816 } else {
820 *retp1 = (unsigned int)p1; 817 *retp1 = (unsigned int)p1;
@@ -858,14 +855,13 @@ calc_pll_params(int index, int clock, u32 *retm1, u32 *retm2, u32 *retn, u32 *re
858 if (p_max > plls[index].max_p) 855 if (p_max > plls[index].max_p)
859 p_max = plls[index].max_p; 856 p_max = plls[index].max_p;
860 857
861 if (clock < PLL_REFCLK && index==PLLS_I9xx) 858 if (clock < PLL_REFCLK && index == PLLS_I9xx) {
862 { 859 p_min = 10;
863 p_min = 10; 860 p_max = 20;
864 p_max = 20; 861 /* this makes 640x480 work it really shouldn't
865 /* this makes 640x480 work it really shouldn't 862 - SOMEONE WITHOUT DOCS WOZ HERE */
866 - SOMEONE WITHOUT DOCS WOZ HERE */ 863 if (clock < 30000)
867 if (clock < 30000) 864 clock *= 4;
868 clock *= 4;
869 } 865 }
870 866
871 DBG_MSG("p range is %d-%d (%d)\n", p_min, p_max, p_inc); 867 DBG_MSG("p range is %d-%d (%d)\n", p_min, p_max, p_inc);
@@ -925,7 +921,7 @@ calc_pll_params(int index, int clock, u32 *retm1, u32 *retm2, u32 *retn, u32 *re
925 DBG_MSG("m, n, p: %d (%d,%d), %d (%d), %d (%d,%d), " 921 DBG_MSG("m, n, p: %d (%d,%d), %d (%d), %d (%d,%d), "
926 "f: %d (%d), VCO: %d\n", 922 "f: %d (%d), VCO: %d\n",
927 m, m1, m2, n, n1, p, p1, p2, 923 m, m1, m2, n, n1, p, p1, p2,
928 calc_vclock3(index, m, n, p), 924 calc_vclock3(index, m, n, p),
929 calc_vclock(index, m1, m2, n1, p1, p2), 925 calc_vclock(index, m1, m2, n1, p1, p2),
930 calc_vclock3(index, m, n, p) * p); 926 calc_vclock3(index, m, n, p) * p);
931 *retm1 = m1; 927 *retm1 = m1;
@@ -1030,7 +1026,8 @@ intelfbhw_mode_to_hw(struct intelfb_info *dinfo, struct intelfb_hwstate *hw,
1030 /* Desired clock in kHz */ 1026 /* Desired clock in kHz */
1031 clock_target = 1000000000 / var->pixclock; 1027 clock_target = 1000000000 / var->pixclock;
1032 1028
1033 if (calc_pll_params(dinfo->pll_index, clock_target, &m1, &m2, &n, &p1, &p2, &clock)) { 1029 if (calc_pll_params(dinfo->pll_index, clock_target, &m1, &m2,
1030 &n, &p1, &p2, &clock)) {
1034 WRN_MSG("calc_pll_params failed\n"); 1031 WRN_MSG("calc_pll_params failed\n");
1035 return 1; 1032 return 1;
1036 } 1033 }
@@ -1263,14 +1260,13 @@ intelfbhw_program_mode(struct intelfb_info *dinfo,
1263 OUTREG(pipe_conf_reg, tmp); 1260 OUTREG(pipe_conf_reg, tmp);
1264 1261
1265 count = 0; 1262 count = 0;
1266 do{ 1263 do {
1267 tmp_val[count%3] = INREG(0x70000); 1264 tmp_val[count%3] = INREG(0x70000);
1268 if ((tmp_val[0] == tmp_val[1]) && (tmp_val[1]==tmp_val[2])) 1265 if ((tmp_val[0] == tmp_val[1]) && (tmp_val[1]==tmp_val[2]))
1269 break; 1266 break;
1270 count++; 1267 count++;
1271 udelay(1); 1268 udelay(1);
1272 if (count % 200 == 0) 1269 if (count % 200 == 0) {
1273 {
1274 tmp = INREG(pipe_conf_reg); 1270 tmp = INREG(pipe_conf_reg);
1275 tmp &= ~PIPECONF_ENABLE; 1271 tmp &= ~PIPECONF_ENABLE;
1276 OUTREG(pipe_conf_reg, tmp); 1272 OUTREG(pipe_conf_reg, tmp);