Thomas Gleixner | 1621633 | 2019-05-19 15:51:31 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Dong Aisheng | ed6e1d0 | 2011-07-21 12:36:55 +0800 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved. |
| 4 | * |
| 5 | * Based on sound/soc/imx/imx-pcm-dma-mx2.c |
Dong Aisheng | ed6e1d0 | 2011-07-21 12:36:55 +0800 | [diff] [blame] | 6 | */ |
| 7 | |
Dong Aisheng | ed6e1d0 | 2011-07-21 12:36:55 +0800 | [diff] [blame] | 8 | #include <linux/device.h> |
Dong Aisheng | ed6e1d0 | 2011-07-21 12:36:55 +0800 | [diff] [blame] | 9 | #include <linux/init.h> |
Dong Aisheng | ed6e1d0 | 2011-07-21 12:36:55 +0800 | [diff] [blame] | 10 | #include <linux/module.h> |
Dong Aisheng | ed6e1d0 | 2011-07-21 12:36:55 +0800 | [diff] [blame] | 11 | |
| 12 | #include <sound/core.h> |
Dong Aisheng | ed6e1d0 | 2011-07-21 12:36:55 +0800 | [diff] [blame] | 13 | #include <sound/pcm.h> |
Dong Aisheng | ed6e1d0 | 2011-07-21 12:36:55 +0800 | [diff] [blame] | 14 | #include <sound/soc.h> |
Lars-Peter Clausen | 016ab46 | 2012-02-22 10:49:10 +0100 | [diff] [blame] | 15 | #include <sound/dmaengine_pcm.h> |
Dong Aisheng | ed6e1d0 | 2011-07-21 12:36:55 +0800 | [diff] [blame] | 16 | |
Dong Aisheng | ed6e1d0 | 2011-07-21 12:36:55 +0800 | [diff] [blame] | 17 | #include "mxs-pcm.h" |
| 18 | |
Lars-Peter Clausen | a895690 | 2013-04-20 19:29:03 +0200 | [diff] [blame] | 19 | static const struct snd_pcm_hardware snd_mxs_hardware = { |
Dong Aisheng | ed6e1d0 | 2011-07-21 12:36:55 +0800 | [diff] [blame] | 20 | .info = SNDRV_PCM_INFO_MMAP | |
| 21 | SNDRV_PCM_INFO_MMAP_VALID | |
| 22 | SNDRV_PCM_INFO_PAUSE | |
| 23 | SNDRV_PCM_INFO_RESUME | |
Lars-Peter Clausen | 57364f9 | 2013-04-20 19:29:01 +0200 | [diff] [blame] | 24 | SNDRV_PCM_INFO_INTERLEAVED | |
| 25 | SNDRV_PCM_INFO_HALF_DUPLEX, |
Dong Aisheng | ed6e1d0 | 2011-07-21 12:36:55 +0800 | [diff] [blame] | 26 | .period_bytes_min = 32, |
| 27 | .period_bytes_max = 8192, |
| 28 | .periods_min = 1, |
| 29 | .periods_max = 52, |
| 30 | .buffer_bytes_max = 64 * 1024, |
| 31 | .fifo_size = 32, |
Dong Aisheng | ed6e1d0 | 2011-07-21 12:36:55 +0800 | [diff] [blame] | 32 | }; |
| 33 | |
Lars-Peter Clausen | a895690 | 2013-04-20 19:29:03 +0200 | [diff] [blame] | 34 | static const struct snd_dmaengine_pcm_config mxs_dmaengine_pcm_config = { |
| 35 | .pcm_hardware = &snd_mxs_hardware, |
Lars-Peter Clausen | a895690 | 2013-04-20 19:29:03 +0200 | [diff] [blame] | 36 | .prealloc_buffer_size = 64 * 1024, |
Dong Aisheng | ed6e1d0 | 2011-07-21 12:36:55 +0800 | [diff] [blame] | 37 | }; |
| 38 | |
Bill Pemberton | fd58273 | 2012-12-07 09:26:27 -0500 | [diff] [blame] | 39 | int mxs_pcm_platform_register(struct device *dev) |
Dong Aisheng | ed6e1d0 | 2011-07-21 12:36:55 +0800 | [diff] [blame] | 40 | { |
Lars-Peter Clausen | 2650bc4 | 2013-11-28 08:50:37 +0100 | [diff] [blame] | 41 | return devm_snd_dmaengine_pcm_register(dev, &mxs_dmaengine_pcm_config, |
Lars-Peter Clausen | a895690 | 2013-04-20 19:29:03 +0200 | [diff] [blame] | 42 | SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX); |
Dong Aisheng | ed6e1d0 | 2011-07-21 12:36:55 +0800 | [diff] [blame] | 43 | } |
Shawn Guo | 4da3fe7 | 2012-05-11 22:24:16 +0800 | [diff] [blame] | 44 | EXPORT_SYMBOL_GPL(mxs_pcm_platform_register); |
Dong Aisheng | ed6e1d0 | 2011-07-21 12:36:55 +0800 | [diff] [blame] | 45 | |
Lothar Waßmann | 06c8eb9 | 2011-12-09 14:38:11 +0100 | [diff] [blame] | 46 | MODULE_LICENSE("GPL"); |