/* * tegra_soc.h -- SoC audio for tegra * * (c) 2010 Nvidia Graphics Pvt. Ltd. * http://www.nvidia.com * * Copyright 2007 Wolfson Microelectronics PLC. * Author: Graeme Gregory * graeme.gregory@wolfsonmicro.com or linux@wolfsonmicro.com * * 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. * */ #ifndef __TEGRA_AUDIO__ #define __TEGRA_AUDIO__ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define STATE_INIT 0 #define STATE_ABORT 1 #define STATE_EXIT 2 #define STATE_EXITED 3 #define STATE_INVALID 4 #define I2S_I2S_FIFO_TX_BUSY I2S_I2S_STATUS_FIFO1_BSY #define I2S_I2S_FIFO_TX_QS I2S_I2S_STATUS_QS_FIFO1 #define I2S_I2S_FIFO_RX_BUSY I2S_I2S_STATUS_FIFO2_BSY #define I2S_I2S_FIFO_RX_QS I2S_I2S_STATUS_QS_FIFO2 #define I2S1_CLK 11289600 #define I2S2_CLK 2000000 #define TEGRA_DEFAULT_SR 44100 #define TEGRA_SAMPLE_RATES \ (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) #define TEGRA_VOICE_SAMPLE_RATES SNDRV_PCM_RATE_8000 #define DMA_STEP_SIZE_MIN 8 struct tegra_dma_channel; struct tegra_runtime_data { struct snd_pcm_substream *substream; int size; int dma_pos; struct tegra_dma_req dma_req1, dma_req2; volatile int state; int period_index; int i2s_shutdown; int dma_state; struct tegra_dma_channel *dma_chan; struct clk *i2s_clk; struct clk *dap_mclk; struct clk *audio_sync_clk; }; struct tegra_audio_data { struct snd_soc_codec *codec; int play_device; int capture_device; bool is_call_mode; }; int tegra_controls_init(struct snd_soc_codec *codec); void tegra_controls_exit(void); int tegra_jack_init(struct snd_soc_codec *codec); void tegra_jack_exit(void); void tegra_switch_set_state(int state); void setup_dma_request(struct snd_pcm_substream *substream, struct tegra_dma_req *req, void (*dma_callback)(struct tegra_dma_req *req), void *dma_data); #endif