diff options
author | Nitin Pai <npai@nvidia.com> | 2012-08-29 19:19:53 +0530 |
---|---|---|
committer | Mrutyunjay Sawant <msawant@nvidia.com> | 2012-10-19 07:01:19 -0700 |
commit | 4c8d82fd70e20bdebd2d7aaebcd019d5a3038934 (patch) | |
tree | 7996fbe1ee15979d448623704682a82af932a24f /sound | |
parent | bf804b26496f6049d664484c4ef5761a8cdbe4e6 (diff) |
asoc: tegra: Have single platform data for VCMs
Rename the file tegra_p1852_pdata.h to tegra_vcm_pdata.h for using
generically across all the VCM based platforms.
Added config structure to pass the DAP/DAS configuration for P852
Added support to configure the DAP/DAS on Tegra2.
Bug 1040171
Reviewed-on: http://git-master/r/128224
(cherry picked from commit fca5e1c5407f17d6860003ca4db4e27b459a0fbe)
Change-Id: I9dba53f6e182550b8267666a37533317d07433db
Signed-off-by: Nitin Pai <npai@nvidia.com>
Change-Id: I7ef9052fb32c680d1d3be623e61669000deccd2e
Reviewed-on: http://git-master/r/145263
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bob Johnston <bjohnston@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/tegra/tegra_vcm.c | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/sound/soc/tegra/tegra_vcm.c b/sound/soc/tegra/tegra_vcm.c index ec622b559ec7..0deba388fa4d 100644 --- a/sound/soc/tegra/tegra_vcm.c +++ b/sound/soc/tegra/tegra_vcm.c @@ -2,11 +2,11 @@ * tegra_vcm.c - Tegra machine ASoC driver for P852/P1852/P1853 Boards. * * Author: Nitin Pai <npai@nvidia.com> - * Copyright (C) 2010-2012 - NVIDIA, Corporation. All rights reserved. + * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. * * Based on code copyright/by: - * Copyright (c) 2009-2012, NVIDIA Corporation. All rights reserved. * Stephen Warren <swarren@nvidia.com> + * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -31,7 +31,7 @@ #include <linux/platform_device.h> #include <linux/slab.h> -#include <mach/tegra_p1852_pdata.h> +#include <mach/tegra_asoc_vcm_pdata.h> #include <sound/core.h> #include <sound/pcm.h> @@ -45,16 +45,19 @@ #define DRV_NAME "tegra-snd-p1852" #endif #ifdef CONFIG_MACH_E1853 -#define DRV_NAME "tegra-snd-e1853" +#define DRV_NAME "tegra-snd-p1853" #endif #ifdef CONFIG_MACH_P852 #define DRV_NAME "tegra-snd-p852" #endif +#ifdef CONFIG_ARCH_TEGRA_2x_SOC +#include "tegra20_das.h" +#endif struct tegra_vcm { struct tegra_asoc_utils_data util_data; - struct tegra_p1852_platform_data *pdata; + struct tegra_asoc_vcm_platform_data *pdata; }; static int tegra_vcm_hw_params(struct snd_pcm_substream *substream, @@ -70,8 +73,11 @@ static int tegra_vcm_hw_params(struct snd_pcm_substream *substream, int srate, mclk; int i2s_daifmt = 0; int err; - struct tegra_p1852_platform_data *pdata; - + struct tegra_asoc_vcm_platform_data *pdata; +#ifdef CONFIG_ARCH_TEGRA_2x_SOC + int dac_id; + int dap_id; +#endif pdata = machine->pdata; srate = params_rate(params); @@ -86,9 +92,6 @@ static int tegra_vcm_hw_params(struct snd_pcm_substream *substream, break; } - /* audio hub needs to be driven at 2x */ - mclk *= 2; - err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk); if (err < 0) { if (!(machine->util_data.set_mclk % mclk)) @@ -139,7 +142,7 @@ static int tegra_vcm_hw_params(struct snd_pcm_substream *substream, if (pdata->codec_info[codec_id].i2s_format == format_tdm) { - err = snd_soc_dai_set_tdm_slot(cpu_dai, + err = snd_soc_dai_set_tdm_slot(cpu_dai, pdata->codec_info[codec_id].rx_mask, pdata->codec_info[codec_id].tx_mask, pdata->codec_info[codec_id].num_slots, @@ -148,6 +151,24 @@ static int tegra_vcm_hw_params(struct snd_pcm_substream *substream, dev_err(card->dev, "cpu_dai tdm mode setting not done\n"); } +#ifdef CONFIG_ARCH_TEGRA_2x_SOC + dac_id = TEGRA20_DAS_DAP_SEL_DAC1 + pdata->dac_info[codec_id].dac_id; + dap_id = TEGRA20_DAS_DAP_ID_1 + pdata->dac_info[codec_id].dap_id; + err = tegra20_das_connect_dac_to_dap(dac_id, dap_id); + if (err < 0) { + dev_err(card->dev, "failed to set dap-dac path\n"); + return err; + } + + tegra20_das_set_tristate(dap_id, 0); + + err = tegra20_das_connect_dap_to_dac(dap_id, dac_id); + if (err < 0) { + dev_err(card->dev, "failed to set dac-dap path\n"); + return err; + } +#endif + return 0; } @@ -211,7 +232,7 @@ static __devinit int tegra_vcm_driver_probe(struct platform_device *pdev) { struct snd_soc_card *card = &snd_soc_tegra_vcm; struct tegra_vcm *machine; - struct tegra_p1852_platform_data *pdata; + struct tegra_asoc_vcm_platform_data *pdata; int ret; int i; |