fbdev: Fix broken fb_blank() implementation.
PATCH 8/8 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).
---
aty/radeon_base.c | 22 +++++++++++++--------- cirrusfb.c | 18 +++++++++++------- epson1355fb.c | 13 ++++++++----- i810/i810_main.c | 17 ++++++++++++----- radeonfb.c | 12 +++++++----- 5 files changed, 51 insertions(+), 31 deletions(-)
drivers/video/aty/radeon_base.c +13 -9
@@ -947,15 +947,16 @@ 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 @@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 @@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 @@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 @@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 @@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);
drivers/video/cirrusfb.c +11 -7
@@ -1727,7 +1727,8 @@ }/* 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 @@ }/* 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 @@ 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 **************************************/ /****************************************************************************/
drivers/video/epson1355fb.c +8 -5
@@ -288,22 +288,25 @@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 ; }/* ------------------------------------------------------------------------- */
drivers/video/i810/i810_main.c +12 -5
@@ -1323,23 +1323,28 @@ 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 @@default :return -EINVAL ; } +i810_screen_off (mmio, scr_off);i810_writel (HVSYNC , mmio, mode);i810_writel (PWR_CLKC , mmio, pwr); +return 0 ; }
drivers/video/radeonfb.c +7 -5
@@ -1629,15 +1629,16 @@ 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 @@break ; } -return 0 ; +/* let fbcon do a soft blank for us */ +return (blank ==FB_BLANK_NORMAL ) ?1 :0 ; }
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
Quoted 9 lines · Antonino A. Daplas
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_NORMALis treated asFB_BLANK_UNBLANK, but returns a nonzero so fbcon wi
I think that on laptops, FB_BLANK_NORMAL could lower the backlight to 0 (without disabling the panel, which requires more time)... I'll look into this, in the meantime, your patch is fine.
BTW, what is the current status, can we use msleep in blank yet ? I think we can still have unblank() called by printk at interrupt time right ? I'd like to msleep in there rather than playing my games with a timer ...
Ben.
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 7 lines · Antonino A. Daplas
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.
Quoted 6 lines
Quoted 2 lines
(Note: For most of the drivers,
FB_BLANK_NORMALis treated asFB_BLANK_UNBLANK, but returns a nonzero so fbcon wiI think that on laptops,
FB_BLANK_NORMALcould lower the backlight to 0 (without disabling the panel, which requires more time)... I'll look into this, in the meantime, your patch is fine.
Yes, I was not too sure what to do with FB_BLANK_NORMAL not just for drivers with backlights, so I took the safe route (unblank but do a soft_blank).
Quoted 6 lines
BTW, what is the current status, can we use msleep in blank yet ? I think we can still have
unblank()called by printk at interrupt time right ? I'd like to msleep in there rather than playing my games with a timer ...
I'm not too sure about this, but I think so, it is world callable and is called by bust_spinlocks() at least. What about putting fbcon_blank() in the workqueue...? (Or perhaps unblank/blank_screen in vt.c, but the code in vt.c is very fragile...)
Tony
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
Quoted 4 lines · Antonino A. Daplas
I'm not too sure about this, but I think so, it is world callable and is called by
bust_spinlocks()at least. What about puttingfbcon_blank()in the workqueue...? (Or perhaps unblank/blank_screen invt.c, but the code invt.cis very fragile...)
Yah. I already fixed a bunch of vt.c so nowadays, at least, we do everything with the console sem. held, so the driver doesn't have to care about re-entrancy, though we still can be called at irq context.
A workqueue may not be a good idea. I don't like workqueue abuse, and sleeping > 200ms there means that whatever other driver using workqueues will suddenly have _huge_ latencies, it's not good.
I suppose I'll stick with my timer ...
Ben.
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click