diff options
Diffstat (limited to 'sound/soc/tegra/tegra_i2s.c')
-rw-r--r-- | sound/soc/tegra/tegra_i2s.c | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/sound/soc/tegra/tegra_i2s.c b/sound/soc/tegra/tegra_i2s.c new file mode 100644 index 000000000000..6e672347ae5e --- /dev/null +++ b/sound/soc/tegra/tegra_i2s.c @@ -0,0 +1,107 @@ +/* + * sound/soc/tegra/tegra_i2s.c + * + * ALSA SOC driver for NVIDIA Tegra SoCs + * + * Copyright (C) 2010 NVIDIA Corporation + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + +#include <linux/init.h> +#include <linux/module.h> +#include <linux/device.h> +#include <linux/delay.h> +#include <linux/clk.h> +#include <linux/jiffies.h> +#include <linux/io.h> +#include <sound/core.h> +#include <sound/pcm.h> +#include <sound/pcm_params.h> +#include <sound/initval.h> +#include <sound/soc.h> + +#include "mach/nvrm_linux.h" +#include "nvrm_memmgr.h" +#include "nvassert.h" + +#include "tegra_transport.h" + +extern struct snd_soc_dai tegra_i2s_rpc_dai; + +static int tegra_i2s_rpc_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct snd_soc_dai *dai) +{ + switch (params_rate(params)) { + case 8000: + case 32000: + case 44100: + case 48000: + case 88200: + case 96000: + return 0; + default: + return -EINVAL; + } +} + +static int tegra_i2s_rpc_probe(struct platform_device *pdev, + struct snd_soc_dai *dai) +{ + return 0; +} + +#define TEGRA_I2S_RATES (SNDRV_PCM_RATE_8000_96000) + +struct snd_soc_dai tegra_i2s_rpc_dai = { + .name = "tegra-i2s-rpc", + .id = 0, + .probe = tegra_i2s_rpc_probe, + .playback = { + .channels_min = 1, + .channels_max = 2, + .rates = TEGRA_I2S_RATES, + .formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 | \ + SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | \ + SNDRV_PCM_FMTBIT_S32_LE,}, + .capture = { + .channels_min = 1, + .channels_max = 2, + .rates = TEGRA_I2S_RATES, + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE |\ + SNDRV_PCM_FMTBIT_S32_LE,}, + .ops = { + .hw_params = tegra_i2s_rpc_hw_params, + }, +}; +EXPORT_SYMBOL_GPL(tegra_i2s_rpc_dai); + +static int __init tegra_i2s_rpc_init(void) +{ + return snd_soc_register_dai(&tegra_i2s_rpc_dai); +} +module_init(tegra_i2s_rpc_init); + +static void __exit tegra_i2s_rpc_exit(void) +{ + snd_soc_unregister_dai(&tegra_i2s_rpc_dai); +} +module_exit(tegra_i2s_rpc_exit); + +/* Module information */ +MODULE_DESCRIPTION("Tegra I2S RPC Interface"); +MODULE_LICENSE("GPL"); |