1 // SPDX-License-Identifier: GPL-2.0-only
3 * tegra_pcm.c - Tegra PCM driver
5 * Author: Stephen Warren <swarren@nvidia.com>
6 * Copyright (C) 2010,2012 - NVIDIA, Inc.
8 * Based on code copyright/by:
10 * Copyright (c) 2009-2010, NVIDIA Corporation.
11 * Scott Peterson <speterson@nvidia.com>
12 * Vijay Mali <vmali@nvidia.com>
14 * Copyright (C) 2010 Google, Inc.
15 * Iliyan Malchev <malchev@google.com>
18 #include <linux/module.h>
19 #include <sound/core.h>
20 #include <sound/pcm.h>
21 #include <sound/pcm_params.h>
22 #include <sound/soc.h>
23 #include <sound/dmaengine_pcm.h>
25 #include "tegra_pcm.h"
27 static const struct snd_pcm_hardware tegra_pcm_hardware
= {
28 .info
= SNDRV_PCM_INFO_MMAP
|
29 SNDRV_PCM_INFO_MMAP_VALID
|
30 SNDRV_PCM_INFO_INTERLEAVED
,
31 .period_bytes_min
= 1024,
32 .period_bytes_max
= PAGE_SIZE
,
35 .buffer_bytes_max
= PAGE_SIZE
* 8,
39 static const struct snd_dmaengine_pcm_config tegra_dmaengine_pcm_config
= {
40 .pcm_hardware
= &tegra_pcm_hardware
,
41 .prepare_slave_config
= snd_dmaengine_pcm_prepare_slave_config
,
42 .prealloc_buffer_size
= PAGE_SIZE
* 8,
45 int tegra_pcm_platform_register(struct device
*dev
)
47 return snd_dmaengine_pcm_register(dev
, &tegra_dmaengine_pcm_config
, 0);
49 EXPORT_SYMBOL_GPL(tegra_pcm_platform_register
);
51 int tegra_pcm_platform_register_with_chan_names(struct device
*dev
,
52 struct snd_dmaengine_pcm_config
*config
,
53 char *txdmachan
, char *rxdmachan
)
55 *config
= tegra_dmaengine_pcm_config
;
56 config
->dma_dev
= dev
->parent
;
57 config
->chan_names
[0] = txdmachan
;
58 config
->chan_names
[1] = rxdmachan
;
60 return snd_dmaengine_pcm_register(dev
, config
, 0);
62 EXPORT_SYMBOL_GPL(tegra_pcm_platform_register_with_chan_names
);
64 void tegra_pcm_platform_unregister(struct device
*dev
)
66 return snd_dmaengine_pcm_unregister(dev
);
68 EXPORT_SYMBOL_GPL(tegra_pcm_platform_unregister
);
70 MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>");
71 MODULE_DESCRIPTION("Tegra PCM ASoC driver");
72 MODULE_LICENSE("GPL");