diff options
author | Misael Lopez Cruz <misael.lopez@ti.com> | 2011-07-20 20:13:08 -0500 |
---|---|---|
committer | Simon Wilson <simonwilson@google.com> | 2011-08-03 17:43:23 -0700 |
commit | 8235f8513a9b3a19277318e2d685f706af78f96d (patch) | |
tree | 4229811ff7e6a930cc601095b15cea888f1916f9 /sound/soc/omap | |
parent | e73dcb533a1d3b9b5cacc3746d6b3540f7412438 (diff) | |
download | kernel_samsung_tuna-8235f8513a9b3a19277318e2d685f706af78f96d.zip kernel_samsung_tuna-8235f8513a9b3a19277318e2d685f706af78f96d.tar.gz kernel_samsung_tuna-8235f8513a9b3a19277318e2d685f706af78f96d.tar.bz2 |
ASoC: ABE DSP: Add controls for DL1, DL2, AUDUL mono mixers
Add controls for DL1, DL2 and AUDUL mono mixers. Mono mixing support
allows mixers to output mono data on both left and right channel.
Change-Id: I774568d0390825b3893d31926727f9dd18017d90
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Diffstat (limited to 'sound/soc/omap')
-rw-r--r-- | sound/soc/omap/omap-abe-dsp.c | 61 | ||||
-rw-r--r-- | sound/soc/omap/omap-abe-dsp.h | 6 |
2 files changed, 66 insertions, 1 deletions
diff --git a/sound/soc/omap/omap-abe-dsp.c b/sound/soc/omap/omap-abe-dsp.c index 059ae12..0d5d301 100644 --- a/sound/soc/omap/omap-abe-dsp.c +++ b/sound/soc/omap/omap-abe-dsp.c @@ -124,6 +124,8 @@ struct abe_data { struct snd_kcontrol_new equalizer_control[ABE_MAX_EQU]; struct coeff_config *equ_texts; + int mono_mix[ABE_NUM_MONO_MIXERS]; + /* DAPM mixer config - TODO: some of this can be replaced with HAL update */ u32 widget_opp[ABE_NUM_DAPM_REG + 1]; @@ -451,6 +453,55 @@ static int abe_get_mixer(struct snd_kcontrol *kcontrol, return 0; } +static int abe_dsp_set_mono_mixer(int id, int enable) +{ + int mixer; + + switch (id) { + case MIX_DL1_MONO: + mixer = MIXDL1; + break; + case MIX_DL2_MONO: + mixer = MIXDL2; + break; + case MIX_AUDUL_MONO: + mixer = MIXAUDUL; + break; + default: + return -EINVAL; + } + + pm_runtime_get_sync(the_abe->dev); + abe_mono_mixer(mixer, enable); + pm_runtime_put_sync(the_abe->dev); + + return 0; +} + +static int abe_put_mono_mixer(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct soc_mixer_control *mc = + (struct soc_mixer_control *)kcontrol->private_value; + int id = mc->shift - MIX_DL1_MONO; + + the_abe->mono_mix[id] = ucontrol->value.integer.value[0]; + abe_dsp_set_mono_mixer(mc->shift, the_abe->mono_mix[id]); + + return 1; +} + +static int abe_get_mono_mixer(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct soc_mixer_control *mc = + (struct soc_mixer_control *)kcontrol->private_value; + int id = mc->shift - MIX_DL1_MONO; + + ucontrol->value.integer.value[0] = the_abe->mono_mix[id]; + return 0; +} + /* router IDs that match our mixer strings */ static const abe_router_t router[] = { ZERO_labelID, /* strangely this is not 0 */ @@ -1021,6 +1072,13 @@ static const struct snd_kcontrol_new abe_controls[] = { SOC_DOUBLE_EXT_TLV("BT UL Volume", GAINS_BTUL, GAIN_LEFT_OFFSET, GAIN_RIGHT_OFFSET, 149, 0, volume_get_gain, volume_put_gain, btul_tlv), + + SOC_SINGLE_EXT("DL1 Mono Mixer", MIXDL1, MIX_DL1_MONO, 1, 0, + abe_get_mono_mixer, abe_put_mono_mixer), + SOC_SINGLE_EXT("DL2 Mono Mixer", MIXDL2, MIX_DL2_MONO, 1, 0, + abe_get_mono_mixer, abe_put_mono_mixer), + SOC_SINGLE_EXT("AUDUL Mono Mixer", MIXAUDUL, MIX_AUDUL_MONO, 1, 0, + abe_get_mono_mixer, abe_put_mono_mixer), }; static const struct snd_soc_dapm_widget abe_dapm_widgets[] = { @@ -1941,6 +1999,9 @@ static int aess_restore_context(struct abe_data *abe) for (i = 0; i < abe->hdr.num_equ; i++) abe_dsp_set_equalizer(i, abe->equ_profile[i]); + for (i = 0; i < ABE_NUM_MONO_MIXERS; i++) + abe_dsp_set_mono_mixer(MIX_DL1_MONO + i, abe->mono_mix[i]); + return 0; } diff --git a/sound/soc/omap/omap-abe-dsp.h b/sound/soc/omap/omap-abe-dsp.h index f39ac99..2e8ac53 100644 --- a/sound/soc/omap/omap-abe-dsp.h +++ b/sound/soc/omap/omap-abe-dsp.h @@ -46,8 +46,12 @@ #define MIX_SWITCH_PDM_DL ABE_MIXER(17) #define MIX_SWITCH_BT_VX_DL ABE_MIXER(18) #define MIX_SWITCH_MM_EXT_DL ABE_MIXER(19) +#define MIX_DL1_MONO ABE_MIXER(20) +#define MIX_DL2_MONO ABE_MIXER(21) +#define MIX_AUDUL_MONO ABE_MIXER(22) -#define ABE_NUM_MIXERS (MIX_SWITCH_MM_EXT_DL + 1) +#define ABE_NUM_MONO_MIXERS (MIX_AUDUL_MONO - MIX_DL1_MONO + 1) +#define ABE_NUM_MIXERS (MIX_AUDUL_MONO + 1) #define ABE_MUX(x) (x + ABE_NUM_MIXERS) |