Blackfin arch: Functional power management support
[linux-2.6.git] / arch / blackfin / kernel / bfin_dma_5xx.c
index d54f190..ad0e758 100644 (file)
@@ -472,6 +472,32 @@ unsigned long get_dma_curr_addr(unsigned int channel)
 }
 EXPORT_SYMBOL(get_dma_curr_addr);
 
+#ifdef CONFIG_PM
+int blackfin_dma_suspend(void)
+{
+       int i;
+
+       for (i = 0; i < MAX_BLACKFIN_DMA_CHANNEL; i++) {
+               if (dma_ch[i].chan_status == DMA_CHANNEL_ENABLED) {
+                       printk(KERN_ERR "DMA Channel %d failed to suspend\n", i);
+                       return -EBUSY;
+               }
+
+               dma_ch[i].saved_peripheral_map = dma_ch[i].regs->peripheral_map;
+       }
+
+       return 0;
+}
+
+void blackfin_dma_resume(void)
+{
+       int i;
+
+       for (i = 0; i < MAX_BLACKFIN_DMA_CHANNEL; i++)
+               dma_ch[i].regs->peripheral_map = dma_ch[i].saved_peripheral_map;
+}
+#endif
+
 static void *__dma_memcpy(void *dest, const void *src, size_t size)
 {
        int direction;  /* 1 - address decrease, 0 - address increase */