Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  *  Copyright (C) 2020 Texas Instruments Incorporated - https://www.ti.com
0004  *  Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
0005  */
0006 
0007 #include <linux/module.h>
0008 #include <sound/core.h>
0009 #include <sound/pcm.h>
0010 #include <sound/pcm_params.h>
0011 #include <sound/soc.h>
0012 #include <sound/dmaengine_pcm.h>
0013 
0014 #include "udma-pcm.h"
0015 
0016 static const struct snd_pcm_hardware udma_pcm_hardware = {
0017     .info           = SNDRV_PCM_INFO_MMAP |
0018                   SNDRV_PCM_INFO_MMAP_VALID |
0019                   SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME |
0020                   SNDRV_PCM_INFO_NO_PERIOD_WAKEUP |
0021                   SNDRV_PCM_INFO_INTERLEAVED,
0022     .buffer_bytes_max   = SIZE_MAX,
0023     .period_bytes_min   = 32,
0024     .period_bytes_max   = SZ_64K,
0025     .periods_min        = 2,
0026     .periods_max        = UINT_MAX,
0027 };
0028 
0029 static const struct snd_dmaengine_pcm_config udma_dmaengine_pcm_config = {
0030     .pcm_hardware = &udma_pcm_hardware,
0031     .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
0032 };
0033 
0034 int udma_pcm_platform_register(struct device *dev)
0035 {
0036     return devm_snd_dmaengine_pcm_register(dev, &udma_dmaengine_pcm_config,
0037                            0);
0038 }
0039 EXPORT_SYMBOL_GPL(udma_pcm_platform_register);
0040 
0041 MODULE_AUTHOR("Peter Ujfalusi <peter.ujfalusi@ti.com>");
0042 MODULE_DESCRIPTION("UDMA PCM ASoC platform driver");
0043 MODULE_LICENSE("GPL v2");