|
@@ -1185,3 +1185,53 @@ int s3c2410_dma_getposition(enum dma_ch channel, dma_addr_t *src, dma_addr_t *ds
|
|
|
|
|
|
if (dst != NULL)
|
|
|
*dst = dma_rdreg(chan, S3C2410_DMA_DCDST);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+EXPORT_SYMBOL(s3c2410_dma_getposition);
|
|
|
+
|
|
|
+/* system core operations */
|
|
|
+
|
|
|
+#ifdef CONFIG_PM
|
|
|
+
|
|
|
+static void s3c2410_dma_suspend_chan(struct s3c2410_dma_chan *cp)
|
|
|
+{
|
|
|
+ printk(KERN_DEBUG "suspending dma channel %d\n", cp->number);
|
|
|
+
|
|
|
+ if (dma_rdreg(cp, S3C2410_DMA_DMASKTRIG) & S3C2410_DMASKTRIG_ON) {
|
|
|
+ /* the dma channel is still working, which is probably
|
|
|
+ * a bad thing to do over suspend/resume. We stop the
|
|
|
+ * channel and assume that the client is either going to
|
|
|
+ * retry after resume, or that it is broken.
|
|
|
+ */
|
|
|
+
|
|
|
+ printk(KERN_INFO "dma: stopping channel %d due to suspend\n",
|
|
|
+ cp->number);
|
|
|
+
|
|
|
+ s3c2410_dma_dostop(cp);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+static int s3c2410_dma_suspend(void)
|
|
|
+{
|
|
|
+ struct s3c2410_dma_chan *cp = s3c2410_chans;
|
|
|
+ int channel;
|
|
|
+
|
|
|
+ for (channel = 0; channel < dma_channels; cp++, channel++)
|
|
|
+ s3c2410_dma_suspend_chan(cp);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static void s3c2410_dma_resume_chan(struct s3c2410_dma_chan *cp)
|
|
|
+{
|
|
|
+ unsigned int no = cp->number | DMACH_LOW_LEVEL;
|
|
|
+
|
|
|
+ /* restore channel's hardware configuration */
|
|
|
+
|
|
|
+ if (!cp->in_use)
|
|
|
+ return;
|
|
|
+
|
|
|
+ printk(KERN_INFO "dma%d: restoring configuration\n", cp->number);
|
|
|
+
|