From 304380a459cf3370d86f2476d5897b86374f5c85 Mon Sep 17 00:00:00 2001 From: Vinod G Date: Mon, 15 Aug 2011 12:10:58 -0700 Subject: arm: tegra: Fix spdif init from soc Add code to pas spdif init information from soc Cleanup the code for checking the device type before calling das function. Change-Id: I2261dc51c1e231ba350dd92e2aa60981523311fc Reviewed-on: http://git-master/r/47157 Reviewed-by: Vinod Gopalakrishnakurup Tested-by: Vinod Gopalakrishnakurup Reviewed-by: Scott Peterson --- sound/soc/tegra/tegra_soc_ad193x.c | 2 -- sound/soc/tegra/tegra_soc_max98088.c | 12 ++---------- sound/soc/tegra/tegra_soc_wm8753.c | 21 ++------------------- sound/soc/tegra/tegra_soc_wm8903.c | 32 +++++++++----------------------- sound/soc/tegra/tegra_spdif.c | 7 +++++++ 5 files changed, 20 insertions(+), 54 deletions(-) (limited to 'sound') diff --git a/sound/soc/tegra/tegra_soc_ad193x.c b/sound/soc/tegra/tegra_soc_ad193x.c index 360231527ac5..c059648a8c2f 100644 --- a/sound/soc/tegra/tegra_soc_ad193x.c +++ b/sound/soc/tegra/tegra_soc_ad193x.c @@ -42,11 +42,9 @@ static int tegra_hifi_hw_params(struct snd_pcm_substream *substream, enum dac_dap_data_format data_fmt; -#ifdef CONFIG_ARCH_TEGRA_2x_SOC if (tegra_das_is_port_master(tegra_audio_codec_type_hifi)) dai_flag |= SND_SOC_DAIFMT_CBM_CFM; else -#endif dai_flag |= SND_SOC_DAIFMT_CBS_CFS; dai_flag |= SND_SOC_DAIFMT_DSP_A; diff --git a/sound/soc/tegra/tegra_soc_max98088.c b/sound/soc/tegra/tegra_soc_max98088.c index 3d247fac3156..bd38faaf6680 100644 --- a/sound/soc/tegra/tegra_soc_max98088.c +++ b/sound/soc/tegra/tegra_soc_max98088.c @@ -76,24 +76,16 @@ static int tegra_hifi_hw_params(struct snd_pcm_substream *substream, int err; int dai_flag = SND_SOC_DAIFMT_NB_NF; enum dac_dap_data_format data_fmt; - struct audio_dev_property dev_prop; -#ifdef CONFIG_ARCH_TEGRA_2x_SOC + if (tegra_das_is_port_master(tegra_audio_codec_type_hifi)) -#else - if(tegra_das_is_device_master(tegra_audio_codec_type_hifi)) -#endif dai_flag |= SND_SOC_DAIFMT_CBM_CFM; else dai_flag |= SND_SOC_DAIFMT_CBS_CFS; -#ifdef CONFIG_ARCH_TEGRA_2x_SOC data_fmt = tegra_das_get_codec_data_fmt(tegra_audio_codec_type_hifi); -#else - tegra_das_get_device_property(tegra_audio_codec_type_hifi,&dev_prop); - data_fmt = dev_prop.dac_dap_data_comm_format; -#endif + /* We are supporting DSP and I2s format for now */ if (data_fmt & dac_dap_data_format_dsp) dai_flag |= SND_SOC_DAIFMT_DSP_A; diff --git a/sound/soc/tegra/tegra_soc_wm8753.c b/sound/soc/tegra/tegra_soc_wm8753.c index ab4e884047dc..99756a3a0b82 100644 --- a/sound/soc/tegra/tegra_soc_wm8753.c +++ b/sound/soc/tegra/tegra_soc_wm8753.c @@ -158,23 +158,14 @@ static int tegra_hifi_hw_params(struct snd_pcm_substream *substream, unsigned int value; int err; enum dac_dap_data_format data_fmt; - struct audio_dev_property dev_prop; -#ifdef CONFIG_ARCH_TEGRA_2x_SOC if (tegra_das_is_port_master(tegra_audio_codec_type_hifi)) -#else - if(tegra_das_is_device_master(tegra_audio_codec_type_hifi)) -#endif dai_flag |= SND_SOC_DAIFMT_CBM_CFM; else dai_flag |= SND_SOC_DAIFMT_CBS_CFS; -#ifdef CONFIG_ARCH_TEGRA_2x_SOC data_fmt = tegra_das_get_codec_data_fmt(tegra_audio_codec_type_hifi); -#else - tegra_das_get_device_property(tegra_audio_codec_type_hifi,&dev_prop); - data_fmt = dev_prop.dac_dap_data_comm_format; -#endif + /* We are supporting DSP and I2s format for now */ if (data_fmt & dac_dap_data_format_dsp) dai_flag |= SND_SOC_DAIFMT_DSP_A; @@ -331,21 +322,13 @@ static int tegra_voice_hw_params(struct snd_pcm_substream *substream, enum dac_dap_data_format data_fmt; struct audio_dev_property dev_prop; -#ifdef CONFIG_ARCH_TEGRA_2x_SOC if (tegra_das_is_port_master(tegra_audio_codec_type_bluetooth)) -#else - if(tegra_das_is_device_master(tegra_audio_codec_type_bluetooth)) -#endif dai_flag |= SND_SOC_DAIFMT_CBM_CFM; else dai_flag |= SND_SOC_DAIFMT_CBS_CFS; -#ifdef CONFIG_ARCH_TEGRA_2x_SOC data_fmt = tegra_das_get_codec_data_fmt(tegra_audio_codec_type_bluetooth); -#else - tegra_das_get_device_property(tegra_audio_codec_type_bluetooth,&dev_prop); - data_fmt = dev_prop.dac_dap_data_comm_format; -#endif + /* We are supporting DSP and I2s format for now */ if (data_fmt & dac_dap_data_format_i2s) dai_flag |= SND_SOC_DAIFMT_I2S; diff --git a/sound/soc/tegra/tegra_soc_wm8903.c b/sound/soc/tegra/tegra_soc_wm8903.c index 7971496fb617..d4c14bfbc374 100644 --- a/sound/soc/tegra/tegra_soc_wm8903.c +++ b/sound/soc/tegra/tegra_soc_wm8903.c @@ -74,27 +74,19 @@ static int tegra_hifi_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; struct snd_soc_codec *codec = codec_dai->codec; - struct tegra_i2s_info *info = cpu_dai->private_data; + struct tegra_i2s_info *info = cpu_dai->private_data; int dai_flag = 0, sys_clk; int err; enum dac_dap_data_format data_fmt; - struct audio_dev_property dev_prop; -#ifdef CONFIG_ARCH_TEGRA_2x_SOC + if (tegra_das_is_port_master(tegra_audio_codec_type_hifi)) -#else - if(tegra_das_is_device_master(tegra_audio_codec_type_hifi)) -#endif dai_flag |= SND_SOC_DAIFMT_CBM_CFM; else dai_flag |= SND_SOC_DAIFMT_CBS_CFS; -#ifdef CONFIG_ARCH_TEGRA_2x_SOC data_fmt = tegra_das_get_codec_data_fmt(tegra_audio_codec_type_hifi); -#else - tegra_das_get_device_property(tegra_audio_codec_type_hifi,&dev_prop); - data_fmt = dev_prop.dac_dap_data_comm_format; -#endif + /* We are supporting DSP and I2s format for now */ if (data_fmt & dac_dap_data_format_dsp) dai_flag |= SND_SOC_DAIFMT_DSP_A; @@ -216,27 +208,21 @@ static int tegra_voice_hw_params(struct snd_pcm_substream *substream, 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; - struct tegra_i2s_info *info = cpu_dai->private_data; + struct tegra_i2s_info *info = cpu_dai->private_data; int dai_flag = 0, sys_clk; int err; enum dac_dap_data_format data_fmt; - struct audio_dev_property dev_prop; -#ifdef CONFIG_ARCH_TEGRA_2x_SOC + + if (tegra_das_is_port_master(tegra_audio_codec_type_bluetooth)) -#else - if(tegra_das_is_device_master(tegra_audio_codec_type_bluetooth)) -#endif dai_flag |= SND_SOC_DAIFMT_CBM_CFM; else dai_flag |= SND_SOC_DAIFMT_CBS_CFS; -#ifdef CONFIG_ARCH_TEGRA_2x_SOC - data_fmt = tegra_das_get_codec_data_fmt(tegra_audio_codec_type_bluetooth); -#else - tegra_das_get_device_property(tegra_audio_codec_type_bluetooth,&dev_prop); - data_fmt = dev_prop.dac_dap_data_comm_format; -#endif + data_fmt = tegra_das_get_codec_data_fmt + (tegra_audio_codec_type_bluetooth); + /* We are supporting DSP and I2s format for now */ if (data_fmt & dac_dap_data_format_i2s) dai_flag |= SND_SOC_DAIFMT_I2S; diff --git a/sound/soc/tegra/tegra_spdif.c b/sound/soc/tegra/tegra_spdif.c index 84f36120f4c3..1a1fe1d588f8 100644 --- a/sound/soc/tegra/tegra_spdif.c +++ b/sound/soc/tegra/tegra_spdif.c @@ -337,6 +337,7 @@ static int tegra_spdif_driver_probe(struct platform_device *pdev) struct resource *res, *mem; struct tegra_spdif_info *info; am_dev_format_info dev_fmt; + am_stream_format_info strm_fmt; pr_info("%s\n", __func__); @@ -372,6 +373,12 @@ static int tegra_spdif_driver_probe(struct platform_device *pdev) goto fail_release_mem; } + memset(&strm_fmt, 0, sizeof(strm_fmt)); + strm_fmt.bitsize = SPDIF_BIT_MODE_MODE16BIT; + strm_fmt.channels = AUDIO_CHANNEL_2; + strm_fmt.samplerate = info->pdata->dev_clk_rate >> 7; + + memset(&dev_fmt, 0, sizeof(dev_fmt)); dev_fmt.clkrate = info->pdata->dev_clk_rate; info->spdev_info.base = info->spdif_base; -- cgit v1.2.3