diff options
author | Simon Wilson <simonwilson@google.com> | 2011-06-24 11:39:19 -0700 |
---|---|---|
committer | Simon Wilson <simonwilson@google.com> | 2011-06-24 11:39:42 -0700 |
commit | c6b8854fb58cf1e5fa3dff3d30337a3e0711911e (patch) | |
tree | e273abbeefe41596d65774c755de8f8f620a5c86 /sound | |
parent | a7e96985ea15176a46ed3d767c58baf3c36d510e (diff) | |
parent | d713edc13aa034f5f154765e5183a05b408745a2 (diff) | |
download | kernel_samsung_tuna-c6b8854fb58cf1e5fa3dff3d30337a3e0711911e.zip kernel_samsung_tuna-c6b8854fb58cf1e5fa3dff3d30337a3e0711911e.tar.gz kernel_samsung_tuna-c6b8854fb58cf1e5fa3dff3d30337a3e0711911e.tar.bz2 |
Merge branch 'linux-omap-audio-3.0' into linux-omap-3.0
Signed-off-by: Simon Wilson <simonwilson@google.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/omap/abe/abe_gain.c | 4 | ||||
-rw-r--r-- | sound/soc/omap/omap-abe.c | 22 | ||||
-rw-r--r-- | sound/soc/omap/omap-mcbsp.c | 2 | ||||
-rw-r--r-- | sound/soc/omap/sdp4430.c | 96 |
4 files changed, 101 insertions, 23 deletions
diff --git a/sound/soc/omap/abe/abe_gain.c b/sound/soc/omap/abe/abe_gain.c index a3d2b07..a31894d 100644 --- a/sound/soc/omap/abe/abe_gain.c +++ b/sound/soc/omap/abe/abe_gain.c @@ -645,14 +645,14 @@ int omap_abe_write_gain(struct omap_abe *abe, /* CMEM bytes address */ mixer_target = OMAP_ABE_C_1_ALPHA_ADDR; /* a pair of gains is updated once in the firmware */ - mixer_target += (p + mixer_offset) << 1; + mixer_target += ((p + mixer_offset) >> 1) << 2; /* load the ramp delay data */ omap_abe_mem_write(abe, OMAP_ABE_CMEM, mixer_target, (u32 *) &alpha, sizeof(alpha)); /* CMEM bytes address */ mixer_target = OMAP_ABE_C_ALPHA_ADDR; /* a pair of gains is updated once in the firmware */ - mixer_target += (p + mixer_offset) << 1; + mixer_target += ((p + mixer_offset) >> 1) << 2; omap_abe_mem_write(abe, OMAP_ABE_CMEM, mixer_target, (u32 *) &beta, sizeof(beta)); return 0; diff --git a/sound/soc/omap/omap-abe.c b/sound/soc/omap/omap-abe.c index 8113131..56ecf4e 100644 --- a/sound/soc/omap/omap-abe.c +++ b/sound/soc/omap/omap-abe.c @@ -1000,14 +1000,30 @@ static int omap_abe_dai_trigger(struct snd_pcm_substream *substream, static int omap_abe_dai_bespoke_trigger(struct snd_pcm_substream *substream, int cmd, struct snd_soc_dai *dai) { + struct omap_abe_data *abe_priv = snd_soc_dai_get_drvdata(dai); + int ret = 0; + dev_dbg(dai->dev, "%s: %s cmd %d\n", __func__, dai->name, cmd); + if (dai->id == ABE_FRONTEND_DAI_MODEM) { + + dev_dbg(abe_priv->modem_dai->dev, "%s: MODEM stream %d cmd %d\n", + __func__, substream->stream, cmd); + + ret = snd_soc_dai_trigger(abe_priv->modem_substream[substream->stream], + cmd, abe_priv->modem_dai); + if (ret < 0) { + dev_err(abe_priv->modem_dai->dev, "MODEM trigger failed\n"); + return ret; + } + } + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) playback_trigger(substream, dai, cmd); else capture_trigger(substream, dai, cmd); - return 0; + return ret; } static int omap_abe_dai_hw_free(struct snd_pcm_substream *substream, @@ -1179,14 +1195,14 @@ static struct snd_soc_dai_driver omap_abe_dai[] = { .playback = { .stream_name = "Voice Playback", .channels_min = 1, - .channels_max = 1, + .channels_max = 2, .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000, .formats = OMAP_ABE_FORMATS, }, .capture = { .stream_name = "Voice Capture", .channels_min = 1, - .channels_max = 1, + .channels_max = 2, .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000, .formats = OMAP_ABE_FORMATS, }, diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 07b7723..36d1cae 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c @@ -258,7 +258,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, default: return -EINVAL; } - if (cpu_is_omap34xx()) { + if (cpu_is_omap34xx() || cpu_is_omap44xx()) { dma_data->set_threshold = omap_mcbsp_set_threshold; /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */ if (omap_mcbsp_get_dma_op_mode(bus_id) == diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c index 69427c8..3d6a554 100644 --- a/sound/soc/omap/sdp4430.c +++ b/sound/soc/omap/sdp4430.c @@ -33,6 +33,7 @@ #include <asm/mach-types.h> #include <plat/hardware.h> #include <plat/mux.h> +#include <plat/mcbsp.h> #include "omap-mcpdm.h" #include "omap-abe.h" @@ -43,13 +44,65 @@ static int twl6040_power_mode; static int mcbsp_cfg; +static int sdp4430_modem_mcbsp_configure(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, int flag) +{ + int ret = 0; + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_pcm_substream *modem_substream[2]; + struct snd_soc_pcm_runtime *modem_rtd; + int channels; + + if (flag) { + modem_substream[substream->stream] = + snd_soc_get_dai_substream(rtd->card, + OMAP_ABE_BE_MM_EXT1, + substream->stream); + if (unlikely(modem_substream[substream->stream] == NULL)) + return -ENODEV; + + modem_rtd = + modem_substream[substream->stream]->private_data; + + if (!mcbsp_cfg) { + /* Set cpu DAI configuration */ + ret = snd_soc_dai_set_fmt(modem_rtd->cpu_dai, + SND_SOC_DAIFMT_I2S | + SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBM_CFM); + + if (unlikely(ret < 0)) { + printk(KERN_ERR "can't set Modem cpu DAI configuration\n"); + goto exit; + } else { + mcbsp_cfg = 1; + } + } + + if (params != NULL) { + /* Configure McBSP internal buffer usage */ + /* this need to be done for playback and/or record */ + channels = params_channels(params); + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + omap_mcbsp_set_rx_threshold( + modem_rtd->cpu_dai->id, channels); + else + omap_mcbsp_set_tx_threshold( + modem_rtd->cpu_dai->id, channels); + } + } else { + mcbsp_cfg = 0; + } + +exit: + return ret; +} + static int sdp4430_mcpdm_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->codec_dai; - struct snd_soc_pcm_runtime *modem_rtd; - struct snd_pcm_substream *modem_substream[2]; struct snd_soc_dsp_params *dsp_params; int clk_id, freq, ret, stream = substream->stream; @@ -73,23 +126,31 @@ static int sdp4430_mcpdm_hw_params(struct snd_pcm_substream *substream, if (dsp_params->fe->cpu_dai->id != ABE_FRONTEND_DAI_MODEM) continue; - if (!mcbsp_cfg) { - modem_substream[stream] = - snd_soc_get_dai_substream(rtd->card, - OMAP_ABE_BE_MM_EXT1, - substream->stream); - if (modem_substream[stream] == NULL) - return -ENODEV; + /* freed Modem McBSP configuration */ + ret = sdp4430_modem_mcbsp_configure(substream, params, 1); + if (ret < 0) { + printk(KERN_ERR "can't set Modem cpu DAI configuration\n"); + return ret; + } + } + return ret; +} - modem_rtd = modem_substream[stream]->private_data; +static int sdp4430_mcpdm_hw_free(struct snd_pcm_substream *substream) +{ + int ret = 0; - /* Set cpu DAI configuration */ - ret = snd_soc_dai_set_fmt(modem_rtd->cpu_dai, - SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_NB_NF | - SND_SOC_DAIFMT_CBM_CFM); - mcbsp_cfg = 1; - } + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dsp_params *dsp_params; + int stream = substream->stream; + + list_for_each_entry(dsp_params, &rtd->dsp[stream].fe_clients, list_fe) { + + if (dsp_params->fe->cpu_dai->id != ABE_FRONTEND_DAI_MODEM) + continue; + + /* freed Modem McBSP configuration */ + ret = sdp4430_modem_mcbsp_configure(substream, NULL, 0); if (ret < 0) { printk(KERN_ERR "can't set Modem cpu DAI configuration\n"); return ret; @@ -100,6 +161,7 @@ static int sdp4430_mcpdm_hw_params(struct snd_pcm_substream *substream, static struct snd_soc_ops sdp4430_mcpdm_ops = { .hw_params = sdp4430_mcpdm_hw_params, + .hw_free = sdp4430_mcpdm_hw_free, }; static int sdp4430_mcbsp_hw_params(struct snd_pcm_substream *substream, |