From 1e66c4cd8aa3135375e8fccadfb58924e15b6477 Mon Sep 17 00:00:00 2001 From: Shyam Krishnan M Date: Mon, 3 Oct 2011 13:35:37 +0530 Subject: ASOC CG29xx: Configure Codec to receive FM This patch tristates the Interfaces in probe. The Interface is enable back in prepare function. ST-Ericsson Linux next: NA ST-Ericsson ID: 335714 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: Ia04453f0e3aca1991e135785e9b2772522219347 Signed-off-by: Shyam Krishnan M Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/32802 Reviewed-by: Srinidhi KASAGAR --- sound/soc/codecs/ab5500.c | 21 +++++++++++++++++---- sound/soc/codecs/cg29xx.c | 9 ++++----- 2 files changed, 21 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ab5500.c b/sound/soc/codecs/ab5500.c index 79df2a6e812..57fc2ca1c62 100644 --- a/sound/soc/codecs/ab5500.c +++ b/sound/soc/codecs/ab5500.c @@ -1212,26 +1212,35 @@ static int ab5500_pcm_hw_params(struct snd_pcm_substream *substream, static int ab5500_pcm_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - dev_dbg(ab5500_dev, "%s called.\n", __func__); + dev_info(ab5500_dev, "%s called.\n", __func__); + u8 value = (dai->id == 1) ? INTERFACE1 : INTERFACE0; + /* Configure registers for either playback or capture */ if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK) && !(ab5500_codec_privates[dai->id].playback_active == true)) { power_for_playback(POWER_ON, dai->id); ab5500_codec_privates[dai->id].playback_active = true; + mask_set_reg(value, I2Sx_TRISTATE_MASK, + 0 << I2Sx_TRISTATE_SHIFT); } else if ((substream->stream == SNDRV_PCM_STREAM_CAPTURE) && !(ab5500_codec_privates[dai->id].capture_active == true)) { power_for_capture(POWER_ON, dai->id); ab5500_codec_privates[dai->id].capture_active = true; + mask_set_reg(value, I2Sx_TRISTATE_MASK, + 0 << I2Sx_TRISTATE_SHIFT); + } + dump_registers(__func__, RX1, AUXO1_ADDER, RX2, AUXO2_ADDER, RX1_DPGA, RX2_DPGA, AUXO1, AUXO2, -1); + return 0; } static void ab5500_pcm_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - u8 iface = dai->id == 0 ? INTERFACE0 : INTERFACE1; + u8 iface = (dai->id == 0) ? INTERFACE0 : INTERFACE1; dev_info(ab5500_dev, "%s called.\n", __func__); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { power_for_playback(POWER_OFF, dai->id); @@ -1239,11 +1248,13 @@ static void ab5500_pcm_shutdown(struct snd_pcm_substream *substream, } else { power_for_capture(POWER_OFF, dai->id); ab5500_codec_privates[dai->id].capture_active = false; - } if (!dai->playback_active && !dai->capture_active && - (read_reg(iface) & I2Sx_MODE_MASK) == 0) + (read_reg(iface) & I2Sx_MODE_MASK) == 0) { + mask_set_reg(iface, I2Sx_TRISTATE_MASK, + 1 << I2Sx_TRISTATE_SHIFT); mask_set_reg(iface, MASTER_GENx_PWR_MASK, 0); + } } static int ab5500_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id, @@ -1640,6 +1651,8 @@ static int __devinit ab5500_platform_probe(struct platform_device *pdev) set_reg(reg, 0); mask_set_reg(CLOCK, CLOCK_ENABLE_MASK, 1 << CLOCK_ENABLE_SHIFT); + mask_set_reg(INTERFACE0, I2Sx_TRISTATE_MASK, 1 << I2Sx_TRISTATE_SHIFT); + mask_set_reg(INTERFACE1, I2Sx_TRISTATE_MASK, 1 << I2Sx_TRISTATE_SHIFT); printk(KERN_ERR "Clock Setting ab5500\n"); init_playback_route(); diff --git a/sound/soc/codecs/cg29xx.c b/sound/soc/codecs/cg29xx.c index 8f64ab76463..b5461c3e214 100644 --- a/sound/soc/codecs/cg29xx.c +++ b/sound/soc/codecs/cg29xx.c @@ -198,7 +198,6 @@ static int cg29xx_set_dai_fmt(struct snd_soc_dai *codec_dai, struct cg29xx_codec_dai_data *dai_data = get_dai_data(codec_dai); unsigned int prot; unsigned int msel; - prot = fmt & SND_SOC_DAIFMT_FORMAT_MASK; msel = fmt & SND_SOC_DAIFMT_MASTER_MASK; @@ -219,8 +218,8 @@ static int cg29xx_set_dai_fmt(struct snd_soc_dai *codec_dai, case SND_SOC_DAIFMT_DSP_A: if (dai_data->config.port != PORT_1_I2S_PCM || msel == SND_SOC_DAIFMT_CBM_CFM) { - pr_err("cg29xx_dai: unsupported DAI format 0x%x\n", - fmt); + pr_err("cg29xx_dai: unsupported DAI format 0x%x port=%d,msel=%d\n", + fmt, dai_data->config.port, msel); return -EINVAL; } break; @@ -666,8 +665,8 @@ static int __devinit cg29xx_codec_driver_probe(struct platform_device *pdev) dai_data[0].tx_active = 0; dai_data[0].rx_active = 0; - dai_data[0].input_select = 0; - dai_data[0].output_select = 0; + dai_data[0].input_select = 1; + dai_data[0].output_select = 1; dai_data[0].config.port = PORT_0_I2S; dai_data[0].config.conf.i2s.mode = DAI_MODE_SLAVE; dai_data[0].config.conf.i2s.half_period = HALF_PER_DUR_16; -- cgit v1.2.3