Stephen Warren | 7605eb5 | 2011-01-07 22:36:13 -0700 | [diff] [blame] | 1 | /* |
| 2 | * tegra_pcm.c - Tegra PCM driver |
| 3 | * |
| 4 | * Author: Stephen Warren <swarren@nvidia.com> |
Stephen Warren | 518de86 | 2012-03-20 14:55:49 -0600 | [diff] [blame] | 5 | * Copyright (C) 2010,2012 - NVIDIA, Inc. |
Stephen Warren | 7605eb5 | 2011-01-07 22:36:13 -0700 | [diff] [blame] | 6 | * |
| 7 | * Based on code copyright/by: |
| 8 | * |
| 9 | * Copyright (c) 2009-2010, NVIDIA Corporation. |
| 10 | * Scott Peterson <speterson@nvidia.com> |
| 11 | * Vijay Mali <vmali@nvidia.com> |
| 12 | * |
| 13 | * Copyright (C) 2010 Google, Inc. |
| 14 | * Iliyan Malchev <malchev@google.com> |
| 15 | * |
| 16 | * This program is free software; you can redistribute it and/or |
| 17 | * modify it under the terms of the GNU General Public License |
| 18 | * version 2 as published by the Free Software Foundation. |
| 19 | * |
| 20 | * This program is distributed in the hope that it will be useful, but |
| 21 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 23 | * General Public License for more details. |
| 24 | * |
| 25 | * You should have received a copy of the GNU General Public License |
| 26 | * along with this program; if not, write to the Free Software |
| 27 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 28 | * 02110-1301 USA |
| 29 | * |
| 30 | */ |
| 31 | |
Stephen Warren | 7613c50 | 2012-04-06 11:12:25 -0600 | [diff] [blame] | 32 | #include <linux/module.h> |
Stephen Warren | 7605eb5 | 2011-01-07 22:36:13 -0700 | [diff] [blame] | 33 | #include <sound/core.h> |
| 34 | #include <sound/pcm.h> |
| 35 | #include <sound/pcm_params.h> |
| 36 | #include <sound/soc.h> |
Laxman Dewangan | df79f55 | 2012-06-29 17:04:33 +0530 | [diff] [blame] | 37 | #include <sound/dmaengine_pcm.h> |
Stephen Warren | 7605eb5 | 2011-01-07 22:36:13 -0700 | [diff] [blame] | 38 | |
| 39 | #include "tegra_pcm.h" |
| 40 | |
| 41 | static const struct snd_pcm_hardware tegra_pcm_hardware = { |
| 42 | .info = SNDRV_PCM_INFO_MMAP | |
| 43 | SNDRV_PCM_INFO_MMAP_VALID | |
Stephen Warren | 7605eb5 | 2011-01-07 22:36:13 -0700 | [diff] [blame] | 44 | SNDRV_PCM_INFO_INTERLEAVED, |
| 45 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
| 46 | .channels_min = 2, |
| 47 | .channels_max = 2, |
| 48 | .period_bytes_min = 1024, |
| 49 | .period_bytes_max = PAGE_SIZE, |
| 50 | .periods_min = 2, |
| 51 | .periods_max = 8, |
| 52 | .buffer_bytes_max = PAGE_SIZE * 8, |
| 53 | .fifo_size = 4, |
| 54 | }; |
| 55 | |
Lars-Peter Clausen | 11a8576 | 2013-04-15 19:19:52 +0200 | [diff] [blame] | 56 | static const struct snd_dmaengine_pcm_config tegra_dmaengine_pcm_config = { |
| 57 | .pcm_hardware = &tegra_pcm_hardware, |
| 58 | .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, |
| 59 | .compat_filter_fn = NULL, |
| 60 | .prealloc_buffer_size = PAGE_SIZE * 8, |
Stephen Warren | 7605eb5 | 2011-01-07 22:36:13 -0700 | [diff] [blame] | 61 | }; |
| 62 | |
Bill Pemberton | 4652a0d | 2012-12-07 09:26:33 -0500 | [diff] [blame] | 63 | int tegra_pcm_platform_register(struct device *dev) |
Stephen Warren | 7605eb5 | 2011-01-07 22:36:13 -0700 | [diff] [blame] | 64 | { |
Lars-Peter Clausen | 11a8576 | 2013-04-15 19:19:52 +0200 | [diff] [blame] | 65 | return snd_dmaengine_pcm_register(dev, &tegra_dmaengine_pcm_config, |
| 66 | SND_DMAENGINE_PCM_FLAG_NO_DT | |
| 67 | SND_DMAENGINE_PCM_FLAG_COMPAT); |
Stephen Warren | 7605eb5 | 2011-01-07 22:36:13 -0700 | [diff] [blame] | 68 | } |
Stephen Warren | 518de86 | 2012-03-20 14:55:49 -0600 | [diff] [blame] | 69 | EXPORT_SYMBOL_GPL(tegra_pcm_platform_register); |
Stephen Warren | 7605eb5 | 2011-01-07 22:36:13 -0700 | [diff] [blame] | 70 | |
Bill Pemberton | 4652a0d | 2012-12-07 09:26:33 -0500 | [diff] [blame] | 71 | void tegra_pcm_platform_unregister(struct device *dev) |
Stephen Warren | 7605eb5 | 2011-01-07 22:36:13 -0700 | [diff] [blame] | 72 | { |
Lars-Peter Clausen | 11a8576 | 2013-04-15 19:19:52 +0200 | [diff] [blame] | 73 | return snd_dmaengine_pcm_unregister(dev); |
Stephen Warren | 7605eb5 | 2011-01-07 22:36:13 -0700 | [diff] [blame] | 74 | } |
Stephen Warren | 518de86 | 2012-03-20 14:55:49 -0600 | [diff] [blame] | 75 | EXPORT_SYMBOL_GPL(tegra_pcm_platform_unregister); |
Stephen Warren | 7605eb5 | 2011-01-07 22:36:13 -0700 | [diff] [blame] | 76 | |
| 77 | MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>"); |
| 78 | MODULE_DESCRIPTION("Tegra PCM ASoC driver"); |
| 79 | MODULE_LICENSE("GPL"); |