asoc: tegra: Voice call with cs42l73 ASP+VSP support
ScottPeterson [Fri, 2 Nov 2012 01:28:17 +0000 (18:28 -0700)]
Using cs42l73 VSP audio port for voice call in pluto

Bug 1056501

Change-Id: I58697b1a08f5e2d1199da5255d1ff086367ad23c
Signed-off-by: ScottPeterson <speterson@nvidia.com>
Signed-off-by: Rahul Mittal <rmittal@nvidia.com>
Reviewed-on: http://git-master/r/162574
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

sound/soc/tegra/tegra30_i2s.c
sound/soc/tegra/tegra30_i2s.h
sound/soc/tegra/tegra_aic326x.c
sound/soc/tegra/tegra_cs42l73.c
sound/soc/tegra/tegra_max98088.c

index e4defa2..cf11d9e 100644 (file)
@@ -184,6 +184,7 @@ int tegra30_i2s_startup(struct snd_pcm_substream *substream,
                                TEGRA30_AHUB_RXCIF_I2S0_RX0 + i2s->id,
                                i2s->txcif);
        } else {
+               i2s->capture_ref_count++;
                ret = tegra30_ahub_allocate_rx_fifo(&i2s->rxcif,
                                        &i2s->capture_dma_data.addr,
                                        &i2s->capture_dma_data.req_sel);
@@ -216,8 +217,10 @@ void tegra30_i2s_shutdown(struct snd_pcm_substream *substream,
                /* decrement the playback ref count */
                i2s->playback_ref_count--;
        } else {
-               tegra30_ahub_unset_rx_cif_source(i2s->rxcif);
+               if (i2s->capture_ref_count == 1)
+                       tegra30_ahub_unset_rx_cif_source(i2s->rxcif);
                tegra30_ahub_free_rx_fifo(i2s->rxcif);
+               i2s->capture_ref_count--;
        }
 
        tegra30_i2s_disable_clocks(i2s);
@@ -279,7 +282,6 @@ static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai,
        default:
                return -EINVAL;
        }
-
        return 0;
 }
 
@@ -738,7 +740,6 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream,
                        break;
                }
        }
-
        switch (i2s->daifmt) {
        case SND_SOC_DAIFMT_RIGHT_J:
                val = 0;
@@ -756,7 +757,6 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream,
        default:
                return -EINVAL;
        }
-
        val = (val << TEGRA30_I2S_OFFSET_RX_DATA_OFFSET_SHIFT) |
                  (val << TEGRA30_I2S_OFFSET_TX_DATA_OFFSET_SHIFT);
        tegra30_i2s_write(i2s, TEGRA30_I2S_OFFSET, val);
@@ -781,7 +781,6 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream,
        tegra30_i2s_write(i2s, TEGRA30_I2S_SLOT_CTRL, val);
 
        tegra30_i2s_disable_clocks(i2s);
-
        return 0;
 }
 
@@ -811,7 +810,7 @@ static void tegra30_i2s_stop_playback(struct tegra30_i2s *i2s)
 static void tegra30_i2s_start_capture(struct tegra30_i2s *i2s)
 {
        tegra30_ahub_enable_rx_fifo(i2s->rxcif);
-       if (!i2s->is_call_mode_rec) {
+       if (!i2s->is_call_mode_rec && (i2s->capture_ref_count == 1)) {
                i2s->reg_ctrl |= TEGRA30_I2S_CTRL_XFER_EN_RX;
                tegra30_i2s_write(i2s, TEGRA30_I2S_CTRL, i2s->reg_ctrl);
        }
@@ -820,13 +819,14 @@ static void tegra30_i2s_start_capture(struct tegra30_i2s *i2s)
 static void tegra30_i2s_stop_capture(struct tegra30_i2s *i2s)
 {
        int dcnt = 10;
-       tegra30_ahub_disable_rx_fifo(i2s->rxcif);
-       if (!i2s->is_call_mode_rec) {
+       if (!i2s->is_call_mode_rec && (i2s->capture_ref_count == 1)) {
+               tegra30_ahub_disable_rx_fifo(i2s->rxcif);
                i2s->reg_ctrl &= ~TEGRA30_I2S_CTRL_XFER_EN_RX;
                tegra30_i2s_write(i2s, TEGRA30_I2S_CTRL, i2s->reg_ctrl);
+               while (tegra30_ahub_rx_fifo_is_enabled(i2s->id) && dcnt--)
+                       udelay(100);
        }
-       while (tegra30_ahub_rx_fifo_is_enabled(i2s->id) && dcnt--)
-               udelay(100);
+
 }
 
 static int tegra30_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
@@ -1119,11 +1119,15 @@ static int configure_dam(struct tegra30_i2s  *i2s, int out_channel,
 #endif
 
 #ifndef CONFIG_ARCH_TEGRA_3x_SOC
-       tegra30_dam_write_coeff_ram(i2s->dam_ifc, in_rate, out_rate);
-       tegra30_dam_set_farrow_param(i2s->dam_ifc, in_rate, out_rate);
-       tegra30_dam_set_biquad_fixed_coef(i2s->dam_ifc);
-       tegra30_dam_enable_coeff_ram(i2s->dam_ifc);
-       tegra30_dam_set_filter_stages(i2s->dam_ifc, in_rate, out_rate);
+       if (in_rate != out_rate) {
+               tegra30_dam_write_coeff_ram(i2s->dam_ifc, in_rate, out_rate);
+               tegra30_dam_set_farrow_param(i2s->dam_ifc, in_rate, out_rate);
+               tegra30_dam_set_biquad_fixed_coef(i2s->dam_ifc);
+               tegra30_dam_enable_coeff_ram(i2s->dam_ifc);
+               tegra30_dam_set_filter_stages(i2s->dam_ifc, in_rate, out_rate);
+       } else {
+               tegra30_dam_enable_stereo_mixing(i2s->dam_ifc);
+       }
 #endif
 
        return 0;
@@ -1131,7 +1135,8 @@ static int configure_dam(struct tegra30_i2s  *i2s, int out_channel,
 
 
 int tegra30_make_voice_call_connections(struct codec_config *codec_info,
-                               struct codec_config *bb_info)
+                               struct codec_config *bb_info,
+                               int uses_voice_codec)
 {
        struct tegra30_i2s  *codec_i2s;
        struct tegra30_i2s  *bb_i2s;
@@ -1142,6 +1147,8 @@ int tegra30_make_voice_call_connections(struct codec_config *codec_info,
        /* increment the codec i2s playback ref count */
        codec_i2s->playback_ref_count++;
        bb_i2s->playback_ref_count++;
+       codec_i2s->capture_ref_count++;
+       bb_i2s->capture_ref_count++;
 
        /*Configure codec i2s*/
        configure_baseband_i2s(codec_i2s, codec_info->is_i2smaster,
@@ -1153,41 +1160,55 @@ int tegra30_make_voice_call_connections(struct codec_config *codec_info,
                bb_info->is_format_dsp, bb_info->channels,
                bb_info->rate, bb_info->bitsize);
 
-       /*configure codec dam*/
-       configure_dam(codec_i2s, codec_info->channels,
-               codec_info->rate, codec_info->bitsize, bb_info->channels,
-               bb_info->rate, bb_info->bitsize);
+       if (uses_voice_codec) {
+               /* The following two lines are a hack */
+               tegra30_ahub_unset_rx_cif_source(TEGRA30_AHUB_RXCIF_APBIF_RX0);
+               tegra30_ahub_unset_rx_cif_source(TEGRA30_AHUB_RXCIF_I2S0_RX0+1);
 
-       /*configure bb dam*/
-       configure_dam(bb_i2s, bb_info->channels,
-               bb_info->rate, bb_info->bitsize, codec_info->channels,
-               codec_info->rate, codec_info->bitsize);
+               tegra30_ahub_set_rx_cif_source(TEGRA30_AHUB_RXCIF_I2S0_RX0 +
+                           bb_info->i2s_id, TEGRA30_AHUB_TXCIF_I2S0_TX0 +
+                           codec_info->i2s_id);
+               tegra30_ahub_set_rx_cif_source(TEGRA30_AHUB_RXCIF_I2S0_RX0 +
+                           codec_info->i2s_id, TEGRA30_AHUB_TXCIF_I2S0_TX0 +
+                           bb_info->i2s_id);
+       } else {
 
-       /*make ahub connections*/
+               /*configure codec dam*/
+               configure_dam(codec_i2s, codec_info->channels,
+                  codec_info->rate, codec_info->bitsize, bb_info->channels,
+                  bb_info->rate, bb_info->bitsize);
+
+               /*configure bb dam*/
+               configure_dam(bb_i2s, bb_info->channels,
+                       bb_info->rate, bb_info->bitsize, codec_info->channels,
+                       codec_info->rate, codec_info->bitsize);
+
+               /*make ahub connections*/
+
+               /*if this is the only user of i2s tx, make i2s rx connection*/
+               if (codec_i2s->playback_ref_count == 1) {
+                       tegra30_ahub_set_rx_cif_source(
+                         TEGRA30_AHUB_RXCIF_I2S0_RX0 + codec_info->i2s_id,
+                         TEGRA30_AHUB_TXCIF_DAM0_TX0 + codec_i2s->dam_ifc);
+               }
 
-       /* if this is the only user of i2s tx then make ahub i2s rx connection*/
-       if (codec_i2s->playback_ref_count == 1) {
                tegra30_ahub_set_rx_cif_source(TEGRA30_AHUB_RXCIF_I2S0_RX0 +
-                               codec_info->i2s_id, TEGRA30_AHUB_TXCIF_DAM0_TX0 +
-                               codec_i2s->dam_ifc);
+                               bb_info->i2s_id, TEGRA30_AHUB_TXCIF_DAM0_TX0 +
+                               bb_i2s->dam_ifc);
+               tegra30_ahub_set_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX0 +
+                       (codec_i2s->dam_ifc*2), TEGRA30_AHUB_TXCIF_I2S0_TX0 +
+                       bb_info->i2s_id);
+               tegra30_ahub_set_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX0 +
+                       (bb_i2s->dam_ifc*2), TEGRA30_AHUB_TXCIF_I2S0_TX0 +
+                       codec_info->i2s_id);
+
+               /*enable dam and i2s*/
+               tegra30_dam_enable(codec_i2s->dam_ifc, TEGRA30_DAM_ENABLE,
+                       TEGRA30_DAM_CHIN0_SRC);
+               tegra30_dam_enable(bb_i2s->dam_ifc, TEGRA30_DAM_ENABLE,
+                       TEGRA30_DAM_CHIN0_SRC);
        }
 
-       tegra30_ahub_set_rx_cif_source(TEGRA30_AHUB_RXCIF_I2S0_RX0 +
-                       bb_info->i2s_id, TEGRA30_AHUB_TXCIF_DAM0_TX0 +
-                       bb_i2s->dam_ifc);
-       tegra30_ahub_set_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX0 +
-               (codec_i2s->dam_ifc*2), TEGRA30_AHUB_TXCIF_I2S0_TX0 +
-               bb_info->i2s_id);
-       tegra30_ahub_set_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX0 +
-               (bb_i2s->dam_ifc*2), TEGRA30_AHUB_TXCIF_I2S0_TX0 +
-               codec_info->i2s_id);
-
-       /*enable dam and i2s*/
-       tegra30_dam_enable(codec_i2s->dam_ifc, TEGRA30_DAM_ENABLE,
-               TEGRA30_DAM_CHIN0_SRC);
-       tegra30_dam_enable(bb_i2s->dam_ifc, TEGRA30_DAM_ENABLE,
-               TEGRA30_DAM_CHIN0_SRC);
-
        codec_i2s->reg_ctrl |= TEGRA30_I2S_CTRL_XFER_EN_TX;
        codec_i2s->reg_ctrl |= TEGRA30_I2S_CTRL_XFER_EN_RX;
        tegra30_i2s_write(codec_i2s, TEGRA30_I2S_CTRL,
@@ -1202,7 +1223,8 @@ int tegra30_make_voice_call_connections(struct codec_config *codec_info,
 }
 
 int tegra30_break_voice_call_connections(struct codec_config *codec_info,
-                               struct codec_config *bb_info)
+                               struct codec_config *bb_info,
+                               int uses_voice_codec)
 {
        struct tegra30_i2s  *codec_i2s;
        struct tegra30_i2s  *bb_i2s;
@@ -1212,7 +1234,9 @@ int tegra30_break_voice_call_connections(struct codec_config *codec_info,
        bb_i2s = &i2scont[bb_info->i2s_id];
 
        /*Disable Codec I2S RX (TX to ahub)*/
-       codec_i2s->reg_ctrl &= ~TEGRA30_I2S_CTRL_XFER_EN_RX;
+       if (codec_i2s->capture_ref_count == 1)
+               codec_i2s->reg_ctrl &= ~TEGRA30_I2S_CTRL_XFER_EN_RX;
+
        tegra30_i2s_write(codec_i2s, TEGRA30_I2S_CTRL, codec_i2s->reg_ctrl);
 
        while (tegra30_ahub_rx_fifo_is_enabled(codec_i2s->id) && dcnt--)
@@ -1220,14 +1244,6 @@ int tegra30_break_voice_call_connections(struct codec_config *codec_info,
 
        dcnt = 10;
 
-       /*Disable baseband DAM*/
-       tegra30_dam_enable(bb_i2s->dam_ifc, TEGRA30_DAM_DISABLE,
-                       TEGRA30_DAM_CHIN0_SRC);
-       tegra30_dam_free_channel(bb_i2s->dam_ifc, TEGRA30_DAM_CHIN0_SRC);
-       bb_i2s->dam_ch_refcount--;
-       if (!bb_i2s->dam_ch_refcount)
-               tegra30_dam_free_controller(bb_i2s->dam_ifc);
-
        /*Disable baseband I2S TX (RX from ahub)*/
        bb_i2s->reg_ctrl &= ~TEGRA30_I2S_CTRL_XFER_EN_TX;
        tegra30_i2s_write(bb_i2s, TEGRA30_I2S_CTRL, bb_i2s->reg_ctrl);
@@ -1246,15 +1262,6 @@ int tegra30_break_voice_call_connections(struct codec_config *codec_info,
 
        dcnt = 10;
 
-       /*Disable Codec DAM*/
-       tegra30_dam_enable(codec_i2s->dam_ifc,
-               TEGRA30_DAM_DISABLE, TEGRA30_DAM_CHIN0_SRC);
-       tegra30_dam_free_channel(codec_i2s->dam_ifc,
-               TEGRA30_DAM_CHIN0_SRC);
-       codec_i2s->dam_ch_refcount--;
-       if (!codec_i2s->dam_ch_refcount)
-               tegra30_dam_free_controller(codec_i2s->dam_ifc);
-
        /*Disable Codec I2S TX (RX from ahub)*/
        if (codec_i2s->playback_ref_count == 1)
                        codec_i2s->reg_ctrl &= ~TEGRA30_I2S_CTRL_XFER_EN_TX;
@@ -1266,30 +1273,58 @@ int tegra30_break_voice_call_connections(struct codec_config *codec_info,
 
        dcnt = 10;
 
-       /* Disconnect the ahub connections */
-       /* If this is the only user of i2s tx then break ahub
-       i2s rx connection */
-       if (codec_i2s->playback_ref_count == 1)
-               tegra30_ahub_unset_rx_cif_source(TEGRA30_AHUB_RXCIF_I2S0_RX0
-                       + codec_info->i2s_id);
+       if (uses_voice_codec) {
+               tegra30_ahub_unset_rx_cif_source(TEGRA30_AHUB_RXCIF_I2S0_RX0 +
+                           bb_info->i2s_id);
+               tegra30_ahub_unset_rx_cif_source(TEGRA30_AHUB_RXCIF_I2S0_RX0 +
+                           codec_info->i2s_id);
+       } else {
+
+               /*Disable baseband DAM*/
+               tegra30_dam_enable(bb_i2s->dam_ifc, TEGRA30_DAM_DISABLE,
+                               TEGRA30_DAM_CHIN0_SRC);
+               tegra30_dam_free_channel(bb_i2s->dam_ifc,
+                               TEGRA30_DAM_CHIN0_SRC);
+               bb_i2s->dam_ch_refcount--;
+               if (!bb_i2s->dam_ch_refcount)
+                       tegra30_dam_free_controller(bb_i2s->dam_ifc);
+
+               /*Disable Codec DAM*/
+               tegra30_dam_enable(codec_i2s->dam_ifc,
+                       TEGRA30_DAM_DISABLE, TEGRA30_DAM_CHIN0_SRC);
+               tegra30_dam_free_channel(codec_i2s->dam_ifc,
+                       TEGRA30_DAM_CHIN0_SRC);
+               codec_i2s->dam_ch_refcount--;
+               if (!codec_i2s->dam_ch_refcount)
+                       tegra30_dam_free_controller(codec_i2s->dam_ifc);
+
+               /* Disconnect the ahub connections */
+               /* If this is the only user of i2s tx then break ahub
+               i2s rx connection */
+               if (codec_i2s->playback_ref_count == 1)
+                       tegra30_ahub_unset_rx_cif_source(
+                          TEGRA30_AHUB_RXCIF_I2S0_RX0 + codec_info->i2s_id);
 
-       tegra30_ahub_unset_rx_cif_source(TEGRA30_AHUB_RXCIF_I2S0_RX0
-                               + bb_info->i2s_id);
-       tegra30_ahub_unset_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX0
-                               + (codec_i2s->dam_ifc*2));
-       tegra30_ahub_unset_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX0
-                               + (bb_i2s->dam_ifc*2));
+               tegra30_ahub_unset_rx_cif_source(TEGRA30_AHUB_RXCIF_I2S0_RX0
+                                       + bb_info->i2s_id);
+               tegra30_ahub_unset_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX0
+                                       + (codec_i2s->dam_ifc*2));
+               tegra30_ahub_unset_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX0
+                                       + (bb_i2s->dam_ifc*2));
+
+               tegra30_dam_disable_clock(codec_i2s->dam_ifc);
+               tegra30_dam_disable_clock(bb_i2s->dam_ifc);
+       }
 
        /* Decrement the codec and bb i2s playback ref count */
        codec_i2s->playback_ref_count--;
        bb_i2s->playback_ref_count--;
+       codec_i2s->capture_ref_count--;
+       bb_i2s->capture_ref_count--;
 
        /* Disable the clocks */
        tegra30_i2s_disable_clocks(codec_i2s);
        tegra30_i2s_disable_clocks(bb_i2s);
-       tegra30_dam_disable_clock(codec_i2s->dam_ifc);
-       tegra30_dam_disable_clock(bb_i2s->dam_ifc);
-
        return 0;
 }
 
index 1163cd5..10fadc8 100644 (file)
@@ -266,6 +266,7 @@ struct tegra30_i2s {
        int dam_ifc;
        int dam_ch_refcount;
        int  playback_ref_count;
+       int  capture_ref_count;
        int daifmt;
        bool is_dam_used;
 #ifdef CONFIG_PM
@@ -291,9 +292,11 @@ struct codec_config {
 };
 
 int tegra30_make_voice_call_connections(struct codec_config *codec_info,
-                       struct codec_config *bb_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);
+                       struct codec_config *bb_info,
+                       int uses_voice_codec);
 
 #endif
index 4120664..568db22 100644 (file)
@@ -168,7 +168,7 @@ static int tegra_aic326x_call_mode_put(struct snd_kcontrol *kcontrol,
 
                tegra30_make_voice_call_connections(
                        &machine->codec_info[codec_index],
-                       &machine->codec_info[BASEBAND]);
+                       &machine->codec_info[BASEBAND], 0);
 #endif
        } else {
 #ifdef CONFIG_ARCH_TEGRA_2x_SOC
@@ -183,7 +183,7 @@ static int tegra_aic326x_call_mode_put(struct snd_kcontrol *kcontrol,
 #else /*assumes tegra3*/
                tegra30_break_voice_call_connections(
                        &machine->codec_info[codec_index],
-                       &machine->codec_info[BASEBAND]);
+                       &machine->codec_info[BASEBAND], 0);
 
                for (i = 0; i < machine->pcard->num_links; i++)
                        machine->pcard->dai_link[i].ignore_suspend = 0;
index f239a9e..2cd901c 100644 (file)
@@ -145,11 +145,11 @@ static int tegra_call_mode_put(struct snd_kcontrol *kcontrol,
 
                tegra30_make_voice_call_connections(
                        &machine->codec_info[codec_index],
-                       &machine->codec_info[BASEBAND]);
+                       &machine->codec_info[BASEBAND], 1);
        } else {
                tegra30_break_voice_call_connections(
                        &machine->codec_info[codec_index],
-                       &machine->codec_info[BASEBAND]);
+                       &machine->codec_info[BASEBAND], 1);
 
                for (i = 0; i < machine->pcard->num_links; i++)
                        machine->pcard->dai_link[i].ignore_suspend = 0;
@@ -307,9 +307,11 @@ static int tegra_cs42l73_hw_params(struct snd_pcm_substream *substream,
        }
 
 #ifndef CONFIG_ARCH_TEGRA_2x_SOC
-       if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-               tegra_cs42l73_set_dam_cif(i2s->dam_ifc, srate,
-                       params_channels(params), sample_size, 0, 0, 0, 0);
+       if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+               if (i2s->dam_ifc)
+                       tegra_cs42l73_set_dam_cif(i2s->dam_ifc, srate,
+                         params_channels(params), sample_size, 0, 0, 0, 0);
+       }
 #endif
 
        return 0;
@@ -448,9 +450,10 @@ static int tegra_bt_hw_params(struct snd_pcm_substream *substream,
        }
 
 #ifndef CONFIG_ARCH_TEGRA_2x_SOC
-       if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+       if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK) &&
+           i2s->dam_ifc)
                tegra_cs42l73_set_dam_cif(i2s->dam_ifc, params_rate(params),
-                       params_channels(params), sample_size, 0, 0, 0, 0);
+                 params_channels(params), sample_size, 0, 0, 0, 0);
 #endif
 
        return 0;
@@ -475,6 +478,7 @@ static int tegra_cs42l73_startup(struct snd_pcm_substream *substream)
        struct tegra_cs42l73 *machine = snd_soc_card_get_drvdata(rtd->card);
        struct codec_config *codec_info;
        struct codec_config *bb_info;
+       struct codec_config *hifi_info;
        int codec_index;
 
        if (!i2s->is_dam_used)
@@ -505,7 +509,6 @@ static int tegra_cs42l73_startup(struct snd_pcm_substream *substream)
                tegra30_dam_enable(i2s->dam_ifc, TEGRA30_DAM_ENABLE,
                                TEGRA30_DAM_CHIN1);
        } else {
-
                i2s->is_call_mode_rec = machine->is_call_mode;
 
                if (!i2s->is_call_mode_rec)
@@ -518,6 +521,7 @@ static int tegra_cs42l73_startup(struct snd_pcm_substream *substream)
 
                codec_info = &machine->codec_info[codec_index];
                bb_info = &machine->codec_info[BASEBAND];
+               hifi_info = &machine->codec_info[HIFI_CODEC];
 
                /* allocate a dam for voice call recording */
 
@@ -535,7 +539,6 @@ static int tegra_cs42l73_startup(struct snd_pcm_substream *substream)
                        bb_info->channels, bb_info->bitsize);
 
                /* setup the connections for voice call record */
-
                tegra30_ahub_unset_rx_cif_source(i2s->rxcif);
                tegra30_ahub_set_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX0 +
                        (i2s->call_record_dam_ifc*2),
@@ -582,7 +585,6 @@ static void tegra_cs42l73_shutdown(struct snd_pcm_substream *substream)
                if (!i2s->dam_ch_refcount)
                        tegra30_dam_free_controller(i2s->dam_ifc);
         } else {
-
                if (!i2s->is_call_mode_rec)
                        return;
 
@@ -619,6 +621,7 @@ static int tegra_voice_call_hw_params(struct snd_pcm_substream *substream,
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_dai *codec_dai = rtd->codec_dai;
+       struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
        struct snd_soc_codec *codec = rtd->codec;
        struct snd_soc_card *card = codec->card;
        struct tegra_cs42l73 *machine = snd_soc_card_get_drvdata(card);
@@ -697,6 +700,12 @@ static int tegra_voice_call_hw_params(struct snd_pcm_substream *substream,
                return err;
        }
 
+       err = snd_soc_dai_set_fmt(cpu_dai, i2s_daifmt);
+       if (err < 0) {
+               dev_err(card->dev, "cpu_dai fmt not set\n");
+               return err;
+       }
+
        err = snd_soc_dai_set_sysclk(codec_dai, 0, rate, SND_SOC_CLOCK_IN);
        if (err < 0) {
                dev_err(card->dev, "codec_dai clock not set\n");
@@ -1019,8 +1028,11 @@ static int tegra_cs42l73_init(struct snd_soc_pcm_runtime *rtd)
        int ret;
 
 #ifndef CONFIG_ARCH_TEGRA_2x_SOC
+
        if (machine->codec_info[BASEBAND].i2s_id != -1)
                i2s->is_dam_used = true;
+
+       i2s->is_dam_used = false;
 #endif
 
        if (machine->init_done)
@@ -1309,6 +1321,9 @@ static __devinit int tegra_cs42l73_driver_probe(struct platform_device *pdev)
 
        tegra_cs42l73_dai[DAI_LINK_BTSCO].cpu_dai_name =
        tegra_cs42l73_i2s_dai_name[machine->codec_info[BT_SCO].i2s_id];
+
+       tegra_cs42l73_dai[DAI_LINK_VOICE_CALL].cpu_dai_name =
+       tegra_cs42l73_i2s_dai_name[machine->codec_info[VOICE_CODEC].i2s_id];
 #endif
        card->dapm.idle_bias_off = 1;
        ret = snd_soc_register_card(card);
index 500687d..a704160 100644 (file)
@@ -142,13 +142,13 @@ static int tegra_call_mode_put(struct snd_kcontrol *kcontrol,
 
                tegra30_make_voice_call_connections(
                        &machine->codec_info[codec_index],
-                       &machine->codec_info[BASEBAND]);
+                       &machine->codec_info[BASEBAND], 0);
 #endif
        } else {
 #ifndef CONFIG_ARCH_TEGRA_2x_SOC
                tegra30_break_voice_call_connections(
                        &machine->codec_info[codec_index],
-                       &machine->codec_info[BASEBAND]);
+                       &machine->codec_info[BASEBAND], 0);
 
                for (i = 0; i < machine->pcard->num_links; i++)
                        machine->pcard->dai_link[i].ignore_suspend = 0;