diff options
author | Axel Castaneda Gonzalez <x0055901@ti.com> | 2011-12-11 01:51:25 -0600 |
---|---|---|
committer | Ziyann <jaraidaniel@gmail.com> | 2014-10-01 12:56:17 +0200 |
commit | 596756fbf5c0e8f91aaf1f1d8a105370ff766038 (patch) | |
tree | 7d6c7f2b44619df24070608548caf0d63005f124 /sound/soc | |
parent | 0f1d15dbcc0ac9927278fb6d8541c390e86d9167 (diff) | |
download | kernel_samsung_tuna-596756fbf5c0e8f91aaf1f1d8a105370ff766038.zip kernel_samsung_tuna-596756fbf5c0e8f91aaf1f1d8a105370ff766038.tar.gz kernel_samsung_tuna-596756fbf5c0e8f91aaf1f1d8a105370ff766038.tar.bz2 |
ASoC: OMAP ABE: Allow FE ports to be muted independently
To avoid muting a FE due an active BE update. Digital muting
control for FEs should be independent of the number of active BEs
and dependent only on active FEs updates.
Change-Id: I227231939f24e93ecee41043a11bcef2045915da
Signed-off-by: Axel Castaneda Gonzalez <x0055901@ti.com>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/omap/omap-abe.c | 166 |
1 files changed, 40 insertions, 126 deletions
diff --git a/sound/soc/omap/omap-abe.c b/sound/soc/omap/omap-abe.c index 86a0eae..4fb7fad 100644 --- a/sound/soc/omap/omap-abe.c +++ b/sound/soc/omap/omap-abe.c @@ -193,12 +193,6 @@ static int omap_abe_dl1_enabled(struct omap_abe_data *abe_priv) abe_priv->port[OMAP_ABE_BE_PORT_MM_EXT_DL]); } -static int omap_abe_dl2_enabled(struct omap_abe_data *abe_priv) -{ - return omap_abe_port_is_enabled(abe_priv->abe, - abe_priv->port[OMAP_ABE_BE_PORT_PDM_DL2]); -} - static void mute_be(struct snd_soc_pcm_runtime *be, struct snd_soc_dai *dai, int stream) { @@ -545,28 +539,20 @@ static void disable_fe_port(struct snd_pcm_substream *substream, } } -static void mute_fe_port_capture(struct snd_soc_pcm_runtime *fe, - struct snd_soc_pcm_runtime *be, int mute) +static void mute_fe_port_capture(struct snd_soc_pcm_runtime *fe, int mute) { - struct omap_abe_data *abe_priv = snd_soc_dai_get_drvdata(fe->cpu_dai); - - dev_dbg(&fe->dev, "%s: %s FE %s BE %s\n", + dev_dbg(&fe->dev, "%s: %s FE %s\n", __func__, mute ? "mute" : "unmute", - fe->dai_link->name, be->dai_link->name); + fe->dai_link->name); switch (fe->cpu_dai->id) { case ABE_FRONTEND_DAI_MEDIA_CAPTURE: - if (omap_abe_dl1_enabled(abe_priv)) { - if (mute) - abe_mute_gain(MIXDL1, MIX_DL1_INPUT_MM_UL2); - else - abe_unmute_gain(MIXDL1, MIX_DL1_INPUT_MM_UL2); - } - if (omap_abe_dl2_enabled(abe_priv)) { - if (mute) - abe_mute_gain(MIXDL2, MIX_DL2_INPUT_MM_UL2); - else - abe_unmute_gain(MIXDL2, MIX_DL2_INPUT_MM_UL2); + if (mute) { + abe_mute_gain(MIXDL1, MIX_DL1_INPUT_MM_UL2); + abe_mute_gain(MIXDL2, MIX_DL2_INPUT_MM_UL2); + } else { + abe_unmute_gain(MIXDL1, MIX_DL1_INPUT_MM_UL2); + abe_unmute_gain(MIXDL2, MIX_DL2_INPUT_MM_UL2); } break; case ABE_FRONTEND_DAI_MODEM: @@ -585,94 +571,40 @@ static void mute_fe_port_capture(struct snd_soc_pcm_runtime *fe, } } -static void mute_fe_port_playback(struct snd_soc_pcm_runtime *fe, - struct snd_soc_pcm_runtime *be, int mute) +static void mute_fe_port_playback(struct snd_soc_pcm_runtime *fe, int mute) { - struct omap_abe_data *abe_priv = snd_soc_dai_get_drvdata(fe->cpu_dai); - - dev_dbg(&fe->dev, "%s: %s FE %s BE %s\n", + dev_dbg(&fe->dev, "%s: %s FE %s\n", __func__, mute ? "mute" : "unmute", - fe->dai_link->name, be->dai_link->name); + fe->dai_link->name); switch (fe->cpu_dai->id) { case ABE_FRONTEND_DAI_MEDIA: case ABE_FRONTEND_DAI_LP_MEDIA: - switch (be->dai_link->be_id) { - case OMAP_ABE_DAI_PDM_DL1: - case OMAP_ABE_DAI_BT_VX: - case OMAP_ABE_DAI_MM_FM: - if (mute) { - /* mute if last running DL1-related BE */ - if (omap_abe_dl1_enabled(abe_priv) == 1) - abe_mute_gain(MIXDL1, - MIX_DL1_INPUT_MM_DL); - } else { - abe_unmute_gain(MIXDL1, MIX_DL1_INPUT_MM_DL); - } - break; - case OMAP_ABE_DAI_PDM_DL2: - if (mute) - abe_mute_gain(MIXDL2, MIX_DL2_INPUT_MM_DL); - else - abe_unmute_gain(MIXDL2, MIX_DL2_INPUT_MM_DL); - break; - case OMAP_ABE_DAI_MODEM: - case OMAP_ABE_DAI_PDM_VIB: - default: - break; + if (mute) { + abe_mute_gain(MIXDL1, MIX_DL1_INPUT_MM_DL); + abe_mute_gain(MIXDL2, MIX_DL2_INPUT_MM_DL); + } else { + abe_unmute_gain(MIXDL1, MIX_DL1_INPUT_MM_DL); + abe_unmute_gain(MIXDL2, MIX_DL2_INPUT_MM_DL); } break; case ABE_FRONTEND_DAI_VOICE: case ABE_FRONTEND_DAI_MODEM: - switch (be->dai_link->be_id) { - case OMAP_ABE_DAI_PDM_DL1: - case OMAP_ABE_DAI_BT_VX: - case OMAP_ABE_DAI_MM_FM: - if (mute) { - /* mute if last running DL1-related BE */ - if (omap_abe_dl1_enabled(abe_priv) == 1) - abe_mute_gain(MIXDL1, - MIX_DL1_INPUT_VX_DL); - } else { - abe_unmute_gain(MIXDL1, MIX_DL1_INPUT_VX_DL); - } - break; - case OMAP_ABE_DAI_PDM_DL2: - if (mute) - abe_mute_gain(MIXDL2, MIX_DL2_INPUT_VX_DL); - else - abe_unmute_gain(MIXDL2, MIX_DL2_INPUT_VX_DL); - break; - case OMAP_ABE_DAI_MODEM: - case OMAP_ABE_DAI_PDM_VIB: - default: - break; + if (mute) { + abe_mute_gain(MIXDL1, MIX_DL1_INPUT_VX_DL); + abe_mute_gain(MIXDL2, MIX_DL2_INPUT_VX_DL); + } else { + abe_unmute_gain(MIXDL1, MIX_DL1_INPUT_VX_DL); + abe_unmute_gain(MIXDL2, MIX_DL2_INPUT_VX_DL); } break; case ABE_FRONTEND_DAI_TONES: - switch (be->dai_link->be_id) { - case OMAP_ABE_DAI_PDM_DL1: - case OMAP_ABE_DAI_BT_VX: - case OMAP_ABE_DAI_MM_FM: - if (mute) { - /* mute if last running DL1-related BE */ - if (omap_abe_dl1_enabled(abe_priv) == 1) - abe_mute_gain(MIXDL1, - MIX_DL1_INPUT_TONES); - } else{ - abe_unmute_gain(MIXDL1, MIX_DL1_INPUT_TONES); - } - break; - case OMAP_ABE_DAI_PDM_DL2: - if (mute) - abe_mute_gain(MIXDL2, MIX_DL2_INPUT_TONES); - else - abe_unmute_gain(MIXDL2, MIX_DL2_INPUT_TONES); - break; - case OMAP_ABE_DAI_MODEM: - case OMAP_ABE_DAI_PDM_VIB: - default: - break; + if (mute) { + abe_mute_gain(MIXDL1, MIX_DL1_INPUT_TONES); + abe_mute_gain(MIXDL2, MIX_DL2_INPUT_TONES); + } else { + abe_unmute_gain(MIXDL1, MIX_DL1_INPUT_TONES); + abe_unmute_gain(MIXDL2, MIX_DL2_INPUT_TONES); } break; case ABE_FRONTEND_DAI_VIBRA: @@ -685,42 +617,26 @@ static void mute_fe_port(struct snd_pcm_substream *substream, struct snd_soc_dai *dai, int stream) { struct snd_soc_pcm_runtime *fe = substream->private_data; - struct snd_soc_dsp_params *dsp_params; dev_dbg(&fe->dev, "%s: %s %d\n", __func__, dai->name, stream); - list_for_each_entry(dsp_params, &fe->dsp[stream].be_clients, list_be) { - struct snd_soc_pcm_runtime *be = dsp_params->be; - - if (!snd_soc_dsp_is_op_for_be(fe, be, stream)) - continue; - - if (stream == SNDRV_PCM_STREAM_PLAYBACK) - mute_fe_port_playback(fe, be, 1); - else - mute_fe_port_capture(fe, be, 1); - } + if (stream == SNDRV_PCM_STREAM_PLAYBACK) + mute_fe_port_playback(fe, 1); + else + mute_fe_port_capture(fe, 1); } static void unmute_fe_port(struct snd_pcm_substream *substream, struct snd_soc_dai *dai, int stream) { struct snd_soc_pcm_runtime *fe = substream->private_data; - struct snd_soc_dsp_params *dsp_params; dev_dbg(&fe->dev, "%s: %s %d\n", __func__, dai->name, stream); - list_for_each_entry(dsp_params, &fe->dsp[stream].be_clients, list_be) { - struct snd_soc_pcm_runtime *be = dsp_params->be; - - if (!snd_soc_dsp_is_op_for_be(fe, be, stream)) - continue; - - if (stream == SNDRV_PCM_STREAM_PLAYBACK) - mute_fe_port_playback(fe, be, 0); - else - mute_fe_port_capture(fe, be, 0); - } + if (stream == SNDRV_PCM_STREAM_PLAYBACK) + mute_fe_port_playback(fe, 0); + else + mute_fe_port_capture(fe, 0); } static void capture_trigger(struct snd_pcm_substream *substream, @@ -921,12 +837,10 @@ static void playback_trigger(struct snd_pcm_substream *substream, break; case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: - - /* mute FE port (sensitive to runtime udpates) */ - mute_fe_port(substream, dai, stream); - /* does this trigger() apply to the FE ? */ if (snd_soc_dsp_is_trigger_for_fe(fe, stream)) { + /* mute FE port (sensitive to runtime udpates) */ + mute_fe_port(substream, dai, stream); /* disable the transfer */ disable_fe_port(substream, dai, stream); snd_soc_dsp_platform_trigger(substream, cmd, fe->platform); |