Can you try that patch and let me know if it helps ?

Ben.

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux 2.4 for PowerPC
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#                  ChangeSet    1.770   -> 1.771  
#       drivers/video/aty/atyfb_base.c  1.15    -> 1.16   
#       drivers/video/aty/mach64_cursor.c       1.2     -> 1.3    
#       drivers/video/aty/atyfb.h       1.2     -> 1.3    
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/01/23      [EMAIL PROTECTED]       1.771
# Make atyfb sleep more robust
# --------------------------------------------
#
diff -Nru a/drivers/video/aty/atyfb.h b/drivers/video/aty/atyfb.h
--- a/drivers/video/aty/atyfb.h Thu Jan 23 23:48:17 2003
+++ b/drivers/video/aty/atyfb.h Thu Jan 23 23:48:17 2003
@@ -124,6 +124,7 @@
 #endif
     } fbcon_cmap;
     u8 blitter_may_be_busy;
+    int asleep;
 #ifdef __sparc__
     u8 mmaped;
     int open;
diff -Nru a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
--- a/drivers/video/aty/atyfb_base.c    Thu Jan 23 23:48:17 2003
+++ b/drivers/video/aty/atyfb_base.c    Thu Jan 23 23:48:17 2003
@@ -748,6 +748,8 @@
 
     info->current_par = *par;
 
+    if (info->asleep)
+       return;
     if (info->blitter_may_be_busy)
        wait_for_idle(info);
     tmp = aty_ld_8(CRTC_GEN_CNTL + 3, info);
@@ -1192,6 +1194,10 @@
        return -EINVAL;
     par->crtc.xoffset = xoffset;
     par->crtc.yoffset = yoffset;
+
+    if (info->asleep)
+               return 0;
+
     set_off_pitch(par, info);
     return 0;
 }
@@ -1660,6 +1666,7 @@
                        }
                        break;
                case PBOOK_SLEEP_NOW:
+                       acquire_console_sem();
                        if (currcon >= 0)
                                fb_display[currcon].dispsw = &fbcon_dummy;
                        if (info->blitter_may_be_busy)
@@ -1675,11 +1682,14 @@
 
                        /* Blank display and LCD */
                        atyfbcon_blank(VESA_POWERDOWN+1, (struct fb_info 
*)info);
+                       info->asleep = 1;
 
                        /* Set chip to "suspend" mode */
                        result = aty_power_mgmt(1, info);
+                       release_console_sem();
                        break;
                case PBOOK_WAKE:
+                       acquire_console_sem();
                        /* Wakeup chip */
                        result = aty_power_mgmt(0, info);
 
@@ -1690,6 +1700,7 @@
                                vfree(info->save_framebuffer);
                                info->save_framebuffer = 0;
                        }
+                       info->asleep = 0;
                        /* Restore display */
                        if (currcon >= 0) {
                                atyfb_set_dispsw(&fb_display[currcon],
@@ -1697,6 +1708,11 @@
                                        info->current_par.accel_flags & 
FB_ACCELF_TEXT);
                        }
                        atyfbcon_blank(0, (struct fb_info *)info);
+                       /* XXX We may want to re-call atyfb_set_par and make
+                        * sure panning & cursor & palette are correct as we
+                        * skipped any change to these during suspend.
+                        */
+                       release_console_sem();
                        break;
                }
        }
@@ -2720,6 +2736,9 @@
     struct fb_info_aty *info = (struct fb_info_aty *)fb;
     u8 gen_cntl;
 
+    if (info->asleep)
+               return;
+
 #ifdef CONFIG_PMAC_BACKLIGHT
     if ((_machine == _MACH_Pmac) && blank)
        set_backlight_enable(0);
@@ -2792,23 +2811,25 @@
     info->palette[regno].red = red;
     info->palette[regno].green = green;
     info->palette[regno].blue = blue;
-    i = aty_ld_8(DAC_CNTL, info) & 0xfc;
-    if (M64_HAS(EXTRA_BRIGHT))
-       i |= 0x2;       /*DAC_CNTL|0x2 turns off the extra brightness for gt*/
-    aty_st_8(DAC_CNTL, i, info);
-    aty_st_8(DAC_MASK, 0xff, info);
-    scale = (M64_HAS(INTEGRATED) && info->current_par.crtc.bpp == 16) ? 3 : 0;
+    if (!info->asleep) {
+        i = aty_ld_8(DAC_CNTL, info) & 0xfc;
+        if (M64_HAS(EXTRA_BRIGHT))
+           i |= 0x2;   /*DAC_CNTL|0x2 turns off the extra brightness for gt*/
+        aty_st_8(DAC_CNTL, i, info);
+        aty_st_8(DAC_MASK, 0xff, info);
+        scale = (M64_HAS(INTEGRATED) && info->current_par.crtc.bpp == 16) ? 3 
: 0;
 #ifdef CONFIG_ATARI
-    out_8(&info->aty_cmap_regs->windex, regno << scale);
-    out_8(&info->aty_cmap_regs->lut, red);
-    out_8(&info->aty_cmap_regs->lut, green);
-    out_8(&info->aty_cmap_regs->lut, blue);
+        out_8(&info->aty_cmap_regs->windex, regno << scale);
+        out_8(&info->aty_cmap_regs->lut, red);
+        out_8(&info->aty_cmap_regs->lut, green);
+        out_8(&info->aty_cmap_regs->lut, blue);
 #else
-    writeb(regno << scale, &info->aty_cmap_regs->windex);
-    writeb(red, &info->aty_cmap_regs->lut);
-    writeb(green, &info->aty_cmap_regs->lut);
-    writeb(blue, &info->aty_cmap_regs->lut);
+        writeb(regno << scale, &info->aty_cmap_regs->windex);
+        writeb(red, &info->aty_cmap_regs->lut);
+        writeb(green, &info->aty_cmap_regs->lut);
+        writeb(blue, &info->aty_cmap_regs->lut);
 #endif
+    }
     if (regno < 16)
        switch (info->current_par.crtc.bpp) {
 #ifdef FBCON_HAS_CFB16
@@ -2859,6 +2880,9 @@
     struct vc_data *conp = p->conp;
     u32 yres, yoffset, sy, height;
 
+    if (info->asleep)
+       return 0;
+       
     yres = ((par->crtc.v_tot_disp >> 16) & 0x7ff) + 1;
     yoffset = fb_display[con].var.yoffset;
 
diff -Nru a/drivers/video/aty/mach64_cursor.c 
b/drivers/video/aty/mach64_cursor.c
--- a/drivers/video/aty/mach64_cursor.c Thu Jan 23 23:48:17 2003
+++ b/drivers/video/aty/mach64_cursor.c Thu Jan 23 23:48:17 2003
@@ -54,7 +54,7 @@
        const u8 *blue = cursor_color_map;
        int i;
 
-       if (!c)
+       if (!c || fb->asleep)
                return;
 
 #ifdef __sparc__
@@ -81,7 +81,7 @@
        u8 *ram, m, b;
        int x, y;
 
-       if (!c)
+       if (!c || fb->asleep)
                return;
 
 #ifdef __sparc__
@@ -118,7 +118,7 @@
        u16 xoff, yoff;
        int x, y;
 
-       if (!c)
+       if (!c || fb->asleep)
                return;
 
 #ifdef __sparc__
@@ -297,8 +297,10 @@
            c->mask[i][height-1] = (j >= 8) ? 0xff : (0xff << (8 - j));
        }
 
-       aty_set_cursor_color(fb);
-       aty_set_cursor_shape(fb);
+       if (!fb->asleep) {
+               aty_set_cursor_color(fb);
+               aty_set_cursor_shape(fb);
+       }
     }
     return 1;
 }

Reply via email to