diff options
author | Nikesh Oswal <noswal@nvidia.com> | 2011-08-09 19:32:17 +0530 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-08-18 16:33:44 -0700 |
commit | 53117d4aaac8b5aff8682866644427958e2441b0 (patch) | |
tree | b0ba39cb5a355f65caad6ba6525ac943238b6cc4 /sound/soc | |
parent | c52a7398c2a1960865ddfc75d94403757b1af256 (diff) |
asoc: tegra: bt-sco bringup on enterprise
add code for bt-sco playback and record support
Bug 864984
Change-Id: I003b58f333bcba371129a9069c2b453e1e8380c0
Reviewed-on: http://git-master/r/46084
Tested-by: Nikesh Oswal <noswal@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/tegra/tegra_soc_max98088.c | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/sound/soc/tegra/tegra_soc_max98088.c b/sound/soc/tegra/tegra_soc_max98088.c index bd38faaf6680..f8bef65e84a5 100644 --- a/sound/soc/tegra/tegra_soc_max98088.c +++ b/sound/soc/tegra/tegra_soc_max98088.c @@ -122,6 +122,51 @@ static int tegra_hifi_hw_params(struct snd_pcm_substream *substream, return 0; } +#ifndef CONFIG_ARCH_TEGRA_2x_SOC +static int tegra_bt_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; + struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; + int sys_clk; + int err; + int dai_flag = SND_SOC_DAIFMT_NB_NF; + enum dac_dap_data_format data_fmt; + struct audio_dev_property dev_prop; + + if (tegra_das_is_device_master(tegra_audio_codec_type_bluetooth)) + dai_flag |= SND_SOC_DAIFMT_CBM_CFM; + else + dai_flag |= SND_SOC_DAIFMT_CBS_CFS; + + tegra_das_get_device_property(tegra_audio_codec_type_bluetooth, + &dev_prop); + + data_fmt = dev_prop.dac_dap_data_comm_format; + + /* We are supporting DSP and I2s format for now */ + if (data_fmt & dac_dap_data_format_dsp) + dai_flag |= SND_SOC_DAIFMT_DSP_A; + else + dai_flag |= SND_SOC_DAIFMT_I2S; + + err = snd_soc_dai_set_fmt(codec_dai, dai_flag); + if (err < 0) { + pr_err("codec_dai fmt not set\n"); + return err; + } + + err = snd_soc_dai_set_fmt(cpu_dai, dai_flag); + if (err < 0) { + pr_err("cpu_dai fmt not set\n"); + return err; + } + + return 0; +} +#endif + static int tegra_voice_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { @@ -207,6 +252,12 @@ static struct snd_soc_ops tegra_voice_ops = { .shutdown = tegra_codec_shutdown, }; +static struct snd_soc_ops tegra_bt_ops = { + .hw_params = tegra_bt_hw_params, + .startup = tegra_codec_startup, + .shutdown = tegra_codec_shutdown, +}; + static struct snd_soc_ops tegra_spdif_ops = { .hw_params = tegra_spdif_hw_params, }; @@ -386,9 +437,9 @@ static struct snd_soc_dai_link tegra_soc_dai[] = { &tegra_i2s_dai[1], &tegra_generic_codec_dai[2], &tegra_voice_ops), #else - TEGRA_CREATE_SOC_DAI_LINK("Tegra-generic", "Tegra Generic Voice", - &tegra_i2s_dai[0], &max98088_dai[0], - &tegra_voice_ops), + TEGRA_CREATE_SOC_DAI_LINK("Tegra-generic", "Tegra BT Voice", + &tegra_i2s_dai[3], &tegra_generic_codec_dai[2], + &tegra_bt_ops), TEGRA_CREATE_SOC_DAI_LINK("Tegra-voice-call", "Tegra Voice Call Max HiFi", |