asoc: tegra: aic326x: Add Voice call recording connections
[linux-3.10.git] / sound / soc / tegra / tegra30_i2s.h
index 34dc47b..5be2c6f 100644 (file)
@@ -45,6 +45,9 @@
 #define TEGRA30_I2S_LCOEF_2_4_0                                0x4c
 #define TEGRA30_I2S_LCOEF_2_4_1                                0x50
 #define TEGRA30_I2S_LCOEF_2_4_2                                0x54
+#ifndef CONFIG_ARCH_TEGRA_3x_SOC
+#define TEGRA30_I2S_SLOT_CTRL2                         0x64
+#endif
 
 /* Fields in TEGRA30_I2S_CTRL */
 
 /* Number of slots in frame, minus 1 */
 #define TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOTS_SHIFT                16
 #define TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOTS_MASK_US      7
-#define TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOTS_MASK         (TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOT_MASK_US << TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOT_SHIFT)
+#define TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOTS_MASK         (TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOTS_MASK_US << TEGRA30_I2S_SLOT_CTRL_TOTAL_SLOTS_SHIFT)
 
 /* TDM mode slot enable bitmask */
 #define TEGRA30_I2S_SLOT_CTRL_RX_SLOT_ENABLES_SHIFT    8
 #define TEGRA30_I2S_SLOT_CTRL_TX_SLOT_ENABLES_SHIFT    0
 #define TEGRA30_I2S_SLOT_CTRL_TX_SLOT_ENABLES_MASK     (0xff << TEGRA30_I2S_SLOT_CTRL_TX_SLOT_ENABLES_SHIFT)
 
+#ifndef CONFIG_ARCH_TEGRA_3x_SOC
+#define TEGRA30_I2S_SLOT_CTRL2_TX_SLOT_ENABLES_SHIFT   0
+#define TEGRA30_I2S_SLOT_CTRL2_RX_SLOT_ENABLES_SHIFT   16
+#endif
+
 /* Fields in TEGRA30_I2S_CIF_RX_CTRL */
 /* Uses field from TEGRA30_AUDIOCIF_CTRL_* in tegra30_ahub.h */
 
 #define TEGRA30_I2S_LCOEF_COEF_MASK_US                 0xffff
 #define TEGRA30_I2S_LCOEF_COEF_MASK                    (TEGRA30_I2S_LCOEF_COEF_MASK_US << TEGRA30_I2S_LCOEF_COEF_SHIFT)
 
+/* Number of i2s controllers*/
+#define TEGRA30_NR_I2S_IFC                             5
+
+struct dsp_config_t {
+       int num_slots;
+       int rx_mask;
+       int tx_mask;
+       int slot_width;
+       int rx_data_offset;
+       int tx_data_offset;
+};
+
+
 struct tegra30_i2s {
+       int id;
        struct snd_soc_dai_driver dai;
        int cif_id;
        struct clk *clk_i2s;
+       struct clk *clk_i2s_sync;
+       struct clk *clk_audio_2x;
+       struct clk *clk_pll_a_out0;
        enum tegra30_ahub_txcif capture_i2s_cif;
        enum tegra30_ahub_rxcif capture_fifo_cif;
        struct tegra_pcm_dma_params capture_dma_data;
@@ -236,6 +261,43 @@ struct tegra30_i2s {
        enum tegra30_ahub_txcif playback_fifo_cif;
        struct tegra_pcm_dma_params playback_dma_data;
        struct regmap *regmap;
+       u32 reg_ch_ctrl;
+       int dam_ifc;
+       int dam_ch_refcount;
+       int  playback_ref_count;
+       int  capture_ref_count;
+       int daifmt;
+       bool is_dam_used;
+#ifdef CONFIG_PM
+       #ifdef CONFIG_ARCH_TEGRA_3x_SOC
+               u32  reg_cache[(TEGRA30_I2S_CIF_TX_CTRL >> 2) + 1];
+       #else
+               u32  reg_cache[(TEGRA30_I2S_SLOT_CTRL2 >> 2) + 1];
+       #endif
+#endif
+       int call_record_dam_ifc;
+       int call_record_dam_ifc2;
+       int is_call_mode_rec;
+
+       struct dsp_config_t dsp_config;
+};
+
+struct codec_config {
+       int i2s_id;
+       int rate;
+       int channels;
+       int bitsize;
+       int is_i2smaster;
+       int i2s_mode;
+       int bit_clk;
 };
 
+int tegra30_make_voice_call_connections(struct codec_config *codec_info,
+                       struct codec_config *bb_info,
+                       int uses_voice_codec);
+
+int tegra30_break_voice_call_connections(struct codec_config *codec_info,
+                       struct codec_config *bb_info,
+                       int uses_voice_codec);
+
 #endif