Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
0004  *
0005  * Based on sound/soc/imx/imx-pcm-dma-mx2.c
0006  */
0007 
0008 #include <linux/device.h>
0009 #include <linux/init.h>
0010 #include <linux/module.h>
0011 
0012 #include <sound/core.h>
0013 #include <sound/pcm.h>
0014 #include <sound/soc.h>
0015 #include <sound/dmaengine_pcm.h>
0016 
0017 #include "mxs-pcm.h"
0018 
0019 static const struct snd_pcm_hardware snd_mxs_hardware = {
0020     .info           = SNDRV_PCM_INFO_MMAP |
0021                   SNDRV_PCM_INFO_MMAP_VALID |
0022                   SNDRV_PCM_INFO_PAUSE |
0023                   SNDRV_PCM_INFO_RESUME |
0024                   SNDRV_PCM_INFO_INTERLEAVED |
0025                   SNDRV_PCM_INFO_HALF_DUPLEX,
0026     .period_bytes_min   = 32,
0027     .period_bytes_max   = 8192,
0028     .periods_min        = 1,
0029     .periods_max        = 52,
0030     .buffer_bytes_max   = 64 * 1024,
0031     .fifo_size      = 32,
0032 };
0033 
0034 static const struct snd_dmaengine_pcm_config mxs_dmaengine_pcm_config = {
0035     .pcm_hardware = &snd_mxs_hardware,
0036     .prealloc_buffer_size = 64 * 1024,
0037 };
0038 
0039 int mxs_pcm_platform_register(struct device *dev)
0040 {
0041     return devm_snd_dmaengine_pcm_register(dev, &mxs_dmaengine_pcm_config,
0042         SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX);
0043 }
0044 EXPORT_SYMBOL_GPL(mxs_pcm_platform_register);
0045 
0046 MODULE_LICENSE("GPL");