Ejemplo n.º 1
0
int
s3c2410_dma_ctrl(unsigned int channel, enum s3c2410_chan_op op)
{
    struct s3c2410_dma_chan *chan = lookup_dma_channel(channel);

    if (chan == NULL)
        return -EINVAL;

    switch (op) {
    case S3C2410_DMAOP_START:
        return s3c2410_dma_start(chan);

    case S3C2410_DMAOP_STOP:
        return s3c2410_dma_dostop(chan);

    case S3C2410_DMAOP_PAUSE:
    case S3C2410_DMAOP_RESUME:
        return -ENOENT;

    case S3C2410_DMAOP_FLUSH:
        return s3c2410_dma_flush(chan);

    case S3C2410_DMAOP_STARTED:
        return s3c2410_dma_started(chan);

    case S3C2410_DMAOP_TIMEOUT:
        return 0;

    }

    return -ENOENT;      /* unknown, don't bother */
}
Ejemplo n.º 2
0
int
s3c2410_dma_ctrl(dmach_t channel, s3c2410_chan_op_t op)
{
	s3c2410_dma_chan_t *chan = &s3c2410_chans[channel];

	check_channel(channel);

	switch (op) {
	case S3C2410_DMAOP_START:
		return s3c2410_dma_start(chan);

	case S3C2410_DMAOP_STOP:
		return s3c2410_dma_dostop(chan);

	case S3C2410_DMAOP_PAUSE:
		return -ENOENT;

	case S3C2410_DMAOP_RESUME:
		return -ENOENT;

	case S3C2410_DMAOP_FLUSH:
		return s3c2410_dma_flush(chan);

	case S3C2410_DMAOP_TIMEOUT:
		return 0;

	}

	return -ENOENT;      /* unknown, don't bother */
}
Ejemplo n.º 3
0
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);
	}
}
Ejemplo n.º 4
0
static int s3c2410_dma_suspend(struct sys_device *dev, pm_message_t state)
{
	s3c2410_dma_chan_t *cp = container_of(dev, s3c2410_dma_chan_t, dev);

	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);
	}

	return 0;
}