Commit 7060950e authored by Antonino Daplas's avatar Antonino Daplas Committed by Linus Torvalds

[PATCH] fbdev: Fix broken fb_blank() implementation.

This patch fixes some of the drivers' fb_blank() implementation which got
the usage of the VESA_* constants incorrectly and converts them to use the
new FB_BLANK-* constants.

I'm not sure if what I did is correct for all drivers, so maintainers,
please review.

(Note: For most of the drivers, FB_BLANK_NORMAL is treated as
FB_BLANK_UNBLANK, but returns a nonzero so fbcon will do a soft_blank).
Signed-off-by: default avatarAntonino Daplas <adaplas@pol.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 0411197c
......@@ -947,15 +947,16 @@ static int radeon_screen_blank (struct radeonfb_info *rinfo, int blank, int mode
val &= ~(CRTC_DISPLAY_DIS | CRTC_HSYNC_DIS |
CRTC_VSYNC_DIS);
switch (blank) {
case VESA_NO_BLANKING:
case FB_BLANK_UNBLANK:
case FB_BLANK_NORMAL:
break;
case VESA_VSYNC_SUSPEND:
case FB_BLANK_VSYNC_SUSPEND:
val |= (CRTC_DISPLAY_DIS | CRTC_VSYNC_DIS);
break;
case VESA_HSYNC_SUSPEND:
case FB_BLANK_HSYNC_SUSPEND:
val |= (CRTC_DISPLAY_DIS | CRTC_HSYNC_DIS);
break;
case VESA_POWERDOWN:
case FB_BLANK_POWERDOWN:
val |= (CRTC_DISPLAY_DIS | CRTC_VSYNC_DIS |
CRTC_HSYNC_DIS);
break;
......@@ -967,7 +968,8 @@ static int radeon_screen_blank (struct radeonfb_info *rinfo, int blank, int mode
case MT_DFP:
if (mode_switch)
break;
if (blank == VESA_NO_BLANKING)
if (blank == FB_BLANK_UNBLANK ||
blank == FB_BLANK_NORMAL)
OUTREGP(FP_GEN_CNTL, (FP_FPON | FP_TMDS_EN),
~(FP_FPON | FP_TMDS_EN));
else
......@@ -975,7 +977,8 @@ static int radeon_screen_blank (struct radeonfb_info *rinfo, int blank, int mode
break;
case MT_LCD:
val = INREG(LVDS_GEN_CNTL);
if (blank == VESA_NO_BLANKING) {
if (blank == FB_BLANK_UNBLANK ||
blank == FB_BLANK_NORMAL) {
u32 target_val = (val & ~LVDS_DISPLAY_DIS) | LVDS_BLON | LVDS_ON
| LVDS_ON | (rinfo->init_state.lvds_gen_cntl & LVDS_DIGON);
if ((val ^ target_val) == LVDS_DISPLAY_DIS)
......@@ -1023,7 +1026,8 @@ static int radeon_screen_blank (struct radeonfb_info *rinfo, int blank, int mode
break;
}
return 0;
/* let fbcon do a soft blank for us */
return (blank == FB_BLANK_NORMAL) ? -EINVAL : 0;
}
int radeonfb_blank (int blank, struct fb_info *info)
......@@ -1265,7 +1269,7 @@ static void radeon_write_mode (struct radeonfb_info *rinfo,
del_timer_sync(&rinfo->lvds_timer);
radeon_screen_blank(rinfo, VESA_POWERDOWN, 1);
radeon_screen_blank(rinfo, FB_BLANK_POWERDOWN, 1);
msleep(100);
radeon_fifo_wait(31);
......@@ -1308,7 +1312,7 @@ static void radeon_write_mode (struct radeonfb_info *rinfo,
OUTREG(TMDS_TRANSMITTER_CNTL, mode->tmds_transmitter_cntl);
}
radeon_screen_blank(rinfo, VESA_NO_BLANKING, 1);
radeon_screen_blank(rinfo, FB_BLANK_UNBLANK, 1);
radeon_fifo_wait(2);
OUTPLL(VCLK_ECP_CNTL, mode->vclk_ecp_cntl);
......
......@@ -1727,7 +1727,8 @@ int cirrusfb_blank (int blank_mode, struct fb_info *info)
}
/* Undo current */
if (current_mode != VESA_NO_BLANKING) {
if (current_mode == FB_BLANK_NORMAL ||
current_mode == FB_BLANK_UNBLANK) {
/* unblank the screen */
val = vga_rseq (cinfo->regbase, VGA_SEQ_CLOCK_MODE);
vga_wseq (cinfo->regbase, VGA_SEQ_CLOCK_MODE, val & 0xdf); /* clear "FullBandwidth" bit */
......@@ -1736,22 +1737,23 @@ int cirrusfb_blank (int blank_mode, struct fb_info *info)
}
/* set new */
if(blank_mode != VESA_NO_BLANKING) {
if(blank_mode > FB_BLANK_NORMAL) {
/* blank the screen */
val = vga_rseq (cinfo->regbase, VGA_SEQ_CLOCK_MODE);
vga_wseq (cinfo->regbase, VGA_SEQ_CLOCK_MODE, val | 0x20); /* set "FullBandwidth" bit */
}
switch (blank_mode) {
case VESA_NO_BLANKING:
case FB_BLANK_UNBLANK:
case FB_BLANK_NORMAL:
break;
case VESA_VSYNC_SUSPEND:
case FB_BLANK_VSYNC_SUSPEND:
vga_wgfx (cinfo->regbase, CL_GRE, 0x04);
break;
case VESA_HSYNC_SUSPEND:
case FB_BLANK_HSYNC_SUSPEND:
vga_wgfx (cinfo->regbase, CL_GRE, 0x02);
break;
case VESA_POWERDOWN:
case FB_BLANK_POWERDOWN:
vga_wgfx (cinfo->regbase, CL_GRE, 0x06);
break;
default:
......@@ -1761,7 +1763,9 @@ int cirrusfb_blank (int blank_mode, struct fb_info *info)
cinfo->blank_mode = blank_mode;
DPRINTK ("EXIT, returning 0\n");
return 0;
/* Let fbcon do a soft blank for us */
return (blank_mode == FB_BLANK_NORMAL) ? 1 : 0;
}
/**** END Hardware specific Routines **************************************/
/****************************************************************************/
......
......@@ -288,22 +288,25 @@ static int epson1355fb_blank(int blank_mode, struct fb_info *info)
struct epson1355_par *par = info->par;
switch (blank_mode) {
case VESA_NO_BLANKING:
case FB_BLANK_UNBLANKING:
case FB_BLANK_NORMAL:
lcd_enable(par, 1);
backlight_enable(1);
break;
case VESA_VSYNC_SUSPEND:
case VESA_HSYNC_SUSPEND:
case FB_BLANK_VSYNC_SUSPEND:
case FB_BLANK_HSYNC_SUSPEND:
backlight_enable(0);
break;
case VESA_POWERDOWN:
case FB_BLANK_POWERDOWN:
backlight_enable(0);
lcd_enable(par, 0);
break;
default:
return -EINVAL;
}
return 0;
/* let fbcon do a soft blank for us */
return (blank_mode == FB_BLANK_NORMAL) ? 1 : 0;
}
/* ------------------------------------------------------------------------- */
......
......@@ -1323,23 +1323,28 @@ static int i810fb_blank (int blank_mode, struct fb_info *info)
pwr = i810_readl(PWR_CLKC, mmio);
switch(blank_mode) {
case VESA_NO_BLANKING:
switch (blank_mode) {
case FB_BLANK_UNBLANK:
mode = POWERON;
pwr |= 1;
scr_off = ON;
break;
case VESA_VSYNC_SUSPEND:
case FB_BLANK_NORMAL:
mode = POWERON;
pwr |= 1;
scr_off = OFF;
break;
case FB_BLANK_VSYNC_SUSPEND:
mode = STANDBY;
pwr |= 1;
scr_off = OFF;
break;
case VESA_HSYNC_SUSPEND:
case FB_BLANK_HSYNC_SUSPEND:
mode = SUSPEND;
pwr |= 1;
scr_off = OFF;
break;
case VESA_POWERDOWN:
case FB_BLANK_POWERDOWN:
mode = POWERDOWN;
pwr &= ~1;
scr_off = OFF;
......@@ -1347,9 +1352,11 @@ static int i810fb_blank (int blank_mode, struct fb_info *info)
default:
return -EINVAL;
}
i810_screen_off(mmio, scr_off);
i810_writel(HVSYNC, mmio, mode);
i810_writel(PWR_CLKC, mmio, pwr);
return 0;
}
......
......@@ -1629,15 +1629,16 @@ static int radeonfb_blank (int blank, struct fb_info *info)
val2 &= ~(LVDS_DISPLAY_DIS);
switch (blank) {
case VESA_NO_BLANKING:
case FB_BLANK_UNBLANK:
case FB_BLANK_NORMAL:
break;
case VESA_VSYNC_SUSPEND:
case FB_BLANK_VSYNC_SUSPEND:
val |= (CRTC_DISPLAY_DIS | CRTC_VSYNC_DIS);
break;
case VESA_HSYNC_SUSPEND:
case FB_BLANK_HSYNC_SUSPEND:
val |= (CRTC_DISPLAY_DIS | CRTC_HSYNC_DIS);
break;
case VESA_POWERDOWN:
case FB_BLANK_POWERDOWN:
val |= (CRTC_DISPLAY_DIS | CRTC_VSYNC_DIS |
CRTC_HSYNC_DIS);
val2 |= (LVDS_DISPLAY_DIS);
......@@ -1654,7 +1655,8 @@ static int radeonfb_blank (int blank, struct fb_info *info)
break;
}
return 0;
/* let fbcon do a soft blank for us */
return (blank == FB_BLANK_NORMAL) ? 1 : 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment