]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
ps3fb: Tear down FB setup during cleanup
authorGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Wed, 10 Jun 2009 04:38:49 +0000 (04:38 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 15 Jun 2009 03:26:21 +0000 (13:26 +1000)
During cleanup, use L1GPU_CONTEXT_ATTRIBUTE_FB_CLOSE to tear down the setup
done by L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP.

This allows unloading and reloading of ps3fb while the sound driver keeps the
GPU open.

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: linux-fbdev-devel@lists.sourceforge.net
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/include/asm/ps3gpu.h
drivers/video/ps3fb.c

index 1037efae4a51e1e8f7ea0dc02806a6b8fd93fbc2..b2b89591907cab8da61f01d2af9c036bfff2fcbd 100644 (file)
@@ -31,6 +31,7 @@
 #define L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP       0x600
 #define L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT                0x601
 #define L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT_SYNC   0x602
+#define L1GPU_CONTEXT_ATTRIBUTE_FB_CLOSE       0x603
 
 #define L1GPU_FB_BLIT_WAIT_FOR_COMPLETION      (1ULL << 32)
 
@@ -75,4 +76,11 @@ static inline int lv1_gpu_fb_blit(u64 context_handle, u64 ddr_offset,
                                         pitch);
 }
 
+static inline int lv1_gpu_fb_close(u64 context_handle)
+{
+       return lv1_gpu_context_attribute(context_handle,
+                                        L1GPU_CONTEXT_ATTRIBUTE_FB_CLOSE, 0,
+                                        0, 0, 0);
+}
+
 #endif /* _ASM_POWERPC_PS3GPU_H */
index 13c876c6e32ce1c458a150e240e5691315f02766..1baa1c93a224662491fcb5bbff87b6ac311f39aa 100644 (file)
@@ -1123,7 +1123,7 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
 
        info = framebuffer_alloc(sizeof(struct ps3fb_par), &dev->core);
        if (!info)
-               goto err_context_unmap;
+               goto err_context_fb_close;
 
        par = info->par;
        par->mode_id = ~ps3fb_mode;     /* != ps3fb_mode, to trigger change */
@@ -1188,6 +1188,8 @@ err_fb_dealloc:
        fb_dealloc_cmap(&info->cmap);
 err_framebuffer_release:
        framebuffer_release(info);
+err_context_fb_close:
+       lv1_gpu_fb_close(ps3fb.context_handle);
 err_context_unmap:
        lv1_gpu_context_iomap(ps3fb.context_handle, GPU_IOIF, xdr_lpar,
                              ps3fb_videomemory.size, CBE_IOPTE_M);
@@ -1233,6 +1235,7 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
                info = dev->core.driver_data = NULL;
        }
        iounmap((u8 __force __iomem *)ps3fb.dinfo);
+       lv1_gpu_fb_close(ps3fb.context_handle);
        lv1_gpu_context_iomap(ps3fb.context_handle, GPU_IOIF, xdr_lpar,
                              ps3fb_videomemory.size, CBE_IOPTE_M);
        lv1_gpu_context_free(ps3fb.context_handle);