Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 480913fe authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Linus Torvalds
Browse files

[PATCH] atyfb: Improve blanking



Force blanking signal and disable display requests when blanked.  Don't
disable LCD backlight with FB_BLANK_NORMAL.

Signed-off-by: default avatarVille Syrjälä <syrjala@sci.fi>
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 25163c56
Loading
Loading
Loading
Loading
+12 −12
Original line number Original line Diff line number Diff line
@@ -2645,16 +2645,16 @@ static int __init store_video_par(char *video_str, unsigned char m64_num)
static int atyfb_blank(int blank, struct fb_info *info)
static int atyfb_blank(int blank, struct fb_info *info)
{
{
	struct atyfb_par *par = (struct atyfb_par *) info->par;
	struct atyfb_par *par = (struct atyfb_par *) info->par;
	u8 gen_cntl;
	u32 gen_cntl;


	if (par->lock_blank || par->asleep)
	if (par->lock_blank || par->asleep)
		return 0;
		return 0;


#ifdef CONFIG_PMAC_BACKLIGHT
#ifdef CONFIG_PMAC_BACKLIGHT
	if ((_machine == _MACH_Pmac) && blank)
	if ((_machine == _MACH_Pmac) && blank > FB_BLANK_NORMAL)
		set_backlight_enable(0);
		set_backlight_enable(0);
#elif defined(CONFIG_FB_ATY_GENERIC_LCD)
#elif defined(CONFIG_FB_ATY_GENERIC_LCD)
	if (par->lcd_table && blank &&
	if (par->lcd_table && blank > FB_BLANK_NORMAL &&
	    (aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) {
	    (aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) {
		u32 pm = aty_ld_lcd(POWER_MANAGEMENT, par);
		u32 pm = aty_ld_lcd(POWER_MANAGEMENT, par);
		pm &= ~PWR_BLON;
		pm &= ~PWR_BLON;
@@ -2662,31 +2662,31 @@ static int atyfb_blank(int blank, struct fb_info *info)
	}
	}
#endif
#endif


	gen_cntl = aty_ld_8(CRTC_GEN_CNTL, par);
	gen_cntl = aty_ld_le32(CRTC_GEN_CNTL, par);
	switch (blank) {
	switch (blank) {
        	case FB_BLANK_UNBLANK:
        	case FB_BLANK_UNBLANK:
			gen_cntl &= ~(0x4c);
			gen_cntl &= ~0x400004c;
			break;
			break;
		case FB_BLANK_NORMAL:
		case FB_BLANK_NORMAL:
			gen_cntl |= 0x40;
			gen_cntl |= 0x4000040;
			break;
			break;
		case FB_BLANK_VSYNC_SUSPEND:
		case FB_BLANK_VSYNC_SUSPEND:
			gen_cntl |= 0x8;
			gen_cntl |= 0x4000048;
			break;
			break;
		case FB_BLANK_HSYNC_SUSPEND:
		case FB_BLANK_HSYNC_SUSPEND:
			gen_cntl |= 0x4;
			gen_cntl |= 0x4000044;
			break;
			break;
		case FB_BLANK_POWERDOWN:
		case FB_BLANK_POWERDOWN:
			gen_cntl |= 0x4c;
			gen_cntl |= 0x400004c;
			break;
			break;
	}
	}
	aty_st_8(CRTC_GEN_CNTL, gen_cntl, par);
	aty_st_le32(CRTC_GEN_CNTL, gen_cntl, par);


#ifdef CONFIG_PMAC_BACKLIGHT
#ifdef CONFIG_PMAC_BACKLIGHT
	if ((_machine == _MACH_Pmac) && !blank)
	if ((_machine == _MACH_Pmac) && blank <= FB_BLANK_NORMAL)
		set_backlight_enable(1);
		set_backlight_enable(1);
#elif defined(CONFIG_FB_ATY_GENERIC_LCD)
#elif defined(CONFIG_FB_ATY_GENERIC_LCD)
	if (par->lcd_table && !blank &&
	if (par->lcd_table && blank <= FB_BLANK_NORMAL &&
	    (aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) {
	    (aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) {
		u32 pm = aty_ld_lcd(POWER_MANAGEMENT, par);
		u32 pm = aty_ld_lcd(POWER_MANAGEMENT, par);
		pm |= PWR_BLON;
		pm |= PWR_BLON;