blob: df2e4be992d2eebde21d46238600abf1d5806a5f [file] [log] [blame]
Thomas Gleixner16216332019-05-19 15:51:31 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Dong Aishenged6e1d02011-07-21 12:36:55 +08002/*
3 * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
4 *
5 * Based on sound/soc/imx/imx-pcm-dma-mx2.c
Dong Aishenged6e1d02011-07-21 12:36:55 +08006 */
7
Dong Aishenged6e1d02011-07-21 12:36:55 +08008#include <linux/device.h>
Dong Aishenged6e1d02011-07-21 12:36:55 +08009#include <linux/init.h>
Dong Aishenged6e1d02011-07-21 12:36:55 +080010#include <linux/module.h>
Dong Aishenged6e1d02011-07-21 12:36:55 +080011
12#include <sound/core.h>
Dong Aishenged6e1d02011-07-21 12:36:55 +080013#include <sound/pcm.h>
Dong Aishenged6e1d02011-07-21 12:36:55 +080014#include <sound/soc.h>
Lars-Peter Clausen016ab462012-02-22 10:49:10 +010015#include <sound/dmaengine_pcm.h>
Dong Aishenged6e1d02011-07-21 12:36:55 +080016
Dong Aishenged6e1d02011-07-21 12:36:55 +080017#include "mxs-pcm.h"
18
Lars-Peter Clausena8956902013-04-20 19:29:03 +020019static const struct snd_pcm_hardware snd_mxs_hardware = {
Dong Aishenged6e1d02011-07-21 12:36:55 +080020 .info = SNDRV_PCM_INFO_MMAP |
21 SNDRV_PCM_INFO_MMAP_VALID |
22 SNDRV_PCM_INFO_PAUSE |
23 SNDRV_PCM_INFO_RESUME |
Lars-Peter Clausen57364f92013-04-20 19:29:01 +020024 SNDRV_PCM_INFO_INTERLEAVED |
25 SNDRV_PCM_INFO_HALF_DUPLEX,
Dong Aishenged6e1d02011-07-21 12:36:55 +080026 .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 Aishenged6e1d02011-07-21 12:36:55 +080032};
33
Lars-Peter Clausena8956902013-04-20 19:29:03 +020034static const struct snd_dmaengine_pcm_config mxs_dmaengine_pcm_config = {
35 .pcm_hardware = &snd_mxs_hardware,
Lars-Peter Clausena8956902013-04-20 19:29:03 +020036 .prealloc_buffer_size = 64 * 1024,
Dong Aishenged6e1d02011-07-21 12:36:55 +080037};
38
Bill Pembertonfd582732012-12-07 09:26:27 -050039int mxs_pcm_platform_register(struct device *dev)
Dong Aishenged6e1d02011-07-21 12:36:55 +080040{
Lars-Peter Clausen2650bc42013-11-28 08:50:37 +010041 return devm_snd_dmaengine_pcm_register(dev, &mxs_dmaengine_pcm_config,
Lars-Peter Clausena8956902013-04-20 19:29:03 +020042 SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX);
Dong Aishenged6e1d02011-07-21 12:36:55 +080043}
Shawn Guo4da3fe72012-05-11 22:24:16 +080044EXPORT_SYMBOL_GPL(mxs_pcm_platform_register);
Dong Aishenged6e1d02011-07-21 12:36:55 +080045
Lothar Waßmann06c8eb92011-12-09 14:38:11 +010046MODULE_LICENSE("GPL");