Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

int mxc_dma_free ( int  channel_num  ) 

This function is generally called by the driver at close time. The DMA driver would do any cleanup associated with this channel.

Parameters:
channel_num the channel number returned at request time. This would be used by the DMA driver to identify the calling driver and do the necessary cleanup on the channel associated with the particular peripheral
Returns:
returns a negative number on error or 0 on success

Definition at line 828 of file dma_mx2.c.

References mxc_dma_channel::active, disable_dma_clk(), mx2_dma_priv_s::dma_irq, enable_dma_clk(), mxc_dma_channel::lock, mask_dma_interrupt(), mxc_dma_disable(), mxc_dma_channel::private, and put_dma_channel().

Referenced by asrc_ioctl(), configure_read_channel(), configure_write_channel(), mxc_asrc_close(), mxc_irda_start(), mxc_irda_stop(), mxcmci_remove(), mxcmci_set_ios(), mxcuart_freedma(), mxcuart_initdma(), snd_card_mxc_audio_capture_close(), snd_card_mxc_audio_playback_close(), snd_card_mxc_spdif_capture_close(), snd_card_mxc_spdif_playback_close(), and spdif_configure_dma_channel().

{
      mxc_dma_channel_t *dma;
      mx2_dma_priv_t *dma_private;

      if ((channel_num >= MAX_DMA_CHANNELS) || (channel_num < 0)) {
            return -EINVAL;
      }

      dma = g_dma_channels + channel_num;
      dma_private = (mx2_dma_priv_t *) dma->private;
      if (dma_private == NULL) {
            printk(KERN_ERR
                   "Free dma %d which is not completed initialization \n",
                   channel_num);
            return -EFAULT;
      }
      if (dma->lock) {
            if (dma->active) {      /*Channel is busy */
                  mxc_dma_disable(channel_num);
            }

            dma_private = (mx2_dma_priv_t *) dma->private;

            enable_dma_clk();
            mask_dma_interrupt(channel_num);
            disable_dma_clk();

            free_irq(dma_private->dma_irq, (void *)dma);
            put_dma_channel(channel_num);
      }
      return 0;
}


Generated by  Doxygen 1.6.0   Back to index