diff options
author | Nikesh Oswal <noswal@nvidia.com> | 2011-11-03 14:49:21 +0530 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:50:08 -0800 |
commit | e0f5b7f46690bf1ee87b13d87db741b1bb2adea9 (patch) | |
tree | b0626e95217599302ab6e9a8f95dd8d227f1fddd /sound/soc/tegra/tegra_max98088.c | |
parent | 4d04f5732bc08ee8ca54008ca4d4d0c4fdde6f6f (diff) |
ASoC: Tegra MAX98088 machine: Add support for Tegra30 BT SCO
Bug: 862023
Change-Id: If5aaa1add08d1339a93a84c41ad1c98a24b63db5
Signed-off-by: Nikesh Oswal <noswal@nvidia.com>
Reviewed-on: http://git-master/r/62082
Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
Rebase-Id: R7531465a6b899b9da52a2003cd6e07afb53961bf
Diffstat (limited to 'sound/soc/tegra/tegra_max98088.c')
-rwxr-xr-x[-rw-r--r--] | sound/soc/tegra/tegra_max98088.c | 71 |
1 files changed, 69 insertions, 2 deletions
diff --git a/sound/soc/tegra/tegra_max98088.c b/sound/soc/tegra/tegra_max98088.c index 81a069494daf..9bb958fbda4a 100644..100755 --- a/sound/soc/tegra/tegra_max98088.c +++ b/sound/soc/tegra/tegra_max98088.c @@ -184,7 +184,60 @@ static int tegra_spdif_hw_params(struct snd_pcm_substream *substream, return 0; } -static int tegra_hw_free(struct snd_pcm_substream *substream) +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_card *card = rtd->card; + struct tegra_max98088 *machine = snd_soc_card_get_drvdata(card); + int err, srate, mclk, min_mclk; + + srate = params_rate(params); + switch (srate) { + case 11025: + case 22050: + case 44100: + case 88200: + mclk = 11289600; + break; + case 8000: + case 16000: + case 32000: + case 48000: + case 64000: + case 96000: + mclk = 12288000; + break; + default: + return -EINVAL; + } + min_mclk = 64 * srate; + + err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk); + if (err < 0) { + if (!(machine->util_data.set_mclk % min_mclk)) + mclk = machine->util_data.set_mclk; + else { + dev_err(card->dev, "Can't configure clocks\n"); + return err; + } + } + + tegra_asoc_utils_lock_clk_rate(&machine->util_data, 1); + + err = snd_soc_dai_set_fmt(rtd->cpu_dai, + SND_SOC_DAIFMT_DSP_A | + SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBS_CFS); + if (err < 0) { + dev_err(rtd->codec->card->dev, "cpu_dai fmt not set\n"); + return err; + } + + return 0; +} + +static void tegra_hw_free(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct tegra_max98088 *machine = snd_soc_card_get_drvdata(rtd->card); @@ -204,6 +257,11 @@ static struct snd_soc_ops tegra_spdif_ops = { .hw_free = tegra_hw_free, }; +static struct snd_soc_ops tegra_bt_ops = { + .hw_params = tegra_bt_hw_params, + .hw_free = tegra_hw_free, +}; + static struct snd_soc_jack tegra_max98088_hp_jack; #ifdef CONFIG_SWITCH @@ -425,7 +483,16 @@ static struct snd_soc_dai_link tegra_max98088_dai[] = { .cpu_dai_name = "tegra30-spdif", .codec_dai_name = "dit-hifi", .ops = &tegra_spdif_ops, - } + }, + { + .name = "BT SCO", + .stream_name = "BT SCO PCM", + .codec_name = "spdif-dit.1", + .platform_name = "tegra-pcm-audio", + .cpu_dai_name = "tegra30-i2s.3", + .codec_dai_name = "dit-hifi", + .ops = &tegra_bt_ops, + }, }; static struct snd_soc_card snd_soc_tegra_max98088 = { |